.gitignore000064400000000240151742741630006542 0ustar00.DS_Store phpunit.xml composer.phar composer.lock composer-test.lock vendor/ build/artifacts/ artifacts/ .idea .metadata coverage.xml src/Jison/Parser.js *.iml .travis.yml000064400000001704151742741630006671 0ustar00language: php sudo: required dist: trusty jobs: include: - php: '5.5.38' - php: '5.6.25' - php: '5.6.25' env: PROTOBUF_C_EXT=true - php: '7.0' - php: '7.1' - php: '7.2' - php: '7.2' env: PROTOBUF_C_EXT=true - stage: 'deploy' php: '7.2' install: - travis_retry composer install script: - ./dev/sh/build-docs.sh - ./dev/sh/push-docs.sh after_success: skip stages: - test - name: deploy if: ((type != pull_request) AND (branch = master)) OR (tag IS present) install: - travis_retry pecl install grpc - if [[ $PROTOBUF_C_EXT =~ ^true ]]; then travis_retry pecl install protobuf-3.5.1; fi - travis_retry composer install script: - vendor/bin/phpunit --coverage-clover=coverage.xml - vendor/bin/phpcs -s --standard=./ruleset.xml - if [[ $TRAVIS_PHP_VERSION =~ ^7 ]]; then ./dev/sh/build-docs.sh; fi after_success: - bash <(curl -s https://codecov.io/bash) CODE_OF_CONDUCT.md000064400000003675151742741630007370 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.md000064400000002654151742741630007016 0ustar00Want to contribute? Great! First, read this page (including the small print at the end). ### Before you contribute Before we can use your code, you must sign the [Google Individual Contributor License Agreement] (https://cla.developers.google.com/about/google-individual) (CLA), which you can do online. The CLA is necessary mainly because you own the copyright to your changes, even after your contribution becomes part of our codebase, so we need your permission to use and distribute your code. We also need to be sure of various other things—for instance that you'll tell us if you know that your code infringes on other people's patents. You don't have to sign the CLA until after you've submitted your code for review and a member has approved it, but you must do it before we can put your code into our codebase. Before you start working on a larger contribution, you should get in touch with us first through the issue tracker with your idea so that we can help out and possibly guide you. Coordinating up front makes it much easier to avoid frustration later on. ### Code reviews All submissions, including submissions by project members, require review. We use Github pull requests for this purpose. ### The small print Contributions made by corporations are covered by a different agreement than the one above, the [Software Grant and Corporate Contributor License Agreement] (https://cla.developers.google.com/about/google-corporate). LICENSE000064400000002700151742741630005562 0ustar00Copyright 2016, Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. README.md000064400000004031151742741630006033 0ustar00Google API Core for PHP ================================= [![Build Status](https://api.travis-ci.org/googleapis/gax-php.svg?branch=master)](https://travis-ci.org/googleapis/gax-php) [![Code Coverage](https://img.shields.io/codecov/c/github/googleapis/gax-php.svg)](https://codecov.io/github/googleapis/gax-php) - [Documentation](http://googleapis.github.io/gax-php) Google API Core for PHP (gax-php) is a set of modules which aids the development of APIs for clients based on [gRPC][] and Google API conventions. Application code will rarely need to use most of the classes within this library directly, but code generated automatically from the API definition files in [Google APIs][] can use services such as page streaming and retry to provide a more convenient and idiomatic API surface to callers. [gRPC]: http://grpc.io [Google APIs]: https://github.com/googleapis/googleapis/ PHP Versions ---------------- gax-php currently requires PHP 5.5 or higher. Contributing ------------ Contributions to this library are always welcome and highly encouraged. See the [CONTRIBUTING][] documentation for more information on how to get started. [CONTRIBUTING]: https://github.com/googleapis/gax-php/blob/master/CONTRIBUTING.md Versioning ---------- This library follows [Semantic Versioning][]. It is currently in major version zero (``0.y.z``), which means that anything may change at any time and the public API should not be considered stable. [Semantic Versioning]: http://semver.org/ Repository Structure ------- All code lives under the src/ directory. Handwritten code lives in the src/ApiCore directory and is contained in the `Google\ApiCore` namespace. Generated classes for protobuf common types and LongRunning client live under the src/ directory, in the appropriate directory and namespace. Code in the metadata/ directory is provided to support generated protobuf classes, and should not be used directly. License ------- BSD - See [LICENSE][] for more information. [LICENSE]: https://github.com/googleapis/gax-php/blob/master/LICENSE VERSION000064400000000007151742741630005623 0ustar000.37.0 composer.json000064400000002467151742741630007311 0ustar00{ "name": "google/gax", "type": "library", "description": "Google API Core for PHP", "keywords": ["google"], "homepage": "https://github.com/googleapis/gax-php", "license": "BSD-3-Clause", "require": { "php": ">=5.5", "google/auth": "^1.2.0", "google/grpc-gcp": "^0.1.0", "grpc/grpc": "^1.4", "google/protobuf": "^3.5.1", "guzzlehttp/promises": "^1.3", "guzzlehttp/psr7": "^1.2" }, "require-dev": { "phpunit/phpunit": "^4.8.36", "squizlabs/php_codesniffer": "3.*", "sami/sami": "*" }, "autoload": { "psr-4": { "Google\\Api\\": "src/Api", "Google\\ApiCore\\": "src/ApiCore", "Google\\Cloud\\": "src/Cloud", "Google\\Iam\\": "src/Iam", "Google\\Jison\\": "src/Jison", "Google\\LongRunning\\": "src/LongRunning", "Google\\Rpc\\": "src/Rpc", "Google\\Type\\": "src/Type", "GPBMetadata\\Google\\": "metadata" } }, "autoload-dev": { "psr-4": { "Google\\ApiCore\\Dev\\": "dev/src", "Google\\": "tests", "GPBMetadata\\": "metadata" } }, "scripts": { "regenerate-test-protos": "dev/sh/regenerate-test-protos.sh" } } dev/sh/build-docs.sh000075500000003517151742741630010340 0ustar00#!/bin/bash # Script to build doc site. # This script expects to be invoked from the gax-php root. # # This script will look for the TRAVIS_TAG cenvironment variable, and # use that as the version number. If no environment variable is found, # it will use the first command line argument. If no command line # argument is specified, default to 'master'. set -ev ROOT_DIR=$(pwd) DOC_OUTPUT_DIR=${ROOT_DIR}/tmp_gh-pages INDEX_FILE=${DOC_OUTPUT_DIR}/index.html VERSION_FILE=${ROOT_DIR}/VERSION SAMI_EXECUTABLE=${ROOT_DIR}/vendor/sami/sami/sami.php SAMI_CONFIG=${ROOT_DIR}/dev/src/Docs/sami-config.php # Construct the base index file that redirects to the latest version # of the docs. This will only be generated when TRAVIS_TAG is set. UPDATED_INDEX_FILE=$(cat << EndOfMessage EndOfMessage ) function checkVersionFile() { # Verify that the specified version matches the contents # of the VERSION file. VERSION_FILE_CONTENTS="$(cat ${VERSION_FILE})" if [ ${VERSION_FILE_CONTENTS} != ${1} ]; then echo ERROR: mismatched versions echo Expected version: ${1} echo VERSION file: ${VERSION_FILE_CONTENTS} exit 1 fi } function buildDocs() { DOCS_VERSION_TO_BUILD=${1} API_CORE_DOCS_VERSION=${DOCS_VERSION_TO_BUILD} php ${SAMI_EXECUTABLE} update ${SAMI_CONFIG} -v } if [[ ! -z ${TRAVIS_TAG} ]]; then checkVersionFile ${TRAVIS_TAG} buildDocs ${TRAVIS_TAG} # Update the redirect index file only for builds that use the # TRAVIS_TAG env variable. echo ${UPDATED_INDEX_FILE} > ${INDEX_FILE} else if [[ ! -z ${1} ]]; then DOCS_VERSION_TO_BUILD=${1} else # If no command line arg is specified, default to 'master' DOCS_VERSION_TO_BUILD=master fi buildDocs ${DOCS_VERSION_TO_BUILD} fi dev/sh/push-docs.sh000075500000001404151742741630010211 0ustar00#!/bin/bash # This script expects to be invoked from the gax-php root set -e function pushDocs () { git submodule add -q -f -b gh-pages https://${GH_OAUTH_TOKEN}@github.com/${TRAVIS_REPO_SLUG} ghpages rsync -aP tmp_gh-pages/* ghpages/ cd ghpages git add . if [[ -n "$(git status --porcelain)" ]]; then git config user.name "travis-ci" git config user.email "travis@travis-ci.org" git commit -m "Updating docs for ${1}" git status git push -q https://${GH_OAUTH_TOKEN}@github.com/${TRAVIS_REPO_SLUG} HEAD:gh-pages else echo "Nothing to commit." fi } if [[ ! -z ${TRAVIS_TAG} ]]; then pushDocs ${TRAVIS_TAG} elif [ "${TRAVIS_BRANCH}" == "master" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then pushDocs ${TRAVIS_BRANCH} fi dev/sh/regenerate-test-protos.sh000075500000000600151742741630012723 0ustar00#!/bin/bash # Run this script whenever changes are made to mocks.proto to regenerate the # PHP protobuf message classes. # # This script expected to be invoked from the gax-php root using: # $ composer regenerate-test-protos echo ${pwd} cd src protoc --php_out . ./ApiCore/Testing/mocks.proto cp -r ./GPBMetadata/* ../metadata/ cp -r ./Google/* ./ rm -r ./GPBMetadata rm -r ./Googledev/src/Docs/SamiConfigBuilder.php000064400000005203151742741630013052 0ustar00= 7.0 to build docs, found version " . phpversion()); } } public static function buildConfigForVersion($version) { $gaxRootDir = realpath(__DIR__ . '/../../..'); $iterator = Finder::create() ->files() ->name('*.php') ->exclude('GPBMetadata') ->in($dir = "$gaxRootDir/src") ; return new Sami($iterator, array( 'title' => "Google ApiCore - $version", 'version' => $version, 'build_dir' => "$gaxRootDir/tmp_gh-pages/%version%", 'cache_dir' => "$gaxRootDir/cache/%version%", 'default_opened_level' => 1, )); } } dev/src/Docs/sami-config.php000064400000003344151742741630011724 0ustar00internalAddGeneratedFile(hex2bin( "0ac4010a1c676f6f676c652f6170692f616e6e6f746174696f6e732e7072" . "6f746f120a676f6f676c652e6170691a20676f6f676c652f70726f746f62" . "75662f64657363726970746f722e70726f746f426e0a0e636f6d2e676f6f" . "676c652e6170694210416e6e6f746174696f6e7350726f746f50015a4167" . "6f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f67" . "6c65617069732f6170692f616e6e6f746174696f6e733b616e6e6f746174" . "696f6e73a2020447415049620670726f746f33" )); static::$is_initialized = true; } } metadata/Api/Auth.php000064400000004262151742741630010465 0ustar00internalAddGeneratedFile(hex2bin( "0a88050a15676f6f676c652f6170692f617574682e70726f746f120a676f" . "6f676c652e617069226c0a0e41757468656e7469636174696f6e122d0a05" . "72756c657318032003280b321e2e676f6f676c652e6170692e4175746865" . "6e7469636174696f6e52756c65122b0a0970726f76696465727318042003" . "280b32182e676f6f676c652e6170692e4175746850726f766964657222a9" . "010a1241757468656e7469636174696f6e52756c6512100a0873656c6563" . "746f72180120012809122c0a056f6175746818022001280b321d2e676f6f" . "676c652e6170692e4f41757468526571756972656d656e747312200a1861" . "6c6c6f775f776974686f75745f63726564656e7469616c18052001280812" . "310a0c726571756972656d656e747318072003280b321b2e676f6f676c65" . "2e6170692e41757468526571756972656d656e74226a0a0c417574685072" . "6f7669646572120a0a026964180120012809120e0a066973737565721802" . "2001280912100a086a776b735f75726918032001280912110a0961756469" . "656e63657318042001280912190a11617574686f72697a6174696f6e5f75" . "726c180520012809222d0a114f41757468526571756972656d656e747312" . "180a1063616e6f6e6963616c5f73636f70657318012001280922390a0f41" . "757468526571756972656d656e7412130a0b70726f76696465725f696418" . "012001280912110a0961756469656e636573180220012809426b0a0e636f" . "6d2e676f6f676c652e61706942094175746850726f746f50015a45676f6f" . "676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c65" . "617069732f6170692f73657276696365636f6e6669673b73657276696365" . "636f6e666967a2020447415049620670726f746f33" )); static::$is_initialized = true; } } metadata/Api/Backend.php000064400000002412151742741630011106 0ustar00internalAddGeneratedFile(hex2bin( "0aab020a18676f6f676c652f6170692f6261636b656e642e70726f746f12" . "0a676f6f676c652e61706922310a074261636b656e6412260a0572756c65" . "7318012003280b32172e676f6f676c652e6170692e4261636b656e645275" . "6c6522580a0b4261636b656e6452756c6512100a0873656c6563746f7218" . "0120012809120f0a076164647265737318022001280912100a0864656164" . "6c696e6518032001280112140a0c6d696e5f646561646c696e6518042001" . "2801426e0a0e636f6d2e676f6f676c652e617069420c4261636b656e6450" . "726f746f50015a45676f6f676c652e676f6c616e672e6f72672f67656e70" . "726f746f2f676f6f676c65617069732f6170692f73657276696365636f6e" . "6669673b73657276696365636f6e666967a2020447415049620670726f74" . "6f33" )); static::$is_initialized = true; } } metadata/Api/Billing.php000064400000002714151742741630011144 0ustar00internalAddGeneratedFile(hex2bin( "0acd020a18676f6f676c652f6170692f62696c6c696e672e70726f746f12" . "0a676f6f676c652e6170691a17676f6f676c652f6170692f6d6574726963" . "2e70726f746f2293010a0742696c6c696e6712450a15636f6e73756d6572" . "5f64657374696e6174696f6e7318082003280b32262e676f6f676c652e61" . "70692e42696c6c696e672e42696c6c696e6744657374696e6174696f6e1a" . "410a1242696c6c696e6744657374696e6174696f6e121a0a126d6f6e6974" . "6f7265645f7265736f75726365180120012809120f0a076d657472696373" . "180220032809426e0a0e636f6d2e676f6f676c652e617069420c42696c6c" . "696e6750726f746f50015a45676f6f676c652e676f6c616e672e6f72672f" . "67656e70726f746f2f676f6f676c65617069732f6170692f736572766963" . "65636f6e6669673b73657276696365636f6e666967a20204474150496206" . "70726f746f33" )); static::$is_initialized = true; } } metadata/Api/ConfigChange.php000064400000003145151742741630012076 0ustar00internalAddGeneratedFile(hex2bin( "0ab1030a1e676f6f676c652f6170692f636f6e6669675f6368616e67652e" . "70726f746f120a676f6f676c652e6170692297010a0c436f6e6669674368" . "616e6765120f0a07656c656d656e7418012001280912110a096f6c645f76" . "616c756518022001280912110a096e65775f76616c756518032001280912" . "2b0a0b6368616e67655f7479706518042001280e32162e676f6f676c652e" . "6170692e4368616e67655479706512230a07616476696365731805200328" . "0b32122e676f6f676c652e6170692e416476696365221d0a064164766963" . "6512130a0b6465736372697074696f6e1802200128092a4f0a0a4368616e" . "676554797065121b0a174348414e47455f545950455f554e535045434946" . "494544100012090a0541444445441001120b0a0752454d4f564544100212" . "0c0a084d4f444946494544100342710a0e636f6d2e676f6f676c652e6170" . "694211436f6e6669674368616e676550726f746f50015a43676f6f676c65" . "2e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c65617069" . "732f6170692f636f6e6669676368616e67653b636f6e6669676368616e67" . "65a2020447415049620670726f746f33" )); static::$is_initialized = true; } } metadata/Api/Consumer.php000064400000002767151742741630011367 0ustar00internalAddGeneratedFile(hex2bin( "0a87030a19676f6f676c652f6170692f636f6e73756d65722e70726f746f" . "120a676f6f676c652e617069223d0a1150726f6a65637450726f70657274" . "69657312280a0a70726f7065727469657318012003280b32142e676f6f67" . "6c652e6170692e50726f706572747922ac010a0850726f7065727479120c" . "0a046e616d65180120012809122f0a047479706518022001280e32212e67" . "6f6f676c652e6170692e50726f70657274792e50726f7065727479547970" . "6512130a0b6465736372697074696f6e180320012809224c0a0c50726f70" . "6572747954797065120f0a0b554e535045434946494544100012090a0549" . "4e543634100112080a04424f4f4c1002120a0a06535452494e471003120a" . "0a06444f55424c45100442680a0e636f6d2e676f6f676c652e617069420d" . "436f6e73756d657250726f746f50015a45676f6f676c652e676f6c616e67" . "2e6f72672f67656e70726f746f2f676f6f676c65617069732f6170692f73" . "657276696365636f6e6669673b73657276696365636f6e66696762067072" . "6f746f33" )); static::$is_initialized = true; } } metadata/Api/Context.php000064400000002321151742741630011202 0ustar00internalAddGeneratedFile(hex2bin( "0a97020a18676f6f676c652f6170692f636f6e746578742e70726f746f12" . "0a676f6f676c652e61706922310a07436f6e7465787412260a0572756c65" . "7318012003280b32172e676f6f676c652e6170692e436f6e746578745275" . "6c6522440a0b436f6e7465787452756c6512100a0873656c6563746f7218" . "012001280912110a0972657175657374656418022003280912100a087072" . "6f7669646564180320032809426e0a0e636f6d2e676f6f676c652e617069" . "420c436f6e7465787450726f746f50015a45676f6f676c652e676f6c616e" . "672e6f72672f67656e70726f746f2f676f6f676c65617069732f6170692f" . "73657276696365636f6e6669673b73657276696365636f6e666967a20204" . "47415049620670726f746f33" )); static::$is_initialized = true; } } metadata/Api/Control.php000064400000001754151742741630011207 0ustar00internalAddGeneratedFile(hex2bin( "0abe010a18676f6f676c652f6170692f636f6e74726f6c2e70726f746f12" . "0a676f6f676c652e617069221e0a07436f6e74726f6c12130a0b656e7669" . "726f6e6d656e74180120012809426e0a0e636f6d2e676f6f676c652e6170" . "69420c436f6e74726f6c50726f746f50015a45676f6f676c652e676f6c61" . "6e672e6f72672f67656e70726f746f2f676f6f676c65617069732f617069" . "2f73657276696365636f6e6669673b73657276696365636f6e666967a202" . "0447415049620670726f746f33" )); static::$is_initialized = true; } } metadata/Api/Distribution.php000064400000005725151742741630012250 0ustar00internalAddGeneratedFile(hex2bin( "0a8c070a1d676f6f676c652f6170692f646973747269627574696f6e2e70" . "726f746f120a676f6f676c652e6170691a19676f6f676c652f70726f746f" . "6275662f616e792e70726f746f1a1f676f6f676c652f70726f746f627566" . "2f74696d657374616d702e70726f746f22ae050a0c446973747269627574" . "696f6e120d0a05636f756e74180120012803120c0a046d65616e18022001" . "280112200a1873756d5f6f665f737175617265645f646576696174696f6e" . "180320012801122d0a0572616e676518042001280b321e2e676f6f676c65" . "2e6170692e446973747269627574696f6e2e52616e6765123e0a0e627563" . "6b65745f6f7074696f6e7318062001280b32262e676f6f676c652e617069" . "2e446973747269627574696f6e2e4275636b65744f7074696f6e7312150a" . "0d6275636b65745f636f756e74731807200328031a210a0552616e676512" . "0b0a036d696e180120012801120b0a036d61781802200128011ab5030a0d" . "4275636b65744f7074696f6e7312470a0e6c696e6561725f6275636b6574" . "7318012001280b322d2e676f6f676c652e6170692e446973747269627574" . "696f6e2e4275636b65744f7074696f6e732e4c696e656172480012510a13" . "6578706f6e656e7469616c5f6275636b65747318022001280b32322e676f" . "6f676c652e6170692e446973747269627574696f6e2e4275636b65744f70" . "74696f6e732e4578706f6e656e7469616c4800124b0a106578706c696369" . "745f6275636b65747318032001280b322f2e676f6f676c652e6170692e44" . "6973747269627574696f6e2e4275636b65744f7074696f6e732e4578706c" . "6963697448001a430a064c696e656172121a0a126e756d5f66696e697465" . "5f6275636b657473180120012805120d0a05776964746818022001280112" . "0e0a066f66667365741803200128011a4f0a0b4578706f6e656e7469616c" . "121a0a126e756d5f66696e6974655f6275636b6574731801200128051215" . "0a0d67726f7774685f666163746f72180220012801120d0a057363616c65" . "1803200128011a1a0a084578706c69636974120e0a06626f756e64731801" . "2003280142090a076f7074696f6e73426a0a0e636f6d2e676f6f676c652e" . "6170694211446973747269627574696f6e50726f746f50015a43676f6f67" . "6c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c6561" . "7069732f6170692f646973747269627574696f6e3b646973747269627574" . "696f6e620670726f746f33" )); static::$is_initialized = true; } } metadata/Api/Documentation.php000064400000003422151742741630012372 0ustar00internalAddGeneratedFile(hex2bin( "0af6030a1e676f6f676c652f6170692f646f63756d656e746174696f6e2e" . "70726f746f120a676f6f676c652e61706922a1010a0d446f63756d656e74" . "6174696f6e120f0a0773756d6d617279180120012809121f0a0570616765" . "7318052003280b32102e676f6f676c652e6170692e50616765122c0a0572" . "756c657318032003280b321d2e676f6f676c652e6170692e446f63756d65" . "6e746174696f6e52756c65121e0a16646f63756d656e746174696f6e5f72" . "6f6f745f75726c18042001280912100a086f766572766965771802200128" . "09225b0a11446f63756d656e746174696f6e52756c6512100a0873656c65" . "63746f7218012001280912130a0b6465736372697074696f6e1802200128" . "09121f0a176465707265636174696f6e5f6465736372697074696f6e1803" . "2001280922490a0450616765120c0a046e616d65180120012809120f0a07" . "636f6e74656e7418022001280912220a0873756270616765731803200328" . "0b32102e676f6f676c652e6170692e5061676542740a0e636f6d2e676f6f" . "676c652e6170694212446f63756d656e746174696f6e50726f746f50015a" . "45676f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f676f" . "6f676c65617069732f6170692f73657276696365636f6e6669673b736572" . "76696365636f6e666967a2020447415049620670726f746f33" )); static::$is_initialized = true; } } metadata/Api/Endpoint.php000064400000002317151742741630011343 0ustar00internalAddGeneratedFile(hex2bin( "0a81020a19676f6f676c652f6170692f656e64706f696e742e70726f746f" . "120a676f6f676c652e617069225f0a08456e64706f696e74120c0a046e61" . "6d65180120012809120f0a07616c696173657318022003280912100a0866" . "65617475726573180420032809120e0a0674617267657418652001280912" . "120a0a616c6c6f775f636f7273180520012808426f0a0e636f6d2e676f6f" . "676c652e617069420d456e64706f696e7450726f746f50015a45676f6f67" . "6c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c6561" . "7069732f6170692f73657276696365636f6e6669673b7365727669636563" . "6f6e666967a2020447415049620670726f746f33" )); static::$is_initialized = true; } } metadata/Api/Experimental/AuthorizationConfig.php000064400000002136151742741630016205 0ustar00internalAddGeneratedFile(hex2bin( "0ad5010a32676f6f676c652f6170692f6578706572696d656e74616c2f61" . "7574686f72697a6174696f6e5f636f6e6669672e70726f746f120a676f6f" . "676c652e61706922270a13417574686f72697a6174696f6e436f6e666967" . "12100a0870726f766964657218012001280942620a0e636f6d2e676f6f67" . "6c652e6170694218417574686f72697a6174696f6e436f6e66696750726f" . "746f50015a2d676f6f676c652e676f6c616e672e6f72672f67656e70726f" . "746f2f676f6f676c65617069732f6170693b617069a20204474150496206" . "70726f746f33" )); static::$is_initialized = true; } } metadata/Api/Experimental/Experimental.php000064400000002600151742741630014650 0ustar00internalAddGeneratedFile(hex2bin( "0a99020a2a676f6f676c652f6170692f6578706572696d656e74616c2f65" . "78706572696d656e74616c2e70726f746f120a676f6f676c652e6170691a" . "32676f6f676c652f6170692f6578706572696d656e74616c2f617574686f" . "72697a6174696f6e5f636f6e6669672e70726f746f22460a0c4578706572" . "696d656e74616c12360a0d617574686f72697a6174696f6e18082001280b" . "321f2e676f6f676c652e6170692e417574686f72697a6174696f6e436f6e" . "666967425b0a0e636f6d2e676f6f676c652e61706942114578706572696d" . "656e74616c50726f746f50015a2d676f6f676c652e676f6c616e672e6f72" . "672f67656e70726f746f2f676f6f676c65617069732f6170693b617069a2" . "020447415049620670726f746f33" )); static::$is_initialized = true; } } metadata/Api/Http.php000064400000003572151742741630010506 0ustar00internalAddGeneratedFile(hex2bin( "0aa2040a15676f6f676c652f6170692f687474702e70726f746f120a676f" . "6f676c652e61706922540a044874747012230a0572756c65731801200328" . "0b32142e676f6f676c652e6170692e4874747052756c6512270a1f66756c" . "6c795f6465636f64655f72657365727665645f657870616e73696f6e1802" . "200128082281020a084874747052756c6512100a0873656c6563746f7218" . "0120012809120d0a036765741802200128094800120d0a03707574180320" . "0128094800120e0a04706f7374180420012809480012100a0664656c6574" . "651805200128094800120f0a0570617463681806200128094800122f0a06" . "637573746f6d18082001280b321d2e676f6f676c652e6170692e43757374" . "6f6d487474705061747465726e4800120c0a04626f647918072001280912" . "150a0d726573706f6e73655f626f6479180c2001280912310a1361646469" . "74696f6e616c5f62696e64696e6773180b2003280b32142e676f6f676c65" . "2e6170692e4874747052756c6542090a077061747465726e222f0a114375" . "73746f6d487474705061747465726e120c0a046b696e6418012001280912" . "0c0a0470617468180220012809426a0a0e636f6d2e676f6f676c652e6170" . "6942094874747050726f746f50015a41676f6f676c652e676f6c616e672e" . "6f72672f67656e70726f746f2f676f6f676c65617069732f6170692f616e" . "6e6f746174696f6e733b616e6e6f746174696f6e73f80101a20204474150" . "49620670726f746f33" )); static::$is_initialized = true; } } metadata/Api/Httpbody.php000064400000002252151742741630011356 0ustar00internalAddGeneratedFile(hex2bin( "0af0010a19676f6f676c652f6170692f68747470626f64792e70726f746f" . "120a676f6f676c652e61706922580a0848747470426f647912140a0c636f" . "6e74656e745f74797065180120012809120c0a046461746118022001280c" . "12280a0a657874656e73696f6e7318032003280b32142e676f6f676c652e" . "70726f746f6275662e416e7942650a0e636f6d2e676f6f676c652e617069" . "420d48747470426f647950726f746f50015a3b676f6f676c652e676f6c61" . "6e672e6f72672f67656e70726f746f2f676f6f676c65617069732f617069" . "2f68747470626f64793b68747470626f6479a2020447415049620670726f" . "746f33" )); static::$is_initialized = true; } } metadata/Api/Label.php000064400000002410151742741630010574 0ustar00internalAddGeneratedFile(hex2bin( "0aac020a16676f6f676c652f6170692f6c6162656c2e70726f746f120a67" . "6f6f676c652e617069229c010a0f4c6162656c44657363726970746f7212" . "0b0a036b657918012001280912390a0a76616c75655f7479706518022001" . "280e32252e676f6f676c652e6170692e4c6162656c44657363726970746f" . "722e56616c75655479706512130a0b6465736372697074696f6e18032001" . "2809222c0a0956616c756554797065120a0a06535452494e47100012080a" . "04424f4f4c100112090a05494e5436341002425f0a0e636f6d2e676f6f67" . "6c652e617069420a4c6162656c50726f746f50015a35676f6f676c652e67" . "6f6c616e672e6f72672f67656e70726f746f2f676f6f676c65617069732f" . "6170692f6c6162656c3b6c6162656cf80101a2020447415049620670726f" . "746f33" )); static::$is_initialized = true; } } metadata/Api/Log.php000064400000002350151742741630010301 0ustar00internalAddGeneratedFile(hex2bin( "0a8d020a14676f6f676c652f6170692f6c6f672e70726f746f120a676f6f" . "676c652e61706922750a0d4c6f6744657363726970746f72120c0a046e61" . "6d65180120012809122b0a066c6162656c7318022003280b321b2e676f6f" . "676c652e6170692e4c6162656c44657363726970746f7212130a0b646573" . "6372697074696f6e18032001280912140a0c646973706c61795f6e616d65" . "180420012809426a0a0e636f6d2e676f6f676c652e61706942084c6f6750" . "726f746f50015a45676f6f676c652e676f6c616e672e6f72672f67656e70" . "726f746f2f676f6f676c65617069732f6170692f73657276696365636f6e" . "6669673b73657276696365636f6e666967a2020447415049620670726f74" . "6f33" )); static::$is_initialized = true; } } metadata/Api/Logging.php000064400000002777151742741630011163 0ustar00internalAddGeneratedFile(hex2bin( "0af8020a18676f6f676c652f6170692f6c6f6767696e672e70726f746f12" . "0a676f6f676c652e61706922d7010a074c6f6767696e6712450a1570726f" . "64756365725f64657374696e6174696f6e7318012003280b32262e676f6f" . "676c652e6170692e4c6f6767696e672e4c6f6767696e6744657374696e61" . "74696f6e12450a15636f6e73756d65725f64657374696e6174696f6e7318" . "022003280b32262e676f6f676c652e6170692e4c6f6767696e672e4c6f67" . "67696e6744657374696e6174696f6e1a3e0a124c6f6767696e6744657374" . "696e6174696f6e121a0a126d6f6e69746f7265645f7265736f7572636518" . "0320012809120c0a046c6f6773180120032809426e0a0e636f6d2e676f6f" . "676c652e617069420c4c6f6767696e6750726f746f50015a45676f6f676c" . "652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c656170" . "69732f6170692f73657276696365636f6e6669673b73657276696365636f" . "6e666967a2020447415049620670726f746f33" )); static::$is_initialized = true; } } metadata/Api/Metric.php000064400000004607151742741630011012 0ustar00internalAddGeneratedFile(hex2bin( "0ada050a17676f6f676c652f6170692f6d65747269632e70726f746f120a" . "676f6f676c652e61706922d2030a104d657472696344657363726970746f" . "72120c0a046e616d65180120012809120c0a047479706518082001280912" . "2b0a066c6162656c7318022003280b321b2e676f6f676c652e6170692e4c" . "6162656c44657363726970746f72123c0a0b6d65747269635f6b696e6418" . "032001280e32272e676f6f676c652e6170692e4d65747269634465736372" . "6970746f722e4d65747269634b696e64123a0a0a76616c75655f74797065" . "18042001280e32262e676f6f676c652e6170692e4d657472696344657363" . "726970746f722e56616c756554797065120c0a04756e6974180520012809" . "12130a0b6465736372697074696f6e18062001280912140a0c646973706c" . "61795f6e616d65180720012809224f0a0a4d65747269634b696e64121b0a" . "174d45545249435f4b494e445f554e535045434946494544100012090a05" . "4741554745100112090a0544454c54411002120e0a0a43554d554c415449" . "5645100322710a0956616c756554797065121a0a1656414c55455f545950" . "455f554e535045434946494544100012080a04424f4f4c100112090a0549" . "4e5436341002120a0a06444f55424c451003120a0a06535452494e471004" . "12100a0c444953545249425554494f4e100512090a054d4f4e4559100622" . "750a064d6574726963120c0a0474797065180320012809122e0a066c6162" . "656c7318022003280b321e2e676f6f676c652e6170692e4d65747269632e" . "4c6162656c73456e7472791a2d0a0b4c6162656c73456e747279120b0a03" . "6b6579180120012809120d0a0576616c75651802200128093a023801425f" . "0a0e636f6d2e676f6f676c652e617069420b4d657472696350726f746f50" . "015a37676f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f" . "676f6f676c65617069732f6170692f6d65747269633b6d6574726963a202" . "0447415049620670726f746f33" )); static::$is_initialized = true; } } metadata/Api/MonitoredResource.php000064400000004624151742741630013236 0ustar00internalAddGeneratedFile(hex2bin( "0ac1050a23676f6f676c652f6170692f6d6f6e69746f7265645f7265736f" . "757263652e70726f746f120a676f6f676c652e6170691a1c676f6f676c65" . "2f70726f746f6275662f7374727563742e70726f746f2291010a1b4d6f6e" . "69746f7265645265736f7572636544657363726970746f72120c0a046e61" . "6d65180520012809120c0a047479706518012001280912140a0c64697370" . "6c61795f6e616d6518022001280912130a0b6465736372697074696f6e18" . "0320012809122b0a066c6162656c7318042003280b321b2e676f6f676c65" . "2e6170692e4c6162656c44657363726970746f72228b010a114d6f6e6974" . "6f7265645265736f75726365120c0a047479706518012001280912390a06" . "6c6162656c7318022003280b32292e676f6f676c652e6170692e4d6f6e69" . "746f7265645265736f757263652e4c6162656c73456e7472791a2d0a0b4c" . "6162656c73456e747279120b0a036b6579180120012809120d0a0576616c" . "75651802200128093a02380122ca010a194d6f6e69746f7265645265736f" . "757263654d65746164617461122e0a0d73797374656d5f6c6162656c7318" . "012001280b32172e676f6f676c652e70726f746f6275662e537472756374" . "124a0a0b757365725f6c6162656c7318022003280b32352e676f6f676c65" . "2e6170692e4d6f6e69746f7265645265736f757263654d65746164617461" . "2e557365724c6162656c73456e7472791a310a0f557365724c6162656c73" . "456e747279120b0a036b6579180120012809120d0a0576616c7565180220" . "0128093a02380142790a0e636f6d2e676f6f676c652e61706942164d6f6e" . "69746f7265645265736f7572636550726f746f50015a43676f6f676c652e" . "676f6c616e672e6f72672f67656e70726f746f2f676f6f676c6561706973" . "2f6170692f6d6f6e69746f7265647265733b6d6f6e69746f726564726573" . "f80101a2020447415049620670726f746f33" )); static::$is_initialized = true; } } metadata/Api/Monitoring.php000064400000003114151742741630011704 0ustar00internalAddGeneratedFile(hex2bin( "0a93030a1b676f6f676c652f6170692f6d6f6e69746f72696e672e70726f" . "746f120a676f6f676c652e61706922ec010a0a4d6f6e69746f72696e6712" . "4b0a1570726f64756365725f64657374696e6174696f6e7318012003280b" . "322c2e676f6f676c652e6170692e4d6f6e69746f72696e672e4d6f6e6974" . "6f72696e6744657374696e6174696f6e124b0a15636f6e73756d65725f64" . "657374696e6174696f6e7318022003280b322c2e676f6f676c652e617069" . "2e4d6f6e69746f72696e672e4d6f6e69746f72696e6744657374696e6174" . "696f6e1a440a154d6f6e69746f72696e6744657374696e6174696f6e121a" . "0a126d6f6e69746f7265645f7265736f75726365180120012809120f0a07" . "6d65747269637318022003280942710a0e636f6d2e676f6f676c652e6170" . "69420f4d6f6e69746f72696e6750726f746f50015a45676f6f676c652e67" . "6f6c616e672e6f72672f67656e70726f746f2f676f6f676c65617069732f" . "6170692f73657276696365636f6e6669673b73657276696365636f6e6669" . "67a2020447415049620670726f746f33" )); static::$is_initialized = true; } } metadata/Api/Quota.php000064400000004377151742741630010664 0ustar00internalAddGeneratedFile(hex2bin( "0aa5050a16676f6f676c652f6170692f71756f74612e70726f746f120a67" . "6f6f676c652e617069225d0a0551756f746112260a066c696d6974731803" . "2003280b32162e676f6f676c652e6170692e51756f74614c696d6974122c" . "0a0c6d65747269635f72756c657318042003280b32162e676f6f676c652e" . "6170692e4d657472696352756c652291010a0a4d657472696352756c6512" . "100a0873656c6563746f72180120012809123d0a0c6d65747269635f636f" . "73747318022003280b32272e676f6f676c652e6170692e4d657472696352" . "756c652e4d6574726963436f737473456e7472791a320a104d6574726963" . "436f737473456e747279120b0a036b6579180120012809120d0a0576616c" . "75651802200128033a0238012295020a0a51756f74614c696d6974120c0a" . "046e616d6518062001280912130a0b6465736372697074696f6e18022001" . "280912150a0d64656661756c745f6c696d697418032001280312110a096d" . "61785f6c696d697418042001280312110a09667265655f74696572180720" . "01280312100a086475726174696f6e180520012809120e0a066d65747269" . "63180820012809120c0a04756e697418092001280912320a0676616c7565" . "73180a2003280b32222e676f6f676c652e6170692e51756f74614c696d69" . "742e56616c756573456e74727912140a0c646973706c61795f6e616d6518" . "0c200128091a2d0a0b56616c756573456e747279120b0a036b6579180120" . "012809120d0a0576616c75651802200128033a023801426c0a0e636f6d2e" . "676f6f676c652e617069420a51756f746150726f746f50015a45676f6f67" . "6c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c6561" . "7069732f6170692f73657276696365636f6e6669673b7365727669636563" . "6f6e666967a2020447415049620670726f746f33" )); static::$is_initialized = true; } } metadata/Api/Service.php000064400000014621151742741630011164 0ustar00internalAddGeneratedFile(hex2bin( "0aaa0e0a18676f6f676c652f6170692f736572766963652e70726f746f12" . "0a676f6f676c652e6170691a15676f6f676c652f6170692f617574682e70" . "726f746f1a18676f6f676c652f6170692f6261636b656e642e70726f746f" . "1a18676f6f676c652f6170692f62696c6c696e672e70726f746f1a18676f" . "6f676c652f6170692f636f6e746578742e70726f746f1a18676f6f676c65" . "2f6170692f636f6e74726f6c2e70726f746f1a1e676f6f676c652f617069" . "2f646f63756d656e746174696f6e2e70726f746f1a19676f6f676c652f61" . "70692f656e64706f696e742e70726f746f1a2a676f6f676c652f6170692f" . "6578706572696d656e74616c2f6578706572696d656e74616c2e70726f74" . "6f1a15676f6f676c652f6170692f687474702e70726f746f1a16676f6f67" . "6c652f6170692f6c6162656c2e70726f746f1a14676f6f676c652f617069" . "2f6c6f672e70726f746f1a18676f6f676c652f6170692f6c6f6767696e67" . "2e70726f746f1a17676f6f676c652f6170692f6d65747269632e70726f74" . "6f1a23676f6f676c652f6170692f6d6f6e69746f7265645f7265736f7572" . "63652e70726f746f1a1b676f6f676c652f6170692f6d6f6e69746f72696e" . "672e70726f746f1a16676f6f676c652f6170692f71756f74612e70726f74" . "6f1a1c676f6f676c652f6170692f736f757263655f696e666f2e70726f74" . "6f1a21676f6f676c652f6170692f73797374656d5f706172616d65746572" . "2e70726f746f1a16676f6f676c652f6170692f75736167652e70726f746f" . "1a19676f6f676c652f70726f746f6275662f616e792e70726f746f1a1967" . "6f6f676c652f70726f746f6275662f6170692e70726f746f1a1a676f6f67" . "6c652f70726f746f6275662f747970652e70726f746f1a1e676f6f676c65" . "2f70726f746f6275662f77726170706572732e70726f746f2286080a0753" . "65727669636512340a0e636f6e6669675f76657273696f6e18142001280b" . "321c2e676f6f676c652e70726f746f6275662e55496e74333256616c7565" . "120c0a046e616d65180120012809120a0a026964182120012809120d0a05" . "7469746c65180220012809121b0a1370726f64756365725f70726f6a6563" . "745f696418162001280912220a046170697318032003280b32142e676f6f" . "676c652e70726f746f6275662e41706912240a0574797065731804200328" . "0b32152e676f6f676c652e70726f746f6275662e5479706512240a05656e" . "756d7318052003280b32152e676f6f676c652e70726f746f6275662e456e" . "756d12300a0d646f63756d656e746174696f6e18062001280b32192e676f" . "6f676c652e6170692e446f63756d656e746174696f6e12240a076261636b" . "656e6418082001280b32132e676f6f676c652e6170692e4261636b656e64" . "121e0a046874747018092001280b32102e676f6f676c652e6170692e4874" . "747012200a0571756f7461180a2001280b32112e676f6f676c652e617069" . "2e51756f746112320a0e61757468656e7469636174696f6e180b2001280b" . "321a2e676f6f676c652e6170692e41757468656e7469636174696f6e1224" . "0a07636f6e74657874180c2001280b32132e676f6f676c652e6170692e43" . "6f6e7465787412200a057573616765180f2001280b32112e676f6f676c65" . "2e6170692e557361676512270a09656e64706f696e747318122003280b32" . "142e676f6f676c652e6170692e456e64706f696e7412240a07636f6e7472" . "6f6c18152001280b32132e676f6f676c652e6170692e436f6e74726f6c12" . "270a046c6f677318172003280b32192e676f6f676c652e6170692e4c6f67" . "44657363726970746f72122d0a076d65747269637318182003280b321c2e" . "676f6f676c652e6170692e4d657472696344657363726970746f7212440a" . "136d6f6e69746f7265645f7265736f757263657318192003280b32272e67" . "6f6f676c652e6170692e4d6f6e69746f7265645265736f75726365446573" . "63726970746f7212240a0762696c6c696e67181a2001280b32132e676f6f" . "676c652e6170692e42696c6c696e6712240a076c6f6767696e67181b2001" . "280b32132e676f6f676c652e6170692e4c6f6767696e67122a0a0a6d6f6e" . "69746f72696e67181c2001280b32162e676f6f676c652e6170692e4d6f6e" . "69746f72696e6712370a1173797374656d5f706172616d6574657273181d" . "2001280b321c2e676f6f676c652e6170692e53797374656d506172616d65" . "74657273122b0a0b736f757263655f696e666f18252001280b32162e676f" . "6f676c652e6170692e536f75726365496e666f122e0a0c6578706572696d" . "656e74616c18652001280b32182e676f6f676c652e6170692e4578706572" . "696d656e74616c426e0a0e636f6d2e676f6f676c652e617069420c536572" . "7669636550726f746f50015a45676f6f676c652e676f6c616e672e6f7267" . "2f67656e70726f746f2f676f6f676c65617069732f6170692f7365727669" . "6365636f6e6669673b73657276696365636f6e666967a202044741504962" . "0670726f746f33" )); static::$is_initialized = true; } } metadata/Api/SourceInfo.php000064400000002174151742741630011640 0ustar00internalAddGeneratedFile(hex2bin( "0adf010a1c676f6f676c652f6170692f736f757263655f696e666f2e7072" . "6f746f120a676f6f676c652e61706922380a0a536f75726365496e666f12" . "2a0a0c736f757263655f66696c657318012003280b32142e676f6f676c65" . "2e70726f746f6275662e416e7942710a0e636f6d2e676f6f676c652e6170" . "69420f536f75726365496e666f50726f746f50015a45676f6f676c652e67" . "6f6c616e672e6f72672f67656e70726f746f2f676f6f676c65617069732f" . "6170692f73657276696365636f6e6669673b73657276696365636f6e6669" . "67a2020447415049620670726f746f33" )); static::$is_initialized = true; } } metadata/Api/SystemParameter.php000064400000003070151742741630012705 0ustar00internalAddGeneratedFile(hex2bin( "0aa0030a21676f6f676c652f6170692f73797374656d5f706172616d6574" . "65722e70726f746f120a676f6f676c652e61706922420a1053797374656d" . "506172616d6574657273122e0a0572756c657318012003280b321f2e676f" . "6f676c652e6170692e53797374656d506172616d6574657252756c652258" . "0a1353797374656d506172616d6574657252756c6512100a0873656c6563" . "746f72180120012809122f0a0a706172616d657465727318022003280b32" . "1b2e676f6f676c652e6170692e53797374656d506172616d657465722251" . "0a0f53797374656d506172616d65746572120c0a046e616d651801200128" . "0912130a0b687474705f686561646572180220012809121b0a1375726c5f" . "71756572795f706172616d6574657218032001280942760a0e636f6d2e67" . "6f6f676c652e617069421453797374656d506172616d6574657250726f74" . "6f50015a45676f6f676c652e676f6c616e672e6f72672f67656e70726f74" . "6f2f676f6f676c65617069732f6170692f73657276696365636f6e666967" . "3b73657276696365636f6e666967a2020447415049620670726f746f33" )); static::$is_initialized = true; } } metadata/Api/Usage.php000064400000002704151742741630010627 0ustar00internalAddGeneratedFile(hex2bin( "0ae5020a16676f6f676c652f6170692f75736167652e70726f746f120a67" . "6f6f676c652e617069226a0a05557361676512140a0c726571756972656d" . "656e747318012003280912240a0572756c657318062003280b32152e676f" . "6f676c652e6170692e557361676552756c6512250a1d70726f6475636572" . "5f6e6f74696669636174696f6e5f6368616e6e656c180720012809225d0a" . "09557361676552756c6512100a0873656c6563746f721801200128091220" . "0a18616c6c6f775f756e726567697374657265645f63616c6c7318022001" . "2808121c0a14736b69705f736572766963655f636f6e74726f6c18032001" . "2808426c0a0e636f6d2e676f6f676c652e617069420a557361676550726f" . "746f50015a45676f6f676c652e676f6c616e672e6f72672f67656e70726f" . "746f2f676f6f676c65617069732f6170692f73657276696365636f6e6669" . "673b73657276696365636f6e666967a2020447415049620670726f746f33" )); static::$is_initialized = true; } } metadata/ApiCore/Testing/Mocks.php000064400000003640151742741630013065 0ustar00internalAddGeneratedFile(hex2bin( "0afc030a1b417069436f72652f54657374696e672f6d6f636b732e70726f" . "746f1216676f6f676c652e617069636f72652e74657374696e671a1e676f" . "6f676c652f70726f746f6275662f77726170706572732e70726f746f2234" . "0a0b4d6f636b5265717565737412120a0a706167655f746f6b656e180120" . "01280912110a09706167655f73697a65180220012804225d0a0c4d6f636b" . "526573706f6e7365120c0a046e616d65180120012809120e0a066e756d62" . "657218022001280412160a0e7265736f75726365735f6c69737418032003" . "280912170a0f6e6578745f706167655f746f6b656e18042001280922ec01" . "0a0f4d6f636b52657175657374426f6479120c0a046e616d651801200128" . "09120e0a066e756d62657218022001280412160a0e72657065617465645f" . "6669656c64180320032809123f0a0e6e65737465645f6d65737361676518" . "042001280b32272e676f6f676c652e617069636f72652e74657374696e67" . "2e4d6f636b52657175657374426f6479122e0a0a6669656c645f6d61736b" . "18052001280b321a2e676f6f676c652e70726f746f6275662e4669656c64" . "4d61736b12320a0c737472696e675f76616c756518062001280b321c2e67" . "6f6f676c652e70726f746f6275662e537472696e6756616c75654219ca02" . "16476f6f676c655c417069436f72655c54657374696e67620670726f746f" . "33" )); static::$is_initialized = true; } } metadata/Cloud/Audit/AuditLog.php000064400000006033151742741630012675 0ustar00internalAddGeneratedFile(hex2bin( "0a92070a22676f6f676c652f636c6f75642f61756469742f61756469745f" . "6c6f672e70726f746f1212676f6f676c652e636c6f75642e61756469741a" . "19676f6f676c652f70726f746f6275662f616e792e70726f746f1a1c676f" . "6f676c652f70726f746f6275662f7374727563742e70726f746f1a17676f" . "6f676c652f7270632f7374617475732e70726f746f22d4030a0841756469" . "744c6f6712140a0c736572766963655f6e616d6518072001280912130a0b" . "6d6574686f645f6e616d6518082001280912150a0d7265736f757263655f" . "6e616d65180b20012809121a0a126e756d5f726573706f6e73655f697465" . "6d73180c2001280312220a0673746174757318022001280b32122e676f6f" . "676c652e7270632e53746174757312430a1361757468656e746963617469" . "6f6e5f696e666f18032001280b32262e676f6f676c652e636c6f75642e61" . "756469742e41757468656e7469636174696f6e496e666f12410a12617574" . "686f72697a6174696f6e5f696e666f18092003280b32252e676f6f676c65" . "2e636c6f75642e61756469742e417574686f72697a6174696f6e496e666f" . "123d0a10726571756573745f6d6574616461746118042001280b32232e67" . "6f6f676c652e636c6f75642e61756469742e526571756573744d65746164" . "61746112280a077265717565737418102001280b32172e676f6f676c652e" . "70726f746f6275662e53747275637412290a08726573706f6e7365181120" . "01280b32172e676f6f676c652e70726f746f6275662e537472756374122a" . "0a0c736572766963655f64617461180f2001280b32142e676f6f676c652e" . "70726f746f6275662e416e79222d0a1241757468656e7469636174696f6e" . "496e666f12170a0f7072696e636970616c5f656d61696c18012001280922" . "4a0a11417574686f72697a6174696f6e496e666f12100a087265736f7572" . "636518012001280912120a0a7065726d697373696f6e180220012809120f" . "0a076772616e74656418032001280822480a0f526571756573744d657461" . "6461746112110a0963616c6c65725f697018012001280912220a1a63616c" . "6c65725f737570706c6965645f757365725f6167656e7418022001280942" . "620a16636f6d2e676f6f676c652e636c6f75642e6175646974420d417564" . "69744c6f6750726f746f50015a37676f6f676c652e676f6c616e672e6f72" . "672f67656e70726f746f2f676f6f676c65617069732f636c6f75642f6175" . "6469743b6175646974620670726f746f33" )); static::$is_initialized = true; } } metadata/Devtools/Source/V1/SourceContext.php000064400000011744151742741630015210 0ustar00internalAddGeneratedFile(hex2bin( "0ace0d0a2e676f6f676c652f646576746f6f6c732f736f757263652f7631" . "2f736f757263655f636f6e746578742e70726f746f1219676f6f676c652e" . "646576746f6f6c732e736f757263652e763122b4020a0d536f7572636543" . "6f6e7465787412470a0a636c6f75645f7265706f18012001280b32312e67" . "6f6f676c652e646576746f6f6c732e736f757263652e76312e436c6f7564" . "5265706f536f75726365436f6e74657874480012510a0f636c6f75645f77" . "6f726b737061636518022001280b32362e676f6f676c652e646576746f6f" . "6c732e736f757263652e76312e436c6f7564576f726b7370616365536f75" . "726365436f6e74657874480012400a0667657272697418032001280b322e" . "2e676f6f676c652e646576746f6f6c732e736f757263652e76312e476572" . "726974536f75726365436f6e746578744800123a0a036769741806200128" . "0b322b2e676f6f676c652e646576746f6f6c732e736f757263652e76312e" . "476974536f75726365436f6e74657874480042090a07636f6e7465787422" . "cf010a15457874656e646564536f75726365436f6e7465787412390a0763" . "6f6e7465787418012001280b32282e676f6f676c652e646576746f6f6c73" . "2e736f757263652e76312e536f75726365436f6e74657874124c0a066c61" . "62656c7318022003280b323c2e676f6f676c652e646576746f6f6c732e73" . "6f757263652e76312e457874656e646564536f75726365436f6e74657874" . "2e4c6162656c73456e7472791a2d0a0b4c6162656c73456e747279120b0a" . "036b6579180120012809120d0a0576616c75651802200128093a02380122" . "8c010a0c416c696173436f6e74657874123a0a046b696e6418012001280e" . "322c2e676f6f676c652e646576746f6f6c732e736f757263652e76312e41" . "6c696173436f6e746578742e4b696e64120c0a046e616d65180220012809" . "22320a044b696e6412070a03414e59100012090a0546495845441001120b" . "0a074d4f5641424c45100212090a054f54484552100422c7010a16436c6f" . "75645265706f536f75726365436f6e7465787412320a077265706f5f6964" . "18012001280b32212e676f6f676c652e646576746f6f6c732e736f757263" . "652e76312e5265706f496412150a0b7265766973696f6e5f696418022001" . "2809480012140a0a616c6961735f6e616d65180320012809480012400a0d" . "616c6961735f636f6e7465787418042001280b32272e676f6f676c652e64" . "6576746f6f6c732e736f757263652e76312e416c696173436f6e74657874" . "4800420a0a087265766973696f6e22750a1b436c6f7564576f726b737061" . "6365536f75726365436f6e7465787412410a0c776f726b73706163655f69" . "6418012001280b322b2e676f6f676c652e646576746f6f6c732e736f7572" . "63652e76312e436c6f7564576f726b7370616365496412130a0b736e6170" . "73686f745f696418022001280922ba010a13476572726974536f75726365" . "436f6e7465787412100a08686f73745f75726918012001280912160a0e67" . "65727269745f70726f6a65637418022001280912150a0b7265766973696f" . "6e5f6964180320012809480012140a0a616c6961735f6e616d6518042001" . "2809480012400a0d616c6961735f636f6e7465787418052001280b32272e" . "676f6f676c652e646576746f6f6c732e736f757263652e76312e416c6961" . "73436f6e746578744800420a0a087265766973696f6e22340a1047697453" . "6f75726365436f6e74657874120b0a0375726c18012001280912130a0b72" . "65766973696f6e5f696418022001280922620a065265706f496412430a0f" . "70726f6a6563745f7265706f5f696418012001280b32282e676f6f676c65" . "2e646576746f6f6c732e736f757263652e76312e50726f6a656374526570" . "6f49644800120d0a03756964180220012809480042040a02696422360a0d" . "50726f6a6563745265706f496412120a0a70726f6a6563745f6964180120" . "01280912110a097265706f5f6e616d6518022001280922540a10436c6f75" . "64576f726b7370616365496412320a077265706f5f696418012001280b32" . "212e676f6f676c652e646576746f6f6c732e736f757263652e76312e5265" . "706f4964120c0a046e616d6518022001280942ba010a1d636f6d2e676f6f" . "676c652e646576746f6f6c732e736f757263652e76314212536f75726365" . "436f6e7465787450726f746f50015a3f676f6f676c652e676f6c616e672e" . "6f72672f67656e70726f746f2f676f6f676c65617069732f646576746f6f" . "6c732f736f757263652f76313b736f75726365aa021f476f6f676c652e43" . "6c6f75642e446576546f6f6c732e536f757263652e5631ca021f476f6f67" . "6c655c436c6f75645c446576546f6f6c735c536f757263655c5631620670" . "726f746f33" )); static::$is_initialized = true; } } metadata/Google/ApiCore/Tests/Unit/Example.php000064400000001534151742741630015224 0ustar00internalAddGeneratedFile(hex2bin( "0a85010a0d6578616d706c652e70726f746f1219676f6f676c652e617069" . "636f72652e74657374732e756e6974220b0a094d794d6573736167654244" . "ca0219476f6f676c655c417069436f72655c54657374735c556e6974e202" . "254750424d657461646174615c476f6f676c655c417069436f72655c5465" . "7374735c556e6974620670726f746f33" )); static::$is_initialized = true; } } metadata/Iam/V1/IamPolicy.php000064400000005447151742741630011743 0ustar00internalAddGeneratedFile(hex2bin( "0ae3060a1e676f6f676c652f69616d2f76312f69616d5f706f6c6963792e" . "70726f746f120d676f6f676c652e69616d2e76311a1a676f6f676c652f69" . "616d2f76312f706f6c6963792e70726f746f224e0a1353657449616d506f" . "6c6963795265717565737412100a087265736f7572636518012001280912" . "250a06706f6c69637918022001280b32152e676f6f676c652e69616d2e76" . "312e506f6c69637922270a1347657449616d506f6c696379526571756573" . "7412100a087265736f7572636518012001280922420a195465737449616d" . "5065726d697373696f6e735265717565737412100a087265736f75726365" . "18012001280912130a0b7065726d697373696f6e7318022003280922310a" . "1a5465737449616d5065726d697373696f6e73526573706f6e736512130a" . "0b7065726d697373696f6e731801200328093294030a0949414d506f6c69" . "637912740a0c53657449616d506f6c69637912222e676f6f676c652e6961" . "6d2e76312e53657449616d506f6c696379526571756573741a152e676f6f" . "676c652e69616d2e76312e506f6c696379222982d3e4930223221e2f7631" . "2f7b7265736f757263653d2a2a7d3a73657449616d506f6c6963793a012a" . "12740a0c47657449616d506f6c69637912222e676f6f676c652e69616d2e" . "76312e47657449616d506f6c696379526571756573741a152e676f6f676c" . "652e69616d2e76312e506f6c696379222982d3e4930223221e2f76312f7b" . "7265736f757263653d2a2a7d3a67657449616d506f6c6963793a012a129a" . "010a125465737449616d5065726d697373696f6e7312282e676f6f676c65" . "2e69616d2e76312e5465737449616d5065726d697373696f6e7352657175" . "6573741a292e676f6f676c652e69616d2e76312e5465737449616d506572" . "6d697373696f6e73526573706f6e7365222f82d3e493022922242f76312f" . "7b7265736f757263653d2a2a7d3a7465737449616d5065726d697373696f" . "6e733a012a4286010a11636f6d2e676f6f676c652e69616d2e7631420e49" . "616d506f6c69637950726f746f50015a30676f6f676c652e676f6c616e67" . "2e6f72672f67656e70726f746f2f676f6f676c65617069732f69616d2f76" . "313b69616df80101aa0213476f6f676c652e436c6f75642e49616d2e5631" . "ca0213476f6f676c655c436c6f75645c49616d5c5631620670726f746f33" )); static::$is_initialized = true; } } metadata/Iam/V1/Logging/AuditData.php000064400000002633151742741630013275 0ustar00internalAddGeneratedFile(hex2bin( "0aae020a26676f6f676c652f69616d2f76312f6c6f6767696e672f617564" . "69745f646174612e70726f746f1215676f6f676c652e69616d2e76312e6c" . "6f6767696e671a1a676f6f676c652f69616d2f76312f706f6c6963792e70" . "726f746f223d0a0941756469744461746112300a0c706f6c6963795f6465" . "6c746118022001280b321a2e676f6f676c652e69616d2e76312e506f6c69" . "637944656c74614289010a19636f6d2e676f6f676c652e69616d2e76312e" . "6c6f6767696e67420e41756469744461746150726f746f50015a3c676f6f" . "676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c65" . "617069732f69616d2f76312f6c6f6767696e673b6c6f6767696e67aa021b" . "476f6f676c652e436c6f75642e49616d2e56312e4c6f6767696e67620670" . "726f746f33" )); static::$is_initialized = true; } } metadata/Iam/V1/Policy.php000064400000003620151742741630011303 0ustar00internalAddGeneratedFile(hex2bin( "0a94040a1a676f6f676c652f69616d2f76312f706f6c6963792e70726f74" . "6f120d676f6f676c652e69616d2e763122510a06506f6c696379120f0a07" . "76657273696f6e18012001280512280a0862696e64696e67731804200328" . "0b32162e676f6f676c652e69616d2e76312e42696e64696e67120c0a0465" . "74616718032001280c22280a0742696e64696e67120c0a04726f6c651801" . "20012809120f0a076d656d6265727318022003280922420a0b506f6c6963" . "7944656c746112330a0e62696e64696e675f64656c74617318012003280b" . "321b2e676f6f676c652e69616d2e76312e42696e64696e6744656c746122" . "97010a0c42696e64696e6744656c746112320a06616374696f6e18012001" . "280e32222e676f6f676c652e69616d2e76312e42696e64696e6744656c74" . "612e416374696f6e120c0a04726f6c65180220012809120e0a066d656d62" . "657218032001280922350a06416374696f6e12160a12414354494f4e5f55" . "4e535045434946494544100012070a034144441001120a0a0652454d4f56" . "4510024283010a11636f6d2e676f6f676c652e69616d2e7631420b506f6c" . "69637950726f746f50015a30676f6f676c652e676f6c616e672e6f72672f" . "67656e70726f746f2f676f6f676c65617069732f69616d2f76313b69616d" . "f80101aa0213476f6f676c652e436c6f75642e49616d2e5631ca0213476f" . "6f676c655c436c6f75645c49616d5c5631620670726f746f33" )); static::$is_initialized = true; } } metadata/Logging/Type/HttpRequest.php000064400000004360151742741630013651 0ustar00internalAddGeneratedFile(hex2bin( "0af9040a26676f6f676c652f6c6f6767696e672f747970652f687474705f" . "726571756573742e70726f746f1213676f6f676c652e6c6f6767696e672e" . "747970651a1e676f6f676c652f70726f746f6275662f6475726174696f6e" . "2e70726f746f22ef020a0b487474705265717565737412160a0e72657175" . "6573745f6d6574686f6418012001280912130a0b726571756573745f7572" . "6c18022001280912140a0c726571756573745f73697a6518032001280312" . "0e0a0673746174757318042001280512150a0d726573706f6e73655f7369" . "7a6518052001280312120a0a757365725f6167656e741806200128091211" . "0a0972656d6f74655f697018072001280912110a097365727665725f6970" . "180d20012809120f0a0772656665726572180820012809122a0a076c6174" . "656e6379180e2001280b32192e676f6f676c652e70726f746f6275662e44" . "75726174696f6e12140a0c63616368655f6c6f6f6b7570180b2001280812" . "110a0963616368655f686974180920012808122a0a2263616368655f7661" . "6c6964617465645f776974685f6f726967696e5f736572766572180a2001" . "280812180a1063616368655f66696c6c5f6279746573180c200128031210" . "0a0870726f746f636f6c180f20012809429f010a17636f6d2e676f6f676c" . "652e6c6f6767696e672e747970654210487474705265717565737450726f" . "746f50015a38676f6f676c652e676f6c616e672e6f72672f67656e70726f" . "746f2f676f6f676c65617069732f6c6f6767696e672f747970653b6c7479" . "7065aa0219476f6f676c652e436c6f75642e4c6f6767696e672e54797065" . "ca0219476f6f676c655c436c6f75645c4c6f6767696e675c547970656206" . "70726f746f33" )); static::$is_initialized = true; } } metadata/Logging/Type/LogSeverity.php000064400000003002151742741630013625 0ustar00internalAddGeneratedFile(hex2bin( "0aec020a26676f6f676c652f6c6f6767696e672f747970652f6c6f675f73" . "657665726974792e70726f746f1213676f6f676c652e6c6f6767696e672e" . "747970652a82010a0b4c6f675365766572697479120b0a0744454641554c" . "54100012090a054445425547106412090a04494e464f10c801120b0a064e" . "4f5449434510ac02120c0a075741524e494e47109003120a0a054552524f" . "5210f403120d0a08435249544943414c10d804120a0a05414c45525410bc" . "05120e0a09454d455247454e435910a006429f010a17636f6d2e676f6f67" . "6c652e6c6f6767696e672e7479706542104c6f6753657665726974795072" . "6f746f50015a38676f6f676c652e676f6c616e672e6f72672f67656e7072" . "6f746f2f676f6f676c65617069732f6c6f6767696e672f747970653b6c74" . "797065aa0219476f6f676c652e436c6f75642e4c6f6767696e672e547970" . "65ca0219476f6f676c655c436c6f75645c4c6f6767696e675c5479706562" . "0670726f746f33" )); static::$is_initialized = true; } } metadata/Longrunning/Operations.php000064400000010021151742741630013464 0ustar00internalAddGeneratedFile(hex2bin( "0a9c0a0a23676f6f676c652f6c6f6e6772756e6e696e672f6f7065726174" . "696f6e732e70726f746f1212676f6f676c652e6c6f6e6772756e6e696e67" . "1a19676f6f676c652f70726f746f6275662f616e792e70726f746f1a1b67" . "6f6f676c652f70726f746f6275662f656d7074792e70726f746f1a17676f" . "6f676c652f7270632f7374617475732e70726f746f22a8010a094f706572" . "6174696f6e120c0a046e616d6518012001280912260a086d657461646174" . "6118022001280b32142e676f6f676c652e70726f746f6275662e416e7912" . "0c0a04646f6e6518032001280812230a056572726f7218042001280b3212" . "2e676f6f676c652e7270632e537461747573480012280a08726573706f6e" . "736518052001280b32142e676f6f676c652e70726f746f6275662e416e79" . "480042080a06726573756c7422230a134765744f7065726174696f6e5265" . "7175657374120c0a046e616d65180120012809225c0a154c6973744f7065" . "726174696f6e7352657175657374120c0a046e616d65180420012809120e" . "0a0666696c74657218012001280912110a09706167655f73697a65180220" . "01280512120a0a706167655f746f6b656e18032001280922640a164c6973" . "744f7065726174696f6e73526573706f6e736512310a0a6f706572617469" . "6f6e7318012003280b321d2e676f6f676c652e6c6f6e6772756e6e696e67" . "2e4f7065726174696f6e12170a0f6e6578745f706167655f746f6b656e18" . "022001280922260a1643616e63656c4f7065726174696f6e526571756573" . "74120c0a046e616d6518012001280922260a1644656c6574654f70657261" . "74696f6e52657175657374120c0a046e616d65180120012809328c040a0a" . "4f7065726174696f6e731286010a0e4c6973744f7065726174696f6e7312" . "292e676f6f676c652e6c6f6e6772756e6e696e672e4c6973744f70657261" . "74696f6e73526571756573741a2a2e676f6f676c652e6c6f6e6772756e6e" . "696e672e4c6973744f7065726174696f6e73526573706f6e7365221d82d3" . "e493021712152f76312f7b6e616d653d6f7065726174696f6e737d12780a" . "0c4765744f7065726174696f6e12272e676f6f676c652e6c6f6e6772756e" . "6e696e672e4765744f7065726174696f6e526571756573741a1d2e676f6f" . "676c652e6c6f6e6772756e6e696e672e4f7065726174696f6e222082d3e4" . "93021a12182f76312f7b6e616d653d6f7065726174696f6e732f2a2a7d12" . "770a0f44656c6574654f7065726174696f6e122a2e676f6f676c652e6c6f" . "6e6772756e6e696e672e44656c6574654f7065726174696f6e5265717565" . "73741a162e676f6f676c652e70726f746f6275662e456d707479222082d3" . "e493021a2a182f76312f7b6e616d653d6f7065726174696f6e732f2a2a7d" . "1281010a0f43616e63656c4f7065726174696f6e122a2e676f6f676c652e" . "6c6f6e6772756e6e696e672e43616e63656c4f7065726174696f6e526571" . "756573741a162e676f6f676c652e70726f746f6275662e456d707479222a" . "82d3e4930224221f2f76312f7b6e616d653d6f7065726174696f6e732f2a" . "2a7d3a63616e63656c3a012a4294010a16636f6d2e676f6f676c652e6c6f" . "6e6772756e6e696e67420f4f7065726174696f6e7350726f746f50015a3d" . "676f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f" . "676c65617069732f6c6f6e6772756e6e696e673b6c6f6e6772756e6e696e" . "67aa0212476f6f676c652e4c6f6e6752756e6e696e67ca0212476f6f676c" . "655c4c6f6e6752756e6e696e67620670726f746f33" )); static::$is_initialized = true; } } metadata/README.md000064400000000243151742741630007614 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/ metadata/Rpc/Code.php000064400000003160151742741630010445 0ustar00internalAddGeneratedFile(hex2bin( "0abf030a15676f6f676c652f7270632f636f64652e70726f746f120a676f" . "6f676c652e7270632ab7020a04436f646512060a024f4b1000120d0a0943" . "414e43454c4c45441001120b0a07554e4b4e4f574e100212140a10494e56" . "414c49445f415247554d454e54100312150a11444541444c494e455f4558" . "4345454445441004120d0a094e4f545f464f554e44100512120a0e414c52" . "454144595f455849535453100612150a115045524d495353494f4e5f4445" . "4e494544100712130a0f554e41555448454e54494341544544101012160a" . "125245534f555243455f455848415553544544100812170a134641494c45" . "445f505245434f4e444954494f4e1009120b0a0741424f52544544100a12" . "100a0c4f55545f4f465f52414e4745100b12110a0d554e494d504c454d45" . "4e544544100c120c0a08494e5445524e414c100d120f0a0b554e41564149" . "4c41424c45100e120d0a09444154415f4c4f5353100f42580a0e636f6d2e" . "676f6f676c652e7270634209436f646550726f746f50015a33676f6f676c" . "652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c656170" . "69732f7270632f636f64653b636f6465a20203525043620670726f746f33" )); static::$is_initialized = true; } } metadata/Rpc/ErrorDetails.php000064400000006030151742741630012171 0ustar00internalAddGeneratedFile(hex2bin( "0ad4070a1e676f6f676c652f7270632f6572726f725f64657461696c732e" . "70726f746f120a676f6f676c652e727063223b0a095265747279496e666f" . "122e0a0b72657472795f64656c617918012001280b32192e676f6f676c65" . "2e70726f746f6275662e4475726174696f6e22320a094465627567496e66" . "6f12150a0d737461636b5f656e7472696573180120032809120e0a066465" . "7461696c18022001280922790a0c51756f74614661696c75726512360a0a" . "76696f6c6174696f6e7318012003280b32222e676f6f676c652e7270632e" . "51756f74614661696c7572652e56696f6c6174696f6e1a310a0956696f6c" . "6174696f6e120f0a077375626a65637418012001280912130a0b64657363" . "72697074696f6e1802200128092295010a13507265636f6e646974696f6e" . "4661696c757265123d0a0a76696f6c6174696f6e7318012003280b32292e" . "676f6f676c652e7270632e507265636f6e646974696f6e4661696c757265" . "2e56696f6c6174696f6e1a3f0a0956696f6c6174696f6e120c0a04747970" . "65180120012809120f0a077375626a65637418022001280912130a0b6465" . "736372697074696f6e1803200128092283010a0a42616452657175657374" . "123f0a106669656c645f76696f6c6174696f6e7318012003280b32252e67" . "6f6f676c652e7270632e426164526571756573742e4669656c6456696f6c" . "6174696f6e1a340a0e4669656c6456696f6c6174696f6e120d0a05666965" . "6c6418012001280912130a0b6465736372697074696f6e18022001280922" . "370a0b52657175657374496e666f12120a0a726571756573745f69641801" . "2001280912140a0c73657276696e675f6461746118022001280922600a0c" . "5265736f75726365496e666f12150a0d7265736f757263655f7479706518" . "012001280912150a0d7265736f757263655f6e616d65180220012809120d" . "0a056f776e657218032001280912130a0b6465736372697074696f6e1804" . "2001280922560a0448656c7012240a056c696e6b7318012003280b32152e" . "676f6f676c652e7270632e48656c702e4c696e6b1a280a044c696e6b1213" . "0a0b6465736372697074696f6e180120012809120b0a0375726c18022001" . "280922330a104c6f63616c697a65644d657373616765120e0a066c6f6361" . "6c65180120012809120f0a076d657373616765180220012809426c0a0e63" . "6f6d2e676f6f676c652e72706342114572726f7244657461696c7350726f" . "746f50015a3f676f6f676c652e676f6c616e672e6f72672f67656e70726f" . "746f2f676f6f676c65617069732f7270632f65727264657461696c733b65" . "727264657461696c73a20203525043620670726f746f33" )); static::$is_initialized = true; } } metadata/Rpc/Status.php000064400000002157151742741630011063 0ustar00internalAddGeneratedFile(hex2bin( "0add010a17676f6f676c652f7270632f7374617475732e70726f746f120a" . "676f6f676c652e727063224e0a06537461747573120c0a04636f64651801" . "20012805120f0a076d65737361676518022001280912250a076465746169" . "6c7318032003280b32142e676f6f676c652e70726f746f6275662e416e79" . "425e0a0e636f6d2e676f6f676c652e727063420b53746174757350726f74" . "6f50015a37676f6f676c652e676f6c616e672e6f72672f67656e70726f74" . "6f2f676f6f676c65617069732f7270632f7374617475733b737461747573" . "a20203525043620670726f746f33" )); static::$is_initialized = true; } } metadata/Type/Color.php000064400000002222151742741630011044 0ustar00internalAddGeneratedFile(hex2bin( "0aec010a17676f6f676c652f747970652f636f6c6f722e70726f746f120b" . "676f6f676c652e74797065225d0a05436f6c6f72120b0a03726564180120" . "012802120d0a05677265656e180220012802120c0a04626c756518032001" . "2802122a0a05616c70686118042001280b321b2e676f6f676c652e70726f" . "746f6275662e466c6f617456616c7565425d0a0f636f6d2e676f6f676c65" . "2e74797065420a436f6c6f7250726f746f50015a36676f6f676c652e676f" . "6c616e672e6f72672f67656e70726f746f2f676f6f676c65617069732f74" . "7970652f636f6c6f723b636f6c6f72a20203475450620670726f746f33" )); static::$is_initialized = true; } } metadata/Type/Date.php000064400000001750151742741630010650 0ustar00internalAddGeneratedFile(hex2bin( "0abe010a16676f6f676c652f747970652f646174652e70726f746f120b67" . "6f6f676c652e7479706522300a0444617465120c0a047965617218012001" . "2805120d0a056d6f6e7468180220012805120b0a03646179180320012805" . "425d0a0f636f6d2e676f6f676c652e7479706542094461746550726f746f" . "50015a34676f6f676c652e676f6c616e672e6f72672f67656e70726f746f" . "2f676f6f676c65617069732f747970652f646174653b64617465f80101a2" . "0203475450620670726f746f33" )); static::$is_initialized = true; } } metadata/Type/Dayofweek.php000064400000002361151742741630011710 0ustar00internalAddGeneratedFile(hex2bin( "0aa4020a1b676f6f676c652f747970652f6461796f667765656b2e70726f" . "746f120b676f6f676c652e747970652a84010a094461794f665765656b12" . "1b0a174441595f4f465f5745454b5f554e5350454349464945441000120a" . "0a064d4f4e4441591001120b0a07545545534441591002120d0a09574544" . "4e45534441591003120c0a0854485552534441591004120a0a0646524944" . "41591005120c0a0853415455524441591006120a0a0653554e4441591007" . "42690a0f636f6d2e676f6f676c652e74797065420e4461794f665765656b" . "50726f746f50015a3e676f6f676c652e676f6c616e672e6f72672f67656e" . "70726f746f2f676f6f676c65617069732f747970652f6461796f66776565" . "6b3b6461796f667765656ba20203475450620670726f746f33" )); static::$is_initialized = true; } } metadata/Type/Latlng.php000064400000001760151742741630011215 0ustar00internalAddGeneratedFile(hex2bin( "0ac0010a18676f6f676c652f747970652f6c61746c6e672e70726f746f12" . "0b676f6f676c652e74797065222d0a064c61744c6e6712100a086c617469" . "7475646518012001280112110a096c6f6e67697475646518022001280142" . "600a0f636f6d2e676f6f676c652e74797065420b4c61744c6e6750726f74" . "6f50015a38676f6f676c652e676f6c616e672e6f72672f67656e70726f74" . "6f2f676f6f676c65617069732f747970652f6c61746c6e673b6c61746c6e" . "67a20203475450620670726f746f33" )); static::$is_initialized = true; } } metadata/Type/Money.php000064400000002004151742741630011053 0ustar00internalAddGeneratedFile(hex2bin( "0acb010a17676f6f676c652f747970652f6d6f6e65792e70726f746f120b" . "676f6f676c652e74797065223c0a054d6f6e657912150a0d63757272656e" . "63795f636f6465180120012809120d0a05756e697473180220012803120d" . "0a056e616e6f73180320012805425d0a0f636f6d2e676f6f676c652e7479" . "7065420a4d6f6e657950726f746f50015a36676f6f676c652e676f6c616e" . "672e6f72672f67656e70726f746f2f676f6f676c65617069732f74797065" . "2f6d6f6e65793b6d6f6e6579a20203475450620670726f746f33" )); static::$is_initialized = true; } } metadata/Type/PostalAddress.php000064400000003143151742741630012541 0ustar00internalAddGeneratedFile(hex2bin( "0aae030a20676f6f676c652f747970652f706f7374616c5f616464726573" . "732e70726f746f120b676f6f676c652e7479706522fd010a0d506f737461" . "6c4164647265737312100a087265766973696f6e18012001280512130a0b" . "726567696f6e5f636f646518022001280912150a0d6c616e67756167655f" . "636f646518032001280912130a0b706f7374616c5f636f64651804200128" . "0912140a0c736f7274696e675f636f6465180520012809121b0a1361646d" . "696e6973747261746976655f6172656118062001280912100a086c6f6361" . "6c69747918072001280912130a0b7375626c6f63616c6974791808200128" . "0912150a0d616464726573735f6c696e657318092003280912120a0a7265" . "63697069656e7473180a2003280912140a0c6f7267616e697a6174696f6e" . "180b2001280942750a0f636f6d2e676f6f676c652e747970654212506f73" . "74616c4164647265737350726f746f50015a46676f6f676c652e676f6c61" . "6e672e6f72672f67656e70726f746f2f676f6f676c65617069732f747970" . "652f706f7374616c616464726573733b706f7374616c61646472657373a2" . "0203475450620670726f746f33" )); static::$is_initialized = true; } } metadata/Type/Timeofday.php000064400000002133151742741630011710 0ustar00internalAddGeneratedFile(hex2bin( "0aea010a1b676f6f676c652f747970652f74696d656f666461792e70726f" . "746f120b676f6f676c652e74797065224b0a0954696d654f66446179120d" . "0a05686f757273180120012805120f0a076d696e75746573180220012805" . "120f0a077365636f6e6473180320012805120d0a056e616e6f7318042001" . "280542690a0f636f6d2e676f6f676c652e74797065420e54696d654f6644" . "617950726f746f50015a3e676f6f676c652e676f6c616e672e6f72672f67" . "656e70726f746f2f676f6f676c65617069732f747970652f74696d656f66" . "6461793b74696d656f66646179a20203475450620670726f746f33" )); static::$is_initialized = true; } } phpunit.xml.dist000064400000000622151742741630007731 0ustar00 tests/ApiCore/Tests/Unit tests/LongRunning/Tests/Unit src/ApiCore ruleset.xml000064400000000747151742741630006773 0ustar00 src/ApiCore/Jison src/ApiCore/LongRunning src/ApiCore/Testing src/ApiCore src/Api/Advice.php000064400000003744151742741630007772 0ustar00google.api.Advice */ class Advice extends \Google\Protobuf\Internal\Message { /** * Useful description for why this advice was applied and what actions should * be taken to mitigate any implied risks. * * Generated from protobuf field string description = 2; */ private $description = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $description * Useful description for why this advice was applied and what actions should * be taken to mitigate any implied risks. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\ConfigChange::initOnce(); parent::__construct($data); } /** * Useful description for why this advice was applied and what actions should * be taken to mitigate any implied risks. * * Generated from protobuf field string description = 2; * @return string */ public function getDescription() { return $this->description; } /** * Useful description for why this advice was applied and what actions should * be taken to mitigate any implied risks. * * Generated from protobuf field string description = 2; * @param string $var * @return $this */ public function setDescription($var) { GPBUtil::checkString($var, True); $this->description = $var; return $this; } } src/Api/AuthProvider.php000064400000027107151742741630011212 0ustar00google.api.AuthProvider */ class AuthProvider extends \Google\Protobuf\Internal\Message { /** * The unique identifier of the auth provider. It will be referred to by * `AuthRequirement.provider_id`. * Example: "bookstore_auth". * * Generated from protobuf field string id = 1; */ private $id = ''; /** * Identifies the principal that issued the JWT. See * https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1 * Usually a URL or an email address. * Example: https://securetoken.google.com * Example: 1234567-compute@developer.gserviceaccount.com * * Generated from protobuf field string issuer = 2; */ private $issuer = ''; /** * URL of the provider's public key set to validate signature of the JWT. See * [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata). * Optional if the key set document: * - can be retrieved from * [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html * of the issuer. * - can be inferred from the email domain of the issuer (e.g. a Google service account). * Example: https://www.googleapis.com/oauth2/v1/certs * * Generated from protobuf field string jwks_uri = 3; */ private $jwks_uri = ''; /** * The list of JWT * [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). * that are allowed to access. A JWT containing any of these audiences will * be accepted. When this setting is absent, only JWTs with audience * "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" * will be accepted. For example, if no audiences are in the setting, * LibraryService API will only accept JWTs with the following audience * "https://library-example.googleapis.com/google.example.library.v1.LibraryService". * Example: * audiences: bookstore_android.apps.googleusercontent.com, * bookstore_web.apps.googleusercontent.com * * Generated from protobuf field string audiences = 4; */ private $audiences = ''; /** * Redirect URL if JWT token is required but no present or is expired. * Implement authorizationUrl of securityDefinitions in OpenAPI spec. * * Generated from protobuf field string authorization_url = 5; */ private $authorization_url = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $id * The unique identifier of the auth provider. It will be referred to by * `AuthRequirement.provider_id`. * Example: "bookstore_auth". * @type string $issuer * Identifies the principal that issued the JWT. See * https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1 * Usually a URL or an email address. * Example: https://securetoken.google.com * Example: 1234567-compute@developer.gserviceaccount.com * @type string $jwks_uri * URL of the provider's public key set to validate signature of the JWT. See * [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata). * Optional if the key set document: * - can be retrieved from * [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html * of the issuer. * - can be inferred from the email domain of the issuer (e.g. a Google service account). * Example: https://www.googleapis.com/oauth2/v1/certs * @type string $audiences * The list of JWT * [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). * that are allowed to access. A JWT containing any of these audiences will * be accepted. When this setting is absent, only JWTs with audience * "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" * will be accepted. For example, if no audiences are in the setting, * LibraryService API will only accept JWTs with the following audience * "https://library-example.googleapis.com/google.example.library.v1.LibraryService". * Example: * audiences: bookstore_android.apps.googleusercontent.com, * bookstore_web.apps.googleusercontent.com * @type string $authorization_url * Redirect URL if JWT token is required but no present or is expired. * Implement authorizationUrl of securityDefinitions in OpenAPI spec. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Auth::initOnce(); parent::__construct($data); } /** * The unique identifier of the auth provider. It will be referred to by * `AuthRequirement.provider_id`. * Example: "bookstore_auth". * * Generated from protobuf field string id = 1; * @return string */ public function getId() { return $this->id; } /** * The unique identifier of the auth provider. It will be referred to by * `AuthRequirement.provider_id`. * Example: "bookstore_auth". * * Generated from protobuf field string id = 1; * @param string $var * @return $this */ public function setId($var) { GPBUtil::checkString($var, True); $this->id = $var; return $this; } /** * Identifies the principal that issued the JWT. See * https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1 * Usually a URL or an email address. * Example: https://securetoken.google.com * Example: 1234567-compute@developer.gserviceaccount.com * * Generated from protobuf field string issuer = 2; * @return string */ public function getIssuer() { return $this->issuer; } /** * Identifies the principal that issued the JWT. See * https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1 * Usually a URL or an email address. * Example: https://securetoken.google.com * Example: 1234567-compute@developer.gserviceaccount.com * * Generated from protobuf field string issuer = 2; * @param string $var * @return $this */ public function setIssuer($var) { GPBUtil::checkString($var, True); $this->issuer = $var; return $this; } /** * URL of the provider's public key set to validate signature of the JWT. See * [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata). * Optional if the key set document: * - can be retrieved from * [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html * of the issuer. * - can be inferred from the email domain of the issuer (e.g. a Google service account). * Example: https://www.googleapis.com/oauth2/v1/certs * * Generated from protobuf field string jwks_uri = 3; * @return string */ public function getJwksUri() { return $this->jwks_uri; } /** * URL of the provider's public key set to validate signature of the JWT. See * [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata). * Optional if the key set document: * - can be retrieved from * [OpenID Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html * of the issuer. * - can be inferred from the email domain of the issuer (e.g. a Google service account). * Example: https://www.googleapis.com/oauth2/v1/certs * * Generated from protobuf field string jwks_uri = 3; * @param string $var * @return $this */ public function setJwksUri($var) { GPBUtil::checkString($var, True); $this->jwks_uri = $var; return $this; } /** * The list of JWT * [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). * that are allowed to access. A JWT containing any of these audiences will * be accepted. When this setting is absent, only JWTs with audience * "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" * will be accepted. For example, if no audiences are in the setting, * LibraryService API will only accept JWTs with the following audience * "https://library-example.googleapis.com/google.example.library.v1.LibraryService". * Example: * audiences: bookstore_android.apps.googleusercontent.com, * bookstore_web.apps.googleusercontent.com * * Generated from protobuf field string audiences = 4; * @return string */ public function getAudiences() { return $this->audiences; } /** * The list of JWT * [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). * that are allowed to access. A JWT containing any of these audiences will * be accepted. When this setting is absent, only JWTs with audience * "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" * will be accepted. For example, if no audiences are in the setting, * LibraryService API will only accept JWTs with the following audience * "https://library-example.googleapis.com/google.example.library.v1.LibraryService". * Example: * audiences: bookstore_android.apps.googleusercontent.com, * bookstore_web.apps.googleusercontent.com * * Generated from protobuf field string audiences = 4; * @param string $var * @return $this */ public function setAudiences($var) { GPBUtil::checkString($var, True); $this->audiences = $var; return $this; } /** * Redirect URL if JWT token is required but no present or is expired. * Implement authorizationUrl of securityDefinitions in OpenAPI spec. * * Generated from protobuf field string authorization_url = 5; * @return string */ public function getAuthorizationUrl() { return $this->authorization_url; } /** * Redirect URL if JWT token is required but no present or is expired. * Implement authorizationUrl of securityDefinitions in OpenAPI spec. * * Generated from protobuf field string authorization_url = 5; * @param string $var * @return $this */ public function setAuthorizationUrl($var) { GPBUtil::checkString($var, True); $this->authorization_url = $var; return $this; } } src/Api/AuthRequirement.php000064400000014363151742741630011720 0ustar00google.api.AuthRequirement */ class AuthRequirement extends \Google\Protobuf\Internal\Message { /** * [id][google.api.AuthProvider.id] from authentication provider. * Example: * provider_id: bookstore_auth * * Generated from protobuf field string provider_id = 1; */ private $provider_id = ''; /** * NOTE: This will be deprecated soon, once AuthProvider.audiences is * implemented and accepted in all the runtime components. * The list of JWT * [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). * that are allowed to access. A JWT containing any of these audiences will * be accepted. When this setting is absent, only JWTs with audience * "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" * will be accepted. For example, if no audiences are in the setting, * LibraryService API will only accept JWTs with the following audience * "https://library-example.googleapis.com/google.example.library.v1.LibraryService". * Example: * audiences: bookstore_android.apps.googleusercontent.com, * bookstore_web.apps.googleusercontent.com * * Generated from protobuf field string audiences = 2; */ private $audiences = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $provider_id * [id][google.api.AuthProvider.id] from authentication provider. * Example: * provider_id: bookstore_auth * @type string $audiences * NOTE: This will be deprecated soon, once AuthProvider.audiences is * implemented and accepted in all the runtime components. * The list of JWT * [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). * that are allowed to access. A JWT containing any of these audiences will * be accepted. When this setting is absent, only JWTs with audience * "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" * will be accepted. For example, if no audiences are in the setting, * LibraryService API will only accept JWTs with the following audience * "https://library-example.googleapis.com/google.example.library.v1.LibraryService". * Example: * audiences: bookstore_android.apps.googleusercontent.com, * bookstore_web.apps.googleusercontent.com * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Auth::initOnce(); parent::__construct($data); } /** * [id][google.api.AuthProvider.id] from authentication provider. * Example: * provider_id: bookstore_auth * * Generated from protobuf field string provider_id = 1; * @return string */ public function getProviderId() { return $this->provider_id; } /** * [id][google.api.AuthProvider.id] from authentication provider. * Example: * provider_id: bookstore_auth * * Generated from protobuf field string provider_id = 1; * @param string $var * @return $this */ public function setProviderId($var) { GPBUtil::checkString($var, True); $this->provider_id = $var; return $this; } /** * NOTE: This will be deprecated soon, once AuthProvider.audiences is * implemented and accepted in all the runtime components. * The list of JWT * [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). * that are allowed to access. A JWT containing any of these audiences will * be accepted. When this setting is absent, only JWTs with audience * "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" * will be accepted. For example, if no audiences are in the setting, * LibraryService API will only accept JWTs with the following audience * "https://library-example.googleapis.com/google.example.library.v1.LibraryService". * Example: * audiences: bookstore_android.apps.googleusercontent.com, * bookstore_web.apps.googleusercontent.com * * Generated from protobuf field string audiences = 2; * @return string */ public function getAudiences() { return $this->audiences; } /** * NOTE: This will be deprecated soon, once AuthProvider.audiences is * implemented and accepted in all the runtime components. * The list of JWT * [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). * that are allowed to access. A JWT containing any of these audiences will * be accepted. When this setting is absent, only JWTs with audience * "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" * will be accepted. For example, if no audiences are in the setting, * LibraryService API will only accept JWTs with the following audience * "https://library-example.googleapis.com/google.example.library.v1.LibraryService". * Example: * audiences: bookstore_android.apps.googleusercontent.com, * bookstore_web.apps.googleusercontent.com * * Generated from protobuf field string audiences = 2; * @param string $var * @return $this */ public function setAudiences($var) { GPBUtil::checkString($var, True); $this->audiences = $var; return $this; } } src/Api/Authentication.php000064400000007666151742741630011565 0ustar00google.api.Authentication */ class Authentication extends \Google\Protobuf\Internal\Message { /** * A list of authentication rules that apply to individual API methods. * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.AuthenticationRule rules = 3; */ private $rules; /** * Defines a set of authentication providers that a service supports. * * Generated from protobuf field repeated .google.api.AuthProvider providers = 4; */ private $providers; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Api\AuthenticationRule[]|\Google\Protobuf\Internal\RepeatedField $rules * A list of authentication rules that apply to individual API methods. * **NOTE:** All service configuration rules follow "last one wins" order. * @type \Google\Api\AuthProvider[]|\Google\Protobuf\Internal\RepeatedField $providers * Defines a set of authentication providers that a service supports. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Auth::initOnce(); parent::__construct($data); } /** * A list of authentication rules that apply to individual API methods. * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.AuthenticationRule rules = 3; * @return \Google\Protobuf\Internal\RepeatedField */ public function getRules() { return $this->rules; } /** * A list of authentication rules that apply to individual API methods. * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.AuthenticationRule rules = 3; * @param \Google\Api\AuthenticationRule[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setRules($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\AuthenticationRule::class); $this->rules = $arr; return $this; } /** * Defines a set of authentication providers that a service supports. * * Generated from protobuf field repeated .google.api.AuthProvider providers = 4; * @return \Google\Protobuf\Internal\RepeatedField */ public function getProviders() { return $this->providers; } /** * Defines a set of authentication providers that a service supports. * * Generated from protobuf field repeated .google.api.AuthProvider providers = 4; * @param \Google\Api\AuthProvider[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setProviders($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\AuthProvider::class); $this->providers = $arr; return $this; } } src/Api/AuthenticationRule.php000064400000012740151742741630012402 0ustar00google.api.AuthenticationRule */ class AuthenticationRule extends \Google\Protobuf\Internal\Message { /** * Selects the methods to which this rule applies. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; */ private $selector = ''; /** * The requirements for OAuth credentials. * * Generated from protobuf field .google.api.OAuthRequirements oauth = 2; */ private $oauth = null; /** * If true, the service accepts API keys without any other credential. * * Generated from protobuf field bool allow_without_credential = 5; */ private $allow_without_credential = false; /** * Requirements for additional authentication providers. * * Generated from protobuf field repeated .google.api.AuthRequirement requirements = 7; */ private $requirements; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $selector * Selects the methods to which this rule applies. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * @type \Google\Api\OAuthRequirements $oauth * The requirements for OAuth credentials. * @type bool $allow_without_credential * If true, the service accepts API keys without any other credential. * @type \Google\Api\AuthRequirement[]|\Google\Protobuf\Internal\RepeatedField $requirements * Requirements for additional authentication providers. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Auth::initOnce(); parent::__construct($data); } /** * Selects the methods to which this rule applies. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; * @return string */ public function getSelector() { return $this->selector; } /** * Selects the methods to which this rule applies. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; * @param string $var * @return $this */ public function setSelector($var) { GPBUtil::checkString($var, True); $this->selector = $var; return $this; } /** * The requirements for OAuth credentials. * * Generated from protobuf field .google.api.OAuthRequirements oauth = 2; * @return \Google\Api\OAuthRequirements */ public function getOauth() { return $this->oauth; } /** * The requirements for OAuth credentials. * * Generated from protobuf field .google.api.OAuthRequirements oauth = 2; * @param \Google\Api\OAuthRequirements $var * @return $this */ public function setOauth($var) { GPBUtil::checkMessage($var, \Google\Api\OAuthRequirements::class); $this->oauth = $var; return $this; } /** * If true, the service accepts API keys without any other credential. * * Generated from protobuf field bool allow_without_credential = 5; * @return bool */ public function getAllowWithoutCredential() { return $this->allow_without_credential; } /** * If true, the service accepts API keys without any other credential. * * Generated from protobuf field bool allow_without_credential = 5; * @param bool $var * @return $this */ public function setAllowWithoutCredential($var) { GPBUtil::checkBool($var); $this->allow_without_credential = $var; return $this; } /** * Requirements for additional authentication providers. * * Generated from protobuf field repeated .google.api.AuthRequirement requirements = 7; * @return \Google\Protobuf\Internal\RepeatedField */ public function getRequirements() { return $this->requirements; } /** * Requirements for additional authentication providers. * * Generated from protobuf field repeated .google.api.AuthRequirement requirements = 7; * @param \Google\Api\AuthRequirement[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setRequirements($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\AuthRequirement::class); $this->requirements = $arr; return $this; } } src/Api/AuthorizationConfig.php000064400000003766151742741630012571 0ustar00google.api.AuthorizationConfig */ class AuthorizationConfig extends \Google\Protobuf\Internal\Message { /** * The name of the authorization provider, such as * firebaserules.googleapis.com. * * Generated from protobuf field string provider = 1; */ private $provider = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $provider * The name of the authorization provider, such as * firebaserules.googleapis.com. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Experimental\AuthorizationConfig::initOnce(); parent::__construct($data); } /** * The name of the authorization provider, such as * firebaserules.googleapis.com. * * Generated from protobuf field string provider = 1; * @return string */ public function getProvider() { return $this->provider; } /** * The name of the authorization provider, such as * firebaserules.googleapis.com. * * Generated from protobuf field string provider = 1; * @param string $var * @return $this */ public function setProvider($var) { GPBUtil::checkString($var, True); $this->provider = $var; return $this; } } src/Api/Backend.php000064400000004360151742741630010121 0ustar00google.api.Backend */ class Backend extends \Google\Protobuf\Internal\Message { /** * A list of API backend rules that apply to individual API methods. * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.BackendRule rules = 1; */ private $rules; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Api\BackendRule[]|\Google\Protobuf\Internal\RepeatedField $rules * A list of API backend rules that apply to individual API methods. * **NOTE:** All service configuration rules follow "last one wins" order. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Backend::initOnce(); parent::__construct($data); } /** * A list of API backend rules that apply to individual API methods. * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.BackendRule rules = 1; * @return \Google\Protobuf\Internal\RepeatedField */ public function getRules() { return $this->rules; } /** * A list of API backend rules that apply to individual API methods. * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.BackendRule rules = 1; * @param \Google\Api\BackendRule[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setRules($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\BackendRule::class); $this->rules = $arr; return $this; } } src/Api/BackendRule.php000064400000012244151742741630010751 0ustar00google.api.BackendRule */ class BackendRule extends \Google\Protobuf\Internal\Message { /** * Selects the methods to which this rule applies. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; */ private $selector = ''; /** * The address of the API backend. * * Generated from protobuf field string address = 2; */ private $address = ''; /** * The number of seconds to wait for a response from a request. The default * deadline for gRPC is infinite (no deadline) and HTTP requests is 5 seconds. * * Generated from protobuf field double deadline = 3; */ private $deadline = 0.0; /** * Minimum deadline in seconds needed for this method. Calls having deadline * value lower than this will be rejected. * * Generated from protobuf field double min_deadline = 4; */ private $min_deadline = 0.0; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $selector * Selects the methods to which this rule applies. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * @type string $address * The address of the API backend. * @type float $deadline * The number of seconds to wait for a response from a request. The default * deadline for gRPC is infinite (no deadline) and HTTP requests is 5 seconds. * @type float $min_deadline * Minimum deadline in seconds needed for this method. Calls having deadline * value lower than this will be rejected. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Backend::initOnce(); parent::__construct($data); } /** * Selects the methods to which this rule applies. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; * @return string */ public function getSelector() { return $this->selector; } /** * Selects the methods to which this rule applies. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; * @param string $var * @return $this */ public function setSelector($var) { GPBUtil::checkString($var, True); $this->selector = $var; return $this; } /** * The address of the API backend. * * Generated from protobuf field string address = 2; * @return string */ public function getAddress() { return $this->address; } /** * The address of the API backend. * * Generated from protobuf field string address = 2; * @param string $var * @return $this */ public function setAddress($var) { GPBUtil::checkString($var, True); $this->address = $var; return $this; } /** * The number of seconds to wait for a response from a request. The default * deadline for gRPC is infinite (no deadline) and HTTP requests is 5 seconds. * * Generated from protobuf field double deadline = 3; * @return float */ public function getDeadline() { return $this->deadline; } /** * The number of seconds to wait for a response from a request. The default * deadline for gRPC is infinite (no deadline) and HTTP requests is 5 seconds. * * Generated from protobuf field double deadline = 3; * @param float $var * @return $this */ public function setDeadline($var) { GPBUtil::checkDouble($var); $this->deadline = $var; return $this; } /** * Minimum deadline in seconds needed for this method. Calls having deadline * value lower than this will be rejected. * * Generated from protobuf field double min_deadline = 4; * @return float */ public function getMinDeadline() { return $this->min_deadline; } /** * Minimum deadline in seconds needed for this method. Calls having deadline * value lower than this will be rejected. * * Generated from protobuf field double min_deadline = 4; * @param float $var * @return $this */ public function setMinDeadline($var) { GPBUtil::checkDouble($var); $this->min_deadline = $var; return $this; } } src/Api/Billing.php000064400000007104151742741630010151 0ustar00google.api.Billing */ class Billing extends \Google\Protobuf\Internal\Message { /** * Billing configurations for sending metrics to the consumer project. * There can be multiple consumer destinations per service, each one must have * a different monitored resource type. A metric can be used in at most * one consumer destination. * * Generated from protobuf field repeated .google.api.Billing.BillingDestination consumer_destinations = 8; */ private $consumer_destinations; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Api\Billing\BillingDestination[]|\Google\Protobuf\Internal\RepeatedField $consumer_destinations * Billing configurations for sending metrics to the consumer project. * There can be multiple consumer destinations per service, each one must have * a different monitored resource type. A metric can be used in at most * one consumer destination. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Billing::initOnce(); parent::__construct($data); } /** * Billing configurations for sending metrics to the consumer project. * There can be multiple consumer destinations per service, each one must have * a different monitored resource type. A metric can be used in at most * one consumer destination. * * Generated from protobuf field repeated .google.api.Billing.BillingDestination consumer_destinations = 8; * @return \Google\Protobuf\Internal\RepeatedField */ public function getConsumerDestinations() { return $this->consumer_destinations; } /** * Billing configurations for sending metrics to the consumer project. * There can be multiple consumer destinations per service, each one must have * a different monitored resource type. A metric can be used in at most * one consumer destination. * * Generated from protobuf field repeated .google.api.Billing.BillingDestination consumer_destinations = 8; * @param \Google\Api\Billing\BillingDestination[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setConsumerDestinations($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Billing\BillingDestination::class); $this->consumer_destinations = $arr; return $this; } } src/Api/Billing/BillingDestination.php000064400000007350151742741630013736 0ustar00google.api.Billing.BillingDestination */ class BillingDestination extends \Google\Protobuf\Internal\Message { /** * The monitored resource type. The type must be defined in * [Service.monitored_resources][google.api.Service.monitored_resources] section. * * Generated from protobuf field string monitored_resource = 1; */ private $monitored_resource = ''; /** * Names of the metrics to report to this billing destination. * Each name must be defined in [Service.metrics][google.api.Service.metrics] section. * * Generated from protobuf field repeated string metrics = 2; */ private $metrics; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $monitored_resource * The monitored resource type. The type must be defined in * [Service.monitored_resources][google.api.Service.monitored_resources] section. * @type string[]|\Google\Protobuf\Internal\RepeatedField $metrics * Names of the metrics to report to this billing destination. * Each name must be defined in [Service.metrics][google.api.Service.metrics] section. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Billing::initOnce(); parent::__construct($data); } /** * The monitored resource type. The type must be defined in * [Service.monitored_resources][google.api.Service.monitored_resources] section. * * Generated from protobuf field string monitored_resource = 1; * @return string */ public function getMonitoredResource() { return $this->monitored_resource; } /** * The monitored resource type. The type must be defined in * [Service.monitored_resources][google.api.Service.monitored_resources] section. * * Generated from protobuf field string monitored_resource = 1; * @param string $var * @return $this */ public function setMonitoredResource($var) { GPBUtil::checkString($var, True); $this->monitored_resource = $var; return $this; } /** * Names of the metrics to report to this billing destination. * Each name must be defined in [Service.metrics][google.api.Service.metrics] section. * * Generated from protobuf field repeated string metrics = 2; * @return \Google\Protobuf\Internal\RepeatedField */ public function getMetrics() { return $this->metrics; } /** * Names of the metrics to report to this billing destination. * Each name must be defined in [Service.metrics][google.api.Service.metrics] section. * * Generated from protobuf field repeated string metrics = 2; * @param string[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setMetrics($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->metrics = $arr; return $this; } } // Adding a class alias for backwards compatibility with the previous class name. class_alias(BillingDestination::class, \Google\Api\Billing_BillingDestination::class); src/Api/Billing_BillingDestination.php000064400000001027151742741630014011 0ustar00google.api.ChangeType */ class ChangeType { /** * No value was provided. * * Generated from protobuf enum CHANGE_TYPE_UNSPECIFIED = 0; */ const CHANGE_TYPE_UNSPECIFIED = 0; /** * The changed object exists in the 'new' service configuration, but not * in the 'old' service configuration. * * Generated from protobuf enum ADDED = 1; */ const ADDED = 1; /** * The changed object exists in the 'old' service configuration, but not * in the 'new' service configuration. * * Generated from protobuf enum REMOVED = 2; */ const REMOVED = 2; /** * The changed object exists in both service configurations, but its value * is different. * * Generated from protobuf enum MODIFIED = 3; */ const MODIFIED = 3; } src/Api/ConfigChange.php000064400000021220151742741630011077 0ustar00google.api.ConfigChange */ class ConfigChange extends \Google\Protobuf\Internal\Message { /** * Object hierarchy path to the change, with levels separated by a '.' * character. For repeated fields, an applicable unique identifier field is * used for the index (usually selector, name, or id). For maps, the term * 'key' is used. If the field has no unique identifier, the numeric index * is used. * Examples: * - visibility.rules[selector=="google.LibraryService.CreateBook"].restriction * - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value * - logging.producer_destinations[0] * * Generated from protobuf field string element = 1; */ private $element = ''; /** * Value of the changed object in the old Service configuration, * in JSON format. This field will not be populated if ChangeType == ADDED. * * Generated from protobuf field string old_value = 2; */ private $old_value = ''; /** * Value of the changed object in the new Service configuration, * in JSON format. This field will not be populated if ChangeType == REMOVED. * * Generated from protobuf field string new_value = 3; */ private $new_value = ''; /** * The type for this change, either ADDED, REMOVED, or MODIFIED. * * Generated from protobuf field .google.api.ChangeType change_type = 4; */ private $change_type = 0; /** * Collection of advice provided for this change, useful for determining the * possible impact of this change. * * Generated from protobuf field repeated .google.api.Advice advices = 5; */ private $advices; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $element * Object hierarchy path to the change, with levels separated by a '.' * character. For repeated fields, an applicable unique identifier field is * used for the index (usually selector, name, or id). For maps, the term * 'key' is used. If the field has no unique identifier, the numeric index * is used. * Examples: * - visibility.rules[selector=="google.LibraryService.CreateBook"].restriction * - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value * - logging.producer_destinations[0] * @type string $old_value * Value of the changed object in the old Service configuration, * in JSON format. This field will not be populated if ChangeType == ADDED. * @type string $new_value * Value of the changed object in the new Service configuration, * in JSON format. This field will not be populated if ChangeType == REMOVED. * @type int $change_type * The type for this change, either ADDED, REMOVED, or MODIFIED. * @type \Google\Api\Advice[]|\Google\Protobuf\Internal\RepeatedField $advices * Collection of advice provided for this change, useful for determining the * possible impact of this change. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\ConfigChange::initOnce(); parent::__construct($data); } /** * Object hierarchy path to the change, with levels separated by a '.' * character. For repeated fields, an applicable unique identifier field is * used for the index (usually selector, name, or id). For maps, the term * 'key' is used. If the field has no unique identifier, the numeric index * is used. * Examples: * - visibility.rules[selector=="google.LibraryService.CreateBook"].restriction * - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value * - logging.producer_destinations[0] * * Generated from protobuf field string element = 1; * @return string */ public function getElement() { return $this->element; } /** * Object hierarchy path to the change, with levels separated by a '.' * character. For repeated fields, an applicable unique identifier field is * used for the index (usually selector, name, or id). For maps, the term * 'key' is used. If the field has no unique identifier, the numeric index * is used. * Examples: * - visibility.rules[selector=="google.LibraryService.CreateBook"].restriction * - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value * - logging.producer_destinations[0] * * Generated from protobuf field string element = 1; * @param string $var * @return $this */ public function setElement($var) { GPBUtil::checkString($var, True); $this->element = $var; return $this; } /** * Value of the changed object in the old Service configuration, * in JSON format. This field will not be populated if ChangeType == ADDED. * * Generated from protobuf field string old_value = 2; * @return string */ public function getOldValue() { return $this->old_value; } /** * Value of the changed object in the old Service configuration, * in JSON format. This field will not be populated if ChangeType == ADDED. * * Generated from protobuf field string old_value = 2; * @param string $var * @return $this */ public function setOldValue($var) { GPBUtil::checkString($var, True); $this->old_value = $var; return $this; } /** * Value of the changed object in the new Service configuration, * in JSON format. This field will not be populated if ChangeType == REMOVED. * * Generated from protobuf field string new_value = 3; * @return string */ public function getNewValue() { return $this->new_value; } /** * Value of the changed object in the new Service configuration, * in JSON format. This field will not be populated if ChangeType == REMOVED. * * Generated from protobuf field string new_value = 3; * @param string $var * @return $this */ public function setNewValue($var) { GPBUtil::checkString($var, True); $this->new_value = $var; return $this; } /** * The type for this change, either ADDED, REMOVED, or MODIFIED. * * Generated from protobuf field .google.api.ChangeType change_type = 4; * @return int */ public function getChangeType() { return $this->change_type; } /** * The type for this change, either ADDED, REMOVED, or MODIFIED. * * Generated from protobuf field .google.api.ChangeType change_type = 4; * @param int $var * @return $this */ public function setChangeType($var) { GPBUtil::checkEnum($var, \Google\Api\ChangeType::class); $this->change_type = $var; return $this; } /** * Collection of advice provided for this change, useful for determining the * possible impact of this change. * * Generated from protobuf field repeated .google.api.Advice advices = 5; * @return \Google\Protobuf\Internal\RepeatedField */ public function getAdvices() { return $this->advices; } /** * Collection of advice provided for this change, useful for determining the * possible impact of this change. * * Generated from protobuf field repeated .google.api.Advice advices = 5; * @param \Google\Api\Advice[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setAdvices($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Advice::class); $this->advices = $arr; return $this; } } src/Api/Context.php000064400000005167151742741630010224 0ustar00google.api.Context */ class Context extends \Google\Protobuf\Internal\Message { /** * A list of RPC context rules that apply to individual API methods. * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.ContextRule rules = 1; */ private $rules; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Api\ContextRule[]|\Google\Protobuf\Internal\RepeatedField $rules * A list of RPC context rules that apply to individual API methods. * **NOTE:** All service configuration rules follow "last one wins" order. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Context::initOnce(); parent::__construct($data); } /** * A list of RPC context rules that apply to individual API methods. * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.ContextRule rules = 1; * @return \Google\Protobuf\Internal\RepeatedField */ public function getRules() { return $this->rules; } /** * A list of RPC context rules that apply to individual API methods. * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.ContextRule rules = 1; * @param \Google\Api\ContextRule[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setRules($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\ContextRule::class); $this->rules = $arr; return $this; } } src/Api/ContextRule.php000064400000010045151742741630011043 0ustar00google.api.ContextRule */ class ContextRule extends \Google\Protobuf\Internal\Message { /** * Selects the methods to which this rule applies. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; */ private $selector = ''; /** * A list of full type names of requested contexts. * * Generated from protobuf field repeated string requested = 2; */ private $requested; /** * A list of full type names of provided contexts. * * Generated from protobuf field repeated string provided = 3; */ private $provided; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $selector * Selects the methods to which this rule applies. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * @type string[]|\Google\Protobuf\Internal\RepeatedField $requested * A list of full type names of requested contexts. * @type string[]|\Google\Protobuf\Internal\RepeatedField $provided * A list of full type names of provided contexts. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Context::initOnce(); parent::__construct($data); } /** * Selects the methods to which this rule applies. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; * @return string */ public function getSelector() { return $this->selector; } /** * Selects the methods to which this rule applies. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; * @param string $var * @return $this */ public function setSelector($var) { GPBUtil::checkString($var, True); $this->selector = $var; return $this; } /** * A list of full type names of requested contexts. * * Generated from protobuf field repeated string requested = 2; * @return \Google\Protobuf\Internal\RepeatedField */ public function getRequested() { return $this->requested; } /** * A list of full type names of requested contexts. * * Generated from protobuf field repeated string requested = 2; * @param string[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setRequested($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->requested = $arr; return $this; } /** * A list of full type names of provided contexts. * * Generated from protobuf field repeated string provided = 3; * @return \Google\Protobuf\Internal\RepeatedField */ public function getProvided() { return $this->provided; } /** * A list of full type names of provided contexts. * * Generated from protobuf field repeated string provided = 3; * @param string[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setProvided($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->provided = $arr; return $this; } } src/Api/Control.php000064400000004013151742741630010205 0ustar00google.api.Control */ class Control extends \Google\Protobuf\Internal\Message { /** * The service control environment to use. If empty, no control plane * feature (like quota and billing) will be enabled. * * Generated from protobuf field string environment = 1; */ private $environment = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $environment * The service control environment to use. If empty, no control plane * feature (like quota and billing) will be enabled. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Control::initOnce(); parent::__construct($data); } /** * The service control environment to use. If empty, no control plane * feature (like quota and billing) will be enabled. * * Generated from protobuf field string environment = 1; * @return string */ public function getEnvironment() { return $this->environment; } /** * The service control environment to use. If empty, no control plane * feature (like quota and billing) will be enabled. * * Generated from protobuf field string environment = 1; * @param string $var * @return $this */ public function setEnvironment($var) { GPBUtil::checkString($var, True); $this->environment = $var; return $this; } } src/Api/CustomHttpPattern.php000064400000004426151742741630012245 0ustar00google.api.CustomHttpPattern */ class CustomHttpPattern extends \Google\Protobuf\Internal\Message { /** * The name of this custom HTTP verb. * * Generated from protobuf field string kind = 1; */ private $kind = ''; /** * The path matched by this custom verb. * * Generated from protobuf field string path = 2; */ private $path = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $kind * The name of this custom HTTP verb. * @type string $path * The path matched by this custom verb. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Http::initOnce(); parent::__construct($data); } /** * The name of this custom HTTP verb. * * Generated from protobuf field string kind = 1; * @return string */ public function getKind() { return $this->kind; } /** * The name of this custom HTTP verb. * * Generated from protobuf field string kind = 1; * @param string $var * @return $this */ public function setKind($var) { GPBUtil::checkString($var, True); $this->kind = $var; return $this; } /** * The path matched by this custom verb. * * Generated from protobuf field string path = 2; * @return string */ public function getPath() { return $this->path; } /** * The path matched by this custom verb. * * Generated from protobuf field string path = 2; * @param string $var * @return $this */ public function setPath($var) { GPBUtil::checkString($var, True); $this->path = $var; return $this; } } src/Api/Distribution.php000064400000026635151742741630011262 0ustar00google.api.Distribution */ class Distribution extends \Google\Protobuf\Internal\Message { /** * The number of values in the population. Must be non-negative. * * Generated from protobuf field int64 count = 1; */ private $count = 0; /** * The arithmetic mean of the values in the population. If `count` is zero * then this field must be zero. * * Generated from protobuf field double mean = 2; */ private $mean = 0.0; /** * The sum of squared deviations from the mean of the values in the * population. For values x_i this is: * Sum[i=1..n]((x_i - mean)^2) * Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition * describes Welford's method for accumulating this sum in one pass. * If `count` is zero then this field must be zero. * * Generated from protobuf field double sum_of_squared_deviation = 3; */ private $sum_of_squared_deviation = 0.0; /** * If specified, contains the range of the population values. The field * must not be present if the `count` is zero. * * Generated from protobuf field .google.api.Distribution.Range range = 4; */ private $range = null; /** * Defines the histogram bucket boundaries. * * Generated from protobuf field .google.api.Distribution.BucketOptions bucket_options = 6; */ private $bucket_options = null; /** * If `bucket_options` is given, then the sum of the values in `bucket_counts` * must equal the value in `count`. If `bucket_options` is not given, no * `bucket_counts` fields may be given. * Bucket counts are given in order under the numbering scheme described * above (the underflow bucket has number 0; the finite buckets, if any, * have numbers 1 through N-2; the overflow bucket has number N-1). * The size of `bucket_counts` must be no greater than N as defined in * `bucket_options`. * Any suffix of trailing zero bucket_count fields may be omitted. * * Generated from protobuf field repeated int64 bucket_counts = 7; */ private $bucket_counts; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type int|string $count * The number of values in the population. Must be non-negative. * @type float $mean * The arithmetic mean of the values in the population. If `count` is zero * then this field must be zero. * @type float $sum_of_squared_deviation * The sum of squared deviations from the mean of the values in the * population. For values x_i this is: * Sum[i=1..n]((x_i - mean)^2) * Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition * describes Welford's method for accumulating this sum in one pass. * If `count` is zero then this field must be zero. * @type \Google\Api\Distribution\Range $range * If specified, contains the range of the population values. The field * must not be present if the `count` is zero. * @type \Google\Api\Distribution\BucketOptions $bucket_options * Defines the histogram bucket boundaries. * @type int[]|string[]|\Google\Protobuf\Internal\RepeatedField $bucket_counts * If `bucket_options` is given, then the sum of the values in `bucket_counts` * must equal the value in `count`. If `bucket_options` is not given, no * `bucket_counts` fields may be given. * Bucket counts are given in order under the numbering scheme described * above (the underflow bucket has number 0; the finite buckets, if any, * have numbers 1 through N-2; the overflow bucket has number N-1). * The size of `bucket_counts` must be no greater than N as defined in * `bucket_options`. * Any suffix of trailing zero bucket_count fields may be omitted. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Distribution::initOnce(); parent::__construct($data); } /** * The number of values in the population. Must be non-negative. * * Generated from protobuf field int64 count = 1; * @return int|string */ public function getCount() { return $this->count; } /** * The number of values in the population. Must be non-negative. * * Generated from protobuf field int64 count = 1; * @param int|string $var * @return $this */ public function setCount($var) { GPBUtil::checkInt64($var); $this->count = $var; return $this; } /** * The arithmetic mean of the values in the population. If `count` is zero * then this field must be zero. * * Generated from protobuf field double mean = 2; * @return float */ public function getMean() { return $this->mean; } /** * The arithmetic mean of the values in the population. If `count` is zero * then this field must be zero. * * Generated from protobuf field double mean = 2; * @param float $var * @return $this */ public function setMean($var) { GPBUtil::checkDouble($var); $this->mean = $var; return $this; } /** * The sum of squared deviations from the mean of the values in the * population. For values x_i this is: * Sum[i=1..n]((x_i - mean)^2) * Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition * describes Welford's method for accumulating this sum in one pass. * If `count` is zero then this field must be zero. * * Generated from protobuf field double sum_of_squared_deviation = 3; * @return float */ public function getSumOfSquaredDeviation() { return $this->sum_of_squared_deviation; } /** * The sum of squared deviations from the mean of the values in the * population. For values x_i this is: * Sum[i=1..n]((x_i - mean)^2) * Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition * describes Welford's method for accumulating this sum in one pass. * If `count` is zero then this field must be zero. * * Generated from protobuf field double sum_of_squared_deviation = 3; * @param float $var * @return $this */ public function setSumOfSquaredDeviation($var) { GPBUtil::checkDouble($var); $this->sum_of_squared_deviation = $var; return $this; } /** * If specified, contains the range of the population values. The field * must not be present if the `count` is zero. * * Generated from protobuf field .google.api.Distribution.Range range = 4; * @return \Google\Api\Distribution\Range */ public function getRange() { return $this->range; } /** * If specified, contains the range of the population values. The field * must not be present if the `count` is zero. * * Generated from protobuf field .google.api.Distribution.Range range = 4; * @param \Google\Api\Distribution\Range $var * @return $this */ public function setRange($var) { GPBUtil::checkMessage($var, \Google\Api\Distribution_Range::class); $this->range = $var; return $this; } /** * Defines the histogram bucket boundaries. * * Generated from protobuf field .google.api.Distribution.BucketOptions bucket_options = 6; * @return \Google\Api\Distribution\BucketOptions */ public function getBucketOptions() { return $this->bucket_options; } /** * Defines the histogram bucket boundaries. * * Generated from protobuf field .google.api.Distribution.BucketOptions bucket_options = 6; * @param \Google\Api\Distribution\BucketOptions $var * @return $this */ public function setBucketOptions($var) { GPBUtil::checkMessage($var, \Google\Api\Distribution_BucketOptions::class); $this->bucket_options = $var; return $this; } /** * If `bucket_options` is given, then the sum of the values in `bucket_counts` * must equal the value in `count`. If `bucket_options` is not given, no * `bucket_counts` fields may be given. * Bucket counts are given in order under the numbering scheme described * above (the underflow bucket has number 0; the finite buckets, if any, * have numbers 1 through N-2; the overflow bucket has number N-1). * The size of `bucket_counts` must be no greater than N as defined in * `bucket_options`. * Any suffix of trailing zero bucket_count fields may be omitted. * * Generated from protobuf field repeated int64 bucket_counts = 7; * @return \Google\Protobuf\Internal\RepeatedField */ public function getBucketCounts() { return $this->bucket_counts; } /** * If `bucket_options` is given, then the sum of the values in `bucket_counts` * must equal the value in `count`. If `bucket_options` is not given, no * `bucket_counts` fields may be given. * Bucket counts are given in order under the numbering scheme described * above (the underflow bucket has number 0; the finite buckets, if any, * have numbers 1 through N-2; the overflow bucket has number N-1). * The size of `bucket_counts` must be no greater than N as defined in * `bucket_options`. * Any suffix of trailing zero bucket_count fields may be omitted. * * Generated from protobuf field repeated int64 bucket_counts = 7; * @param int[]|string[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setBucketCounts($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT64); $this->bucket_counts = $arr; return $this; } } src/Api/Distribution/BucketOptions.php000064400000011770151742741630014045 0ustar00 0) is the same as the upper bound of bucket i - 1. * The buckets span the whole range of finite values: lower bound of the * underflow bucket is -infinity and the upper bound of the overflow bucket is * +infinity. The finite buckets are so-called because both bounds are * finite. * `BucketOptions` describes bucket boundaries in one of three ways. Two * describe the boundaries by giving parameters for a formula to generate * boundaries and one gives the bucket boundaries explicitly. * If `bucket_boundaries` is not given, then no `bucket_counts` may be given. * * Generated from protobuf message google.api.Distribution.BucketOptions */ class BucketOptions extends \Google\Protobuf\Internal\Message { protected $options; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Api\Distribution\BucketOptions\Linear $linear_buckets * The linear bucket. * @type \Google\Api\Distribution\BucketOptions\Exponential $exponential_buckets * The exponential buckets. * @type \Google\Api\Distribution\BucketOptions\Explicit $explicit_buckets * The explicit buckets. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Distribution::initOnce(); parent::__construct($data); } /** * The linear bucket. * * Generated from protobuf field .google.api.Distribution.BucketOptions.Linear linear_buckets = 1; * @return \Google\Api\Distribution\BucketOptions\Linear */ public function getLinearBuckets() { return $this->readOneof(1); } /** * The linear bucket. * * Generated from protobuf field .google.api.Distribution.BucketOptions.Linear linear_buckets = 1; * @param \Google\Api\Distribution\BucketOptions\Linear $var * @return $this */ public function setLinearBuckets($var) { GPBUtil::checkMessage($var, \Google\Api\Distribution_BucketOptions_Linear::class); $this->writeOneof(1, $var); return $this; } /** * The exponential buckets. * * Generated from protobuf field .google.api.Distribution.BucketOptions.Exponential exponential_buckets = 2; * @return \Google\Api\Distribution\BucketOptions\Exponential */ public function getExponentialBuckets() { return $this->readOneof(2); } /** * The exponential buckets. * * Generated from protobuf field .google.api.Distribution.BucketOptions.Exponential exponential_buckets = 2; * @param \Google\Api\Distribution\BucketOptions\Exponential $var * @return $this */ public function setExponentialBuckets($var) { GPBUtil::checkMessage($var, \Google\Api\Distribution_BucketOptions_Exponential::class); $this->writeOneof(2, $var); return $this; } /** * The explicit buckets. * * Generated from protobuf field .google.api.Distribution.BucketOptions.Explicit explicit_buckets = 3; * @return \Google\Api\Distribution\BucketOptions\Explicit */ public function getExplicitBuckets() { return $this->readOneof(3); } /** * The explicit buckets. * * Generated from protobuf field .google.api.Distribution.BucketOptions.Explicit explicit_buckets = 3; * @param \Google\Api\Distribution\BucketOptions\Explicit $var * @return $this */ public function setExplicitBuckets($var) { GPBUtil::checkMessage($var, \Google\Api\Distribution_BucketOptions_Explicit::class); $this->writeOneof(3, $var); return $this; } /** * @return string */ public function getOptions() { return $this->whichOneof("options"); } } // Adding a class alias for backwards compatibility with the previous class name. class_alias(BucketOptions::class, \Google\Api\Distribution_BucketOptions::class); src/Api/Distribution/BucketOptions/Explicit.php000064400000004505151742741630015624 0ustar00google.api.Distribution.BucketOptions.Explicit */ class Explicit extends \Google\Protobuf\Internal\Message { /** * The values must be monotonically increasing. * * Generated from protobuf field repeated double bounds = 1; */ private $bounds; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type float[]|\Google\Protobuf\Internal\RepeatedField $bounds * The values must be monotonically increasing. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Distribution::initOnce(); parent::__construct($data); } /** * The values must be monotonically increasing. * * Generated from protobuf field repeated double bounds = 1; * @return \Google\Protobuf\Internal\RepeatedField */ public function getBounds() { return $this->bounds; } /** * The values must be monotonically increasing. * * Generated from protobuf field repeated double bounds = 1; * @param float[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setBounds($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::DOUBLE); $this->bounds = $arr; return $this; } } // Adding a class alias for backwards compatibility with the previous class name. class_alias(Explicit::class, \Google\Api\Distribution_BucketOptions_Explicit::class); src/Api/Distribution/BucketOptions/Exponential.php000064400000007237151742741630016336 0ustar00google.api.Distribution.BucketOptions.Exponential */ class Exponential extends \Google\Protobuf\Internal\Message { /** * Must be greater than 0. * * Generated from protobuf field int32 num_finite_buckets = 1; */ private $num_finite_buckets = 0; /** * Must be greater than 1. * * Generated from protobuf field double growth_factor = 2; */ private $growth_factor = 0.0; /** * Must be greater than 0. * * Generated from protobuf field double scale = 3; */ private $scale = 0.0; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type int $num_finite_buckets * Must be greater than 0. * @type float $growth_factor * Must be greater than 1. * @type float $scale * Must be greater than 0. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Distribution::initOnce(); parent::__construct($data); } /** * Must be greater than 0. * * Generated from protobuf field int32 num_finite_buckets = 1; * @return int */ public function getNumFiniteBuckets() { return $this->num_finite_buckets; } /** * Must be greater than 0. * * Generated from protobuf field int32 num_finite_buckets = 1; * @param int $var * @return $this */ public function setNumFiniteBuckets($var) { GPBUtil::checkInt32($var); $this->num_finite_buckets = $var; return $this; } /** * Must be greater than 1. * * Generated from protobuf field double growth_factor = 2; * @return float */ public function getGrowthFactor() { return $this->growth_factor; } /** * Must be greater than 1. * * Generated from protobuf field double growth_factor = 2; * @param float $var * @return $this */ public function setGrowthFactor($var) { GPBUtil::checkDouble($var); $this->growth_factor = $var; return $this; } /** * Must be greater than 0. * * Generated from protobuf field double scale = 3; * @return float */ public function getScale() { return $this->scale; } /** * Must be greater than 0. * * Generated from protobuf field double scale = 3; * @param float $var * @return $this */ public function setScale($var) { GPBUtil::checkDouble($var); $this->scale = $var; return $this; } } // Adding a class alias for backwards compatibility with the previous class name. class_alias(Exponential::class, \Google\Api\Distribution_BucketOptions_Exponential::class); src/Api/Distribution/BucketOptions/Linear.php000064400000007136151742741630015260 0ustar00google.api.Distribution.BucketOptions.Linear */ class Linear extends \Google\Protobuf\Internal\Message { /** * Must be greater than 0. * * Generated from protobuf field int32 num_finite_buckets = 1; */ private $num_finite_buckets = 0; /** * Must be greater than 0. * * Generated from protobuf field double width = 2; */ private $width = 0.0; /** * Lower bound of the first bucket. * * Generated from protobuf field double offset = 3; */ private $offset = 0.0; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type int $num_finite_buckets * Must be greater than 0. * @type float $width * Must be greater than 0. * @type float $offset * Lower bound of the first bucket. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Distribution::initOnce(); parent::__construct($data); } /** * Must be greater than 0. * * Generated from protobuf field int32 num_finite_buckets = 1; * @return int */ public function getNumFiniteBuckets() { return $this->num_finite_buckets; } /** * Must be greater than 0. * * Generated from protobuf field int32 num_finite_buckets = 1; * @param int $var * @return $this */ public function setNumFiniteBuckets($var) { GPBUtil::checkInt32($var); $this->num_finite_buckets = $var; return $this; } /** * Must be greater than 0. * * Generated from protobuf field double width = 2; * @return float */ public function getWidth() { return $this->width; } /** * Must be greater than 0. * * Generated from protobuf field double width = 2; * @param float $var * @return $this */ public function setWidth($var) { GPBUtil::checkDouble($var); $this->width = $var; return $this; } /** * Lower bound of the first bucket. * * Generated from protobuf field double offset = 3; * @return float */ public function getOffset() { return $this->offset; } /** * Lower bound of the first bucket. * * Generated from protobuf field double offset = 3; * @param float $var * @return $this */ public function setOffset($var) { GPBUtil::checkDouble($var); $this->offset = $var; return $this; } } // Adding a class alias for backwards compatibility with the previous class name. class_alias(Linear::class, \Google\Api\Distribution_BucketOptions_Linear::class); src/Api/Distribution/Range.php000064400000004623151742741630012307 0ustar00google.api.Distribution.Range */ class Range extends \Google\Protobuf\Internal\Message { /** * The minimum of the population values. * * Generated from protobuf field double min = 1; */ private $min = 0.0; /** * The maximum of the population values. * * Generated from protobuf field double max = 2; */ private $max = 0.0; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type float $min * The minimum of the population values. * @type float $max * The maximum of the population values. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Distribution::initOnce(); parent::__construct($data); } /** * The minimum of the population values. * * Generated from protobuf field double min = 1; * @return float */ public function getMin() { return $this->min; } /** * The minimum of the population values. * * Generated from protobuf field double min = 1; * @param float $var * @return $this */ public function setMin($var) { GPBUtil::checkDouble($var); $this->min = $var; return $this; } /** * The maximum of the population values. * * Generated from protobuf field double max = 2; * @return float */ public function getMax() { return $this->max; } /** * The maximum of the population values. * * Generated from protobuf field double max = 2; * @param float $var * @return $this */ public function setMax($var) { GPBUtil::checkDouble($var); $this->max = $var; return $this; } } // Adding a class alias for backwards compatibility with the previous class name. class_alias(Range::class, \Google\Api\Distribution_Range::class); src/Api/Distribution_BucketOptions.php000064400000001034151742741630014115 0ustar00documentation: * summary: > * The Google Calendar API gives access * to most calendar features. * pages: * - name: Overview * content: (== include google/foo/overview.md ==) * - name: Tutorial * content: (== include google/foo/tutorial.md ==) * subpages; * - name: Java * content: (== include google/foo/tutorial_java.md ==) * rules: * - selector: google.calendar.Calendar.Get * description: > * ... * - selector: google.calendar.Calendar.Put * description: > * ... * * Documentation is provided in markdown syntax. In addition to * standard markdown features, definition lists, tables and fenced * code blocks are supported. Section headers can be provided and are * interpreted relative to the section nesting of the context where * a documentation fragment is embedded. * Documentation from the IDL is merged with documentation defined * via the config at normalization time, where documentation provided * by config rules overrides IDL provided. * A number of constructs specific to the API platform are supported * in documentation text. * In order to reference a proto element, the following * notation can be used: *
[fully.qualified.proto.name][]
* To override the display text used for the link, this can be used: *
[display text][fully.qualified.proto.name]
* Text can be excluded from doc using the following notation: *
(-- internal comment --)
* A few directives are available in documentation. Note that * directives must appear on a single line to be properly * identified. The `include` directive includes a markdown file from * an external source: *
(== include path/to/file ==)
* The `resource_for` directive marks a message to be the resource of * a collection in REST view. If it is not specified, tools attempt * to infer the resource from the operations in a collection: *
(== resource_for v1.shelves.books ==)
* The directive `suppress_warning` does not directly affect documentation * and is documented together with service config validation. * * Generated from protobuf message google.api.Documentation */ class Documentation extends \Google\Protobuf\Internal\Message { /** * A short summary of what the service does. Can only be provided by * plain text. * * Generated from protobuf field string summary = 1; */ private $summary = ''; /** * The top level pages for the documentation set. * * Generated from protobuf field repeated .google.api.Page pages = 5; */ private $pages; /** * A list of documentation rules that apply to individual API elements. * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.DocumentationRule rules = 3; */ private $rules; /** * The URL to the root of documentation. * * Generated from protobuf field string documentation_root_url = 4; */ private $documentation_root_url = ''; /** * Declares a single overview page. For example: *
documentation:
     *   summary: ...
     *   overview: (== include overview.md ==)
     * 
* This is a shortcut for the following declaration (using pages style): *
documentation:
     *   summary: ...
     *   pages:
     *   - name: Overview
     *     content: (== include overview.md ==)
     * 
* Note: you cannot specify both `overview` field and `pages` field. * * Generated from protobuf field string overview = 2; */ private $overview = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $summary * A short summary of what the service does. Can only be provided by * plain text. * @type \Google\Api\Page[]|\Google\Protobuf\Internal\RepeatedField $pages * The top level pages for the documentation set. * @type \Google\Api\DocumentationRule[]|\Google\Protobuf\Internal\RepeatedField $rules * A list of documentation rules that apply to individual API elements. * **NOTE:** All service configuration rules follow "last one wins" order. * @type string $documentation_root_url * The URL to the root of documentation. * @type string $overview * Declares a single overview page. For example: *
documentation:
     *             summary: ...
     *             overview: (== include overview.md ==)
     *           
* This is a shortcut for the following declaration (using pages style): *
documentation:
     *             summary: ...
     *             pages:
     *             - name: Overview
     *               content: (== include overview.md ==)
     *           
* Note: you cannot specify both `overview` field and `pages` field. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Documentation::initOnce(); parent::__construct($data); } /** * A short summary of what the service does. Can only be provided by * plain text. * * Generated from protobuf field string summary = 1; * @return string */ public function getSummary() { return $this->summary; } /** * A short summary of what the service does. Can only be provided by * plain text. * * Generated from protobuf field string summary = 1; * @param string $var * @return $this */ public function setSummary($var) { GPBUtil::checkString($var, True); $this->summary = $var; return $this; } /** * The top level pages for the documentation set. * * Generated from protobuf field repeated .google.api.Page pages = 5; * @return \Google\Protobuf\Internal\RepeatedField */ public function getPages() { return $this->pages; } /** * The top level pages for the documentation set. * * Generated from protobuf field repeated .google.api.Page pages = 5; * @param \Google\Api\Page[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setPages($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Page::class); $this->pages = $arr; return $this; } /** * A list of documentation rules that apply to individual API elements. * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.DocumentationRule rules = 3; * @return \Google\Protobuf\Internal\RepeatedField */ public function getRules() { return $this->rules; } /** * A list of documentation rules that apply to individual API elements. * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.DocumentationRule rules = 3; * @param \Google\Api\DocumentationRule[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setRules($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\DocumentationRule::class); $this->rules = $arr; return $this; } /** * The URL to the root of documentation. * * Generated from protobuf field string documentation_root_url = 4; * @return string */ public function getDocumentationRootUrl() { return $this->documentation_root_url; } /** * The URL to the root of documentation. * * Generated from protobuf field string documentation_root_url = 4; * @param string $var * @return $this */ public function setDocumentationRootUrl($var) { GPBUtil::checkString($var, True); $this->documentation_root_url = $var; return $this; } /** * Declares a single overview page. For example: *
documentation:
     *   summary: ...
     *   overview: (== include overview.md ==)
     * 
* This is a shortcut for the following declaration (using pages style): *
documentation:
     *   summary: ...
     *   pages:
     *   - name: Overview
     *     content: (== include overview.md ==)
     * 
* Note: you cannot specify both `overview` field and `pages` field. * * Generated from protobuf field string overview = 2; * @return string */ public function getOverview() { return $this->overview; } /** * Declares a single overview page. For example: *
documentation:
     *   summary: ...
     *   overview: (== include overview.md ==)
     * 
* This is a shortcut for the following declaration (using pages style): *
documentation:
     *   summary: ...
     *   pages:
     *   - name: Overview
     *     content: (== include overview.md ==)
     * 
* Note: you cannot specify both `overview` field and `pages` field. * * Generated from protobuf field string overview = 2; * @param string $var * @return $this */ public function setOverview($var) { GPBUtil::checkString($var, True); $this->overview = $var; return $this; } } src/Api/DocumentationRule.php000064400000012217151742741630012233 0ustar00google.api.DocumentationRule */ class DocumentationRule extends \Google\Protobuf\Internal\Message { /** * The selector is a comma-separated list of patterns. Each pattern is a * qualified name of the element which may end in "*", indicating a wildcard. * Wildcards are only allowed at the end and for a whole component of the * qualified name, i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". To * specify a default for all applicable elements, the whole pattern "*" * is used. * * Generated from protobuf field string selector = 1; */ private $selector = ''; /** * Description of the selected API(s). * * Generated from protobuf field string description = 2; */ private $description = ''; /** * Deprecation description of the selected element(s). It can be provided if an * element is marked as `deprecated`. * * Generated from protobuf field string deprecation_description = 3; */ private $deprecation_description = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $selector * The selector is a comma-separated list of patterns. Each pattern is a * qualified name of the element which may end in "*", indicating a wildcard. * Wildcards are only allowed at the end and for a whole component of the * qualified name, i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". To * specify a default for all applicable elements, the whole pattern "*" * is used. * @type string $description * Description of the selected API(s). * @type string $deprecation_description * Deprecation description of the selected element(s). It can be provided if an * element is marked as `deprecated`. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Documentation::initOnce(); parent::__construct($data); } /** * The selector is a comma-separated list of patterns. Each pattern is a * qualified name of the element which may end in "*", indicating a wildcard. * Wildcards are only allowed at the end and for a whole component of the * qualified name, i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". To * specify a default for all applicable elements, the whole pattern "*" * is used. * * Generated from protobuf field string selector = 1; * @return string */ public function getSelector() { return $this->selector; } /** * The selector is a comma-separated list of patterns. Each pattern is a * qualified name of the element which may end in "*", indicating a wildcard. * Wildcards are only allowed at the end and for a whole component of the * qualified name, i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". To * specify a default for all applicable elements, the whole pattern "*" * is used. * * Generated from protobuf field string selector = 1; * @param string $var * @return $this */ public function setSelector($var) { GPBUtil::checkString($var, True); $this->selector = $var; return $this; } /** * Description of the selected API(s). * * Generated from protobuf field string description = 2; * @return string */ public function getDescription() { return $this->description; } /** * Description of the selected API(s). * * Generated from protobuf field string description = 2; * @param string $var * @return $this */ public function setDescription($var) { GPBUtil::checkString($var, True); $this->description = $var; return $this; } /** * Deprecation description of the selected element(s). It can be provided if an * element is marked as `deprecated`. * * Generated from protobuf field string deprecation_description = 3; * @return string */ public function getDeprecationDescription() { return $this->deprecation_description; } /** * Deprecation description of the selected element(s). It can be provided if an * element is marked as `deprecated`. * * Generated from protobuf field string deprecation_description = 3; * @param string $var * @return $this */ public function setDeprecationDescription($var) { GPBUtil::checkString($var, True); $this->deprecation_description = $var; return $this; } } src/Api/Endpoint.php000064400000022042151742741630010347 0ustar00google.api.Endpoint */ class Endpoint extends \Google\Protobuf\Internal\Message { /** * The canonical name of this endpoint. * * Generated from protobuf field string name = 1; */ private $name = ''; /** * DEPRECATED: This field is no longer supported. Instead of using aliases, * please specify multiple [google.api.Endpoint][google.api.Endpoint] for each of the intended * aliases. * Additional names that this endpoint will be hosted on. * * Generated from protobuf field repeated string aliases = 2; */ private $aliases; /** * The list of features enabled on this endpoint. * * Generated from protobuf field repeated string features = 4; */ private $features; /** * The specification of an Internet routable address of API frontend that will * handle requests to this [API Endpoint](https://cloud.google.com/apis/design/glossary). * It should be either a valid IPv4 address or a fully-qualified domain name. * For example, "8.8.8.8" or "myservice.appspot.com". * * Generated from protobuf field string target = 101; */ private $target = ''; /** * Allowing * [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka * cross-domain traffic, would allow the backends served from this endpoint to * receive and respond to HTTP OPTIONS requests. The response will be used by * the browser to determine whether the subsequent cross-origin request is * allowed to proceed. * * Generated from protobuf field bool allow_cors = 5; */ private $allow_cors = false; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $name * The canonical name of this endpoint. * @type string[]|\Google\Protobuf\Internal\RepeatedField $aliases * DEPRECATED: This field is no longer supported. Instead of using aliases, * please specify multiple [google.api.Endpoint][google.api.Endpoint] for each of the intended * aliases. * Additional names that this endpoint will be hosted on. * @type string[]|\Google\Protobuf\Internal\RepeatedField $features * The list of features enabled on this endpoint. * @type string $target * The specification of an Internet routable address of API frontend that will * handle requests to this [API Endpoint](https://cloud.google.com/apis/design/glossary). * It should be either a valid IPv4 address or a fully-qualified domain name. * For example, "8.8.8.8" or "myservice.appspot.com". * @type bool $allow_cors * Allowing * [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka * cross-domain traffic, would allow the backends served from this endpoint to * receive and respond to HTTP OPTIONS requests. The response will be used by * the browser to determine whether the subsequent cross-origin request is * allowed to proceed. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Endpoint::initOnce(); parent::__construct($data); } /** * The canonical name of this endpoint. * * Generated from protobuf field string name = 1; * @return string */ public function getName() { return $this->name; } /** * The canonical name of this endpoint. * * 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; } /** * DEPRECATED: This field is no longer supported. Instead of using aliases, * please specify multiple [google.api.Endpoint][google.api.Endpoint] for each of the intended * aliases. * Additional names that this endpoint will be hosted on. * * Generated from protobuf field repeated string aliases = 2; * @return \Google\Protobuf\Internal\RepeatedField */ public function getAliases() { return $this->aliases; } /** * DEPRECATED: This field is no longer supported. Instead of using aliases, * please specify multiple [google.api.Endpoint][google.api.Endpoint] for each of the intended * aliases. * Additional names that this endpoint will be hosted on. * * Generated from protobuf field repeated string aliases = 2; * @param string[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setAliases($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->aliases = $arr; return $this; } /** * The list of features enabled on this endpoint. * * Generated from protobuf field repeated string features = 4; * @return \Google\Protobuf\Internal\RepeatedField */ public function getFeatures() { return $this->features; } /** * The list of features enabled on this endpoint. * * Generated from protobuf field repeated string features = 4; * @param string[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setFeatures($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->features = $arr; return $this; } /** * The specification of an Internet routable address of API frontend that will * handle requests to this [API Endpoint](https://cloud.google.com/apis/design/glossary). * It should be either a valid IPv4 address or a fully-qualified domain name. * For example, "8.8.8.8" or "myservice.appspot.com". * * Generated from protobuf field string target = 101; * @return string */ public function getTarget() { return $this->target; } /** * The specification of an Internet routable address of API frontend that will * handle requests to this [API Endpoint](https://cloud.google.com/apis/design/glossary). * It should be either a valid IPv4 address or a fully-qualified domain name. * For example, "8.8.8.8" or "myservice.appspot.com". * * Generated from protobuf field string target = 101; * @param string $var * @return $this */ public function setTarget($var) { GPBUtil::checkString($var, True); $this->target = $var; return $this; } /** * Allowing * [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka * cross-domain traffic, would allow the backends served from this endpoint to * receive and respond to HTTP OPTIONS requests. The response will be used by * the browser to determine whether the subsequent cross-origin request is * allowed to proceed. * * Generated from protobuf field bool allow_cors = 5; * @return bool */ public function getAllowCors() { return $this->allow_cors; } /** * Allowing * [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka * cross-domain traffic, would allow the backends served from this endpoint to * receive and respond to HTTP OPTIONS requests. The response will be used by * the browser to determine whether the subsequent cross-origin request is * allowed to proceed. * * Generated from protobuf field bool allow_cors = 5; * @param bool $var * @return $this */ public function setAllowCors($var) { GPBUtil::checkBool($var); $this->allow_cors = $var; return $this; } } src/Api/Experimental.php000064400000003502151742741630011224 0ustar00google.api.Experimental */ class Experimental extends \Google\Protobuf\Internal\Message { /** * Authorization configuration. * * Generated from protobuf field .google.api.AuthorizationConfig authorization = 8; */ private $authorization = null; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Api\AuthorizationConfig $authorization * Authorization configuration. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Experimental\Experimental::initOnce(); parent::__construct($data); } /** * Authorization configuration. * * Generated from protobuf field .google.api.AuthorizationConfig authorization = 8; * @return \Google\Api\AuthorizationConfig */ public function getAuthorization() { return $this->authorization; } /** * Authorization configuration. * * Generated from protobuf field .google.api.AuthorizationConfig authorization = 8; * @param \Google\Api\AuthorizationConfig $var * @return $this */ public function setAuthorization($var) { GPBUtil::checkMessage($var, \Google\Api\AuthorizationConfig::class); $this->authorization = $var; return $this; } } src/Api/Http.php000064400000010550151742741630007507 0ustar00google.api.Http */ class Http extends \Google\Protobuf\Internal\Message { /** * A list of HTTP configuration rules that apply to individual API methods. * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.HttpRule rules = 1; */ private $rules; /** * When set to true, URL path parmeters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * The default behavior is to not decode RFC 6570 reserved characters in multi * segment matches. * * Generated from protobuf field bool fully_decode_reserved_expansion = 2; */ private $fully_decode_reserved_expansion = false; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Api\HttpRule[]|\Google\Protobuf\Internal\RepeatedField $rules * A list of HTTP configuration rules that apply to individual API methods. * **NOTE:** All service configuration rules follow "last one wins" order. * @type bool $fully_decode_reserved_expansion * When set to true, URL path parmeters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * The default behavior is to not decode RFC 6570 reserved characters in multi * segment matches. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Http::initOnce(); parent::__construct($data); } /** * A list of HTTP configuration rules that apply to individual API methods. * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.HttpRule rules = 1; * @return \Google\Protobuf\Internal\RepeatedField */ public function getRules() { return $this->rules; } /** * A list of HTTP configuration rules that apply to individual API methods. * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.HttpRule rules = 1; * @param \Google\Api\HttpRule[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setRules($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\HttpRule::class); $this->rules = $arr; return $this; } /** * When set to true, URL path parmeters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * The default behavior is to not decode RFC 6570 reserved characters in multi * segment matches. * * Generated from protobuf field bool fully_decode_reserved_expansion = 2; * @return bool */ public function getFullyDecodeReservedExpansion() { return $this->fully_decode_reserved_expansion; } /** * When set to true, URL path parmeters will be fully URI-decoded except in * cases of single segment matches in reserved expansion, where "%2F" will be * left encoded. * The default behavior is to not decode RFC 6570 reserved characters in multi * segment matches. * * Generated from protobuf field bool fully_decode_reserved_expansion = 2; * @param bool $var * @return $this */ public function setFullyDecodeReservedExpansion($var) { GPBUtil::checkBool($var); $this->fully_decode_reserved_expansion = $var; return $this; } } src/Api/HttpBody.php000064400000012043151742741630010324 0ustar00google.api.HttpBody */ class HttpBody extends \Google\Protobuf\Internal\Message { /** * The HTTP Content-Type string representing the content type of the body. * * Generated from protobuf field string content_type = 1; */ private $content_type = ''; /** * HTTP body binary data. * * Generated from protobuf field bytes data = 2; */ private $data = ''; /** * Application specific response metadata. Must be set in the first response * for streaming APIs. * * Generated from protobuf field repeated .google.protobuf.Any extensions = 3; */ private $extensions; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $content_type * The HTTP Content-Type string representing the content type of the body. * @type string $data * HTTP body binary data. * @type \Google\Protobuf\Any[]|\Google\Protobuf\Internal\RepeatedField $extensions * Application specific response metadata. Must be set in the first response * for streaming APIs. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Httpbody::initOnce(); parent::__construct($data); } /** * The HTTP Content-Type string representing the content type of the body. * * Generated from protobuf field string content_type = 1; * @return string */ public function getContentType() { return $this->content_type; } /** * The HTTP Content-Type string representing the content type of the body. * * Generated from protobuf field string content_type = 1; * @param string $var * @return $this */ public function setContentType($var) { GPBUtil::checkString($var, True); $this->content_type = $var; return $this; } /** * HTTP body binary data. * * Generated from protobuf field bytes data = 2; * @return string */ public function getData() { return $this->data; } /** * HTTP body binary data. * * Generated from protobuf field bytes data = 2; * @param string $var * @return $this */ public function setData($var) { GPBUtil::checkString($var, False); $this->data = $var; return $this; } /** * Application specific response metadata. Must be set in the first response * for streaming APIs. * * Generated from protobuf field repeated .google.protobuf.Any extensions = 3; * @return \Google\Protobuf\Internal\RepeatedField */ public function getExtensions() { return $this->extensions; } /** * Application specific response metadata. Must be set in the first response * for streaming APIs. * * Generated from protobuf field repeated .google.protobuf.Any extensions = 3; * @param \Google\Protobuf\Any[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setExtensions($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Any::class); $this->extensions = $arr; return $this; } } src/Api/HttpRule.php000064400000047611151742741630010347 0ustar00.Messaging.GetMessage * get: /v1/messages/{message_id}/{sub.subfield} * This definition enables an automatic, bidrectional mapping of HTTP * JSON to RPC. Example: * HTTP | RPC * -----|----- * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` * In general, not only fields but also field paths can be referenced * from a path pattern. Fields mapped to the path pattern cannot be * repeated and must have a primitive (non-message) type. * Any fields in the request message which are not bound by the path * pattern automatically become (optional) HTTP query * parameters. Assume the following definition of the request message: * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { * option (google.api.http).get = "/v1/messages/{message_id}"; * } * } * message GetMessageRequest { * message SubMessage { * string subfield = 1; * } * string message_id = 1; // mapped to the URL * int64 revision = 2; // becomes a parameter * SubMessage sub = 3; // `sub.subfield` becomes a parameter * } * This enables a HTTP JSON to RPC mapping as below: * HTTP | RPC * -----|----- * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` * Note that fields which are mapped to HTTP parameters must have a * primitive type or a repeated primitive type. Message types are not * allowed. In the case of a repeated type, the parameter can be * repeated in the URL, as in `...?param=A¶m=B`. * For HTTP method kinds which allow a request body, the `body` field * specifies the mapping. Consider a REST update method on the * message resource collection: * service Messaging { * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { * option (google.api.http) = { * put: "/v1/messages/{message_id}" * body: "message" * }; * } * } * message UpdateMessageRequest { * string message_id = 1; // mapped to the URL * Message message = 2; // mapped to the body * } * The following HTTP JSON to RPC mapping is enabled, where the * representation of the JSON in the request body is determined by * protos JSON encoding: * HTTP | RPC * -----|----- * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` * The special name `*` can be used in the body mapping to define that * every field not bound by the path template should be mapped to the * request body. This enables the following alternative definition of * the update method: * service Messaging { * rpc UpdateMessage(Message) returns (Message) { * option (google.api.http) = { * put: "/v1/messages/{message_id}" * body: "*" * }; * } * } * message Message { * string message_id = 1; * string text = 2; * } * The following HTTP JSON to RPC mapping is enabled: * HTTP | RPC * -----|----- * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` * Note that when using `*` in the body mapping, it is not possible to * have HTTP parameters, as all fields not bound by the path end in * the body. This makes this option more rarely used in practice of * defining REST APIs. The common usage of `*` is in custom methods * which don't use the URL at all for transferring data. * It is possible to define multiple HTTP methods for one RPC by using * the `additional_bindings` option. Example: * service Messaging { * rpc GetMessage(GetMessageRequest) returns (Message) { * option (google.api.http) = { * get: "/v1/messages/{message_id}" * additional_bindings { * get: "/v1/users/{user_id}/messages/{message_id}" * } * }; * } * } * message GetMessageRequest { * string message_id = 1; * string user_id = 2; * } * This enables the following two alternative HTTP JSON to RPC * mappings: * HTTP | RPC * -----|----- * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` * # Rules for HTTP mapping * The rules for mapping HTTP path, query parameters, and body fields * to the request message are as follows: * 1. The `body` field specifies either `*` or a field path, or is * omitted. If omitted, it indicates there is no HTTP request body. * 2. Leaf fields (recursive expansion of nested messages in the * request) can be classified into three types: * (a) Matched in the URL template. * (b) Covered by body (if body is `*`, everything except (a) fields; * else everything under the body field) * (c) All other fields. * 3. URL query parameters found in the HTTP request are mapped to (c) fields. * 4. Any body sent with an HTTP request can contain only (b) fields. * The syntax of the path template is as follows: * Template = "/" Segments [ Verb ] ; * Segments = Segment { "/" Segment } ; * Segment = "*" | "**" | LITERAL | Variable ; * Variable = "{" FieldPath [ "=" Segments ] "}" ; * FieldPath = IDENT { "." IDENT } ; * Verb = ":" LITERAL ; * The syntax `*` matches a single path segment. The syntax `**` matches zero * or more path segments, which must be the last part of the path except the * `Verb`. The syntax `LITERAL` matches literal text in the path. * The syntax `Variable` matches part of the URL path as specified by its * template. A variable template must not contain other variables. If a variable * matches a single path segment, its template may be omitted, e.g. `{var}` * is equivalent to `{var=*}`. * If a variable contains exactly one path segment, such as `"{var}"` or * `"{var=*}"`, when such a variable is expanded into a URL path, all characters * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the * Discovery Document as `{var}`. * If a variable contains one or more path segments, such as `"{var=foo/*}"` * or `"{var=**}"`, when such a variable is expanded into a URL path, all * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables * show up in the Discovery Document as `{+var}`. * NOTE: While the single segment variable matches the semantics of * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 * Simple String Expansion, the multi segment variable **does not** match * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion * does not expand special characters like `?` and `#`, which would lead * to invalid URLs. * NOTE: the field paths in variables and in the `body` must not refer to * repeated fields or map fields. * * Generated from protobuf message google.api.HttpRule */ class HttpRule extends \Google\Protobuf\Internal\Message { /** * Selects methods to which this rule applies. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; */ private $selector = ''; /** * The name of the request field whose value is mapped to the HTTP body, or * `*` for mapping all fields not captured by the path pattern to the HTTP * body. NOTE: the referred field must not be a repeated field and must be * present at the top-level of request message type. * * Generated from protobuf field string body = 7; */ private $body = ''; /** * Optional. The name of the response field whose value is mapped to the HTTP * body of response. Other response fields are ignored. When * not set, the response message will be used as HTTP body of response. * * Generated from protobuf field string response_body = 12; */ private $response_body = ''; /** * Additional HTTP bindings for the selector. Nested bindings must * not contain an `additional_bindings` field themselves (that is, * the nesting may only be one level deep). * * Generated from protobuf field repeated .google.api.HttpRule additional_bindings = 11; */ private $additional_bindings; protected $pattern; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $selector * Selects methods to which this rule applies. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * @type string $get * Used for listing and getting information about resources. * @type string $put * Used for updating a resource. * @type string $post * Used for creating a resource. * @type string $delete * Used for deleting a resource. * @type string $patch * Used for updating a resource. * @type \Google\Api\CustomHttpPattern $custom * The custom pattern is used for specifying an HTTP method that is not * included in the `pattern` field, such as HEAD, or "*" to leave the * HTTP method unspecified for this rule. The wild-card rule is useful * for services that provide content to Web (HTML) clients. * @type string $body * The name of the request field whose value is mapped to the HTTP body, or * `*` for mapping all fields not captured by the path pattern to the HTTP * body. NOTE: the referred field must not be a repeated field and must be * present at the top-level of request message type. * @type string $response_body * Optional. The name of the response field whose value is mapped to the HTTP * body of response. Other response fields are ignored. When * not set, the response message will be used as HTTP body of response. * @type \Google\Api\HttpRule[]|\Google\Protobuf\Internal\RepeatedField $additional_bindings * Additional HTTP bindings for the selector. Nested bindings must * not contain an `additional_bindings` field themselves (that is, * the nesting may only be one level deep). * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Http::initOnce(); parent::__construct($data); } /** * Selects methods to which this rule applies. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; * @return string */ public function getSelector() { return $this->selector; } /** * Selects methods to which this rule applies. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; * @param string $var * @return $this */ public function setSelector($var) { GPBUtil::checkString($var, True); $this->selector = $var; return $this; } /** * Used for listing and getting information about resources. * * Generated from protobuf field string get = 2; * @return string */ public function getGet() { return $this->readOneof(2); } /** * Used for listing and getting information about resources. * * Generated from protobuf field string get = 2; * @param string $var * @return $this */ public function setGet($var) { GPBUtil::checkString($var, True); $this->writeOneof(2, $var); return $this; } /** * Used for updating a resource. * * Generated from protobuf field string put = 3; * @return string */ public function getPut() { return $this->readOneof(3); } /** * Used for updating a resource. * * Generated from protobuf field string put = 3; * @param string $var * @return $this */ public function setPut($var) { GPBUtil::checkString($var, True); $this->writeOneof(3, $var); return $this; } /** * Used for creating a resource. * * Generated from protobuf field string post = 4; * @return string */ public function getPost() { return $this->readOneof(4); } /** * Used for creating a resource. * * Generated from protobuf field string post = 4; * @param string $var * @return $this */ public function setPost($var) { GPBUtil::checkString($var, True); $this->writeOneof(4, $var); return $this; } /** * Used for deleting a resource. * * Generated from protobuf field string delete = 5; * @return string */ public function getDelete() { return $this->readOneof(5); } /** * Used for deleting a resource. * * Generated from protobuf field string delete = 5; * @param string $var * @return $this */ public function setDelete($var) { GPBUtil::checkString($var, True); $this->writeOneof(5, $var); return $this; } /** * Used for updating a resource. * * Generated from protobuf field string patch = 6; * @return string */ public function getPatch() { return $this->readOneof(6); } /** * Used for updating a resource. * * Generated from protobuf field string patch = 6; * @param string $var * @return $this */ public function setPatch($var) { GPBUtil::checkString($var, True); $this->writeOneof(6, $var); return $this; } /** * The custom pattern is used for specifying an HTTP method that is not * included in the `pattern` field, such as HEAD, or "*" to leave the * HTTP method unspecified for this rule. The wild-card rule is useful * for services that provide content to Web (HTML) clients. * * Generated from protobuf field .google.api.CustomHttpPattern custom = 8; * @return \Google\Api\CustomHttpPattern */ public function getCustom() { return $this->readOneof(8); } /** * The custom pattern is used for specifying an HTTP method that is not * included in the `pattern` field, such as HEAD, or "*" to leave the * HTTP method unspecified for this rule. The wild-card rule is useful * for services that provide content to Web (HTML) clients. * * Generated from protobuf field .google.api.CustomHttpPattern custom = 8; * @param \Google\Api\CustomHttpPattern $var * @return $this */ public function setCustom($var) { GPBUtil::checkMessage($var, \Google\Api\CustomHttpPattern::class); $this->writeOneof(8, $var); return $this; } /** * The name of the request field whose value is mapped to the HTTP body, or * `*` for mapping all fields not captured by the path pattern to the HTTP * body. NOTE: the referred field must not be a repeated field and must be * present at the top-level of request message type. * * Generated from protobuf field string body = 7; * @return string */ public function getBody() { return $this->body; } /** * The name of the request field whose value is mapped to the HTTP body, or * `*` for mapping all fields not captured by the path pattern to the HTTP * body. NOTE: the referred field must not be a repeated field and must be * present at the top-level of request message type. * * Generated from protobuf field string body = 7; * @param string $var * @return $this */ public function setBody($var) { GPBUtil::checkString($var, True); $this->body = $var; return $this; } /** * Optional. The name of the response field whose value is mapped to the HTTP * body of response. Other response fields are ignored. When * not set, the response message will be used as HTTP body of response. * * Generated from protobuf field string response_body = 12; * @return string */ public function getResponseBody() { return $this->response_body; } /** * Optional. The name of the response field whose value is mapped to the HTTP * body of response. Other response fields are ignored. When * not set, the response message will be used as HTTP body of response. * * Generated from protobuf field string response_body = 12; * @param string $var * @return $this */ public function setResponseBody($var) { GPBUtil::checkString($var, True); $this->response_body = $var; return $this; } /** * Additional HTTP bindings for the selector. Nested bindings must * not contain an `additional_bindings` field themselves (that is, * the nesting may only be one level deep). * * Generated from protobuf field repeated .google.api.HttpRule additional_bindings = 11; * @return \Google\Protobuf\Internal\RepeatedField */ public function getAdditionalBindings() { return $this->additional_bindings; } /** * Additional HTTP bindings for the selector. Nested bindings must * not contain an `additional_bindings` field themselves (that is, * the nesting may only be one level deep). * * Generated from protobuf field repeated .google.api.HttpRule additional_bindings = 11; * @param \Google\Api\HttpRule[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setAdditionalBindings($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\HttpRule::class); $this->additional_bindings = $arr; return $this; } /** * @return string */ public function getPattern() { return $this->whichOneof("pattern"); } } src/Api/LabelDescriptor.php000064400000006363151742741630011655 0ustar00google.api.LabelDescriptor */ class LabelDescriptor extends \Google\Protobuf\Internal\Message { /** * The label key. * * Generated from protobuf field string key = 1; */ private $key = ''; /** * The type of data that can be assigned to the label. * * Generated from protobuf field .google.api.LabelDescriptor.ValueType value_type = 2; */ private $value_type = 0; /** * A human-readable description for the label. * * Generated from protobuf field string description = 3; */ private $description = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $key * The label key. * @type int $value_type * The type of data that can be assigned to the label. * @type string $description * A human-readable description for the label. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Label::initOnce(); parent::__construct($data); } /** * The label key. * * Generated from protobuf field string key = 1; * @return string */ public function getKey() { return $this->key; } /** * The label key. * * Generated from protobuf field string key = 1; * @param string $var * @return $this */ public function setKey($var) { GPBUtil::checkString($var, True); $this->key = $var; return $this; } /** * The type of data that can be assigned to the label. * * Generated from protobuf field .google.api.LabelDescriptor.ValueType value_type = 2; * @return int */ public function getValueType() { return $this->value_type; } /** * The type of data that can be assigned to the label. * * Generated from protobuf field .google.api.LabelDescriptor.ValueType value_type = 2; * @param int $var * @return $this */ public function setValueType($var) { GPBUtil::checkEnum($var, \Google\Api\LabelDescriptor_ValueType::class); $this->value_type = $var; return $this; } /** * A human-readable description for the label. * * Generated from protobuf field string description = 3; * @return string */ public function getDescription() { return $this->description; } /** * A human-readable description for the label. * * Generated from protobuf field string description = 3; * @param string $var * @return $this */ public function setDescription($var) { GPBUtil::checkString($var, True); $this->description = $var; return $this; } } src/Api/LabelDescriptor/ValueType.php000064400000001553151742741630013567 0ustar00google.api.LabelDescriptor.ValueType */ class ValueType { /** * A variable-length string. This is the default. * * Generated from protobuf enum STRING = 0; */ const STRING = 0; /** * Boolean; true or false. * * Generated from protobuf enum BOOL = 1; */ const BOOL = 1; /** * A 64-bit signed integer. * * Generated from protobuf enum INT64 = 2; */ const INT64 = 2; } // Adding a class alias for backwards compatibility with the previous class name. class_alias(ValueType::class, \Google\Api\LabelDescriptor_ValueType::class); src/Api/LabelDescriptor_ValueType.php000064400000001020151742741630013634 0ustar00google.api.LogDescriptor */ class LogDescriptor extends \Google\Protobuf\Internal\Message { /** * The name of the log. It must be less than 512 characters long and can * include the following characters: upper- and lower-case alphanumeric * characters [A-Za-z0-9], and punctuation characters including * slash, underscore, hyphen, period [/_-.]. * * Generated from protobuf field string name = 1; */ private $name = ''; /** * The set of labels that are available to describe a specific log entry. * Runtime requests that contain labels not specified here are * considered invalid. * * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 2; */ private $labels; /** * A human-readable description of this log. This information appears in * the documentation and can contain details. * * Generated from protobuf field string description = 3; */ private $description = ''; /** * The human-readable name for this log. This information appears on * the user interface and should be concise. * * Generated from protobuf field string display_name = 4; */ private $display_name = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $name * The name of the log. It must be less than 512 characters long and can * include the following characters: upper- and lower-case alphanumeric * characters [A-Za-z0-9], and punctuation characters including * slash, underscore, hyphen, period [/_-.]. * @type \Google\Api\LabelDescriptor[]|\Google\Protobuf\Internal\RepeatedField $labels * The set of labels that are available to describe a specific log entry. * Runtime requests that contain labels not specified here are * considered invalid. * @type string $description * A human-readable description of this log. This information appears in * the documentation and can contain details. * @type string $display_name * The human-readable name for this log. This information appears on * the user interface and should be concise. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Log::initOnce(); parent::__construct($data); } /** * The name of the log. It must be less than 512 characters long and can * include the following characters: upper- and lower-case alphanumeric * characters [A-Za-z0-9], and punctuation characters including * slash, underscore, hyphen, period [/_-.]. * * Generated from protobuf field string name = 1; * @return string */ public function getName() { return $this->name; } /** * The name of the log. It must be less than 512 characters long and can * include the following characters: upper- and lower-case alphanumeric * characters [A-Za-z0-9], and punctuation characters including * slash, underscore, hyphen, period [/_-.]. * * 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; } /** * The set of labels that are available to describe a specific log entry. * Runtime requests that contain labels not specified here are * considered invalid. * * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 2; * @return \Google\Protobuf\Internal\RepeatedField */ public function getLabels() { return $this->labels; } /** * The set of labels that are available to describe a specific log entry. * Runtime requests that contain labels not specified here are * considered invalid. * * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 2; * @param \Google\Api\LabelDescriptor[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setLabels($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\LabelDescriptor::class); $this->labels = $arr; return $this; } /** * A human-readable description of this log. This information appears in * the documentation and can contain details. * * Generated from protobuf field string description = 3; * @return string */ public function getDescription() { return $this->description; } /** * A human-readable description of this log. This information appears in * the documentation and can contain details. * * Generated from protobuf field string description = 3; * @param string $var * @return $this */ public function setDescription($var) { GPBUtil::checkString($var, True); $this->description = $var; return $this; } /** * The human-readable name for this log. This information appears on * the user interface and should be concise. * * Generated from protobuf field string display_name = 4; * @return string */ public function getDisplayName() { return $this->display_name; } /** * The human-readable name for this log. This information appears on * the user interface and should be concise. * * Generated from protobuf field string display_name = 4; * @param string $var * @return $this */ public function setDisplayName($var) { GPBUtil::checkString($var, True); $this->display_name = $var; return $this; } } src/Api/Logging.php000064400000013700151742741630010156 0ustar00google.api.Logging */ class Logging extends \Google\Protobuf\Internal\Message { /** * Logging configurations for sending logs to the producer project. * There can be multiple producer destinations, each one must have a * different monitored resource type. A log can be used in at most * one producer destination. * * Generated from protobuf field repeated .google.api.Logging.LoggingDestination producer_destinations = 1; */ private $producer_destinations; /** * Logging configurations for sending logs to the consumer project. * There can be multiple consumer destinations, each one must have a * different monitored resource type. A log can be used in at most * one consumer destination. * * Generated from protobuf field repeated .google.api.Logging.LoggingDestination consumer_destinations = 2; */ private $consumer_destinations; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Api\Logging\LoggingDestination[]|\Google\Protobuf\Internal\RepeatedField $producer_destinations * Logging configurations for sending logs to the producer project. * There can be multiple producer destinations, each one must have a * different monitored resource type. A log can be used in at most * one producer destination. * @type \Google\Api\Logging\LoggingDestination[]|\Google\Protobuf\Internal\RepeatedField $consumer_destinations * Logging configurations for sending logs to the consumer project. * There can be multiple consumer destinations, each one must have a * different monitored resource type. A log can be used in at most * one consumer destination. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Logging::initOnce(); parent::__construct($data); } /** * Logging configurations for sending logs to the producer project. * There can be multiple producer destinations, each one must have a * different monitored resource type. A log can be used in at most * one producer destination. * * Generated from protobuf field repeated .google.api.Logging.LoggingDestination producer_destinations = 1; * @return \Google\Protobuf\Internal\RepeatedField */ public function getProducerDestinations() { return $this->producer_destinations; } /** * Logging configurations for sending logs to the producer project. * There can be multiple producer destinations, each one must have a * different monitored resource type. A log can be used in at most * one producer destination. * * Generated from protobuf field repeated .google.api.Logging.LoggingDestination producer_destinations = 1; * @param \Google\Api\Logging\LoggingDestination[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setProducerDestinations($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Logging\LoggingDestination::class); $this->producer_destinations = $arr; return $this; } /** * Logging configurations for sending logs to the consumer project. * There can be multiple consumer destinations, each one must have a * different monitored resource type. A log can be used in at most * one consumer destination. * * Generated from protobuf field repeated .google.api.Logging.LoggingDestination consumer_destinations = 2; * @return \Google\Protobuf\Internal\RepeatedField */ public function getConsumerDestinations() { return $this->consumer_destinations; } /** * Logging configurations for sending logs to the consumer project. * There can be multiple consumer destinations, each one must have a * different monitored resource type. A log can be used in at most * one consumer destination. * * Generated from protobuf field repeated .google.api.Logging.LoggingDestination consumer_destinations = 2; * @param \Google\Api\Logging\LoggingDestination[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setConsumerDestinations($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Logging\LoggingDestination::class); $this->consumer_destinations = $arr; return $this; } } src/Api/Logging/LoggingDestination.php000064400000010311151742741630013741 0ustar00google.api.Logging.LoggingDestination */ class LoggingDestination extends \Google\Protobuf\Internal\Message { /** * The monitored resource type. The type must be defined in the * [Service.monitored_resources][google.api.Service.monitored_resources] section. * * Generated from protobuf field string monitored_resource = 3; */ private $monitored_resource = ''; /** * Names of the logs to be sent to this destination. Each name must * be defined in the [Service.logs][google.api.Service.logs] section. If the log name is * not a domain scoped name, it will be automatically prefixed with * the service name followed by "/". * * Generated from protobuf field repeated string logs = 1; */ private $logs; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $monitored_resource * The monitored resource type. The type must be defined in the * [Service.monitored_resources][google.api.Service.monitored_resources] section. * @type string[]|\Google\Protobuf\Internal\RepeatedField $logs * Names of the logs to be sent to this destination. Each name must * be defined in the [Service.logs][google.api.Service.logs] section. If the log name is * not a domain scoped name, it will be automatically prefixed with * the service name followed by "/". * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Logging::initOnce(); parent::__construct($data); } /** * The monitored resource type. The type must be defined in the * [Service.monitored_resources][google.api.Service.monitored_resources] section. * * Generated from protobuf field string monitored_resource = 3; * @return string */ public function getMonitoredResource() { return $this->monitored_resource; } /** * The monitored resource type. The type must be defined in the * [Service.monitored_resources][google.api.Service.monitored_resources] section. * * Generated from protobuf field string monitored_resource = 3; * @param string $var * @return $this */ public function setMonitoredResource($var) { GPBUtil::checkString($var, True); $this->monitored_resource = $var; return $this; } /** * Names of the logs to be sent to this destination. Each name must * be defined in the [Service.logs][google.api.Service.logs] section. If the log name is * not a domain scoped name, it will be automatically prefixed with * the service name followed by "/". * * Generated from protobuf field repeated string logs = 1; * @return \Google\Protobuf\Internal\RepeatedField */ public function getLogs() { return $this->logs; } /** * Names of the logs to be sent to this destination. Each name must * be defined in the [Service.logs][google.api.Service.logs] section. If the log name is * not a domain scoped name, it will be automatically prefixed with * the service name followed by "/". * * Generated from protobuf field repeated string logs = 1; * @param string[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setLogs($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->logs = $arr; return $this; } } // Adding a class alias for backwards compatibility with the previous class name. class_alias(LoggingDestination::class, \Google\Api\Logging_LoggingDestination::class); src/Api/Logging_LoggingDestination.php000064400000001027151742741630014025 0ustar00google.api.Metric */ class Metric extends \Google\Protobuf\Internal\Message { /** * An existing metric type, see [google.api.MetricDescriptor][google.api.MetricDescriptor]. * For example, `custom.googleapis.com/invoice/paid/amount`. * * Generated from protobuf field string type = 3; */ private $type = ''; /** * The set of label values that uniquely identify this metric. All * labels listed in the `MetricDescriptor` must be assigned values. * * Generated from protobuf field map labels = 2; */ private $labels; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $type * An existing metric type, see [google.api.MetricDescriptor][google.api.MetricDescriptor]. * For example, `custom.googleapis.com/invoice/paid/amount`. * @type array|\Google\Protobuf\Internal\MapField $labels * The set of label values that uniquely identify this metric. All * labels listed in the `MetricDescriptor` must be assigned values. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Metric::initOnce(); parent::__construct($data); } /** * An existing metric type, see [google.api.MetricDescriptor][google.api.MetricDescriptor]. * For example, `custom.googleapis.com/invoice/paid/amount`. * * Generated from protobuf field string type = 3; * @return string */ public function getType() { return $this->type; } /** * An existing metric type, see [google.api.MetricDescriptor][google.api.MetricDescriptor]. * For example, `custom.googleapis.com/invoice/paid/amount`. * * Generated from protobuf field string type = 3; * @param string $var * @return $this */ public function setType($var) { GPBUtil::checkString($var, True); $this->type = $var; return $this; } /** * The set of label values that uniquely identify this metric. All * labels listed in the `MetricDescriptor` must be assigned values. * * Generated from protobuf field map labels = 2; * @return \Google\Protobuf\Internal\MapField */ public function getLabels() { return $this->labels; } /** * The set of label values that uniquely identify this metric. All * labels listed in the `MetricDescriptor` must be assigned values. * * Generated from protobuf field map labels = 2; * @param array|\Google\Protobuf\Internal\MapField $var * @return $this */ public function setLabels($var) { $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); $this->labels = $arr; return $this; } } src/Api/MetricDescriptor.php000064400000052535151742741630012063 0ustar00google.api.MetricDescriptor */ class MetricDescriptor extends \Google\Protobuf\Internal\Message { /** * The resource name of the metric descriptor. * * Generated from protobuf field string name = 1; */ private $name = ''; /** * The metric type, including its DNS name prefix. The type is not * URL-encoded. All user-defined custom metric types have the DNS name * `custom.googleapis.com`. Metric types should use a natural hierarchical * grouping. For example: * "custom.googleapis.com/invoice/paid/amount" * "appengine.googleapis.com/http/server/response_latencies" * * Generated from protobuf field string type = 8; */ private $type = ''; /** * The set of labels that can be used to describe a specific * instance of this metric type. For example, the * `appengine.googleapis.com/http/server/response_latencies` metric * type has a label for the HTTP response code, `response_code`, so * you can look at latencies for successful responses or just * for responses that failed. * * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 2; */ private $labels; /** * Whether the metric records instantaneous values, changes to a value, etc. * Some combinations of `metric_kind` and `value_type` might not be supported. * * Generated from protobuf field .google.api.MetricDescriptor.MetricKind metric_kind = 3; */ private $metric_kind = 0; /** * Whether the measurement is an integer, a floating-point number, etc. * Some combinations of `metric_kind` and `value_type` might not be supported. * * Generated from protobuf field .google.api.MetricDescriptor.ValueType value_type = 4; */ private $value_type = 0; /** * The unit in which the metric value is reported. It is only applicable * if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The * supported units are a subset of [The Unified Code for Units of * Measure](http://unitsofmeasure.org/ucum.html) standard: * **Basic units (UNIT)** * * `bit` bit * * `By` byte * * `s` second * * `min` minute * * `h` hour * * `d` day * **Prefixes (PREFIX)** * * `k` kilo (10**3) * * `M` mega (10**6) * * `G` giga (10**9) * * `T` tera (10**12) * * `P` peta (10**15) * * `E` exa (10**18) * * `Z` zetta (10**21) * * `Y` yotta (10**24) * * `m` milli (10**-3) * * `u` micro (10**-6) * * `n` nano (10**-9) * * `p` pico (10**-12) * * `f` femto (10**-15) * * `a` atto (10**-18) * * `z` zepto (10**-21) * * `y` yocto (10**-24) * * `Ki` kibi (2**10) * * `Mi` mebi (2**20) * * `Gi` gibi (2**30) * * `Ti` tebi (2**40) * **Grammar** * The grammar also includes these connectors: * * `/` division (as an infix operator, e.g. `1/s`). * * `.` multiplication (as an infix operator, e.g. `GBy.d`) * The grammar for a unit is as follows: * Expression = Component { "." Component } { "/" Component } ; * Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ] * | Annotation * | "1" * ; * Annotation = "{" NAME "}" ; * Notes: * * `Annotation` is just a comment if it follows a `UNIT` and is * equivalent to `1` if it is used alone. For examples, * `{requests}/s == 1/s`, `By{transmitted}/s == By/s`. * * `NAME` is a sequence of non-blank printable ASCII characters not * containing '{' or '}'. * * `1` represents dimensionless value 1, such as in `1/s`. * * `%` represents dimensionless value 1/100, and annotates values giving * a percentage. * * Generated from protobuf field string unit = 5; */ private $unit = ''; /** * A detailed description of the metric, which can be used in documentation. * * Generated from protobuf field string description = 6; */ private $description = ''; /** * A concise name for the metric, which can be displayed in user interfaces. * Use sentence case without an ending period, for example "Request count". * This field is optional but it is recommended to be set for any metrics * associated with user-visible concepts, such as Quota. * * Generated from protobuf field string display_name = 7; */ private $display_name = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $name * The resource name of the metric descriptor. * @type string $type * The metric type, including its DNS name prefix. The type is not * URL-encoded. All user-defined custom metric types have the DNS name * `custom.googleapis.com`. Metric types should use a natural hierarchical * grouping. For example: * "custom.googleapis.com/invoice/paid/amount" * "appengine.googleapis.com/http/server/response_latencies" * @type \Google\Api\LabelDescriptor[]|\Google\Protobuf\Internal\RepeatedField $labels * The set of labels that can be used to describe a specific * instance of this metric type. For example, the * `appengine.googleapis.com/http/server/response_latencies` metric * type has a label for the HTTP response code, `response_code`, so * you can look at latencies for successful responses or just * for responses that failed. * @type int $metric_kind * Whether the metric records instantaneous values, changes to a value, etc. * Some combinations of `metric_kind` and `value_type` might not be supported. * @type int $value_type * Whether the measurement is an integer, a floating-point number, etc. * Some combinations of `metric_kind` and `value_type` might not be supported. * @type string $unit * The unit in which the metric value is reported. It is only applicable * if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The * supported units are a subset of [The Unified Code for Units of * Measure](http://unitsofmeasure.org/ucum.html) standard: * **Basic units (UNIT)** * * `bit` bit * * `By` byte * * `s` second * * `min` minute * * `h` hour * * `d` day * **Prefixes (PREFIX)** * * `k` kilo (10**3) * * `M` mega (10**6) * * `G` giga (10**9) * * `T` tera (10**12) * * `P` peta (10**15) * * `E` exa (10**18) * * `Z` zetta (10**21) * * `Y` yotta (10**24) * * `m` milli (10**-3) * * `u` micro (10**-6) * * `n` nano (10**-9) * * `p` pico (10**-12) * * `f` femto (10**-15) * * `a` atto (10**-18) * * `z` zepto (10**-21) * * `y` yocto (10**-24) * * `Ki` kibi (2**10) * * `Mi` mebi (2**20) * * `Gi` gibi (2**30) * * `Ti` tebi (2**40) * **Grammar** * The grammar also includes these connectors: * * `/` division (as an infix operator, e.g. `1/s`). * * `.` multiplication (as an infix operator, e.g. `GBy.d`) * The grammar for a unit is as follows: * Expression = Component { "." Component } { "/" Component } ; * Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ] * | Annotation * | "1" * ; * Annotation = "{" NAME "}" ; * Notes: * * `Annotation` is just a comment if it follows a `UNIT` and is * equivalent to `1` if it is used alone. For examples, * `{requests}/s == 1/s`, `By{transmitted}/s == By/s`. * * `NAME` is a sequence of non-blank printable ASCII characters not * containing '{' or '}'. * * `1` represents dimensionless value 1, such as in `1/s`. * * `%` represents dimensionless value 1/100, and annotates values giving * a percentage. * @type string $description * A detailed description of the metric, which can be used in documentation. * @type string $display_name * A concise name for the metric, which can be displayed in user interfaces. * Use sentence case without an ending period, for example "Request count". * This field is optional but it is recommended to be set for any metrics * associated with user-visible concepts, such as Quota. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Metric::initOnce(); parent::__construct($data); } /** * The resource name of the metric descriptor. * * Generated from protobuf field string name = 1; * @return string */ public function getName() { return $this->name; } /** * The resource name of the metric descriptor. * * 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; } /** * The metric type, including its DNS name prefix. The type is not * URL-encoded. All user-defined custom metric types have the DNS name * `custom.googleapis.com`. Metric types should use a natural hierarchical * grouping. For example: * "custom.googleapis.com/invoice/paid/amount" * "appengine.googleapis.com/http/server/response_latencies" * * Generated from protobuf field string type = 8; * @return string */ public function getType() { return $this->type; } /** * The metric type, including its DNS name prefix. The type is not * URL-encoded. All user-defined custom metric types have the DNS name * `custom.googleapis.com`. Metric types should use a natural hierarchical * grouping. For example: * "custom.googleapis.com/invoice/paid/amount" * "appengine.googleapis.com/http/server/response_latencies" * * Generated from protobuf field string type = 8; * @param string $var * @return $this */ public function setType($var) { GPBUtil::checkString($var, True); $this->type = $var; return $this; } /** * The set of labels that can be used to describe a specific * instance of this metric type. For example, the * `appengine.googleapis.com/http/server/response_latencies` metric * type has a label for the HTTP response code, `response_code`, so * you can look at latencies for successful responses or just * for responses that failed. * * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 2; * @return \Google\Protobuf\Internal\RepeatedField */ public function getLabels() { return $this->labels; } /** * The set of labels that can be used to describe a specific * instance of this metric type. For example, the * `appengine.googleapis.com/http/server/response_latencies` metric * type has a label for the HTTP response code, `response_code`, so * you can look at latencies for successful responses or just * for responses that failed. * * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 2; * @param \Google\Api\LabelDescriptor[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setLabels($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\LabelDescriptor::class); $this->labels = $arr; return $this; } /** * Whether the metric records instantaneous values, changes to a value, etc. * Some combinations of `metric_kind` and `value_type` might not be supported. * * Generated from protobuf field .google.api.MetricDescriptor.MetricKind metric_kind = 3; * @return int */ public function getMetricKind() { return $this->metric_kind; } /** * Whether the metric records instantaneous values, changes to a value, etc. * Some combinations of `metric_kind` and `value_type` might not be supported. * * Generated from protobuf field .google.api.MetricDescriptor.MetricKind metric_kind = 3; * @param int $var * @return $this */ public function setMetricKind($var) { GPBUtil::checkEnum($var, \Google\Api\MetricDescriptor_MetricKind::class); $this->metric_kind = $var; return $this; } /** * Whether the measurement is an integer, a floating-point number, etc. * Some combinations of `metric_kind` and `value_type` might not be supported. * * Generated from protobuf field .google.api.MetricDescriptor.ValueType value_type = 4; * @return int */ public function getValueType() { return $this->value_type; } /** * Whether the measurement is an integer, a floating-point number, etc. * Some combinations of `metric_kind` and `value_type` might not be supported. * * Generated from protobuf field .google.api.MetricDescriptor.ValueType value_type = 4; * @param int $var * @return $this */ public function setValueType($var) { GPBUtil::checkEnum($var, \Google\Api\MetricDescriptor_ValueType::class); $this->value_type = $var; return $this; } /** * The unit in which the metric value is reported. It is only applicable * if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The * supported units are a subset of [The Unified Code for Units of * Measure](http://unitsofmeasure.org/ucum.html) standard: * **Basic units (UNIT)** * * `bit` bit * * `By` byte * * `s` second * * `min` minute * * `h` hour * * `d` day * **Prefixes (PREFIX)** * * `k` kilo (10**3) * * `M` mega (10**6) * * `G` giga (10**9) * * `T` tera (10**12) * * `P` peta (10**15) * * `E` exa (10**18) * * `Z` zetta (10**21) * * `Y` yotta (10**24) * * `m` milli (10**-3) * * `u` micro (10**-6) * * `n` nano (10**-9) * * `p` pico (10**-12) * * `f` femto (10**-15) * * `a` atto (10**-18) * * `z` zepto (10**-21) * * `y` yocto (10**-24) * * `Ki` kibi (2**10) * * `Mi` mebi (2**20) * * `Gi` gibi (2**30) * * `Ti` tebi (2**40) * **Grammar** * The grammar also includes these connectors: * * `/` division (as an infix operator, e.g. `1/s`). * * `.` multiplication (as an infix operator, e.g. `GBy.d`) * The grammar for a unit is as follows: * Expression = Component { "." Component } { "/" Component } ; * Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ] * | Annotation * | "1" * ; * Annotation = "{" NAME "}" ; * Notes: * * `Annotation` is just a comment if it follows a `UNIT` and is * equivalent to `1` if it is used alone. For examples, * `{requests}/s == 1/s`, `By{transmitted}/s == By/s`. * * `NAME` is a sequence of non-blank printable ASCII characters not * containing '{' or '}'. * * `1` represents dimensionless value 1, such as in `1/s`. * * `%` represents dimensionless value 1/100, and annotates values giving * a percentage. * * Generated from protobuf field string unit = 5; * @return string */ public function getUnit() { return $this->unit; } /** * The unit in which the metric value is reported. It is only applicable * if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The * supported units are a subset of [The Unified Code for Units of * Measure](http://unitsofmeasure.org/ucum.html) standard: * **Basic units (UNIT)** * * `bit` bit * * `By` byte * * `s` second * * `min` minute * * `h` hour * * `d` day * **Prefixes (PREFIX)** * * `k` kilo (10**3) * * `M` mega (10**6) * * `G` giga (10**9) * * `T` tera (10**12) * * `P` peta (10**15) * * `E` exa (10**18) * * `Z` zetta (10**21) * * `Y` yotta (10**24) * * `m` milli (10**-3) * * `u` micro (10**-6) * * `n` nano (10**-9) * * `p` pico (10**-12) * * `f` femto (10**-15) * * `a` atto (10**-18) * * `z` zepto (10**-21) * * `y` yocto (10**-24) * * `Ki` kibi (2**10) * * `Mi` mebi (2**20) * * `Gi` gibi (2**30) * * `Ti` tebi (2**40) * **Grammar** * The grammar also includes these connectors: * * `/` division (as an infix operator, e.g. `1/s`). * * `.` multiplication (as an infix operator, e.g. `GBy.d`) * The grammar for a unit is as follows: * Expression = Component { "." Component } { "/" Component } ; * Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ] * | Annotation * | "1" * ; * Annotation = "{" NAME "}" ; * Notes: * * `Annotation` is just a comment if it follows a `UNIT` and is * equivalent to `1` if it is used alone. For examples, * `{requests}/s == 1/s`, `By{transmitted}/s == By/s`. * * `NAME` is a sequence of non-blank printable ASCII characters not * containing '{' or '}'. * * `1` represents dimensionless value 1, such as in `1/s`. * * `%` represents dimensionless value 1/100, and annotates values giving * a percentage. * * Generated from protobuf field string unit = 5; * @param string $var * @return $this */ public function setUnit($var) { GPBUtil::checkString($var, True); $this->unit = $var; return $this; } /** * A detailed description of the metric, which can be used in documentation. * * Generated from protobuf field string description = 6; * @return string */ public function getDescription() { return $this->description; } /** * A detailed description of the metric, which can be used in documentation. * * Generated from protobuf field string description = 6; * @param string $var * @return $this */ public function setDescription($var) { GPBUtil::checkString($var, True); $this->description = $var; return $this; } /** * A concise name for the metric, which can be displayed in user interfaces. * Use sentence case without an ending period, for example "Request count". * This field is optional but it is recommended to be set for any metrics * associated with user-visible concepts, such as Quota. * * Generated from protobuf field string display_name = 7; * @return string */ public function getDisplayName() { return $this->display_name; } /** * A concise name for the metric, which can be displayed in user interfaces. * Use sentence case without an ending period, for example "Request count". * This field is optional but it is recommended to be set for any metrics * associated with user-visible concepts, such as Quota. * * Generated from protobuf field string display_name = 7; * @param string $var * @return $this */ public function setDisplayName($var) { GPBUtil::checkString($var, True); $this->display_name = $var; return $this; } } src/Api/MetricDescriptor/MetricKind.php000064400000002511151742741630014101 0ustar00google.api.MetricDescriptor.MetricKind */ class MetricKind { /** * Do not use this default value. * * Generated from protobuf enum METRIC_KIND_UNSPECIFIED = 0; */ const METRIC_KIND_UNSPECIFIED = 0; /** * An instantaneous measurement of a value. * * Generated from protobuf enum GAUGE = 1; */ const GAUGE = 1; /** * The change in a value during a time interval. * * Generated from protobuf enum DELTA = 2; */ const DELTA = 2; /** * A value accumulated over a time interval. Cumulative * measurements in a time series should have the same start time * and increasing end times, until an event resets the cumulative * value to zero and sets a new start time for the following * points. * * Generated from protobuf enum CUMULATIVE = 3; */ const CUMULATIVE = 3; } // Adding a class alias for backwards compatibility with the previous class name. class_alias(MetricKind::class, \Google\Api\MetricDescriptor_MetricKind::class); src/Api/MetricDescriptor/ValueType.php000064400000003167151742741630013776 0ustar00google.api.MetricDescriptor.ValueType */ class ValueType { /** * Do not use this default value. * * Generated from protobuf enum VALUE_TYPE_UNSPECIFIED = 0; */ const VALUE_TYPE_UNSPECIFIED = 0; /** * The value is a boolean. * This value type can be used only if the metric kind is `GAUGE`. * * Generated from protobuf enum BOOL = 1; */ const BOOL = 1; /** * The value is a signed 64-bit integer. * * Generated from protobuf enum INT64 = 2; */ const INT64 = 2; /** * The value is a double precision floating point number. * * Generated from protobuf enum DOUBLE = 3; */ const DOUBLE = 3; /** * The value is a text string. * This value type can be used only if the metric kind is `GAUGE`. * * Generated from protobuf enum STRING = 4; */ const STRING = 4; /** * The value is a [`Distribution`][google.api.Distribution]. * * Generated from protobuf enum DISTRIBUTION = 5; */ const DISTRIBUTION = 5; /** * The value is money. * * Generated from protobuf enum MONEY = 6; */ const MONEY = 6; } // Adding a class alias for backwards compatibility with the previous class name. class_alias(ValueType::class, \Google\Api\MetricDescriptor_ValueType::class); src/Api/MetricDescriptor_MetricKind.php000064400000001033151742741630014157 0ustar00google.api.MetricRule */ class MetricRule extends \Google\Protobuf\Internal\Message { /** * Selects the methods to which this rule applies. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; */ private $selector = ''; /** * Metrics to update when the selected methods are called, and the associated * cost applied to each metric. * The key of the map is the metric name, and the values are the amount * increased for the metric against which the quota limits are defined. * The value must not be negative. * * Generated from protobuf field map metric_costs = 2; */ private $metric_costs; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $selector * Selects the methods to which this rule applies. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * @type array|\Google\Protobuf\Internal\MapField $metric_costs * Metrics to update when the selected methods are called, and the associated * cost applied to each metric. * The key of the map is the metric name, and the values are the amount * increased for the metric against which the quota limits are defined. * The value must not be negative. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Quota::initOnce(); parent::__construct($data); } /** * Selects the methods to which this rule applies. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; * @return string */ public function getSelector() { return $this->selector; } /** * Selects the methods to which this rule applies. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; * @param string $var * @return $this */ public function setSelector($var) { GPBUtil::checkString($var, True); $this->selector = $var; return $this; } /** * Metrics to update when the selected methods are called, and the associated * cost applied to each metric. * The key of the map is the metric name, and the values are the amount * increased for the metric against which the quota limits are defined. * The value must not be negative. * * Generated from protobuf field map metric_costs = 2; * @return \Google\Protobuf\Internal\MapField */ public function getMetricCosts() { return $this->metric_costs; } /** * Metrics to update when the selected methods are called, and the associated * cost applied to each metric. * The key of the map is the metric name, and the values are the amount * increased for the metric against which the quota limits are defined. * The value must not be negative. * * Generated from protobuf field map metric_costs = 2; * @param array|\Google\Protobuf\Internal\MapField $var * @return $this */ public function setMetricCosts($var) { $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT64); $this->metric_costs = $arr; return $this; } } src/Api/MonitoredResource.php000064400000011554151742741630012245 0ustar00google.api.MonitoredResource */ class MonitoredResource extends \Google\Protobuf\Internal\Message { /** * Required. The monitored resource type. This field must match * the `type` field of a [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object. For * example, the type of a Compute Engine VM instance is `gce_instance`. * * Generated from protobuf field string type = 1; */ private $type = ''; /** * Required. Values for all of the labels listed in the associated monitored * resource descriptor. For example, Compute Engine VM instances use the * labels `"project_id"`, `"instance_id"`, and `"zone"`. * * Generated from protobuf field map labels = 2; */ private $labels; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $type * Required. The monitored resource type. This field must match * the `type` field of a [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object. For * example, the type of a Compute Engine VM instance is `gce_instance`. * @type array|\Google\Protobuf\Internal\MapField $labels * Required. Values for all of the labels listed in the associated monitored * resource descriptor. For example, Compute Engine VM instances use the * labels `"project_id"`, `"instance_id"`, and `"zone"`. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\MonitoredResource::initOnce(); parent::__construct($data); } /** * Required. The monitored resource type. This field must match * the `type` field of a [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object. For * example, the type of a Compute Engine VM instance is `gce_instance`. * * Generated from protobuf field string type = 1; * @return string */ public function getType() { return $this->type; } /** * Required. The monitored resource type. This field must match * the `type` field of a [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object. For * example, the type of a Compute Engine VM instance is `gce_instance`. * * Generated from protobuf field string type = 1; * @param string $var * @return $this */ public function setType($var) { GPBUtil::checkString($var, True); $this->type = $var; return $this; } /** * Required. Values for all of the labels listed in the associated monitored * resource descriptor. For example, Compute Engine VM instances use the * labels `"project_id"`, `"instance_id"`, and `"zone"`. * * Generated from protobuf field map labels = 2; * @return \Google\Protobuf\Internal\MapField */ public function getLabels() { return $this->labels; } /** * Required. Values for all of the labels listed in the associated monitored * resource descriptor. For example, Compute Engine VM instances use the * labels `"project_id"`, `"instance_id"`, and `"zone"`. * * Generated from protobuf field map labels = 2; * @param array|\Google\Protobuf\Internal\MapField $var * @return $this */ public function setLabels($var) { $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); $this->labels = $arr; return $this; } } src/Api/MonitoredResourceDescriptor.php000064400000023271151742741630014303 0ustar00google.api.MonitoredResourceDescriptor */ class MonitoredResourceDescriptor extends \Google\Protobuf\Internal\Message { /** * Optional. The resource name of the monitored resource descriptor: * `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where * {type} is the value of the `type` field in this object and * {project_id} is a project ID that provides API-specific context for * accessing the type. APIs that do not use project information can use the * resource name format `"monitoredResourceDescriptors/{type}"`. * * Generated from protobuf field string name = 5; */ private $name = ''; /** * Required. The monitored resource type. For example, the type * `"cloudsql_database"` represents databases in Google Cloud SQL. * The maximum length of this value is 256 characters. * * Generated from protobuf field string type = 1; */ private $type = ''; /** * Optional. A concise name for the monitored resource type that might be * displayed in user interfaces. It should be a Title Cased Noun Phrase, * without any article or other determiners. For example, * `"Google Cloud SQL Database"`. * * Generated from protobuf field string display_name = 2; */ private $display_name = ''; /** * Optional. A detailed description of the monitored resource type that might * be used in documentation. * * Generated from protobuf field string description = 3; */ private $description = ''; /** * Required. A set of labels used to describe instances of this monitored * resource type. For example, an individual Google Cloud SQL database is * identified by values for the labels `"database_id"` and `"zone"`. * * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 4; */ private $labels; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $name * Optional. The resource name of the monitored resource descriptor: * `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where * {type} is the value of the `type` field in this object and * {project_id} is a project ID that provides API-specific context for * accessing the type. APIs that do not use project information can use the * resource name format `"monitoredResourceDescriptors/{type}"`. * @type string $type * Required. The monitored resource type. For example, the type * `"cloudsql_database"` represents databases in Google Cloud SQL. * The maximum length of this value is 256 characters. * @type string $display_name * Optional. A concise name for the monitored resource type that might be * displayed in user interfaces. It should be a Title Cased Noun Phrase, * without any article or other determiners. For example, * `"Google Cloud SQL Database"`. * @type string $description * Optional. A detailed description of the monitored resource type that might * be used in documentation. * @type \Google\Api\LabelDescriptor[]|\Google\Protobuf\Internal\RepeatedField $labels * Required. A set of labels used to describe instances of this monitored * resource type. For example, an individual Google Cloud SQL database is * identified by values for the labels `"database_id"` and `"zone"`. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\MonitoredResource::initOnce(); parent::__construct($data); } /** * Optional. The resource name of the monitored resource descriptor: * `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where * {type} is the value of the `type` field in this object and * {project_id} is a project ID that provides API-specific context for * accessing the type. APIs that do not use project information can use the * resource name format `"monitoredResourceDescriptors/{type}"`. * * Generated from protobuf field string name = 5; * @return string */ public function getName() { return $this->name; } /** * Optional. The resource name of the monitored resource descriptor: * `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where * {type} is the value of the `type` field in this object and * {project_id} is a project ID that provides API-specific context for * accessing the type. APIs that do not use project information can use the * resource name format `"monitoredResourceDescriptors/{type}"`. * * Generated from protobuf field string name = 5; * @param string $var * @return $this */ public function setName($var) { GPBUtil::checkString($var, True); $this->name = $var; return $this; } /** * Required. The monitored resource type. For example, the type * `"cloudsql_database"` represents databases in Google Cloud SQL. * The maximum length of this value is 256 characters. * * Generated from protobuf field string type = 1; * @return string */ public function getType() { return $this->type; } /** * Required. The monitored resource type. For example, the type * `"cloudsql_database"` represents databases in Google Cloud SQL. * The maximum length of this value is 256 characters. * * Generated from protobuf field string type = 1; * @param string $var * @return $this */ public function setType($var) { GPBUtil::checkString($var, True); $this->type = $var; return $this; } /** * Optional. A concise name for the monitored resource type that might be * displayed in user interfaces. It should be a Title Cased Noun Phrase, * without any article or other determiners. For example, * `"Google Cloud SQL Database"`. * * Generated from protobuf field string display_name = 2; * @return string */ public function getDisplayName() { return $this->display_name; } /** * Optional. A concise name for the monitored resource type that might be * displayed in user interfaces. It should be a Title Cased Noun Phrase, * without any article or other determiners. For example, * `"Google Cloud SQL Database"`. * * Generated from protobuf field string display_name = 2; * @param string $var * @return $this */ public function setDisplayName($var) { GPBUtil::checkString($var, True); $this->display_name = $var; return $this; } /** * Optional. A detailed description of the monitored resource type that might * be used in documentation. * * Generated from protobuf field string description = 3; * @return string */ public function getDescription() { return $this->description; } /** * Optional. A detailed description of the monitored resource type that might * be used in documentation. * * Generated from protobuf field string description = 3; * @param string $var * @return $this */ public function setDescription($var) { GPBUtil::checkString($var, True); $this->description = $var; return $this; } /** * Required. A set of labels used to describe instances of this monitored * resource type. For example, an individual Google Cloud SQL database is * identified by values for the labels `"database_id"` and `"zone"`. * * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 4; * @return \Google\Protobuf\Internal\RepeatedField */ public function getLabels() { return $this->labels; } /** * Required. A set of labels used to describe instances of this monitored * resource type. For example, an individual Google Cloud SQL database is * identified by values for the labels `"database_id"` and `"zone"`. * * Generated from protobuf field repeated .google.api.LabelDescriptor labels = 4; * @param \Google\Api\LabelDescriptor[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setLabels($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\LabelDescriptor::class); $this->labels = $arr; return $this; } } src/Api/MonitoredResourceMetadata.php000064400000012572151742741630013707 0ustar00google.api.MonitoredResourceMetadata */ class MonitoredResourceMetadata extends \Google\Protobuf\Internal\Message { /** * Output only. Values for predefined system metadata labels. * System labels are a kind of metadata extracted by Google Stackdriver. * Stackdriver determines what system labels are useful and how to obtain * their values. Some examples: "machine_image", "vpc", "subnet_id", * "security_group", "name", etc. * System label values can be only strings, Boolean values, or a list of * strings. For example: * { "name": "my-test-instance", * "security_group": ["a", "b", "c"], * "spot_instance": false } * * Generated from protobuf field .google.protobuf.Struct system_labels = 1; */ private $system_labels = null; /** * Output only. A map of user-defined metadata labels. * * Generated from protobuf field map user_labels = 2; */ private $user_labels; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Protobuf\Struct $system_labels * Output only. Values for predefined system metadata labels. * System labels are a kind of metadata extracted by Google Stackdriver. * Stackdriver determines what system labels are useful and how to obtain * their values. Some examples: "machine_image", "vpc", "subnet_id", * "security_group", "name", etc. * System label values can be only strings, Boolean values, or a list of * strings. For example: * { "name": "my-test-instance", * "security_group": ["a", "b", "c"], * "spot_instance": false } * @type array|\Google\Protobuf\Internal\MapField $user_labels * Output only. A map of user-defined metadata labels. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\MonitoredResource::initOnce(); parent::__construct($data); } /** * Output only. Values for predefined system metadata labels. * System labels are a kind of metadata extracted by Google Stackdriver. * Stackdriver determines what system labels are useful and how to obtain * their values. Some examples: "machine_image", "vpc", "subnet_id", * "security_group", "name", etc. * System label values can be only strings, Boolean values, or a list of * strings. For example: * { "name": "my-test-instance", * "security_group": ["a", "b", "c"], * "spot_instance": false } * * Generated from protobuf field .google.protobuf.Struct system_labels = 1; * @return \Google\Protobuf\Struct */ public function getSystemLabels() { return $this->system_labels; } /** * Output only. Values for predefined system metadata labels. * System labels are a kind of metadata extracted by Google Stackdriver. * Stackdriver determines what system labels are useful and how to obtain * their values. Some examples: "machine_image", "vpc", "subnet_id", * "security_group", "name", etc. * System label values can be only strings, Boolean values, or a list of * strings. For example: * { "name": "my-test-instance", * "security_group": ["a", "b", "c"], * "spot_instance": false } * * Generated from protobuf field .google.protobuf.Struct system_labels = 1; * @param \Google\Protobuf\Struct $var * @return $this */ public function setSystemLabels($var) { GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); $this->system_labels = $var; return $this; } /** * Output only. A map of user-defined metadata labels. * * Generated from protobuf field map user_labels = 2; * @return \Google\Protobuf\Internal\MapField */ public function getUserLabels() { return $this->user_labels; } /** * Output only. A map of user-defined metadata labels. * * Generated from protobuf field map user_labels = 2; * @param array|\Google\Protobuf\Internal\MapField $var * @return $this */ public function setUserLabels($var) { $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); $this->user_labels = $arr; return $this; } } src/Api/Monitoring.php000064400000014751151742741630010724 0ustar00google.api.Monitoring */ class Monitoring extends \Google\Protobuf\Internal\Message { /** * Monitoring configurations for sending metrics to the producer project. * There can be multiple producer destinations, each one must have a * different monitored resource type. A metric can be used in at most * one producer destination. * * Generated from protobuf field repeated .google.api.Monitoring.MonitoringDestination producer_destinations = 1; */ private $producer_destinations; /** * Monitoring configurations for sending metrics to the consumer project. * There can be multiple consumer destinations, each one must have a * different monitored resource type. A metric can be used in at most * one consumer destination. * * Generated from protobuf field repeated .google.api.Monitoring.MonitoringDestination consumer_destinations = 2; */ private $consumer_destinations; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Api\Monitoring\MonitoringDestination[]|\Google\Protobuf\Internal\RepeatedField $producer_destinations * Monitoring configurations for sending metrics to the producer project. * There can be multiple producer destinations, each one must have a * different monitored resource type. A metric can be used in at most * one producer destination. * @type \Google\Api\Monitoring\MonitoringDestination[]|\Google\Protobuf\Internal\RepeatedField $consumer_destinations * Monitoring configurations for sending metrics to the consumer project. * There can be multiple consumer destinations, each one must have a * different monitored resource type. A metric can be used in at most * one consumer destination. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Monitoring::initOnce(); parent::__construct($data); } /** * Monitoring configurations for sending metrics to the producer project. * There can be multiple producer destinations, each one must have a * different monitored resource type. A metric can be used in at most * one producer destination. * * Generated from protobuf field repeated .google.api.Monitoring.MonitoringDestination producer_destinations = 1; * @return \Google\Protobuf\Internal\RepeatedField */ public function getProducerDestinations() { return $this->producer_destinations; } /** * Monitoring configurations for sending metrics to the producer project. * There can be multiple producer destinations, each one must have a * different monitored resource type. A metric can be used in at most * one producer destination. * * Generated from protobuf field repeated .google.api.Monitoring.MonitoringDestination producer_destinations = 1; * @param \Google\Api\Monitoring\MonitoringDestination[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setProducerDestinations($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Monitoring\MonitoringDestination::class); $this->producer_destinations = $arr; return $this; } /** * Monitoring configurations for sending metrics to the consumer project. * There can be multiple consumer destinations, each one must have a * different monitored resource type. A metric can be used in at most * one consumer destination. * * Generated from protobuf field repeated .google.api.Monitoring.MonitoringDestination consumer_destinations = 2; * @return \Google\Protobuf\Internal\RepeatedField */ public function getConsumerDestinations() { return $this->consumer_destinations; } /** * Monitoring configurations for sending metrics to the consumer project. * There can be multiple consumer destinations, each one must have a * different monitored resource type. A metric can be used in at most * one consumer destination. * * Generated from protobuf field repeated .google.api.Monitoring.MonitoringDestination consumer_destinations = 2; * @param \Google\Api\Monitoring\MonitoringDestination[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setConsumerDestinations($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Monitoring\MonitoringDestination::class); $this->consumer_destinations = $arr; return $this; } } src/Api/Monitoring/MonitoringDestination.php000064400000007412151742741630015247 0ustar00google.api.Monitoring.MonitoringDestination */ class MonitoringDestination extends \Google\Protobuf\Internal\Message { /** * The monitored resource type. The type must be defined in * [Service.monitored_resources][google.api.Service.monitored_resources] section. * * Generated from protobuf field string monitored_resource = 1; */ private $monitored_resource = ''; /** * Names of the metrics to report to this monitoring destination. * Each name must be defined in [Service.metrics][google.api.Service.metrics] section. * * Generated from protobuf field repeated string metrics = 2; */ private $metrics; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $monitored_resource * The monitored resource type. The type must be defined in * [Service.monitored_resources][google.api.Service.monitored_resources] section. * @type string[]|\Google\Protobuf\Internal\RepeatedField $metrics * Names of the metrics to report to this monitoring destination. * Each name must be defined in [Service.metrics][google.api.Service.metrics] section. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Monitoring::initOnce(); parent::__construct($data); } /** * The monitored resource type. The type must be defined in * [Service.monitored_resources][google.api.Service.monitored_resources] section. * * Generated from protobuf field string monitored_resource = 1; * @return string */ public function getMonitoredResource() { return $this->monitored_resource; } /** * The monitored resource type. The type must be defined in * [Service.monitored_resources][google.api.Service.monitored_resources] section. * * Generated from protobuf field string monitored_resource = 1; * @param string $var * @return $this */ public function setMonitoredResource($var) { GPBUtil::checkString($var, True); $this->monitored_resource = $var; return $this; } /** * Names of the metrics to report to this monitoring destination. * Each name must be defined in [Service.metrics][google.api.Service.metrics] section. * * Generated from protobuf field repeated string metrics = 2; * @return \Google\Protobuf\Internal\RepeatedField */ public function getMetrics() { return $this->metrics; } /** * Names of the metrics to report to this monitoring destination. * Each name must be defined in [Service.metrics][google.api.Service.metrics] section. * * Generated from protobuf field repeated string metrics = 2; * @param string[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setMetrics($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->metrics = $arr; return $this; } } // Adding a class alias for backwards compatibility with the previous class name. class_alias(MonitoringDestination::class, \Google\Api\Monitoring_MonitoringDestination::class); src/Api/Monitoring_MonitoringDestination.php000064400000001070151742741630015321 0ustar00google.api.OAuthRequirements */ class OAuthRequirements extends \Google\Protobuf\Internal\Message { /** * The list of publicly documented OAuth scopes that are allowed access. An * OAuth token containing any of these scopes will be accepted. * Example: * canonical_scopes: https://www.googleapis.com/auth/calendar, * https://www.googleapis.com/auth/calendar.read * * Generated from protobuf field string canonical_scopes = 1; */ private $canonical_scopes = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $canonical_scopes * The list of publicly documented OAuth scopes that are allowed access. An * OAuth token containing any of these scopes will be accepted. * Example: * canonical_scopes: https://www.googleapis.com/auth/calendar, * https://www.googleapis.com/auth/calendar.read * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Auth::initOnce(); parent::__construct($data); } /** * The list of publicly documented OAuth scopes that are allowed access. An * OAuth token containing any of these scopes will be accepted. * Example: * canonical_scopes: https://www.googleapis.com/auth/calendar, * https://www.googleapis.com/auth/calendar.read * * Generated from protobuf field string canonical_scopes = 1; * @return string */ public function getCanonicalScopes() { return $this->canonical_scopes; } /** * The list of publicly documented OAuth scopes that are allowed access. An * OAuth token containing any of these scopes will be accepted. * Example: * canonical_scopes: https://www.googleapis.com/auth/calendar, * https://www.googleapis.com/auth/calendar.read * * Generated from protobuf field string canonical_scopes = 1; * @param string $var * @return $this */ public function setCanonicalScopes($var) { GPBUtil::checkString($var, True); $this->canonical_scopes = $var; return $this; } } src/Api/Page.php000064400000015274151742741630007454 0ustar00google.api.Page */ class Page extends \Google\Protobuf\Internal\Message { /** * The name of the page. It will be used as an identity of the page to * generate URI of the page, text of the link to this page in navigation, * etc. The full page name (start from the root page name to this page * concatenated with `.`) can be used as reference to the page in your * documentation. For example: *
pages:
     * - name: Tutorial
     *   content: (== include tutorial.md ==)
     *   subpages:
     *   - name: Java
     *     content: (== include tutorial_java.md ==)
     * 
* You can reference `Java` page using Markdown reference link syntax: * `[Java][Tutorial.Java]`. * * Generated from protobuf field string name = 1; */ private $name = ''; /** * The Markdown content of the page. You can use (== include {path} ==) * to include content from a Markdown file. * * Generated from protobuf field string content = 2; */ private $content = ''; /** * Subpages of this page. The order of subpages specified here will be * honored in the generated docset. * * Generated from protobuf field repeated .google.api.Page subpages = 3; */ private $subpages; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $name * The name of the page. It will be used as an identity of the page to * generate URI of the page, text of the link to this page in navigation, * etc. The full page name (start from the root page name to this page * concatenated with `.`) can be used as reference to the page in your * documentation. For example: *
pages:
     *           - name: Tutorial
     *             content: (== include tutorial.md ==)
     *             subpages:
     *             - name: Java
     *               content: (== include tutorial_java.md ==)
     *           
* You can reference `Java` page using Markdown reference link syntax: * `[Java][Tutorial.Java]`. * @type string $content * The Markdown content of the page. You can use (== include {path} ==) * to include content from a Markdown file. * @type \Google\Api\Page[]|\Google\Protobuf\Internal\RepeatedField $subpages * Subpages of this page. The order of subpages specified here will be * honored in the generated docset. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Documentation::initOnce(); parent::__construct($data); } /** * The name of the page. It will be used as an identity of the page to * generate URI of the page, text of the link to this page in navigation, * etc. The full page name (start from the root page name to this page * concatenated with `.`) can be used as reference to the page in your * documentation. For example: *
pages:
     * - name: Tutorial
     *   content: (== include tutorial.md ==)
     *   subpages:
     *   - name: Java
     *     content: (== include tutorial_java.md ==)
     * 
* You can reference `Java` page using Markdown reference link syntax: * `[Java][Tutorial.Java]`. * * Generated from protobuf field string name = 1; * @return string */ public function getName() { return $this->name; } /** * The name of the page. It will be used as an identity of the page to * generate URI of the page, text of the link to this page in navigation, * etc. The full page name (start from the root page name to this page * concatenated with `.`) can be used as reference to the page in your * documentation. For example: *
pages:
     * - name: Tutorial
     *   content: (== include tutorial.md ==)
     *   subpages:
     *   - name: Java
     *     content: (== include tutorial_java.md ==)
     * 
* You can reference `Java` page using Markdown reference link syntax: * `[Java][Tutorial.Java]`. * * 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; } /** * The Markdown content of the page. You can use (== include {path} ==) * to include content from a Markdown file. * * Generated from protobuf field string content = 2; * @return string */ public function getContent() { return $this->content; } /** * The Markdown content of the page. You can use (== include {path} ==) * to include content from a Markdown file. * * Generated from protobuf field string content = 2; * @param string $var * @return $this */ public function setContent($var) { GPBUtil::checkString($var, True); $this->content = $var; return $this; } /** * Subpages of this page. The order of subpages specified here will be * honored in the generated docset. * * Generated from protobuf field repeated .google.api.Page subpages = 3; * @return \Google\Protobuf\Internal\RepeatedField */ public function getSubpages() { return $this->subpages; } /** * Subpages of this page. The order of subpages specified here will be * honored in the generated docset. * * Generated from protobuf field repeated .google.api.Page subpages = 3; * @param \Google\Api\Page[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setSubpages($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Page::class); $this->subpages = $arr; return $this; } } src/Api/ProjectProperties.php000064400000005051151742741630012253 0ustar00google.api.ProjectProperties */ class ProjectProperties extends \Google\Protobuf\Internal\Message { /** * List of per consumer project-specific properties. * * Generated from protobuf field repeated .google.api.Property properties = 1; */ private $properties; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Api\Property[]|\Google\Protobuf\Internal\RepeatedField $properties * List of per consumer project-specific properties. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Consumer::initOnce(); parent::__construct($data); } /** * List of per consumer project-specific properties. * * Generated from protobuf field repeated .google.api.Property properties = 1; * @return \Google\Protobuf\Internal\RepeatedField */ public function getProperties() { return $this->properties; } /** * List of per consumer project-specific properties. * * Generated from protobuf field repeated .google.api.Property properties = 1; * @param \Google\Api\Property[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setProperties($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Property::class); $this->properties = $arr; return $this; } } src/Api/Property.php000064400000007075151742741630010424 0ustar00google.api.Property */ class Property extends \Google\Protobuf\Internal\Message { /** * The name of the property (a.k.a key). * * Generated from protobuf field string name = 1; */ private $name = ''; /** * The type of this property. * * Generated from protobuf field .google.api.Property.PropertyType type = 2; */ private $type = 0; /** * The description of the property * * Generated from protobuf field string description = 3; */ private $description = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $name * The name of the property (a.k.a key). * @type int $type * The type of this property. * @type string $description * The description of the property * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Consumer::initOnce(); parent::__construct($data); } /** * The name of the property (a.k.a key). * * Generated from protobuf field string name = 1; * @return string */ public function getName() { return $this->name; } /** * The name of the property (a.k.a key). * * 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; } /** * The type of this property. * * Generated from protobuf field .google.api.Property.PropertyType type = 2; * @return int */ public function getType() { return $this->type; } /** * The type of this property. * * Generated from protobuf field .google.api.Property.PropertyType type = 2; * @param int $var * @return $this */ public function setType($var) { GPBUtil::checkEnum($var, \Google\Api\Property_PropertyType::class); $this->type = $var; return $this; } /** * The description of the property * * Generated from protobuf field string description = 3; * @return string */ public function getDescription() { return $this->description; } /** * The description of the property * * Generated from protobuf field string description = 3; * @param string $var * @return $this */ public function setDescription($var) { GPBUtil::checkString($var, True); $this->description = $var; return $this; } } src/Api/Property/PropertyType.php000064400000002171151742741630013102 0ustar00google.api.Property.PropertyType */ class PropertyType { /** * The type is unspecified, and will result in an error. * * Generated from protobuf enum UNSPECIFIED = 0; */ const UNSPECIFIED = 0; /** * The type is `int64`. * * Generated from protobuf enum INT64 = 1; */ const INT64 = 1; /** * The type is `bool`. * * Generated from protobuf enum BOOL = 2; */ const BOOL = 2; /** * The type is `string`. * * Generated from protobuf enum STRING = 3; */ const STRING = 3; /** * The type is 'double'. * * Generated from protobuf enum DOUBLE = 4; */ const DOUBLE = 4; } // Adding a class alias for backwards compatibility with the previous class name. class_alias(PropertyType::class, \Google\Api\Property_PropertyType::class); src/Api/Property_PropertyType.php000064400000000777151742741630013174 0ustar00google.api.Quota */ class Quota extends \Google\Protobuf\Internal\Message { /** * List of `QuotaLimit` definitions for the service. * Used by metric-based quotas only. * * Generated from protobuf field repeated .google.api.QuotaLimit limits = 3; */ private $limits; /** * List of `MetricRule` definitions, each one mapping a selected method to one * or more metrics. * Used by metric-based quotas only. * * Generated from protobuf field repeated .google.api.MetricRule metric_rules = 4; */ private $metric_rules; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Api\QuotaLimit[]|\Google\Protobuf\Internal\RepeatedField $limits * List of `QuotaLimit` definitions for the service. * Used by metric-based quotas only. * @type \Google\Api\MetricRule[]|\Google\Protobuf\Internal\RepeatedField $metric_rules * List of `MetricRule` definitions, each one mapping a selected method to one * or more metrics. * Used by metric-based quotas only. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Quota::initOnce(); parent::__construct($data); } /** * List of `QuotaLimit` definitions for the service. * Used by metric-based quotas only. * * Generated from protobuf field repeated .google.api.QuotaLimit limits = 3; * @return \Google\Protobuf\Internal\RepeatedField */ public function getLimits() { return $this->limits; } /** * List of `QuotaLimit` definitions for the service. * Used by metric-based quotas only. * * Generated from protobuf field repeated .google.api.QuotaLimit limits = 3; * @param \Google\Api\QuotaLimit[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setLimits($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\QuotaLimit::class); $this->limits = $arr; return $this; } /** * List of `MetricRule` definitions, each one mapping a selected method to one * or more metrics. * Used by metric-based quotas only. * * Generated from protobuf field repeated .google.api.MetricRule metric_rules = 4; * @return \Google\Protobuf\Internal\RepeatedField */ public function getMetricRules() { return $this->metric_rules; } /** * List of `MetricRule` definitions, each one mapping a selected method to one * or more metrics. * Used by metric-based quotas only. * * Generated from protobuf field repeated .google.api.MetricRule metric_rules = 4; * @param \Google\Api\MetricRule[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setMetricRules($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MetricRule::class); $this->metric_rules = $arr; return $this; } } src/Api/QuotaLimit.php000064400000105215151742741630010663 0ustar00google.api.QuotaLimit */ class QuotaLimit extends \Google\Protobuf\Internal\Message { /** * Name of the quota limit. The name is used to refer to the limit when * overriding the default limit on per-consumer basis. * For group-based quota limits, the name must be unique within the quota * group. If a name is not provided, it will be generated from the limit_by * and duration fields. * For metric-based quota limits, the name must be provided, and it must be * unique within the service. The name can only include alphanumeric * characters as well as '-'. * The maximum length of the limit name is 64 characters. * The name of a limit is used as a unique identifier for this limit. * Therefore, once a limit has been put into use, its name should be * immutable. You can use the display_name field to provide a user-friendly * name for the limit. The display name can be evolved over time without * affecting the identity of the limit. * * Generated from protobuf field string name = 6; */ private $name = ''; /** * Optional. User-visible, extended description for this quota limit. * Should be used only when more context is needed to understand this limit * than provided by the limit's display name (see: `display_name`). * * Generated from protobuf field string description = 2; */ private $description = ''; /** * Default number of tokens that can be consumed during the specified * duration. This is the number of tokens assigned when a client * application developer activates the service for his/her project. * Specifying a value of 0 will block all requests. This can be used if you * are provisioning quota to selected consumers and blocking others. * Similarly, a value of -1 will indicate an unlimited quota. No other * negative values are allowed. * Used by group-based quotas only. * * Generated from protobuf field int64 default_limit = 3; */ private $default_limit = 0; /** * Maximum number of tokens that can be consumed during the specified * duration. Client application developers can override the default limit up * to this maximum. If specified, this value cannot be set to a value less * than the default limit. If not specified, it is set to the default limit. * To allow clients to apply overrides with no upper bound, set this to -1, * indicating unlimited maximum quota. * Used by group-based quotas only. * * Generated from protobuf field int64 max_limit = 4; */ private $max_limit = 0; /** * Free tier value displayed in the Developers Console for this limit. * The free tier is the number of tokens that will be subtracted from the * billed amount when billing is enabled. * This field can only be set on a limit with duration "1d", in a billable * group; it is invalid on any other limit. If this field is not set, it * defaults to 0, indicating that there is no free tier for this service. * Used by group-based quotas only. * * Generated from protobuf field int64 free_tier = 7; */ private $free_tier = 0; /** * Duration of this limit in textual notation. Example: "100s", "24h", "1d". * For duration longer than a day, only multiple of days is supported. We * support only "100s" and "1d" for now. Additional support will be added in * the future. "0" indicates indefinite duration. * Used by group-based quotas only. * * Generated from protobuf field string duration = 5; */ private $duration = ''; /** * The name of the metric this quota limit applies to. The quota limits with * the same metric will be checked together during runtime. The metric must be * defined within the service config. * Used by metric-based quotas only. * * Generated from protobuf field string metric = 8; */ private $metric = ''; /** * Specify the unit of the quota limit. It uses the same syntax as * [Metric.unit][]. The supported unit kinds are determined by the quota * backend system. * The [Google Service Control](https://cloud.google.com/service-control) * supports the following unit components: * * One of the time intevals: * * "/min" for quota every minute. * * "/d" for quota every 24 hours, starting 00:00 US Pacific Time. * * Otherwise the quota won't be reset by time, such as storage limit. * * One and only one of the granted containers: * * "/{organization}" quota for an organization. * * "/{project}" quota for a project. * * "/{folder}" quota for a folder. * * "/{resource}" quota for a universal resource. * * Zero or more quota segmentation dimension. Not all combos are valid. * * "/{region}" quota for every region. Not to be used with time intervals. * * Otherwise the resources granted on the target is not segmented. * * "/{zone}" quota for every zone. Not to be used with time intervals. * * Otherwise the resources granted on the target is not segmented. * * "/{resource}" quota for a resource associated with a project or org. * Here are some examples: * * "1/min/{project}" for quota per minute per project. * * "1/min/{user}" for quota per minute per user. * * "1/min/{organization}" for quota per minute per organization. * Note: the order of unit components is insignificant. * The "1" at the beginning is required to follow the metric unit syntax. * Used by metric-based quotas only. * * Generated from protobuf field string unit = 9; */ private $unit = ''; /** * Tiered limit values. Also allows for regional or zone overrides for these * values if "/{region}" or "/{zone}" is specified in the unit field. * Currently supported tiers from low to high: * VERY_LOW, LOW, STANDARD, HIGH, VERY_HIGH * To apply different limit values for users according to their tiers, specify * the values for the tiers you want to differentiate. For example: * {LOW:100, STANDARD:500, HIGH:1000, VERY_HIGH:5000} * The limit value for each tier is optional except for the tier STANDARD. * The limit value for an unspecified tier falls to the value of its next * tier towards tier STANDARD. For the above example, the limit value for tier * STANDARD is 500. * To apply the same limit value for all users, just specify limit value for * tier STANDARD. For example: {STANDARD:500}. * To apply a regional overide for a tier, add a map entry with key * "/", where is a region name. Similarly, for a zone * override, add a map entry with key "/{zone}". * Further, a wildcard can be used at the end of a zone name in order to * specify zone level overrides. For example: * LOW: 10, STANDARD: 50, HIGH: 100, * LOW/us-central1: 20, STANDARD/us-central1: 60, HIGH/us-central1: 200, * LOW/us-central1-*: 10, STANDARD/us-central1-*: 20, HIGH/us-central1-*: 80 * The regional overrides tier set for each region must be the same as * the tier set for default limit values. Same rule applies for zone overrides * tier as well. * Used by metric-based quotas only. * * Generated from protobuf field map values = 10; */ private $values; /** * User-visible display name for this limit. * Optional. If not set, the UI will provide a default display name based on * the quota configuration. This field can be used to override the default * display name generated from the configuration. * * Generated from protobuf field string display_name = 12; */ private $display_name = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $name * Name of the quota limit. The name is used to refer to the limit when * overriding the default limit on per-consumer basis. * For group-based quota limits, the name must be unique within the quota * group. If a name is not provided, it will be generated from the limit_by * and duration fields. * For metric-based quota limits, the name must be provided, and it must be * unique within the service. The name can only include alphanumeric * characters as well as '-'. * The maximum length of the limit name is 64 characters. * The name of a limit is used as a unique identifier for this limit. * Therefore, once a limit has been put into use, its name should be * immutable. You can use the display_name field to provide a user-friendly * name for the limit. The display name can be evolved over time without * affecting the identity of the limit. * @type string $description * Optional. User-visible, extended description for this quota limit. * Should be used only when more context is needed to understand this limit * than provided by the limit's display name (see: `display_name`). * @type int|string $default_limit * Default number of tokens that can be consumed during the specified * duration. This is the number of tokens assigned when a client * application developer activates the service for his/her project. * Specifying a value of 0 will block all requests. This can be used if you * are provisioning quota to selected consumers and blocking others. * Similarly, a value of -1 will indicate an unlimited quota. No other * negative values are allowed. * Used by group-based quotas only. * @type int|string $max_limit * Maximum number of tokens that can be consumed during the specified * duration. Client application developers can override the default limit up * to this maximum. If specified, this value cannot be set to a value less * than the default limit. If not specified, it is set to the default limit. * To allow clients to apply overrides with no upper bound, set this to -1, * indicating unlimited maximum quota. * Used by group-based quotas only. * @type int|string $free_tier * Free tier value displayed in the Developers Console for this limit. * The free tier is the number of tokens that will be subtracted from the * billed amount when billing is enabled. * This field can only be set on a limit with duration "1d", in a billable * group; it is invalid on any other limit. If this field is not set, it * defaults to 0, indicating that there is no free tier for this service. * Used by group-based quotas only. * @type string $duration * Duration of this limit in textual notation. Example: "100s", "24h", "1d". * For duration longer than a day, only multiple of days is supported. We * support only "100s" and "1d" for now. Additional support will be added in * the future. "0" indicates indefinite duration. * Used by group-based quotas only. * @type string $metric * The name of the metric this quota limit applies to. The quota limits with * the same metric will be checked together during runtime. The metric must be * defined within the service config. * Used by metric-based quotas only. * @type string $unit * Specify the unit of the quota limit. It uses the same syntax as * [Metric.unit][]. The supported unit kinds are determined by the quota * backend system. * The [Google Service Control](https://cloud.google.com/service-control) * supports the following unit components: * * One of the time intevals: * * "/min" for quota every minute. * * "/d" for quota every 24 hours, starting 00:00 US Pacific Time. * * Otherwise the quota won't be reset by time, such as storage limit. * * One and only one of the granted containers: * * "/{organization}" quota for an organization. * * "/{project}" quota for a project. * * "/{folder}" quota for a folder. * * "/{resource}" quota for a universal resource. * * Zero or more quota segmentation dimension. Not all combos are valid. * * "/{region}" quota for every region. Not to be used with time intervals. * * Otherwise the resources granted on the target is not segmented. * * "/{zone}" quota for every zone. Not to be used with time intervals. * * Otherwise the resources granted on the target is not segmented. * * "/{resource}" quota for a resource associated with a project or org. * Here are some examples: * * "1/min/{project}" for quota per minute per project. * * "1/min/{user}" for quota per minute per user. * * "1/min/{organization}" for quota per minute per organization. * Note: the order of unit components is insignificant. * The "1" at the beginning is required to follow the metric unit syntax. * Used by metric-based quotas only. * @type array|\Google\Protobuf\Internal\MapField $values * Tiered limit values. Also allows for regional or zone overrides for these * values if "/{region}" or "/{zone}" is specified in the unit field. * Currently supported tiers from low to high: * VERY_LOW, LOW, STANDARD, HIGH, VERY_HIGH * To apply different limit values for users according to their tiers, specify * the values for the tiers you want to differentiate. For example: * {LOW:100, STANDARD:500, HIGH:1000, VERY_HIGH:5000} * The limit value for each tier is optional except for the tier STANDARD. * The limit value for an unspecified tier falls to the value of its next * tier towards tier STANDARD. For the above example, the limit value for tier * STANDARD is 500. * To apply the same limit value for all users, just specify limit value for * tier STANDARD. For example: {STANDARD:500}. * To apply a regional overide for a tier, add a map entry with key * "/", where is a region name. Similarly, for a zone * override, add a map entry with key "/{zone}". * Further, a wildcard can be used at the end of a zone name in order to * specify zone level overrides. For example: * LOW: 10, STANDARD: 50, HIGH: 100, * LOW/us-central1: 20, STANDARD/us-central1: 60, HIGH/us-central1: 200, * LOW/us-central1-*: 10, STANDARD/us-central1-*: 20, HIGH/us-central1-*: 80 * The regional overrides tier set for each region must be the same as * the tier set for default limit values. Same rule applies for zone overrides * tier as well. * Used by metric-based quotas only. * @type string $display_name * User-visible display name for this limit. * Optional. If not set, the UI will provide a default display name based on * the quota configuration. This field can be used to override the default * display name generated from the configuration. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Quota::initOnce(); parent::__construct($data); } /** * Name of the quota limit. The name is used to refer to the limit when * overriding the default limit on per-consumer basis. * For group-based quota limits, the name must be unique within the quota * group. If a name is not provided, it will be generated from the limit_by * and duration fields. * For metric-based quota limits, the name must be provided, and it must be * unique within the service. The name can only include alphanumeric * characters as well as '-'. * The maximum length of the limit name is 64 characters. * The name of a limit is used as a unique identifier for this limit. * Therefore, once a limit has been put into use, its name should be * immutable. You can use the display_name field to provide a user-friendly * name for the limit. The display name can be evolved over time without * affecting the identity of the limit. * * Generated from protobuf field string name = 6; * @return string */ public function getName() { return $this->name; } /** * Name of the quota limit. The name is used to refer to the limit when * overriding the default limit on per-consumer basis. * For group-based quota limits, the name must be unique within the quota * group. If a name is not provided, it will be generated from the limit_by * and duration fields. * For metric-based quota limits, the name must be provided, and it must be * unique within the service. The name can only include alphanumeric * characters as well as '-'. * The maximum length of the limit name is 64 characters. * The name of a limit is used as a unique identifier for this limit. * Therefore, once a limit has been put into use, its name should be * immutable. You can use the display_name field to provide a user-friendly * name for the limit. The display name can be evolved over time without * affecting the identity of the limit. * * Generated from protobuf field string name = 6; * @param string $var * @return $this */ public function setName($var) { GPBUtil::checkString($var, True); $this->name = $var; return $this; } /** * Optional. User-visible, extended description for this quota limit. * Should be used only when more context is needed to understand this limit * than provided by the limit's display name (see: `display_name`). * * Generated from protobuf field string description = 2; * @return string */ public function getDescription() { return $this->description; } /** * Optional. User-visible, extended description for this quota limit. * Should be used only when more context is needed to understand this limit * than provided by the limit's display name (see: `display_name`). * * Generated from protobuf field string description = 2; * @param string $var * @return $this */ public function setDescription($var) { GPBUtil::checkString($var, True); $this->description = $var; return $this; } /** * Default number of tokens that can be consumed during the specified * duration. This is the number of tokens assigned when a client * application developer activates the service for his/her project. * Specifying a value of 0 will block all requests. This can be used if you * are provisioning quota to selected consumers and blocking others. * Similarly, a value of -1 will indicate an unlimited quota. No other * negative values are allowed. * Used by group-based quotas only. * * Generated from protobuf field int64 default_limit = 3; * @return int|string */ public function getDefaultLimit() { return $this->default_limit; } /** * Default number of tokens that can be consumed during the specified * duration. This is the number of tokens assigned when a client * application developer activates the service for his/her project. * Specifying a value of 0 will block all requests. This can be used if you * are provisioning quota to selected consumers and blocking others. * Similarly, a value of -1 will indicate an unlimited quota. No other * negative values are allowed. * Used by group-based quotas only. * * Generated from protobuf field int64 default_limit = 3; * @param int|string $var * @return $this */ public function setDefaultLimit($var) { GPBUtil::checkInt64($var); $this->default_limit = $var; return $this; } /** * Maximum number of tokens that can be consumed during the specified * duration. Client application developers can override the default limit up * to this maximum. If specified, this value cannot be set to a value less * than the default limit. If not specified, it is set to the default limit. * To allow clients to apply overrides with no upper bound, set this to -1, * indicating unlimited maximum quota. * Used by group-based quotas only. * * Generated from protobuf field int64 max_limit = 4; * @return int|string */ public function getMaxLimit() { return $this->max_limit; } /** * Maximum number of tokens that can be consumed during the specified * duration. Client application developers can override the default limit up * to this maximum. If specified, this value cannot be set to a value less * than the default limit. If not specified, it is set to the default limit. * To allow clients to apply overrides with no upper bound, set this to -1, * indicating unlimited maximum quota. * Used by group-based quotas only. * * Generated from protobuf field int64 max_limit = 4; * @param int|string $var * @return $this */ public function setMaxLimit($var) { GPBUtil::checkInt64($var); $this->max_limit = $var; return $this; } /** * Free tier value displayed in the Developers Console for this limit. * The free tier is the number of tokens that will be subtracted from the * billed amount when billing is enabled. * This field can only be set on a limit with duration "1d", in a billable * group; it is invalid on any other limit. If this field is not set, it * defaults to 0, indicating that there is no free tier for this service. * Used by group-based quotas only. * * Generated from protobuf field int64 free_tier = 7; * @return int|string */ public function getFreeTier() { return $this->free_tier; } /** * Free tier value displayed in the Developers Console for this limit. * The free tier is the number of tokens that will be subtracted from the * billed amount when billing is enabled. * This field can only be set on a limit with duration "1d", in a billable * group; it is invalid on any other limit. If this field is not set, it * defaults to 0, indicating that there is no free tier for this service. * Used by group-based quotas only. * * Generated from protobuf field int64 free_tier = 7; * @param int|string $var * @return $this */ public function setFreeTier($var) { GPBUtil::checkInt64($var); $this->free_tier = $var; return $this; } /** * Duration of this limit in textual notation. Example: "100s", "24h", "1d". * For duration longer than a day, only multiple of days is supported. We * support only "100s" and "1d" for now. Additional support will be added in * the future. "0" indicates indefinite duration. * Used by group-based quotas only. * * Generated from protobuf field string duration = 5; * @return string */ public function getDuration() { return $this->duration; } /** * Duration of this limit in textual notation. Example: "100s", "24h", "1d". * For duration longer than a day, only multiple of days is supported. We * support only "100s" and "1d" for now. Additional support will be added in * the future. "0" indicates indefinite duration. * Used by group-based quotas only. * * Generated from protobuf field string duration = 5; * @param string $var * @return $this */ public function setDuration($var) { GPBUtil::checkString($var, True); $this->duration = $var; return $this; } /** * The name of the metric this quota limit applies to. The quota limits with * the same metric will be checked together during runtime. The metric must be * defined within the service config. * Used by metric-based quotas only. * * Generated from protobuf field string metric = 8; * @return string */ public function getMetric() { return $this->metric; } /** * The name of the metric this quota limit applies to. The quota limits with * the same metric will be checked together during runtime. The metric must be * defined within the service config. * Used by metric-based quotas only. * * Generated from protobuf field string metric = 8; * @param string $var * @return $this */ public function setMetric($var) { GPBUtil::checkString($var, True); $this->metric = $var; return $this; } /** * Specify the unit of the quota limit. It uses the same syntax as * [Metric.unit][]. The supported unit kinds are determined by the quota * backend system. * The [Google Service Control](https://cloud.google.com/service-control) * supports the following unit components: * * One of the time intevals: * * "/min" for quota every minute. * * "/d" for quota every 24 hours, starting 00:00 US Pacific Time. * * Otherwise the quota won't be reset by time, such as storage limit. * * One and only one of the granted containers: * * "/{organization}" quota for an organization. * * "/{project}" quota for a project. * * "/{folder}" quota for a folder. * * "/{resource}" quota for a universal resource. * * Zero or more quota segmentation dimension. Not all combos are valid. * * "/{region}" quota for every region. Not to be used with time intervals. * * Otherwise the resources granted on the target is not segmented. * * "/{zone}" quota for every zone. Not to be used with time intervals. * * Otherwise the resources granted on the target is not segmented. * * "/{resource}" quota for a resource associated with a project or org. * Here are some examples: * * "1/min/{project}" for quota per minute per project. * * "1/min/{user}" for quota per minute per user. * * "1/min/{organization}" for quota per minute per organization. * Note: the order of unit components is insignificant. * The "1" at the beginning is required to follow the metric unit syntax. * Used by metric-based quotas only. * * Generated from protobuf field string unit = 9; * @return string */ public function getUnit() { return $this->unit; } /** * Specify the unit of the quota limit. It uses the same syntax as * [Metric.unit][]. The supported unit kinds are determined by the quota * backend system. * The [Google Service Control](https://cloud.google.com/service-control) * supports the following unit components: * * One of the time intevals: * * "/min" for quota every minute. * * "/d" for quota every 24 hours, starting 00:00 US Pacific Time. * * Otherwise the quota won't be reset by time, such as storage limit. * * One and only one of the granted containers: * * "/{organization}" quota for an organization. * * "/{project}" quota for a project. * * "/{folder}" quota for a folder. * * "/{resource}" quota for a universal resource. * * Zero or more quota segmentation dimension. Not all combos are valid. * * "/{region}" quota for every region. Not to be used with time intervals. * * Otherwise the resources granted on the target is not segmented. * * "/{zone}" quota for every zone. Not to be used with time intervals. * * Otherwise the resources granted on the target is not segmented. * * "/{resource}" quota for a resource associated with a project or org. * Here are some examples: * * "1/min/{project}" for quota per minute per project. * * "1/min/{user}" for quota per minute per user. * * "1/min/{organization}" for quota per minute per organization. * Note: the order of unit components is insignificant. * The "1" at the beginning is required to follow the metric unit syntax. * Used by metric-based quotas only. * * Generated from protobuf field string unit = 9; * @param string $var * @return $this */ public function setUnit($var) { GPBUtil::checkString($var, True); $this->unit = $var; return $this; } /** * Tiered limit values. Also allows for regional or zone overrides for these * values if "/{region}" or "/{zone}" is specified in the unit field. * Currently supported tiers from low to high: * VERY_LOW, LOW, STANDARD, HIGH, VERY_HIGH * To apply different limit values for users according to their tiers, specify * the values for the tiers you want to differentiate. For example: * {LOW:100, STANDARD:500, HIGH:1000, VERY_HIGH:5000} * The limit value for each tier is optional except for the tier STANDARD. * The limit value for an unspecified tier falls to the value of its next * tier towards tier STANDARD. For the above example, the limit value for tier * STANDARD is 500. * To apply the same limit value for all users, just specify limit value for * tier STANDARD. For example: {STANDARD:500}. * To apply a regional overide for a tier, add a map entry with key * "/", where is a region name. Similarly, for a zone * override, add a map entry with key "/{zone}". * Further, a wildcard can be used at the end of a zone name in order to * specify zone level overrides. For example: * LOW: 10, STANDARD: 50, HIGH: 100, * LOW/us-central1: 20, STANDARD/us-central1: 60, HIGH/us-central1: 200, * LOW/us-central1-*: 10, STANDARD/us-central1-*: 20, HIGH/us-central1-*: 80 * The regional overrides tier set for each region must be the same as * the tier set for default limit values. Same rule applies for zone overrides * tier as well. * Used by metric-based quotas only. * * Generated from protobuf field map values = 10; * @return \Google\Protobuf\Internal\MapField */ public function getValues() { return $this->values; } /** * Tiered limit values. Also allows for regional or zone overrides for these * values if "/{region}" or "/{zone}" is specified in the unit field. * Currently supported tiers from low to high: * VERY_LOW, LOW, STANDARD, HIGH, VERY_HIGH * To apply different limit values for users according to their tiers, specify * the values for the tiers you want to differentiate. For example: * {LOW:100, STANDARD:500, HIGH:1000, VERY_HIGH:5000} * The limit value for each tier is optional except for the tier STANDARD. * The limit value for an unspecified tier falls to the value of its next * tier towards tier STANDARD. For the above example, the limit value for tier * STANDARD is 500. * To apply the same limit value for all users, just specify limit value for * tier STANDARD. For example: {STANDARD:500}. * To apply a regional overide for a tier, add a map entry with key * "/", where is a region name. Similarly, for a zone * override, add a map entry with key "/{zone}". * Further, a wildcard can be used at the end of a zone name in order to * specify zone level overrides. For example: * LOW: 10, STANDARD: 50, HIGH: 100, * LOW/us-central1: 20, STANDARD/us-central1: 60, HIGH/us-central1: 200, * LOW/us-central1-*: 10, STANDARD/us-central1-*: 20, HIGH/us-central1-*: 80 * The regional overrides tier set for each region must be the same as * the tier set for default limit values. Same rule applies for zone overrides * tier as well. * Used by metric-based quotas only. * * Generated from protobuf field map values = 10; * @param array|\Google\Protobuf\Internal\MapField $var * @return $this */ public function setValues($var) { $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT64); $this->values = $arr; return $this; } /** * User-visible display name for this limit. * Optional. If not set, the UI will provide a default display name based on * the quota configuration. This field can be used to override the default * display name generated from the configuration. * * Generated from protobuf field string display_name = 12; * @return string */ public function getDisplayName() { return $this->display_name; } /** * User-visible display name for this limit. * Optional. If not set, the UI will provide a default display name based on * the quota configuration. This field can be used to override the default * display name generated from the configuration. * * Generated from protobuf field string display_name = 12; * @param string $var * @return $this */ public function setDisplayName($var) { GPBUtil::checkString($var, True); $this->display_name = $var; return $this; } } src/Api/Service.php000064400000102427151742741630010175 0ustar00google.api.Service */ class Service extends \Google\Protobuf\Internal\Message { /** * The semantic version of the service configuration. The config version * affects the interpretation of the service configuration. For example, * certain features are enabled by default for certain config versions. * The latest config version is `3`. * * Generated from protobuf field .google.protobuf.UInt32Value config_version = 20; */ private $config_version = null; /** * The DNS address at which this service is available, * e.g. `calendar.googleapis.com`. * * Generated from protobuf field string name = 1; */ private $name = ''; /** * A unique ID for a specific instance of this message, typically assigned * by the client for tracking purpose. If empty, the server may choose to * generate one instead. * * Generated from protobuf field string id = 33; */ private $id = ''; /** * The product title for this service. * * Generated from protobuf field string title = 2; */ private $title = ''; /** * The Google project that owns this service. * * Generated from protobuf field string producer_project_id = 22; */ private $producer_project_id = ''; /** * A list of API interfaces exported by this service. Only the `name` field * of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by the configuration * author, as the remaining fields will be derived from the IDL during the * normalization process. It is an error to specify an API interface here * which cannot be resolved against the associated IDL files. * * Generated from protobuf field repeated .google.protobuf.Api apis = 3; */ private $apis; /** * A list of all proto message types included in this API service. * Types referenced directly or indirectly by the `apis` are * automatically included. Messages which are not referenced but * shall be included, such as types used by the `google.protobuf.Any` type, * should be listed here by name. Example: * types: * - name: google.protobuf.Int32 * * Generated from protobuf field repeated .google.protobuf.Type types = 4; */ private $types; /** * A list of all enum types included in this API service. Enums * referenced directly or indirectly by the `apis` are automatically * included. Enums which are not referenced but shall be included * should be listed here by name. Example: * enums: * - name: google.someapi.v1.SomeEnum * * Generated from protobuf field repeated .google.protobuf.Enum enums = 5; */ private $enums; /** * Additional API documentation. * * Generated from protobuf field .google.api.Documentation documentation = 6; */ private $documentation = null; /** * API backend configuration. * * Generated from protobuf field .google.api.Backend backend = 8; */ private $backend = null; /** * HTTP configuration. * * Generated from protobuf field .google.api.Http http = 9; */ private $http = null; /** * Quota configuration. * * Generated from protobuf field .google.api.Quota quota = 10; */ private $quota = null; /** * Auth configuration. * * Generated from protobuf field .google.api.Authentication authentication = 11; */ private $authentication = null; /** * Context configuration. * * Generated from protobuf field .google.api.Context context = 12; */ private $context = null; /** * Configuration controlling usage of this service. * * Generated from protobuf field .google.api.Usage usage = 15; */ private $usage = null; /** * Configuration for network endpoints. If this is empty, then an endpoint * with the same name as the service is automatically generated to service all * defined APIs. * * Generated from protobuf field repeated .google.api.Endpoint endpoints = 18; */ private $endpoints; /** * Configuration for the service control plane. * * Generated from protobuf field .google.api.Control control = 21; */ private $control = null; /** * Defines the logs used by this service. * * Generated from protobuf field repeated .google.api.LogDescriptor logs = 23; */ private $logs; /** * Defines the metrics used by this service. * * Generated from protobuf field repeated .google.api.MetricDescriptor metrics = 24; */ private $metrics; /** * Defines the monitored resources used by this service. This is required * by the [Service.monitoring][google.api.Service.monitoring] and [Service.logging][google.api.Service.logging] configurations. * * Generated from protobuf field repeated .google.api.MonitoredResourceDescriptor monitored_resources = 25; */ private $monitored_resources; /** * Billing configuration. * * Generated from protobuf field .google.api.Billing billing = 26; */ private $billing = null; /** * Logging configuration. * * Generated from protobuf field .google.api.Logging logging = 27; */ private $logging = null; /** * Monitoring configuration. * * Generated from protobuf field .google.api.Monitoring monitoring = 28; */ private $monitoring = null; /** * System parameter configuration. * * Generated from protobuf field .google.api.SystemParameters system_parameters = 29; */ private $system_parameters = null; /** * Output only. The source information for this configuration if available. * * Generated from protobuf field .google.api.SourceInfo source_info = 37; */ private $source_info = null; /** * Experimental configuration. * * Generated from protobuf field .google.api.Experimental experimental = 101; */ private $experimental = null; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Protobuf\UInt32Value $config_version * The semantic version of the service configuration. The config version * affects the interpretation of the service configuration. For example, * certain features are enabled by default for certain config versions. * The latest config version is `3`. * @type string $name * The DNS address at which this service is available, * e.g. `calendar.googleapis.com`. * @type string $id * A unique ID for a specific instance of this message, typically assigned * by the client for tracking purpose. If empty, the server may choose to * generate one instead. * @type string $title * The product title for this service. * @type string $producer_project_id * The Google project that owns this service. * @type \Google\Protobuf\Api[]|\Google\Protobuf\Internal\RepeatedField $apis * A list of API interfaces exported by this service. Only the `name` field * of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by the configuration * author, as the remaining fields will be derived from the IDL during the * normalization process. It is an error to specify an API interface here * which cannot be resolved against the associated IDL files. * @type \Google\Protobuf\Type[]|\Google\Protobuf\Internal\RepeatedField $types * A list of all proto message types included in this API service. * Types referenced directly or indirectly by the `apis` are * automatically included. Messages which are not referenced but * shall be included, such as types used by the `google.protobuf.Any` type, * should be listed here by name. Example: * types: * - name: google.protobuf.Int32 * @type \Google\Protobuf\Enum[]|\Google\Protobuf\Internal\RepeatedField $enums * A list of all enum types included in this API service. Enums * referenced directly or indirectly by the `apis` are automatically * included. Enums which are not referenced but shall be included * should be listed here by name. Example: * enums: * - name: google.someapi.v1.SomeEnum * @type \Google\Api\Documentation $documentation * Additional API documentation. * @type \Google\Api\Backend $backend * API backend configuration. * @type \Google\Api\Http $http * HTTP configuration. * @type \Google\Api\Quota $quota * Quota configuration. * @type \Google\Api\Authentication $authentication * Auth configuration. * @type \Google\Api\Context $context * Context configuration. * @type \Google\Api\Usage $usage * Configuration controlling usage of this service. * @type \Google\Api\Endpoint[]|\Google\Protobuf\Internal\RepeatedField $endpoints * Configuration for network endpoints. If this is empty, then an endpoint * with the same name as the service is automatically generated to service all * defined APIs. * @type \Google\Api\Control $control * Configuration for the service control plane. * @type \Google\Api\LogDescriptor[]|\Google\Protobuf\Internal\RepeatedField $logs * Defines the logs used by this service. * @type \Google\Api\MetricDescriptor[]|\Google\Protobuf\Internal\RepeatedField $metrics * Defines the metrics used by this service. * @type \Google\Api\MonitoredResourceDescriptor[]|\Google\Protobuf\Internal\RepeatedField $monitored_resources * Defines the monitored resources used by this service. This is required * by the [Service.monitoring][google.api.Service.monitoring] and [Service.logging][google.api.Service.logging] configurations. * @type \Google\Api\Billing $billing * Billing configuration. * @type \Google\Api\Logging $logging * Logging configuration. * @type \Google\Api\Monitoring $monitoring * Monitoring configuration. * @type \Google\Api\SystemParameters $system_parameters * System parameter configuration. * @type \Google\Api\SourceInfo $source_info * Output only. The source information for this configuration if available. * @type \Google\Api\Experimental $experimental * Experimental configuration. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Service::initOnce(); parent::__construct($data); } /** * The semantic version of the service configuration. The config version * affects the interpretation of the service configuration. For example, * certain features are enabled by default for certain config versions. * The latest config version is `3`. * * Generated from protobuf field .google.protobuf.UInt32Value config_version = 20; * @return \Google\Protobuf\UInt32Value */ public function getConfigVersion() { return $this->config_version; } /** * The semantic version of the service configuration. The config version * affects the interpretation of the service configuration. For example, * certain features are enabled by default for certain config versions. * The latest config version is `3`. * * Generated from protobuf field .google.protobuf.UInt32Value config_version = 20; * @param \Google\Protobuf\UInt32Value $var * @return $this */ public function setConfigVersion($var) { GPBUtil::checkMessage($var, \Google\Protobuf\UInt32Value::class); $this->config_version = $var; return $this; } /** * The DNS address at which this service is available, * e.g. `calendar.googleapis.com`. * * Generated from protobuf field string name = 1; * @return string */ public function getName() { return $this->name; } /** * The DNS address at which this service is available, * e.g. `calendar.googleapis.com`. * * 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; } /** * A unique ID for a specific instance of this message, typically assigned * by the client for tracking purpose. If empty, the server may choose to * generate one instead. * * Generated from protobuf field string id = 33; * @return string */ public function getId() { return $this->id; } /** * A unique ID for a specific instance of this message, typically assigned * by the client for tracking purpose. If empty, the server may choose to * generate one instead. * * Generated from protobuf field string id = 33; * @param string $var * @return $this */ public function setId($var) { GPBUtil::checkString($var, True); $this->id = $var; return $this; } /** * The product title for this service. * * Generated from protobuf field string title = 2; * @return string */ public function getTitle() { return $this->title; } /** * The product title for this service. * * Generated from protobuf field string title = 2; * @param string $var * @return $this */ public function setTitle($var) { GPBUtil::checkString($var, True); $this->title = $var; return $this; } /** * The Google project that owns this service. * * Generated from protobuf field string producer_project_id = 22; * @return string */ public function getProducerProjectId() { return $this->producer_project_id; } /** * The Google project that owns this service. * * Generated from protobuf field string producer_project_id = 22; * @param string $var * @return $this */ public function setProducerProjectId($var) { GPBUtil::checkString($var, True); $this->producer_project_id = $var; return $this; } /** * A list of API interfaces exported by this service. Only the `name` field * of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by the configuration * author, as the remaining fields will be derived from the IDL during the * normalization process. It is an error to specify an API interface here * which cannot be resolved against the associated IDL files. * * Generated from protobuf field repeated .google.protobuf.Api apis = 3; * @return \Google\Protobuf\Internal\RepeatedField */ public function getApis() { return $this->apis; } /** * A list of API interfaces exported by this service. Only the `name` field * of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by the configuration * author, as the remaining fields will be derived from the IDL during the * normalization process. It is an error to specify an API interface here * which cannot be resolved against the associated IDL files. * * Generated from protobuf field repeated .google.protobuf.Api apis = 3; * @param \Google\Protobuf\Api[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setApis($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Api::class); $this->apis = $arr; return $this; } /** * A list of all proto message types included in this API service. * Types referenced directly or indirectly by the `apis` are * automatically included. Messages which are not referenced but * shall be included, such as types used by the `google.protobuf.Any` type, * should be listed here by name. Example: * types: * - name: google.protobuf.Int32 * * Generated from protobuf field repeated .google.protobuf.Type types = 4; * @return \Google\Protobuf\Internal\RepeatedField */ public function getTypes() { return $this->types; } /** * A list of all proto message types included in this API service. * Types referenced directly or indirectly by the `apis` are * automatically included. Messages which are not referenced but * shall be included, such as types used by the `google.protobuf.Any` type, * should be listed here by name. Example: * types: * - name: google.protobuf.Int32 * * Generated from protobuf field repeated .google.protobuf.Type types = 4; * @param \Google\Protobuf\Type[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setTypes($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Type::class); $this->types = $arr; return $this; } /** * A list of all enum types included in this API service. Enums * referenced directly or indirectly by the `apis` are automatically * included. Enums which are not referenced but shall be included * should be listed here by name. Example: * enums: * - name: google.someapi.v1.SomeEnum * * Generated from protobuf field repeated .google.protobuf.Enum enums = 5; * @return \Google\Protobuf\Internal\RepeatedField */ public function getEnums() { return $this->enums; } /** * A list of all enum types included in this API service. Enums * referenced directly or indirectly by the `apis` are automatically * included. Enums which are not referenced but shall be included * should be listed here by name. Example: * enums: * - name: google.someapi.v1.SomeEnum * * Generated from protobuf field repeated .google.protobuf.Enum enums = 5; * @param \Google\Protobuf\Enum[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setEnums($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Enum::class); $this->enums = $arr; return $this; } /** * Additional API documentation. * * Generated from protobuf field .google.api.Documentation documentation = 6; * @return \Google\Api\Documentation */ public function getDocumentation() { return $this->documentation; } /** * Additional API documentation. * * Generated from protobuf field .google.api.Documentation documentation = 6; * @param \Google\Api\Documentation $var * @return $this */ public function setDocumentation($var) { GPBUtil::checkMessage($var, \Google\Api\Documentation::class); $this->documentation = $var; return $this; } /** * API backend configuration. * * Generated from protobuf field .google.api.Backend backend = 8; * @return \Google\Api\Backend */ public function getBackend() { return $this->backend; } /** * API backend configuration. * * Generated from protobuf field .google.api.Backend backend = 8; * @param \Google\Api\Backend $var * @return $this */ public function setBackend($var) { GPBUtil::checkMessage($var, \Google\Api\Backend::class); $this->backend = $var; return $this; } /** * HTTP configuration. * * Generated from protobuf field .google.api.Http http = 9; * @return \Google\Api\Http */ public function getHttp() { return $this->http; } /** * HTTP configuration. * * Generated from protobuf field .google.api.Http http = 9; * @param \Google\Api\Http $var * @return $this */ public function setHttp($var) { GPBUtil::checkMessage($var, \Google\Api\Http::class); $this->http = $var; return $this; } /** * Quota configuration. * * Generated from protobuf field .google.api.Quota quota = 10; * @return \Google\Api\Quota */ public function getQuota() { return $this->quota; } /** * Quota configuration. * * Generated from protobuf field .google.api.Quota quota = 10; * @param \Google\Api\Quota $var * @return $this */ public function setQuota($var) { GPBUtil::checkMessage($var, \Google\Api\Quota::class); $this->quota = $var; return $this; } /** * Auth configuration. * * Generated from protobuf field .google.api.Authentication authentication = 11; * @return \Google\Api\Authentication */ public function getAuthentication() { return $this->authentication; } /** * Auth configuration. * * Generated from protobuf field .google.api.Authentication authentication = 11; * @param \Google\Api\Authentication $var * @return $this */ public function setAuthentication($var) { GPBUtil::checkMessage($var, \Google\Api\Authentication::class); $this->authentication = $var; return $this; } /** * Context configuration. * * Generated from protobuf field .google.api.Context context = 12; * @return \Google\Api\Context */ public function getContext() { return $this->context; } /** * Context configuration. * * Generated from protobuf field .google.api.Context context = 12; * @param \Google\Api\Context $var * @return $this */ public function setContext($var) { GPBUtil::checkMessage($var, \Google\Api\Context::class); $this->context = $var; return $this; } /** * Configuration controlling usage of this service. * * Generated from protobuf field .google.api.Usage usage = 15; * @return \Google\Api\Usage */ public function getUsage() { return $this->usage; } /** * Configuration controlling usage of this service. * * Generated from protobuf field .google.api.Usage usage = 15; * @param \Google\Api\Usage $var * @return $this */ public function setUsage($var) { GPBUtil::checkMessage($var, \Google\Api\Usage::class); $this->usage = $var; return $this; } /** * Configuration for network endpoints. If this is empty, then an endpoint * with the same name as the service is automatically generated to service all * defined APIs. * * Generated from protobuf field repeated .google.api.Endpoint endpoints = 18; * @return \Google\Protobuf\Internal\RepeatedField */ public function getEndpoints() { return $this->endpoints; } /** * Configuration for network endpoints. If this is empty, then an endpoint * with the same name as the service is automatically generated to service all * defined APIs. * * Generated from protobuf field repeated .google.api.Endpoint endpoints = 18; * @param \Google\Api\Endpoint[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setEndpoints($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Endpoint::class); $this->endpoints = $arr; return $this; } /** * Configuration for the service control plane. * * Generated from protobuf field .google.api.Control control = 21; * @return \Google\Api\Control */ public function getControl() { return $this->control; } /** * Configuration for the service control plane. * * Generated from protobuf field .google.api.Control control = 21; * @param \Google\Api\Control $var * @return $this */ public function setControl($var) { GPBUtil::checkMessage($var, \Google\Api\Control::class); $this->control = $var; return $this; } /** * Defines the logs used by this service. * * Generated from protobuf field repeated .google.api.LogDescriptor logs = 23; * @return \Google\Protobuf\Internal\RepeatedField */ public function getLogs() { return $this->logs; } /** * Defines the logs used by this service. * * Generated from protobuf field repeated .google.api.LogDescriptor logs = 23; * @param \Google\Api\LogDescriptor[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setLogs($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\LogDescriptor::class); $this->logs = $arr; return $this; } /** * Defines the metrics used by this service. * * Generated from protobuf field repeated .google.api.MetricDescriptor metrics = 24; * @return \Google\Protobuf\Internal\RepeatedField */ public function getMetrics() { return $this->metrics; } /** * Defines the metrics used by this service. * * Generated from protobuf field repeated .google.api.MetricDescriptor metrics = 24; * @param \Google\Api\MetricDescriptor[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setMetrics($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MetricDescriptor::class); $this->metrics = $arr; return $this; } /** * Defines the monitored resources used by this service. This is required * by the [Service.monitoring][google.api.Service.monitoring] and [Service.logging][google.api.Service.logging] configurations. * * Generated from protobuf field repeated .google.api.MonitoredResourceDescriptor monitored_resources = 25; * @return \Google\Protobuf\Internal\RepeatedField */ public function getMonitoredResources() { return $this->monitored_resources; } /** * Defines the monitored resources used by this service. This is required * by the [Service.monitoring][google.api.Service.monitoring] and [Service.logging][google.api.Service.logging] configurations. * * Generated from protobuf field repeated .google.api.MonitoredResourceDescriptor monitored_resources = 25; * @param \Google\Api\MonitoredResourceDescriptor[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setMonitoredResources($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MonitoredResourceDescriptor::class); $this->monitored_resources = $arr; return $this; } /** * Billing configuration. * * Generated from protobuf field .google.api.Billing billing = 26; * @return \Google\Api\Billing */ public function getBilling() { return $this->billing; } /** * Billing configuration. * * Generated from protobuf field .google.api.Billing billing = 26; * @param \Google\Api\Billing $var * @return $this */ public function setBilling($var) { GPBUtil::checkMessage($var, \Google\Api\Billing::class); $this->billing = $var; return $this; } /** * Logging configuration. * * Generated from protobuf field .google.api.Logging logging = 27; * @return \Google\Api\Logging */ public function getLogging() { return $this->logging; } /** * Logging configuration. * * Generated from protobuf field .google.api.Logging logging = 27; * @param \Google\Api\Logging $var * @return $this */ public function setLogging($var) { GPBUtil::checkMessage($var, \Google\Api\Logging::class); $this->logging = $var; return $this; } /** * Monitoring configuration. * * Generated from protobuf field .google.api.Monitoring monitoring = 28; * @return \Google\Api\Monitoring */ public function getMonitoring() { return $this->monitoring; } /** * Monitoring configuration. * * Generated from protobuf field .google.api.Monitoring monitoring = 28; * @param \Google\Api\Monitoring $var * @return $this */ public function setMonitoring($var) { GPBUtil::checkMessage($var, \Google\Api\Monitoring::class); $this->monitoring = $var; return $this; } /** * System parameter configuration. * * Generated from protobuf field .google.api.SystemParameters system_parameters = 29; * @return \Google\Api\SystemParameters */ public function getSystemParameters() { return $this->system_parameters; } /** * System parameter configuration. * * Generated from protobuf field .google.api.SystemParameters system_parameters = 29; * @param \Google\Api\SystemParameters $var * @return $this */ public function setSystemParameters($var) { GPBUtil::checkMessage($var, \Google\Api\SystemParameters::class); $this->system_parameters = $var; return $this; } /** * Output only. The source information for this configuration if available. * * Generated from protobuf field .google.api.SourceInfo source_info = 37; * @return \Google\Api\SourceInfo */ public function getSourceInfo() { return $this->source_info; } /** * Output only. The source information for this configuration if available. * * Generated from protobuf field .google.api.SourceInfo source_info = 37; * @param \Google\Api\SourceInfo $var * @return $this */ public function setSourceInfo($var) { GPBUtil::checkMessage($var, \Google\Api\SourceInfo::class); $this->source_info = $var; return $this; } /** * Experimental configuration. * * Generated from protobuf field .google.api.Experimental experimental = 101; * @return \Google\Api\Experimental */ public function getExperimental() { return $this->experimental; } /** * Experimental configuration. * * Generated from protobuf field .google.api.Experimental experimental = 101; * @param \Google\Api\Experimental $var * @return $this */ public function setExperimental($var) { GPBUtil::checkMessage($var, \Google\Api\Experimental::class); $this->experimental = $var; return $this; } } src/Api/SourceInfo.php000064400000003566151742741630010655 0ustar00google.api.SourceInfo */ class SourceInfo extends \Google\Protobuf\Internal\Message { /** * All files used during config generation. * * Generated from protobuf field repeated .google.protobuf.Any source_files = 1; */ private $source_files; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Protobuf\Any[]|\Google\Protobuf\Internal\RepeatedField $source_files * All files used during config generation. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\SourceInfo::initOnce(); parent::__construct($data); } /** * All files used during config generation. * * Generated from protobuf field repeated .google.protobuf.Any source_files = 1; * @return \Google\Protobuf\Internal\RepeatedField */ public function getSourceFiles() { return $this->source_files; } /** * All files used during config generation. * * Generated from protobuf field repeated .google.protobuf.Any source_files = 1; * @param \Google\Protobuf\Any[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setSourceFiles($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Any::class); $this->source_files = $arr; return $this; } } src/Api/SystemParameter.php000064400000007721151742741630011723 0ustar00google.api.SystemParameter */ class SystemParameter extends \Google\Protobuf\Internal\Message { /** * Define the name of the parameter, such as "api_key" . It is case sensitive. * * Generated from protobuf field string name = 1; */ private $name = ''; /** * Define the HTTP header name to use for the parameter. It is case * insensitive. * * Generated from protobuf field string http_header = 2; */ private $http_header = ''; /** * Define the URL query parameter name to use for the parameter. It is case * sensitive. * * Generated from protobuf field string url_query_parameter = 3; */ private $url_query_parameter = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $name * Define the name of the parameter, such as "api_key" . It is case sensitive. * @type string $http_header * Define the HTTP header name to use for the parameter. It is case * insensitive. * @type string $url_query_parameter * Define the URL query parameter name to use for the parameter. It is case * sensitive. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\SystemParameter::initOnce(); parent::__construct($data); } /** * Define the name of the parameter, such as "api_key" . It is case sensitive. * * Generated from protobuf field string name = 1; * @return string */ public function getName() { return $this->name; } /** * Define the name of the parameter, such as "api_key" . It is case sensitive. * * 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; } /** * Define the HTTP header name to use for the parameter. It is case * insensitive. * * Generated from protobuf field string http_header = 2; * @return string */ public function getHttpHeader() { return $this->http_header; } /** * Define the HTTP header name to use for the parameter. It is case * insensitive. * * Generated from protobuf field string http_header = 2; * @param string $var * @return $this */ public function setHttpHeader($var) { GPBUtil::checkString($var, True); $this->http_header = $var; return $this; } /** * Define the URL query parameter name to use for the parameter. It is case * sensitive. * * Generated from protobuf field string url_query_parameter = 3; * @return string */ public function getUrlQueryParameter() { return $this->url_query_parameter; } /** * Define the URL query parameter name to use for the parameter. It is case * sensitive. * * Generated from protobuf field string url_query_parameter = 3; * @param string $var * @return $this */ public function setUrlQueryParameter($var) { GPBUtil::checkString($var, True); $this->url_query_parameter = $var; return $this; } } src/Api/SystemParameterRule.php000064400000010646151742741630012553 0ustar00google.api.SystemParameterRule */ class SystemParameterRule extends \Google\Protobuf\Internal\Message { /** * Selects the methods to which this rule applies. Use '*' to indicate all * methods in all APIs. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; */ private $selector = ''; /** * Define parameters. Multiple names may be defined for a parameter. * For a given method call, only one of them should be used. If multiple * names are used the behavior is implementation-dependent. * If none of the specified names are present the behavior is * parameter-dependent. * * Generated from protobuf field repeated .google.api.SystemParameter parameters = 2; */ private $parameters; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $selector * Selects the methods to which this rule applies. Use '*' to indicate all * methods in all APIs. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * @type \Google\Api\SystemParameter[]|\Google\Protobuf\Internal\RepeatedField $parameters * Define parameters. Multiple names may be defined for a parameter. * For a given method call, only one of them should be used. If multiple * names are used the behavior is implementation-dependent. * If none of the specified names are present the behavior is * parameter-dependent. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\SystemParameter::initOnce(); parent::__construct($data); } /** * Selects the methods to which this rule applies. Use '*' to indicate all * methods in all APIs. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; * @return string */ public function getSelector() { return $this->selector; } /** * Selects the methods to which this rule applies. Use '*' to indicate all * methods in all APIs. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; * @param string $var * @return $this */ public function setSelector($var) { GPBUtil::checkString($var, True); $this->selector = $var; return $this; } /** * Define parameters. Multiple names may be defined for a parameter. * For a given method call, only one of them should be used. If multiple * names are used the behavior is implementation-dependent. * If none of the specified names are present the behavior is * parameter-dependent. * * Generated from protobuf field repeated .google.api.SystemParameter parameters = 2; * @return \Google\Protobuf\Internal\RepeatedField */ public function getParameters() { return $this->parameters; } /** * Define parameters. Multiple names may be defined for a parameter. * For a given method call, only one of them should be used. If multiple * names are used the behavior is implementation-dependent. * If none of the specified names are present the behavior is * parameter-dependent. * * Generated from protobuf field repeated .google.api.SystemParameter parameters = 2; * @param \Google\Api\SystemParameter[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setParameters($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\SystemParameter::class); $this->parameters = $arr; return $this; } } src/Api/SystemParameters.php000064400000013673151742741630012111 0ustar00google.api.SystemParameters */ class SystemParameters extends \Google\Protobuf\Internal\Message { /** * Define system parameters. * The parameters defined here will override the default parameters * implemented by the system. If this field is missing from the service * config, default system parameters will be used. Default system parameters * and names is implementation-dependent. * Example: define api key for all methods * system_parameters * rules: * - selector: "*" * parameters: * - name: api_key * url_query_parameter: api_key * Example: define 2 api key names for a specific method. * system_parameters * rules: * - selector: "/ListShelves" * parameters: * - name: api_key * http_header: Api-Key1 * - name: api_key * http_header: Api-Key2 * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.SystemParameterRule rules = 1; */ private $rules; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Api\SystemParameterRule[]|\Google\Protobuf\Internal\RepeatedField $rules * Define system parameters. * The parameters defined here will override the default parameters * implemented by the system. If this field is missing from the service * config, default system parameters will be used. Default system parameters * and names is implementation-dependent. * Example: define api key for all methods * system_parameters * rules: * - selector: "*" * parameters: * - name: api_key * url_query_parameter: api_key * Example: define 2 api key names for a specific method. * system_parameters * rules: * - selector: "/ListShelves" * parameters: * - name: api_key * http_header: Api-Key1 * - name: api_key * http_header: Api-Key2 * **NOTE:** All service configuration rules follow "last one wins" order. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\SystemParameter::initOnce(); parent::__construct($data); } /** * Define system parameters. * The parameters defined here will override the default parameters * implemented by the system. If this field is missing from the service * config, default system parameters will be used. Default system parameters * and names is implementation-dependent. * Example: define api key for all methods * system_parameters * rules: * - selector: "*" * parameters: * - name: api_key * url_query_parameter: api_key * Example: define 2 api key names for a specific method. * system_parameters * rules: * - selector: "/ListShelves" * parameters: * - name: api_key * http_header: Api-Key1 * - name: api_key * http_header: Api-Key2 * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.SystemParameterRule rules = 1; * @return \Google\Protobuf\Internal\RepeatedField */ public function getRules() { return $this->rules; } /** * Define system parameters. * The parameters defined here will override the default parameters * implemented by the system. If this field is missing from the service * config, default system parameters will be used. Default system parameters * and names is implementation-dependent. * Example: define api key for all methods * system_parameters * rules: * - selector: "*" * parameters: * - name: api_key * url_query_parameter: api_key * Example: define 2 api key names for a specific method. * system_parameters * rules: * - selector: "/ListShelves" * parameters: * - name: api_key * http_header: Api-Key1 * - name: api_key * http_header: Api-Key2 * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.SystemParameterRule rules = 1; * @param \Google\Api\SystemParameterRule[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setRules($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\SystemParameterRule::class); $this->rules = $arr; return $this; } } src/Api/Usage.php000064400000015246151742741630007643 0ustar00google.api.Usage */ class Usage extends \Google\Protobuf\Internal\Message { /** * Requirements that must be satisfied before a consumer project can use the * service. Each requirement is of the form /; * for example 'serviceusage.googleapis.com/billing-enabled'. * * Generated from protobuf field repeated string requirements = 1; */ private $requirements; /** * A list of usage rules that apply to individual API methods. * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.UsageRule rules = 6; */ private $rules; /** * The full resource name of a channel used for sending notifications to the * service producer. * Google Service Management currently only supports * [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification * channel. To use Google Cloud Pub/Sub as the channel, this must be the name * of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format * documented in https://cloud.google.com/pubsub/docs/overview. * * Generated from protobuf field string producer_notification_channel = 7; */ private $producer_notification_channel = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string[]|\Google\Protobuf\Internal\RepeatedField $requirements * Requirements that must be satisfied before a consumer project can use the * service. Each requirement is of the form /; * for example 'serviceusage.googleapis.com/billing-enabled'. * @type \Google\Api\UsageRule[]|\Google\Protobuf\Internal\RepeatedField $rules * A list of usage rules that apply to individual API methods. * **NOTE:** All service configuration rules follow "last one wins" order. * @type string $producer_notification_channel * The full resource name of a channel used for sending notifications to the * service producer. * Google Service Management currently only supports * [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification * channel. To use Google Cloud Pub/Sub as the channel, this must be the name * of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format * documented in https://cloud.google.com/pubsub/docs/overview. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Usage::initOnce(); parent::__construct($data); } /** * Requirements that must be satisfied before a consumer project can use the * service. Each requirement is of the form /; * for example 'serviceusage.googleapis.com/billing-enabled'. * * Generated from protobuf field repeated string requirements = 1; * @return \Google\Protobuf\Internal\RepeatedField */ public function getRequirements() { return $this->requirements; } /** * Requirements that must be satisfied before a consumer project can use the * service. Each requirement is of the form /; * for example 'serviceusage.googleapis.com/billing-enabled'. * * Generated from protobuf field repeated string requirements = 1; * @param string[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setRequirements($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->requirements = $arr; return $this; } /** * A list of usage rules that apply to individual API methods. * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.UsageRule rules = 6; * @return \Google\Protobuf\Internal\RepeatedField */ public function getRules() { return $this->rules; } /** * A list of usage rules that apply to individual API methods. * **NOTE:** All service configuration rules follow "last one wins" order. * * Generated from protobuf field repeated .google.api.UsageRule rules = 6; * @param \Google\Api\UsageRule[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setRules($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\UsageRule::class); $this->rules = $arr; return $this; } /** * The full resource name of a channel used for sending notifications to the * service producer. * Google Service Management currently only supports * [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification * channel. To use Google Cloud Pub/Sub as the channel, this must be the name * of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format * documented in https://cloud.google.com/pubsub/docs/overview. * * Generated from protobuf field string producer_notification_channel = 7; * @return string */ public function getProducerNotificationChannel() { return $this->producer_notification_channel; } /** * The full resource name of a channel used for sending notifications to the * service producer. * Google Service Management currently only supports * [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification * channel. To use Google Cloud Pub/Sub as the channel, this must be the name * of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format * documented in https://cloud.google.com/pubsub/docs/overview. * * Generated from protobuf field string producer_notification_channel = 7; * @param string $var * @return $this */ public function setProducerNotificationChannel($var) { GPBUtil::checkString($var, True); $this->producer_notification_channel = $var; return $this; } } src/Api/UsageRule.php000064400000014035151742741630010466 0ustar00google.api.UsageRule */ class UsageRule extends \Google\Protobuf\Internal\Message { /** * Selects the methods to which this rule applies. Use '*' to indicate all * methods in all APIs. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; */ private $selector = ''; /** * If true, the selected method allows unregistered calls, e.g. calls * that don't identify any user or application. * * Generated from protobuf field bool allow_unregistered_calls = 2; */ private $allow_unregistered_calls = false; /** * If true, the selected method should skip service control and the control * plane features, such as quota and billing, will not be available. * This flag is used by Google Cloud Endpoints to bypass checks for internal * methods, such as service health check methods. * * Generated from protobuf field bool skip_service_control = 3; */ private $skip_service_control = false; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $selector * Selects the methods to which this rule applies. Use '*' to indicate all * methods in all APIs. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * @type bool $allow_unregistered_calls * If true, the selected method allows unregistered calls, e.g. calls * that don't identify any user or application. * @type bool $skip_service_control * If true, the selected method should skip service control and the control * plane features, such as quota and billing, will not be available. * This flag is used by Google Cloud Endpoints to bypass checks for internal * methods, such as service health check methods. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Api\Usage::initOnce(); parent::__construct($data); } /** * Selects the methods to which this rule applies. Use '*' to indicate all * methods in all APIs. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; * @return string */ public function getSelector() { return $this->selector; } /** * Selects the methods to which this rule applies. Use '*' to indicate all * methods in all APIs. * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. * * Generated from protobuf field string selector = 1; * @param string $var * @return $this */ public function setSelector($var) { GPBUtil::checkString($var, True); $this->selector = $var; return $this; } /** * If true, the selected method allows unregistered calls, e.g. calls * that don't identify any user or application. * * Generated from protobuf field bool allow_unregistered_calls = 2; * @return bool */ public function getAllowUnregisteredCalls() { return $this->allow_unregistered_calls; } /** * If true, the selected method allows unregistered calls, e.g. calls * that don't identify any user or application. * * Generated from protobuf field bool allow_unregistered_calls = 2; * @param bool $var * @return $this */ public function setAllowUnregisteredCalls($var) { GPBUtil::checkBool($var); $this->allow_unregistered_calls = $var; return $this; } /** * If true, the selected method should skip service control and the control * plane features, such as quota and billing, will not be available. * This flag is used by Google Cloud Endpoints to bypass checks for internal * methods, such as service health check methods. * * Generated from protobuf field bool skip_service_control = 3; * @return bool */ public function getSkipServiceControl() { return $this->skip_service_control; } /** * If true, the selected method should skip service control and the control * plane features, such as quota and billing, will not be available. * This flag is used by Google Cloud Endpoints to bypass checks for internal * methods, such as service health check methods. * * Generated from protobuf field bool skip_service_control = 3; * @param bool $var * @return $this */ public function setSkipServiceControl($var) { GPBUtil::checkBool($var); $this->skip_service_control = $var; return $this; } } src/ApiCore/AgentHeader.php000064400000011467151742741630011560 0ustar00 $value) { $metricsList[] = $key . "/" . $value; } return [self::AGENT_HEADER_KEY => [implode(" ", $metricsList)]]; } /** * Reads the gapic version string from a VERSION file. In order to determine the file * location, this method follows this procedure: * - accepts a class name $callingClass * - identifies the file defining that class * - searches up the directory structure for the 'src' directory * - looks in the directory above 'src' for a file named VERSION * * @param string $callingClass * @return string the gapic version * @throws \ReflectionException */ public static function readGapicVersionFromFile($callingClass) { $callingClassFile = (new \ReflectionClass($callingClass))->getFileName(); $versionFile = substr( $callingClassFile, 0, strrpos($callingClassFile, DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR) ) . DIRECTORY_SEPARATOR . 'VERSION'; return Version::readVersionFile($versionFile); } } src/ApiCore/ApiException.php000064400000012323151742741630011771 0ustar00 null, 'metadata' => null, 'basicMessage' => $message, ]; parent::__construct($message, $code, $optionalArgs['previous']); $this->status = $status; $this->metadata = $optionalArgs['metadata']; $this->basicMessage = $optionalArgs['basicMessage']; } public function getStatus() { return $this->status; } /** * @param \stdClass $status * @return ApiException */ public static function createFromStdClass($status) { $metadata = property_exists($status, 'metadata') ? $status->metadata : null; return self::create( $status->details, $status->code, $metadata, Serializer::decodeMetadata($metadata) ); } /** * @param string $basicMessage * @param int $rpcCode * @param array|null $metadata * @param \Exception $previous * @return ApiException */ public static function createFromApiResponse( $basicMessage, $rpcCode, array $metadata = null, \Exception $previous = null ) { return self::create( $basicMessage, $rpcCode, $metadata, Serializer::decodeMetadata($metadata), $previous ); } /** * Construct an ApiException with a useful message, including decoded metadata. * * @param string $basicMessage * @param int $rpcCode * @param mixed[] $metadata * @param array $decodedMetadata * @param \Exception|null $previous * @return ApiException */ private static function create($basicMessage, $rpcCode, $metadata, array $decodedMetadata, $previous = null) { $rpcStatus = ApiStatus::statusFromRpcCode($rpcCode); $messageData = [ 'message' => $basicMessage, 'code' => $rpcCode, 'status' => $rpcStatus, 'details' => $decodedMetadata ]; $message = json_encode($messageData, JSON_PRETTY_PRINT); return new ApiException($message, $rpcCode, $rpcStatus, [ 'previous' => $previous, 'metadata' => $metadata, 'basicMessage' => $basicMessage, ]); } /** * @param Status $status * @return ApiException */ public static function createFromRpcStatus(Status $status) { return self::create( $status->getMessage(), $status->getCode(), $status->getDetails(), Serializer::decodeAnyMessages($status->getDetails()) ); } /** * @return null|string */ public function getBasicMessage() { return $this->basicMessage; } /** * @return mixed[] */ public function getMetadata() { return $this->metadata; } /** * String representation of ApiException * @return string */ public function __toString() { return __CLASS__ . ": $this->message\n"; } } src/ApiCore/ApiStatus.php000064400000013677151742741630011333 0ustar00 Code::OK, ApiStatus::CANCELLED => Code::CANCELLED, ApiStatus::UNKNOWN => Code::UNKNOWN, ApiStatus::INVALID_ARGUMENT => Code::INVALID_ARGUMENT, ApiStatus::DEADLINE_EXCEEDED => Code::DEADLINE_EXCEEDED, ApiStatus::NOT_FOUND => Code::NOT_FOUND, ApiStatus::ALREADY_EXISTS => Code::ALREADY_EXISTS, ApiStatus::PERMISSION_DENIED => Code::PERMISSION_DENIED, ApiStatus::RESOURCE_EXHAUSTED => Code::RESOURCE_EXHAUSTED, ApiStatus::FAILED_PRECONDITION => Code::FAILED_PRECONDITION, ApiStatus::ABORTED => Code::ABORTED, ApiStatus::OUT_OF_RANGE => Code::OUT_OF_RANGE, ApiStatus::UNIMPLEMENTED => Code::UNIMPLEMENTED, ApiStatus::INTERNAL => Code::INTERNAL, ApiStatus::UNAVAILABLE => Code::UNAVAILABLE, ApiStatus::DATA_LOSS => Code::DATA_LOSS, ApiStatus::UNAUTHENTICATED => Code::UNAUTHENTICATED, ]; private static $codeToApiStatusMap = [ Code::OK => ApiStatus::OK, Code::CANCELLED => ApiStatus::CANCELLED, Code::UNKNOWN => ApiStatus::UNKNOWN, Code::INVALID_ARGUMENT => ApiStatus::INVALID_ARGUMENT, Code::DEADLINE_EXCEEDED => ApiStatus::DEADLINE_EXCEEDED, Code::NOT_FOUND => ApiStatus::NOT_FOUND, Code::ALREADY_EXISTS => ApiStatus::ALREADY_EXISTS, Code::PERMISSION_DENIED => ApiStatus::PERMISSION_DENIED, Code::RESOURCE_EXHAUSTED => ApiStatus::RESOURCE_EXHAUSTED, Code::FAILED_PRECONDITION => ApiStatus::FAILED_PRECONDITION, Code::ABORTED => ApiStatus::ABORTED, Code::OUT_OF_RANGE => ApiStatus::OUT_OF_RANGE, Code::UNIMPLEMENTED => ApiStatus::UNIMPLEMENTED, Code::INTERNAL => ApiStatus::INTERNAL, Code::UNAVAILABLE => ApiStatus::UNAVAILABLE, Code::DATA_LOSS => ApiStatus::DATA_LOSS, Code::UNAUTHENTICATED => ApiStatus::UNAUTHENTICATED, ]; private static $httpStatusCodeToRpcCodeMap = [ 401 => Code::UNAUTHENTICATED, 403 => Code::PERMISSION_DENIED, 404 => Code::NOT_FOUND, 429 => Code::RESOURCE_EXHAUSTED, 499 => Code::CANCELLED, 501 => Code::UNIMPLEMENTED, 503 => Code::UNAVAILABLE, 504 => Code::DEADLINE_EXCEEDED, ]; /** * @param string $status * @return bool */ public static function isValidStatus($status) { return array_key_exists($status, self::$apiStatusToCodeMap); } /** * @param int $code * @return string */ public static function statusFromRpcCode($code) { if (array_key_exists($code, self::$codeToApiStatusMap)) { return self::$codeToApiStatusMap[$code]; } return ApiStatus::UNRECOGNIZED_STATUS; } /** * @param string $status * @return int */ public static function rpcCodeFromStatus($status) { if (array_key_exists($status, self::$apiStatusToCodeMap)) { return self::$apiStatusToCodeMap[$status]; } return ApiStatus::UNRECOGNIZED_CODE; } /** * Maps HTTP status codes to Google\Rpc\Code codes. * Only map codes which do not map to multiple gRPC codes (e.g. excludes * 400, 409, and 500). * * @param int $httpStatusCode * @return int */ public static function rpcCodeFromHttpStatusCode($httpStatusCode) { if (array_key_exists($httpStatusCode, self::$httpStatusCodeToRpcCodeMap)) { return self::$httpStatusCodeToRpcCodeMap[$httpStatusCode]; } return ApiStatus::UNRECOGNIZED_CODE; } } src/ApiCore/ArrayTrait.php000064400000007147151742741630011473 0ustar00pluck($key, $arr, false); } } return $values; } /** * Determine whether given array is associative. * * @param array $arr * @return bool */ private function isAssoc(array $arr) { return array_keys($arr) !== range(0, count($arr) - 1); } /** * Just like array_filter(), but preserves falsey values except null. * * @param array $arr * @return array */ private function arrayFilterRemoveNull(array $arr) { return array_filter($arr, function ($element) { if (!is_null($element)) { return true; } return false; }); } /** * Return a subset of an array, like pluckArray, without modifying the original array. * * @param array $keys * @param array $arr * @return array */ private function subsetArray(array $keys, $arr) { return array_intersect_key( $arr, array_flip($keys) ); } } src/ApiCore/BidiStream.php000064400000013446151742741630011433 0ustar00call = $bidiStreamingCall; if (array_key_exists('resourcesGetMethod', $streamingDescriptor)) { $this->resourcesGetMethod = $streamingDescriptor['resourcesGetMethod']; } } /** * Write request to the server. * * @param mixed $request The request to write * @throws ValidationException */ public function write($request) { if ($this->isComplete) { throw new ValidationException("Cannot call write() after streaming call is complete."); } if ($this->writesClosed) { throw new ValidationException("Cannot call write() after calling closeWrite()."); } $this->call->write($request); } /** * Write all requests in $requests. * * @param mixed[] $requests An Iterable of request objects to write to the server * * @throws ValidationException * @throws ApiException */ public function writeAll($requests = []) { foreach ($requests as $request) { $this->write($request); } } /** * Inform the server that no more requests will be written. The write() function cannot be * called after closeWrite() is called. */ public function closeWrite() { if ($this->isComplete) { throw new ValidationException( "Cannot call closeWrite() after streaming call is complete." ); } if (!$this->writesClosed) { $this->call->writesDone(); $this->writesClosed = true; } } /** * Read the next response from the server. Returns null if the streaming call completed * successfully. Throws an ApiException if the streaming call failed. * * @throws ValidationException * @throws ApiException * @return mixed */ public function read() { if ($this->isComplete) { throw new ValidationException("Cannot call read() after streaming call is complete."); } $resourcesGetMethod = $this->resourcesGetMethod; if (!is_null($resourcesGetMethod)) { if (count($this->pendingResources) === 0) { $response = $this->call->read(); if (!is_null($response)) { $pendingResources = []; foreach ($response->$resourcesGetMethod() as $resource) { $pendingResources[] = $resource; } $this->pendingResources = array_reverse($pendingResources); } } $result = array_pop($this->pendingResources); } else { $result = $this->call->read(); } if (is_null($result)) { $status = $this->call->getStatus(); $this->isComplete = true; if (!($status->code == Code::OK)) { throw ApiException::createFromStdClass($status); } } return $result; } /** * Call closeWrite(), and read all responses from the server, until the streaming call is * completed. Throws an ApiException if the streaming call failed. * * @throws ValidationException * @throws ApiException * @return \Generator|mixed[] */ public function closeWriteAndReadAll() { $this->closeWrite(); $response = $this->read(); while (!is_null($response)) { yield $response; $response = $this->read(); } } /** * Return the underlying gRPC call object * * @return \Grpc\BidiStreamingCall|mixed */ public function getBidiStreamingCall() { return $this->call; } } src/ApiCore/Call.php000064400000006520151742741630010256 0ustar00method = $method; $this->decodeType = $decodeType; $this->message = $message; $this->descriptor = $descriptor; $this->callType = $callType; } /** * @return string */ public function getMethod() { return $this->method; } /** * @return int */ public function getCallType() { return $this->callType; } /** * @return string */ public function getDecodeType() { return $this->decodeType; } /** * @return Message */ public function getMessage() { return $this->message; } /** * @return array|null */ public function getDescriptor() { return $this->descriptor; } /** * @param Message $message * @return Call */ public function withMessage(Message $message) { return new static( $this->method, $this->decodeType, $message, $this->descriptor, $this->callType ); } } src/ApiCore/ClientStream.php000064400000006511151742741630011775 0ustar00call = $clientStreamingCall; } /** * Write request to the server. * * @param mixed $request The request to write */ public function write($request) { $this->call->write($request); } /** * Read the response from the server, completing the streaming call. * * @throws ApiException * @return mixed The response object from the server */ public function readResponse() { list($response, $status) = $this->call->wait(); if ($status->code == Code::OK) { return $response; } else { throw ApiException::createFromStdClass($status); } } /** * Write all data in $dataArray and read the response from the server, completing the streaming * call. * * @param mixed[] $requests An iterator of request objects to write to the server * @return mixed The response object from the server */ public function writeAllAndReadResponse($requests) { foreach ($requests as $request) { $this->write($request); } return $this->readResponse(); } /** * Return the underlying gRPC call object * * @return \Grpc\ClientStreamingCall|mixed */ public function getClientStreamingCall() { return $this->call; } } src/ApiCore/CredentialsWrapper.php000064400000020474151742741630013205 0ustar00credentialsFetcher = $credentialsFetcher; $this->authHttpHandler = $authHttpHandler ?: self::buildHttpHandlerFactory(); } /** * Factory method to create a CredentialsWrapper from an array of options. * * @param array $args { * An array of optional arguments. * * @type string|array $keyFile * Credentials to be used. Accepts either a path to a credentials file, or a decoded * credentials file as a PHP array. If this is not specified, application default * credentials will be used. * @type string[] $scopes * A string array of scopes to use when acquiring credentials. * @type callable $authHttpHandler * A handler used to deliver PSR-7 requests specifically * for authentication. Should match a signature of * `function (RequestInterface $request, array $options) : ResponseInterface`. * @type bool $enableCaching * Enable caching of access tokens. Defaults to true. * @type CacheItemPoolInterface $authCache * A cache for storing access tokens. Defaults to a simple in memory implementation. * @type array $authCacheOptions * Cache configuration options. * } * @return CredentialsWrapper * @throws ValidationException */ public static function build(array $args = []) { $args += [ 'keyFile' => null, 'scopes' => null, 'authHttpHandler' => null, 'enableCaching' => true, 'authCache' => null, 'authCacheOptions' => [], ]; $keyFile = $args['keyFile']; $authHttpHandler = $args['authHttpHandler'] ?: self::buildHttpHandlerFactory(); if (is_null($keyFile)) { $loader = self::buildApplicationDefaultCredentials( $args['scopes'], $authHttpHandler ); } else { if (is_string($keyFile)) { if (!file_exists($keyFile)) { throw new ValidationException("Could not find keyfile: $keyFile"); } $keyFile = json_decode(file_get_contents($keyFile), true); } $loader = CredentialsLoader::makeCredentials($args['scopes'], $keyFile); } if ($args['enableCaching']) { $authCache = $args['authCache'] ?: new MemoryCacheItemPool(); $loader = new FetchAuthTokenCache( $loader, $args['authCacheOptions'], $authCache ); } return new CredentialsWrapper($loader, $authHttpHandler); } /** * @return string Bearer string containing access token. */ public function getBearerString() { return 'Bearer ' . self::getToken($this->credentialsFetcher, $this->authHttpHandler); } /** * @return callable Callable function that returns an authorization header. */ public function getAuthorizationHeaderCallback() { $credentialsFetcher = $this->credentialsFetcher; $authHttpHandler = $this->authHttpHandler; // NOTE: changes to this function should be treated carefully and tested thoroughly. It will // be passed into the gRPC c extension, and changes have the potential to trigger very // difficult-to-diagnose segmentation faults. return function () use ($credentialsFetcher, $authHttpHandler) { return ['authorization' => ['Bearer ' . self::getToken($credentialsFetcher, $authHttpHandler)]]; }; } /** * @return Guzzle5HttpHandler|Guzzle6HttpHandler * @throws ValidationException */ private static function buildHttpHandlerFactory() { try { return HttpHandlerFactory::build(); } catch (Exception $ex) { throw new ValidationException("Failed to build HttpHandler", $ex->getCode(), $ex); } } /** * @param array $scopes * @param callable $authHttpHandler * @param array $authCacheOptions * @param CacheItemPoolInterface $authCache * @return CredentialsLoader * @throws ValidationException */ private static function buildApplicationDefaultCredentials( array $scopes = null, callable $authHttpHandler = null, array $authCacheOptions = null, CacheItemPoolInterface $authCache = null ) { try { return ApplicationDefaultCredentials::getCredentials( $scopes, $authHttpHandler, $authCacheOptions, $authCache ); } catch (DomainException $ex) { throw new ValidationException("Could not construct ApplicationDefaultCredentials", $ex->getCode(), $ex); } } private static function getToken($credentialsFetcher, $authHttpHandler) { $token = $credentialsFetcher->getLastReceivedToken(); if (self::isExpired($token)) { $token = $credentialsFetcher->fetchAuthToken($authHttpHandler); if (!self::isValid($token)) { return ''; } } return $token['access_token']; } private static function isValid($token) { return is_array($token) && array_key_exists('access_token', $token); } private static function isExpired($token) { return !(self::isValid($token) && array_key_exists('expires_at', $token) && $token['expires_at'] > time()); } } src/ApiCore/FixedSizeCollection.php000064400000014350151742741630013311 0ustar00 0. collectionSize: $collectionSize" ); } if ($collectionSize < $initialPage->getPageElementCount()) { $ipc = $initialPage->getPageElementCount(); throw new InvalidArgumentException( "collectionSize must be greater than or equal to the number of " . "elements in initialPage. collectionSize: $collectionSize, " . "initialPage size: $ipc" ); } $this->collectionSize = $collectionSize; $this->pageList = FixedSizeCollection::createPageArray($initialPage, $collectionSize); } /** * Returns the number of elements in the collection. This will be * equal to the collectionSize parameter used at construction * unless there are no elements remaining to be retrieved. * * @return int */ public function getCollectionSize() { $size = 0; foreach ($this->pageList as $page) { $size += $page->getPageElementCount(); } return $size; } /** * Returns true if there are more elements that can be retrieved * from the API. * * @return bool */ public function hasNextCollection() { return $this->getLastPage()->hasNextPage(); } /** * Returns a page token that can be passed into the API list * method to retrieve additional elements. * * @return string */ public function getNextPageToken() { return $this->getLastPage()->getNextPageToken(); } /** * Retrieves the next FixedSizeCollection using one or more API calls. * * @return FixedSizeCollection */ public function getNextCollection() { $lastPage = $this->getLastPage(); $nextPage = $lastPage->getNextPage($this->collectionSize); return new FixedSizeCollection($nextPage, $this->collectionSize); } /** * Returns an iterator over the elements of the collection. * * @return Generator */ public function getIterator() { foreach ($this->pageList as $page) { foreach ($page as $element) { yield $element; } } } /** * Returns an iterator over FixedSizeCollections, starting with this * and making API calls as required until all of the elements have * been retrieved. * * @return Generator|FixedSizeCollection[] */ public function iterateCollections() { $currentCollection = $this; yield $this; while ($currentCollection->hasNextCollection()) { $currentCollection = $currentCollection->getNextCollection(); yield $currentCollection; } } private function getLastPage() { $pageList = $this->pageList; // Get last element in array... $lastPage = end($pageList); reset($pageList); return $lastPage; } /** * @param Page $initialPage * @param integer $collectionSize * @return Page[] */ private static function createPageArray($initialPage, $collectionSize) { $pageList = [$initialPage]; $currentPage = $initialPage; $itemCount = $currentPage->getPageElementCount(); while ($itemCount < $collectionSize && $currentPage->hasNextPage()) { $remainingCount = $collectionSize - $itemCount; $currentPage = $currentPage->getNextPage($remainingCount); $rxElementCount = $currentPage->getPageElementCount(); if ($rxElementCount > $remainingCount) { throw new LengthException("API returned a number of elements " . "exceeding the specified page size limit. page size: " . "$remainingCount, elements received: $rxElementCount"); } array_push($pageList, $currentPage); $itemCount += $rxElementCount; } return $pageList; } } src/ApiCore/GPBLabel.php000064400000003511151742741630010750 0ustar00 'startUnaryCall', Call::BIDI_STREAMING_CALL => 'startBidiStreamingCall', Call::CLIENT_STREAMING_CALL => 'startClientStreamingCall', Call::SERVER_STREAMING_CALL => 'startServerStreamingCall', ]; /** * Initiates an orderly shutdown in which preexisting calls continue but new * calls are immediately cancelled. * * @experimental */ public function close() { $this->transport->close(); } /** * Get the transport for the client. This method is protected to support * use by customized clients. * * @access private * @return TransportInterface */ protected function getTransport() { return $this->transport; } /** * Get the credentials for the client. This method is protected to support * use by customized clients. * * @access private * @return CredentialsWrapper */ protected function getCredentialsWrapper() { return $this->credentialsWrapper; } private static function getGapicVersion(array $options) { if (isset($options['libVersion'])) { return $options['libVersion']; } else { if (!isset(self::$gapicVersionFromFile)) { self::$gapicVersionFromFile = AgentHeader::readGapicVersionFromFile(__CLASS__); } return self::$gapicVersionFromFile; } } private static function initGrpcGcpConfig($hostName, $confPath) { $apiConfig = new ApiConfig(); $apiConfig->mergeFromJsonString(file_get_contents($confPath)); $config = new Config($hostName, $apiConfig); return $config; } /** * Get default options. This function should be "overridden" by clients using late static * binding to provide default options to the client. * * @return array * @access private */ private static function getClientDefaults() { return []; } private function buildClientOptions(array $options) { // Build $defaultOptions starting from top level // variables, then going into deeper nesting, so that // we will not encounter missing keys $defaultOptions = self::getClientDefaults(); $defaultOptions += [ 'disableRetries' => false, 'credentials' => null, 'credentialsConfig' => [], 'transport' => null, 'transportConfig' => [], 'gapicVersion' => self::getGapicVersion($options), 'libName' => null, 'libVersion' => null, ]; $defaultOptions['transportConfig'] += [ 'grpc' => [], 'rest' => [], 'grpc-fallback' => [], ]; // Merge defaults into $options starting from top level // variables, then going into deeper nesting, so that // we will not encounter missing keys $options += $defaultOptions; $options['credentialsConfig'] += $defaultOptions['credentialsConfig']; $options['transportConfig'] += $defaultOptions['transportConfig']; $options['transportConfig']['grpc'] += $defaultOptions['transportConfig']['grpc']; $options['transportConfig']['rest'] += $defaultOptions['transportConfig']['rest']; $options['transportConfig']['grpc-fallback'] += $defaultOptions['transportConfig']['grpc-fallback']; $this->modifyClientOptions($options); if (extension_loaded('sysvshm') && isset($options['gcpApiConfigPath']) && file_exists($options['gcpApiConfigPath']) && isset($options['serviceAddress'])) { $grpcGcpConfig = self::initGrpcGcpConfig( $options['serviceAddress'], $options['gcpApiConfigPath'] ); if (array_key_exists('stubOpts', $options['transportConfig']['grpc'])) { $options['transportConfig']['grpc']['stubOpts'] += [ 'grpc_call_invoker' => $grpcGcpConfig->callInvoker() ]; } else { $options['transportConfig']['grpc'] += [ 'stubOpts' => [ 'grpc_call_invoker' => $grpcGcpConfig->callInvoker() ] ]; } } return $options; } /** * Configures the GAPIC client based on an array of options. * * @param array $options { * An array of required and optional arguments. * * @type string $serviceAddress * The address of the API remote host, for example "example.googleapis.com. May also * include the port, for example "example.googleapis.com:443" * @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|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 * \Google\Auth\FetchAuthTokenInterface object or \Google\ApiCore\CredentialsWrapper * object. Note that when one of these objects are provided, any settings in * $authConfig 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 string|TransportInterface $transport * The transport used for executing network requests. May be either the string `rest`, * `grpc`, or 'grpc-fallback'. 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 $serviceAddress setting, will be ignored. * @type array $transportConfig * Configuration options that will be used to construct the transport. Options for * each supported transport type should be passed in a key for that transport. For * example: * $transportConfig = [ * 'grpc' => [...], * 'rest' => [...], * 'grpc-fallback' => [...], * ]; * See the GrpcTransport::build and RestTransport::build * methods for the supported options. * @type string $versionFile * The path to a file which contains the current version of the client. * @type string $descriptorsConfigPath * The path to a descriptor configuration file. * @type string $serviceName * The name of the service. * @type string $libName * The name of the client application. * @type string $libVersion * The version of the client application. * @type string $gapicVersion * The code generator version of the GAPIC library. * } * @throws ValidationException */ private function setClientOptions(array $options) { $this->validateNotNull($options, [ 'serviceAddress', 'serviceName', 'descriptorsConfigPath', 'clientConfig', 'disableRetries', 'credentialsConfig', 'transportConfig', ]); $this->validate($options, [ 'credentials', 'transport', 'gapicVersion', 'libName', 'libVersion', ]); $clientConfig = $options['clientConfig']; if (is_string($clientConfig)) { $clientConfig = json_decode(file_get_contents($clientConfig), true); } $this->serviceName = $options['serviceName']; $this->retrySettings = RetrySettings::load( $this->serviceName, $clientConfig, $options['disableRetries'] ); $this->agentHeader = AgentHeader::buildAgentHeader( $this->pluckArray([ 'libName', 'libVersion', 'gapicVersion' ], $options) ); self::validateFileExists($options['descriptorsConfigPath']); $descriptors = require($options['descriptorsConfigPath']); $this->descriptors = $descriptors['interfaces'][$this->serviceName]; $this->credentialsWrapper = $this->createCredentialsWrapper( $options['credentials'], $options['credentialsConfig'] ); $transport = $options['transport'] ?: self::defaultTransport(); $this->transport = $transport instanceof TransportInterface ? $transport : $this->createTransport($options['serviceAddress'], $transport, $options['transportConfig']); } /** * @param mixed $auth * @param array $authConfig * @return CredentialsWrapper * @throws ValidationException */ private function createCredentialsWrapper($auth, array $authConfig) { if (is_null($auth)) { return CredentialsWrapper::build($authConfig); } elseif (is_string($auth) || is_array($auth)) { return CredentialsWrapper::build(['keyFile' => $auth] + $authConfig); } elseif ($auth instanceof FetchAuthTokenInterface) { $authHttpHandler = isset($authConfig['authHttpHandler']) ? $authConfig['authHttpHandler'] : null; return new CredentialsWrapper($auth, $authHttpHandler); } elseif ($auth instanceof CredentialsWrapper) { return $auth; } else { throw new ValidationException( 'Unexpected value in $auth option, got: ' . print_r($auth, true) ); } } /** * @param string $serviceAddress * @param string $transport * @param array $transportConfig * @return TransportInterface * @throws ValidationException */ private function createTransport($serviceAddress, $transport, array $transportConfig) { if (!is_string($transport)) { throw new ValidationException( "'transport' must be a string, instead got:" . print_r($transport, true) ); } $configForSpecifiedTransport = isset($transportConfig[$transport]) ? $transportConfig[$transport] : []; switch ($transport) { case 'grpc': return GrpcTransport::build($serviceAddress, $configForSpecifiedTransport); case 'grpc-fallback': return GrpcFallbackTransport::build($serviceAddress, $configForSpecifiedTransport); case 'rest': if (!isset($configForSpecifiedTransport['restClientConfigPath'])) { throw new ValidationException( "The 'restClientConfigPath' config is required for 'rest' transport." ); } $restConfigPath = $configForSpecifiedTransport['restClientConfigPath']; return RestTransport::build($serviceAddress, $restConfigPath, $configForSpecifiedTransport); default: throw new ValidationException( "Unexpected 'transport' option: $transport. " . "Supported values: ['grpc', 'rest', 'grpc-fallback']" ); } } /** * @param array $options * @return OperationsClient */ private function createOperationsClient(array $options) { $this->pluckArray([ 'serviceName', 'clientConfig', 'descriptorsConfigPath', ], $options); return $this->pluck('operationsClient', $options, false) ?: new OperationsClient($options); } /** * @return string */ private static function defaultTransport() { return self::getGrpcDependencyStatus() ? 'grpc' : 'rest'; } /** * @param string $methodName * @param string $decodeType * @param array $optionalArgs { * Call Options * * @type array $headers [optional] key-value array containing headers * @type int $timeoutMillis [optional] the timeout in milliseconds for the call * @type array $transportOptions [optional] transport-specific call options * @type RetrySettings $retrySettings [optional] A retry settings override * For the call. * } * @param Message $request * @param int $callType * @param string $interfaceName * * @return PromiseInterface|BidiStream|ClientStream|ServerStream */ private function startCall( $methodName, $decodeType, array $optionalArgs = [], Message $request = null, $callType = Call::UNARY_CALL, $interfaceName = null ) { $callStack = $this->createCallStack( $this->configureCallConstructionOptions($methodName, $optionalArgs) ); $descriptor = isset($this->descriptors[$methodName]['grpcStreaming']) ? $this->descriptors[$methodName]['grpcStreaming'] : null; $call = new Call( $this->buildMethod($interfaceName, $methodName), $decodeType, $request, $descriptor, $callType ); switch ($callType) { case Call::UNARY_CALL: $this->modifyUnaryCallable($callStack); break; case Call::BIDI_STREAMING_CALL: case Call::CLIENT_STREAMING_CALL: case Call::SERVER_STREAMING_CALL: $this->modifyStreamingCallable($callStack); break; } return $callStack($call, $optionalArgs); } /** * @param array $callConstructionOptions { * Call Construction Options * * @type RetrySettings $retrySettings [optional] A retry settings override * For the call. * } * * @return callable */ private function createCallStack(array $callConstructionOptions) { $callStack = function (Call $call, array $options) { $startCallMethod = $this->transportCallMethods[$call->getCallType()]; return $this->transport->$startCallMethod($call, $options); }; $callStack = new CredentialsWrapperMiddleware($callStack, $this->credentialsWrapper); $callStack = new FixedHeaderMiddleware($callStack, $this->agentHeader, true); $callStack = new RetryMiddleware($callStack, $callConstructionOptions['retrySettings']); $callStack = new OptionsFilterMiddleware($callStack, [ 'headers', 'timeoutMillis', 'transportOptions', 'metadataCallback', ]); return $callStack; } /** * @param string $methodName * @param array $optionalArgs { * Optional arguments * * @type RetrySettings $retrySettings [optional] A retry settings override * For the call. * } * * @return array */ private function configureCallConstructionOptions($methodName, array $optionalArgs) { $retrySettings = $this->retrySettings[$methodName]; // Allow for retry settings to be changed at call time if (isset($optionalArgs['retrySettings'])) { $retrySettings = $retrySettings->with( $optionalArgs['retrySettings'] ); } return [ 'retrySettings' => $retrySettings, ]; } /** * @param string $methodName * @param array $optionalArgs { * Call Options * * @type array $headers [optional] key-value array containing headers * @type int $timeoutMillis [optional] the timeout in milliseconds for the call * @type array $transportOptions [optional] transport-specific call options * } * @param Message $request * @param OperationsClient $client * @param string $interfaceName * * @return PromiseInterface */ private function startOperationsCall( $methodName, array $optionalArgs, Message $request, OperationsClient $client, $interfaceName = null ) { $callStack = $this->createCallStack( $this->configureCallConstructionOptions($methodName, $optionalArgs) ); $descriptor = $this->descriptors[$methodName]['longRunning']; $callStack = new OperationsMiddleware($callStack, $client, $descriptor); $call = new Call( $this->buildMethod($interfaceName, $methodName), Operation::class, $request, [], Call::UNARY_CALL ); $this->modifyUnaryCallable($callStack); return $callStack($call, $optionalArgs); } /** * @param string $methodName * @param array $optionalArgs * @param string $decodeType * @param Message $request * @param string $interfaceName * * @return PagedListResponse */ private function getPagedListResponse( $methodName, array $optionalArgs, $decodeType, Message $request, $interfaceName = null ) { $callStack = $this->createCallStack( $this->configureCallConstructionOptions($methodName, $optionalArgs) ); $descriptor = new PageStreamingDescriptor( $this->descriptors[$methodName]['pageStreaming'] ); $callStack = new PagedMiddleware($callStack, $descriptor); $call = new Call( $this->buildMethod($interfaceName, $methodName), $decodeType, $request, [], Call::UNARY_CALL ); $this->modifyUnaryCallable($callStack); return $callStack($call, $optionalArgs)->wait(); } /** * @param string $interfaceName * @param string $methodName * * @return string */ private function buildMethod($interfaceName, $methodName) { return sprintf( '%s/%s', $interfaceName ?: $this->serviceName, $methodName ); } // Gapic Client Extension Points // The methods below provide extension points that can be used to customize client // functionality. These extension points are currently considered // private and may change at any time. /** * Modify options passed to the client before calling setClientOptions. * * @param array $options * @access private */ protected function modifyClientOptions(array &$options) { // Do nothing - this method exists to allow option modification by partial veneers. } /** * Modify the unary callable. * * @param callable $callable * @access private */ protected function modifyUnaryCallable(callable &$callable) { // Do nothing - this method exists to allow callable modification by partial veneers. } /** * Modify the streaming callable. * * @param callable $callable * @access private */ protected function modifyStreamingCallable(callable &$callable) { // Do nothing - this method exists to allow callable modification by partial veneers. } } src/ApiCore/GrpcSupportTrait.php000064400000004354151742741630012702 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 $serviceAddress * 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 $serviceAddress setting, will be ignored. * @type array $transportConfig * Configuration options that will be used to construct the transport. Options for * each supported transport type should be passed in a key for that transport. For * example: * $transportConfig = [ * 'grpc' => [...], * 'rest' => [...] * ]; * See the 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 = [ * 'serviceAddress' => '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); 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 = [ * 'serviceAddress' => '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']); } 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 = [ * 'serviceAddress' => '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); 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 = [ * 'serviceAddress' => '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); return $this->startCall( 'DeleteOperation', GPBEmpty::class, $optionalArgs, $request )->wait(); } } src/ApiCore/LongRunning/OperationsClient.php000064400000004436151742741630015131 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.php000064400000003057151742741630021762 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/ApiCore/Middleware/CredentialsWrapperMiddleware.php000064400000004502151742741630017252 0ustar00nextHandler = $nextHandler; $this->credentialsWrapper = $credentialsWrapper; } public function __invoke(Call $call, array $options) { $next = $this->nextHandler; return $next( $call, $options + ['credentialsWrapper' => $this->credentialsWrapper] ); } } src/ApiCore/Middleware/FixedHeaderMiddleware.php000064400000004755151742741630015636 0ustar00nextHandler = $nextHandler; $this->headers = $headers; $this->overrideUserHeaders = $overrideUserHeaders; } public function __invoke(Call $call, array $options) { $userHeaders = isset($options['headers']) ? $options['headers'] : []; if ($this->overrideUserHeaders) { $options['headers'] = $this->headers + $userHeaders; } else { $options['headers'] = $userHeaders + $this->headers; } $next = $this->nextHandler; return $next( $call, $options ); } } src/ApiCore/Middleware/OperationsMiddleware.php000064400000005217151742741630015603 0ustar00nextHandler = $nextHandler; $this->client = $client; $this->descriptor = $descriptor; } public function __invoke(Call $call, array $options) { $next = $this->nextHandler; return $next( $call, $options )->then(function (Message $response) { $options = $this->descriptor + [ 'lastProtoResponse' => $response ]; return new OperationResponse($response->getName(), $this->client, $options); }); } } src/ApiCore/Middleware/OptionsFilterMiddleware.php000064400000004461151742741630016261 0ustar00nextHandler = $nextHandler; $this->permittedOptions = $permittedOptions; } public function __invoke(Call $call, array $options) { $next = $this->nextHandler; $filteredOptions = $this->pluckArray($this->permittedOptions, $options); return $next( $call, $filteredOptions ); } } src/ApiCore/Middleware/PagedMiddleware.php000064400000005457151742741630014506 0ustar00nextHandler = $nextHandler; $this->descriptor = $descriptor; } public function __invoke(Call $call, array $options) { $next = $this->nextHandler; $descriptor = $this->descriptor; return $next($call, $options)->then( function (Message $response) use ($call, $next, $options, $descriptor) { $page = new Page( $call, $options, $next, $descriptor, $response ); return new PagedListResponse($page); } ); } } src/ApiCore/Middleware/ResponseMetadataMiddleware.php000064400000005261151742741630016716 0ustar00nextHandler = $nextHandler; } public function __invoke(Call $call, array $options) { $metadataReceiver = new Promise(); $options['metadataCallback'] = function ($metadata) use ($metadataReceiver) { $metadataReceiver->resolve($metadata); }; $next = $this->nextHandler; return $next($call, $options)->then( function ($response) use ($metadataReceiver) { if ($metadataReceiver->getState() === PromiseInterface::FULFILLED) { return [$response, $metadataReceiver->wait()]; } else { return [$response, []]; } } ); } } src/ApiCore/Middleware/RetryMiddleware.php000064400000013036151742741630014563 0ustar00nextHandler = $nextHandler; $this->retrySettings = $retrySettings; $this->deadlineMs = $deadlineMs; } /** * @param Call $call * @param array $options * * @return PromiseInterface */ public function __invoke(Call $call, array $options) { $nextHandler = $this->nextHandler; if (!isset($options['timeoutMillis'])) { // default to "noRetriesRpcTimeoutMillis" when retries are disabled, otherwise use "initialRpcTimeoutMillis" if (!$this->retrySettings->retriesEnabled() && $this->retrySettings->getNoRetriesRpcTimeoutMillis() > 0) { $options['timeoutMillis'] = $this->retrySettings->getNoRetriesRpcTimeoutMillis(); } elseif ($this->retrySettings->getInitialRpcTimeoutMillis() > 0) { $options['timeoutMillis'] = $this->retrySettings->getInitialRpcTimeoutMillis(); } } // Call the handler immediately if retry settings are disabled. if (!$this->retrySettings->retriesEnabled()) { return $nextHandler($call, $options); } return $nextHandler($call, $options)->then(null, function ($e) use ($call, $options) { if (!$e instanceof ApiException) { throw $e; } if (!in_array($e->getStatus(), $this->retrySettings->getRetryableCodes())) { throw $e; } return $this->retry($call, $options, $e->getStatus()); }); } /** * @param Call $call * @param array $options * @param string $status * * @return PromiseInterface */ private function retry(Call $call, array $options, $status) { $delayMult = $this->retrySettings->getRetryDelayMultiplier(); $maxDelayMs = $this->retrySettings->getMaxRetryDelayMillis(); $timeoutMult = $this->retrySettings->getRpcTimeoutMultiplier(); $maxTimeoutMs = $this->retrySettings->getMaxRpcTimeoutMillis(); $totalTimeoutMs = $this->retrySettings->getTotalTimeoutMillis(); $delayMs = $this->retrySettings->getInitialRetryDelayMillis(); $timeoutMs = $options['timeoutMillis']; $currentTimeMs = $this->getCurrentTimeMs(); $deadlineMs = $this->deadlineMs ?: $currentTimeMs + $totalTimeoutMs; if ($currentTimeMs >= $deadlineMs) { throw new ApiException( 'Retry total timeout exceeded.', \Google\Rpc\Code::DEADLINE_EXCEEDED, ApiStatus::DEADLINE_EXCEEDED ); } // Don't sleep if the failure was a timeout if ($status != ApiStatus::DEADLINE_EXCEEDED) { usleep($delayMs * 1000); } $delayMs = min($delayMs * $delayMult, $maxDelayMs); $timeoutMs = min( $timeoutMs * $timeoutMult, $maxTimeoutMs, $deadlineMs - $this->getCurrentTimeMs() ); $nextHandler = new RetryMiddleware( $this->nextHandler, $this->retrySettings->with([ 'initialRetryDelayMillis' => $delayMs, ]), $deadlineMs ); // Set the timeout for the call $options['timeoutMillis'] = $timeoutMs; return $nextHandler( $call, $options ); } protected function getCurrentTimeMs() { return microtime(true) * 1000.0; } } src/ApiCore/OperationResponse.php000064400000031005151742741630013056 0ustar00 self::DEFAULT_POLLING_INTERVAL, 'pollDelayMultiplier' => self::DEFAULT_POLLING_MULTIPLIER, 'maxPollDelayMillis' => self::DEFAULT_MAX_POLLING_INTERVAL, 'totalPollTimeoutMillis' => self::DEFAULT_MAX_POLLING_DURATION, ]; private $lastProtoResponse; private $deleted = false; /** * OperationResponse constructor. * * @param string $operationName * @param OperationsClient $operationsClient * @param array $options { * Optional. Options for configuring the Operation response object. * * @type string $operationReturnType The return type of the longrunning operation. * @type string $metadataReturnType The type of the metadata returned in the Operation response. * @type int $initialPollDelayMillis The initial polling interval to use, in milliseconds. * @type int $pollDelayMultiplier Multiplier applied to the polling interval on each retry. * @type int $maxPollDelayMillis The maximum polling interval to use, in milliseconds. * @type int $totalPollTimeoutMillis The maximum amount of time to continue polling. * @type Operation $lastProtoResponse A response already received from the server. * } */ public function __construct($operationName, $operationsClient, $options = []) { $this->operationName = $operationName; $this->operationsClient = $operationsClient; if (isset($options['operationReturnType'])) { $this->operationReturnType = $options['operationReturnType']; } if (isset($options['metadataReturnType'])) { $this->metadataReturnType = $options['metadataReturnType']; } if (isset($options['initialPollDelayMillis'])) { $this->defaultPollSettings['initialPollDelayMillis'] = $options['initialPollDelayMillis']; } if (isset($options['pollDelayMultiplier'])) { $this->defaultPollSettings['pollDelayMultiplier'] = $options['pollDelayMultiplier']; } if (isset($options['maxPollDelayMillis'])) { $this->defaultPollSettings['maxPollDelayMillis'] = $options['maxPollDelayMillis']; } if (isset($options['totalPollTimeoutMillis'])) { $this->defaultPollSettings['totalPollTimeoutMillis'] = $options['totalPollTimeoutMillis']; } if (isset($options['lastProtoResponse'])) { $this->lastProtoResponse = $options['lastProtoResponse']; } } /** * Check whether the operation has completed. * * @return bool */ public function isDone() { return (is_null($this->lastProtoResponse) || is_null($this->lastProtoResponse->getDone())) ? false : $this->lastProtoResponse->getDone(); } /** * Check whether the operation completed successfully. If the operation is not complete, or if the operation * failed, return false. * * @return bool */ public function operationSucceeded() { return !is_null($this->getResult()); } /** * Check whether the operation failed. If the operation is not complete, or if the operation * succeeded, return false. * * @return bool */ public function operationFailed() { return !is_null($this->getError()); } /** * Get the formatted name of the operation * * @return string The formatted name of the operation */ public function getName() { return $this->operationName; } /** * Poll the server in a loop until the operation is complete. * * Return true if the operation completed, otherwise return false. If the * $options['totalPollTimeoutMillis'] setting is not set (or set <= 0) then * pollUntilComplete will continue polling until the operation completes, * and therefore will always return true. * * @param array $options { * Options for configuring the polling behaviour. * * @type int $initialPollDelayMillis The initial polling interval to use, in milliseconds. * @type int $pollDelayMultiplier Multiplier applied to the polling interval on each retry. * @type int $maxPollDelayMillis The maximum polling interval to use, in milliseconds. * @type int $totalPollTimeoutMillis The maximum amount of time to continue polling, in milliseconds. * } * @throws ApiException If an API call fails. * @throws ValidationException * @return bool Indicates if the operation completed. */ public function pollUntilComplete($options = []) { if ($this->isDone()) { return true; } $pollSettings = array_merge($this->defaultPollSettings, $options); return $this->poll(function () { $this->reload(); return $this->isDone(); }, $pollSettings); } /** * Reload the status of the operation with a request to the service. * * @throws ApiException If the API call fails. * @throws ValidationException If called on a deleted operation. */ public function reload() { if ($this->deleted) { throw new ValidationException("Cannot call reload() on a deleted operation"); } $name = $this->getName(); $this->lastProtoResponse = $this->operationsClient->getOperation($name); } /** * Return the result of the operation. If operationSucceeded() is false, return null. * * @return mixed|null The result of the operation, or null if operationSucceeded() is false */ public function getResult() { if (!$this->isDone() || is_null($this->lastProtoResponse->getResponse())) { return null; } $anyResponse = $this->lastProtoResponse->getResponse(); if (is_null($this->operationReturnType)) { return $anyResponse; } $operationReturnType = $this->operationReturnType; $response = new $operationReturnType(); $response->mergeFromString($anyResponse->getValue()); return $response; } /** * If the operation failed, return the status. If operationFailed() is false, return null. * * @return Status|null The status of the operation in case of failure, or null if * operationFailed() is false. */ public function getError() { if (!$this->isDone() || is_null($this->lastProtoResponse->getError())) { return null; } return $this->lastProtoResponse->getError(); } /** * Get an array containing the values of 'operationReturnType', 'metadataReturnType', and * the polling options `initialPollDelayMillis`, `pollDelayMultiplier`, `maxPollDelayMillis`, * and `totalPollTimeoutMillis`. The array can be passed as the $options argument to the * constructor when creating another OperationResponse object. * * @return array */ public function getDescriptorOptions() { return [ 'operationReturnType' => $this->operationReturnType, 'metadataReturnType' => $this->metadataReturnType, ] + $this->defaultPollSettings; } /** * @return Operation|null The last Operation object received from the server. */ public function getLastProtoResponse() { return $this->lastProtoResponse; } /** * @return OperationsClient The OperationsClient object used to make * requests to the operations API. */ public function getOperationsClient() { return $this->operationsClient; } /** * 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 will throw an * ApiException with code \Google\Rpc\Code::UNIMPLEMENTED. Clients can continue * to use reload and pollUntilComplete 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 a getError() value with a \Google\Rpc\Status code of 1, * corresponding to \Google\Rpc\Code::CANCELLED. * * @throws ApiException If the API call fails. */ public function cancel() { $this->operationsClient->cancelOperation($this->getName()); } /** * Delete the 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 will throw an ApiException with * code \Google\Rpc\Code::UNIMPLEMENTED. * * @throws ApiException If the API call fails. */ public function delete() { $this->operationsClient->deleteOperation($this->getName()); $this->deleted = true; } /** * Get the metadata returned with the last proto response. If a metadata type was provided, then * the return value will be of that type - otherwise, the return value will be of type Any. If * no metadata object is available, returns null. * * @return mixed The metadata returned from the server in the last response. */ public function getMetadata() { if (is_null($this->lastProtoResponse)) { return null; } $any = $this->lastProtoResponse->getMetadata(); if (is_null($this->metadataReturnType)) { return $any; } if (is_null($any) || is_null($any->getValue())) { return null; } $metadataReturnType = $this->metadataReturnType; $metadata = new $metadataReturnType(); $metadata->mergeFromString($any->getValue()); return $metadata; } } src/ApiCore/Page.php000064400000021373151742741630010262 0ustar00call = $call; $this->options = $options; $this->callable = $callable; $this->pageStreamingDescriptor = $pageStreamingDescriptor; $this->response = $response; $requestPageTokenGetMethod = $this->pageStreamingDescriptor->getRequestPageTokenGetMethod(); $this->pageToken = $this->call->getMessage()->$requestPageTokenGetMethod(); } /** * Returns true if there are more pages that can be retrieved from the * API. * * @return bool */ public function hasNextPage() { return strcmp($this->getNextPageToken(), Page::FINAL_PAGE_TOKEN) != 0; } /** * Returns the next page token from the response. * * @return string */ public function getNextPageToken() { $responsePageTokenGetMethod = $this->pageStreamingDescriptor->getResponsePageTokenGetMethod(); return $this->getResponseObject()->$responsePageTokenGetMethod(); } /** * Retrieves the next Page object using the next page token. * * @param int|null $pageSize * @throws ValidationException if there are no pages remaining, or if pageSize is supplied but * is not supported by the API * @return Page */ public function getNextPage($pageSize = null) { if (!$this->hasNextPage()) { throw new ValidationException( 'Could not complete getNextPage operation: ' . 'there are no more pages to retrieve.' ); } $newRequest = clone $this->getRequestObject(); $requestPageTokenSetMethod = $this->pageStreamingDescriptor->getRequestPageTokenSetMethod(); $newRequest->$requestPageTokenSetMethod($this->getNextPageToken()); if (isset($pageSize)) { if (!$this->pageStreamingDescriptor->requestHasPageSizeField()) { throw new ValidationException( 'pageSize argument was defined, but the method does not ' . 'support a page size parameter in the optional array argument' ); } $requestPageSizeSetMethod = $this->pageStreamingDescriptor->getRequestPageSizeSetMethod(); $newRequest->$requestPageSizeSetMethod($pageSize); } $this->call = $this->call->withMessage($newRequest); $callable = $this->callable; $response = $callable( $this->call, $this->options )->wait(); return new Page( $this->call, $this->options, $this->callable, $this->pageStreamingDescriptor, $response ); } /** * Return the number of elements in the response. * * @return int */ public function getPageElementCount() { $resourcesGetMethod = $this->pageStreamingDescriptor->getResourcesGetMethod(); return count($this->getResponseObject()->$resourcesGetMethod()); } /** * Return an iterator over the elements in the response. * * @return Generator */ public function getIterator() { $resourcesGetMethod = $this->pageStreamingDescriptor->getResourcesGetMethod(); foreach ($this->getResponseObject()->$resourcesGetMethod() as $element) { yield $element; } } /** * Return an iterator over Page objects, beginning with this object. * Additional Page objects are retrieved lazily via API calls until * all elements have been retrieved. * * @return Page[] */ public function iteratePages() { $currentPage = $this; yield $this; while ($currentPage->hasNextPage()) { $currentPage = $currentPage->getNextPage(); yield $currentPage; } } /** * Gets the request object used to generate the Page. * * @return \Google\Protobuf\Internal\Message */ public function getRequestObject() { return $this->call->getMessage(); } /** * Gets the API response object. * * @return \Google\Protobuf\Internal\Message */ public function getResponseObject() { return $this->response; } /** * Returns a collection of elements with a fixed size set by * the collectionSize parameter. The collection will only contain * fewer than collectionSize elements if there are no more * pages to be retrieved from the server. * * NOTE: it is an error to call this method if an optional parameter * to set the page size is not supported or has not been set in the * API call that was used to create this page. It is also an error * if the collectionSize parameter is less than the page size that * has been set. * * @param $collectionSize int * @throws ValidationException if a FixedSizeCollection of the specified size cannot be constructed * @return FixedSizeCollection */ public function expandToFixedSizeCollection($collectionSize) { if (!$this->pageStreamingDescriptor->requestHasPageSizeField()) { throw new ValidationException( "FixedSizeCollection is not supported for this method, because " . "the method does not support an optional argument to set the " . "page size." ); } $request = $this->getRequestObject(); $pageSizeGetMethod = $this->pageStreamingDescriptor->getRequestPageSizeGetMethod(); $pageSize = $request->$pageSizeGetMethod(); if (is_null($pageSize)) { throw new ValidationException( "Error while expanding Page to FixedSizeCollection: No page size " . "parameter found. The page size parameter must be set in the API " . "optional arguments array, and must be less than the collectionSize " . "parameter, in order to create a FixedSizeCollection object." ); } if ($pageSize > $collectionSize) { throw new ValidationException( "Error while expanding Page to FixedSizeCollection: collectionSize " . "parameter is less than the page size optional argument specified in " . "the API call. collectionSize: $collectionSize, page size: $pageSize" ); } return new FixedSizeCollection($this, $collectionSize); } } src/ApiCore/PageStreamingDescriptor.php000064400000014226151742741630014172 0ustar00descriptor = $descriptor; } /** * @param array $fields { * Required. * * @type string $requestPageTokenField the page token field in the request object. * @type string $responsePageTokenField the page token field in the response object. * @type string $resourceField the resource field in the response object. * * Optional. * @type string $requestPageSizeField the page size field in the request object. * } * @return PageStreamingDescriptor */ public static function createFromFields($fields) { $requestPageToken = $fields['requestPageTokenField']; $responsePageToken = $fields['responsePageTokenField']; $resources = $fields['resourceField']; $descriptor = [ 'requestPageTokenGetMethod' => PageStreamingDescriptor::getMethod($requestPageToken), 'requestPageTokenSetMethod' => PageStreamingDescriptor::setMethod($requestPageToken), 'responsePageTokenGetMethod' => PageStreamingDescriptor::getMethod($responsePageToken), 'resourcesGetMethod' => PageStreamingDescriptor::getMethod($resources), ]; if (isset($fields['requestPageSizeField'])) { $requestPageSize = $fields['requestPageSizeField']; $descriptor['requestPageSizeGetMethod'] = PageStreamingDescriptor::getMethod($requestPageSize); $descriptor['requestPageSizeSetMethod'] = PageStreamingDescriptor::setMethod($requestPageSize); } return new PageStreamingDescriptor($descriptor); } private static function getMethod($field) { return 'get' . ucfirst($field); } private static function setMethod($field) { return 'set' . ucfirst($field); } /** * @return string The page token get method on the request object */ public function getRequestPageTokenGetMethod() { return $this->descriptor['requestPageTokenGetMethod']; } /** * @return string The page size get method on the request object */ public function getRequestPageSizeGetMethod() { return $this->descriptor['requestPageSizeGetMethod']; } /** * @return bool True if the request object has a page size field */ public function requestHasPageSizeField() { return array_key_exists('requestPageSizeGetMethod', $this->descriptor); } /** * @return string The page token get method on the response object */ public function getResponsePageTokenGetMethod() { return $this->descriptor['responsePageTokenGetMethod']; } /** * @return string The resources get method on the response object */ public function getResourcesGetMethod() { return $this->descriptor['resourcesGetMethod']; } /** * @return string The page token set method on the request object */ public function getRequestPageTokenSetMethod() { return $this->descriptor['requestPageTokenSetMethod']; } /** * @return string The page size set method on the request object */ public function getRequestPageSizeSetMethod() { return $this->descriptor['requestPageSizeSetMethod']; } private static function validate($descriptor) { $requiredFields = [ 'requestPageTokenGetMethod', 'requestPageTokenSetMethod', 'responsePageTokenGetMethod', 'resourcesGetMethod', ]; foreach ($requiredFields as $field) { if (empty($descriptor[$field])) { throw new InvalidArgumentException( "$field is required for PageStreamingDescriptor" ); } } } } src/ApiCore/PagedListResponse.php000064400000012161151742741630012774 0ustar00firstPage = $firstPage; } /** * Returns an iterator over the full list of elements. Elements * of the list are retrieved lazily using the underlying API. * * @return Generator */ public function iterateAllElements() { foreach ($this->iteratePages() as $page) { foreach ($page as $element) { yield $element; } } } /** * Return the current page of results. * * @return Page */ public function getPage() { return $this->firstPage; } /** * Returns an iterator over pages of results. The pages are * retrieved lazily from the underlying API. * * @return Page[] */ public function iteratePages() { return $this->getPage()->iteratePages(); } /** * Returns a collection of elements with a fixed size set by * the collectionSize parameter. The collection will only contain * fewer than collectionSize elements if there are no more * pages to be retrieved from the server. * * NOTE: it is an error to call this method if an optional parameter * to set the page size is not supported or has not been set in the * original API call. It is also an error if the collectionSize parameter * is less than the page size that has been set. * * @param $collectionSize int * @throws ValidationException if a FixedSizeCollection of the specified size cannot be constructed * @return FixedSizeCollection */ public function expandToFixedSizeCollection($collectionSize) { return $this->getPage()->expandToFixedSizeCollection($collectionSize); } /** * Returns an iterator over fixed size collections of results. * The collections are retrieved lazily from the underlying API. * * Each collection will have collectionSize elements, with the * exception of the final collection which may contain fewer * elements. * * NOTE: it is an error to call this method if an optional parameter * to set the page size is not supported or has not been set in the * original API call. It is also an error if the collectionSize parameter * is less than the page size that has been set. * * @param $collectionSize int * @throws ValidationException if a FixedSizeCollection of the specified size cannot be constructed * @return Generator|FixedSizeCollection[] */ public function iterateFixedSizeCollections($collectionSize) { return $this->expandToFixedSizeCollection($collectionSize)->iterateCollections(); } } src/ApiCore/PathTemplate.php000064400000010041151742741630011764 0ustar00resourceTemplate = new AbsoluteResourceTemplate($path); } else { $this->resourceTemplate = new RelativeResourceTemplate($path); } } /** * @return string A string representation of the path template */ public function __toString() { return $this->resourceTemplate->__toString(); } /** * Renders a path template using the provided bindings. * * @param array $bindings An array matching var names to binding strings. * @throws ValidationException if a key isn't provided or if a sub-template * can't be parsed. * @return string A rendered representation of this path template. */ public function render(array $bindings) { return $this->resourceTemplate->render($bindings); } /** * Check if $path matches a resource string. * * @param string $path A resource string. * @return bool */ public function matches($path) { return $this->resourceTemplate->matches($path); } /** * Matches a fully qualified path template string. * * @param string $path A fully qualified path template string. * @throws ValidationException if path can't be matched to the template. * @return array Array matching var names to binding values. */ public function match($path) { return $this->resourceTemplate->match($path); } } src/ApiCore/PollingTrait.php000064400000007175151742741630012022 0ustar00 0.0; $endTime = $this->getCurrentTimeMillis() + $totalPollTimeoutMillis; while (true) { if ($hasTotalPollTimeout && $this->getCurrentTimeMillis() > $endTime) { return false; } $this->sleepMillis($currentPollDelayMillis); if ($pollCallable()) { return true; } $currentPollDelayMillis = min([ $currentPollDelayMillis * $pollDelayMultiplier, $maxPollDelayMillis ]); } } /** * Protected to allow overriding for tests * * @return float Current time in milliseconds */ protected function getCurrentTimeMillis() { return microtime(true) * 1000.0; } /** * Protected to allow overriding for tests * * @param float $millis */ protected function sleepMillis($millis) { usleep($millis * 1000); } } src/ApiCore/RequestBuilder.php000064400000023543151742741630012346 0ustar00baseUri = $baseUri; $this->restConfig = require($restConfigPath); } /** * @param string $path * @param Message $message * @param array $headers * @return RequestInterface * @throws ValidationException */ public function build($path, Message $message, array $headers = []) { list($interface, $method) = explode('/', $path); if (!isset($this->restConfig['interfaces'][$interface][$method])) { throw new ValidationException( "Failed to build request, as the provided path ($path) was not found in the configuration." ); } $methodConfig = $this->restConfig['interfaces'][$interface][$method] + [ 'placeholders' => [], 'body' => null, 'additionalBindings' => null, ]; $bindings = $this->buildBindings($methodConfig['placeholders'], $message); $uriTemplateConfigs = $this->getConfigsForUriTemplates($methodConfig); foreach ($uriTemplateConfigs as $config) { $pathTemplate = $this->tryRenderPathTemplate($config['uriTemplate'], $bindings); if ($pathTemplate) { // We found a valid uriTemplate - now build and return the Request list($body, $queryParams) = $this->constructBodyAndQueryParameters($message, $config); $uri = $this->buildUri($pathTemplate, $queryParams); return new Request( $config['method'], $uri, ['Content-Type' => 'application/json'] + $headers, $body ); } } // No valid uriTemplate found - construct an exception $uriTemplates = []; foreach ($uriTemplateConfigs as $config) { $uriTemplates[] = $config['uriTemplate']; } throw new ValidationException("Could not map bindings for $path to any Uri template.\n" . "Bindings: " . print_r($bindings, true) . "UriTemplates: " . print_r($uriTemplates, true)); } /** * Create a list of all possible configs using the additionalBindings * * @param array $config * @return array[] An array of configs */ private function getConfigsForUriTemplates($config) { $configs = [$config]; if ($config['additionalBindings']) { foreach ($config['additionalBindings'] as $additionalBinding) { $configs[] = $additionalBinding + $config; } } return $configs; } /** * @param $message * @param $config * @return array Tuple [$body, $queryParams] */ private function constructBodyAndQueryParameters($message, $config) { if ($config['body'] === '*') { return [$message->serializeToJsonString(), []]; } $body = null; $queryParams = []; foreach ($this->getAllProperties($message) as $name => $value) { if (array_key_exists($name, $config['placeholders'])) { continue; } $propertyValue = $this->getPrivatePropertyValue($message, $name); if ($name === $config['body']) { $body = $propertyValue->serializeToJsonString(); continue; } $value = $this->getQuerystringValue($propertyValue); if ($propertyValue instanceof Message && is_array($value)) { foreach ($value as $key => $value2) { $queryParams[$name . '.' . $key] = $value2; } } else { $queryParams[$name] = $value; } } return [$body, $queryParams]; } /** * @param array $placeholders * @param Message $message * @return array Bindings from path template fields to values from message */ private function buildBindings(array $placeholders, Message $message) { $bindings = []; foreach ($placeholders as $placeholder => $metadata) { $value = array_reduce( $metadata['getters'], function (Message $result = null, $getter) { if ($result) { return $result->$getter(); } }, $message ); $bindings[$placeholder] = $value; } return $bindings; } /** * Try to render the resource name. The rendered resource name will always contain a leading '/' * * @param $uriTemplate * @param array $bindings * @return null|string * @throws ValidationException */ private function tryRenderPathTemplate($uriTemplate, array $bindings) { $template = new AbsoluteResourceTemplate($uriTemplate); try { return $template->render($bindings); } catch (ValidationException $e) { return null; } } /** * @param $path * @param $queryParams * @return UriInterface */ private function buildUri($path, $queryParams) { $uri = Psr7\uri_for( sprintf( 'https://%s%s', $this->baseUri, $path ) ); if ($queryParams) { $uri = $this->buildUriWithQuery( $uri, $queryParams ); } return $uri; } private function getPrivatePropertyValue(Message $message, $propertyName) { $privatePropertyValueFunc = \Closure::bind(function (Message $message, $propertyName) { return $message->$propertyName; }, null, $message); return $privatePropertyValueFunc($message, $propertyName); } private function getAllProperties(Message $message) { $privatePropertiesFunc = \Closure::bind(function (Message $message) { return get_class_vars(get_class($message)); }, null, $message); return $privatePropertiesFunc($message); } private function getQuerystringValue($propertyValue) { if ($propertyValue instanceof Message) { return $this->messageToArray($propertyValue); } if ($propertyValue instanceof RepeatedField) { return iterator_to_array($propertyValue); } return $propertyValue; } private function messageToArray(Message $message) { if ($this->hasSpecialJsonMapping($message)) { return json_decode($message->serializeToJsonString(), true); } $messageArray = []; foreach ($this->getAllProperties($message) as $name => $value) { $propertyValue = $this->getPrivatePropertyValue($message, $name); $messageArray[$name] = $this->getQuerystringValue($propertyValue); } return $messageArray; } private function hasSpecialJsonMapping(Message $message) { return in_array(get_class($message), [ 'Google\Protobuf\Any', 'Google\Protobuf\ListValue', 'Google\Protobuf\Struct', 'Google\Protobuf\Value', 'Google\Protobuf\Duration', 'Google\Protobuf\Timestamp', 'Google\Protobuf\FieldMask', 'Google\Protobuf\DoubleValue', 'Google\Protobuf\FloatValue', 'Google\Protobuf\Int64Value', 'Google\Protobuf\UInt64Value', 'Google\Protobuf\Int32Value', 'Google\Protobuf\UInt32Value', 'Google\Protobuf\BoolValue', 'Google\Protobuf\StringValue', 'Google\Protobuf\BytesValue' ]); } } src/ApiCore/RequestParamsHeaderDescriptor.php000064400000004766151742741630015361 0ustar00 value]. */ public function __construct($requestParams) { $headerValue = ''; foreach ($requestParams as $key => $value) { if ('' !== $headerValue) { $headerValue .= '&'; } $headerValue .= $key . '=' . strval($value); } $this->header = [self::HEADER_KEY => [$headerValue]]; } /** * Returns an associative array that contains request params header metadata. * * @return array */ public function getHeader() { return $this->header; } } src/ApiCore/ResourceTemplate/AbsoluteResourceTemplate.php000064400000011373151742741630017652 0ustar00"). * * Examples: * /projects * /projects/{project} * /foo/{bar=**}/fizz/*:action * * Templates use the syntax of the API platform; see * https://github.com/googleapis/api-common-protos/blob/master/google/api/http.proto * for details. A template consists of a sequence of literals, wildcards, and variable bindings, * where each binding can have a sub-path. A string representation can be parsed into an * instance of AbsoluteResourceTemplate, which can then be used to perform matching and instantiation. */ class AbsoluteResourceTemplate implements ResourceTemplateInterface { /** @var RelativeResourceTemplate */ private $resourceTemplate; /** @var string */ private $verb; /** * AbsoluteResourceTemplate constructor. * @param string $path * @throws ValidationException */ public function __construct($path) { if (empty($path)) { throw new ValidationException("Cannot construct AbsoluteResourceTemplate from empty string"); } if ($path[0] !== '/') { throw new ValidationException( "Could not construct AbsoluteResourceTemplate from '$path': must begin with '/'" ); } $verbSeparatorPos = $this->verbSeparatorPos($path); $this->resourceTemplate = new RelativeResourceTemplate(substr($path, 1, $verbSeparatorPos - 1)); $this->verb = substr($path, $verbSeparatorPos + 1); } /** * @inheritdoc */ public function __toString() { return sprintf("/%s%s", $this->resourceTemplate, $this->renderVerb()); } /** * @inheritdoc */ public function render(array $bindings) { return sprintf("/%s%s", $this->resourceTemplate->render($bindings), $this->renderVerb()); } /** * @inheritdoc */ public function matches($path) { try { $this->match($path); return true; } catch (ValidationException $ex) { return false; } } /** * @inheritdoc */ public function match($path) { if (empty($path) || $path[0] !== '/') { throw $this->matchException($path); } $verbSeparatorPos = $this->verbSeparatorPos($path); if (substr($path, $verbSeparatorPos + 1) !== $this->verb) { throw $this->matchException($path); } return $this->resourceTemplate->match(substr($path, 1, $verbSeparatorPos - 1)); } private function matchException($path) { return new ValidationException("Could not match path '$path' to template '$this'"); } private function renderVerb() { return $this->verb ? ':' . $this->verb : ''; } private function verbSeparatorPos($path) { $finalSeparatorPos = strrpos($path, '/'); $verbSeparatorPos = strrpos($path, ':', $finalSeparatorPos); if ($verbSeparatorPos === false) { $verbSeparatorPos = strlen($path); } return $verbSeparatorPos; } } src/ApiCore/ResourceTemplate/Parser.php000064400000015537151742741630014132 0ustar00"). * * Examples: * projects * projects/{project} * foo/{bar=**}/fizz/* * * Templates use the syntax of the API platform; see * https://github.com/googleapis/api-common-protos/blob/master/google/api/http.proto * for details. A template consists of a sequence of literals, wildcards, and variable bindings, * where each binding can have a sub-path. A string representation can be parsed into an * instance of AbsoluteResourceTemplate, which can then be used to perform matching and instantiation. */ class RelativeResourceTemplate implements ResourceTemplateInterface { /** @var Segment[] $segments */ private $segments; /** * RelativeResourceTemplate constructor. * * @param string $path * @throws ValidationException */ public function __construct($path) { if (empty($path)) { throw new ValidationException("Cannot construct RelativeResourceTemplate from empty string"); } $this->segments = Parser::parseSegments($path); $doubleWildcardCount = self::countDoubleWildcards($this->segments); if ($doubleWildcardCount > 1) { throw new ValidationException( "Cannot parse '$path': cannot contain more than one path wildcard" ); } // Check for duplicate keys $keys = []; foreach ($this->segments as $segment) { if ($segment->getSegmentType() === Segment::VARIABLE_SEGMENT) { if (isset($keys[$segment->getKey()])) { throw new ValidationException( "Duplicate key '{$segment->getKey()}' in path $path" ); } $keys[$segment->getKey()] = true; } } } /** * @inheritdoc */ public function __toString() { return implode("/", $this->segments); } /** * @inheritdoc */ public function render(array $bindings) { $literalSegments = []; $keySegmentTuples = self::buildKeySegmentTuples($this->segments); foreach ($keySegmentTuples as list($key, $segment)) { /** @var Segment $segment */ if ($segment->getSegmentType() === Segment::LITERAL_SEGMENT) { $literalSegments[] = $segment; continue; } if (!array_key_exists($key, $bindings)) { throw new ValidationException( "Rendering error - missing required binding '$key' for segment '$segment'." ); } $boundSegment = $segment->bindTo($bindings[$key]); $literalSegments[] = $boundSegment; } return implode("/", $literalSegments); } /** * @inheritdoc */ public function matches($path) { try { $this->match($path); return true; } catch (ValidationException $ex) { return false; } } /** * @inheritdoc */ public function match($path) { // High level strategy for matching: // - Break $path into pieces based on '/' // - Build a list of Segments from our template, where any variable segments are // flattened into a single, non-nested list // - Match pieces of the path with Segments in the flattened list $pathPieces = explode('/', $path); $pathPiecesCount = count($pathPieces); // In order to build correct bindings after we match the $path against our template, we // need to (a) calculate the correct positional keys for our wildcards, and (b) maintain // information about the variable identifier of any flattened segments. To do this, we // build a list of [string, Segment] tuples, where the string component is the appropriate // key. $keySegmentTuples = self::buildKeySegmentTuples($this->segments); $flattenedKeySegmentTuples = self::flattenKeySegmentTuples($keySegmentTuples); $flattenedKeySegmentTuplesCount = count($flattenedKeySegmentTuples); assert($flattenedKeySegmentTuplesCount > 0); // We would like to match pieces of our path 1:1 with the segments of our template. However, // this is confounded by the presence of double wildcards ('**') in the template, which can // match multiple segments in the path. // Because there can only be one '**' present, we can determine how many segments it must // match by examining the difference in count between the template segments and the // path pieces. if ($pathPiecesCount < $flattenedKeySegmentTuplesCount) { // Each segment in $flattenedKeyedSegments must consume at least one // segment in $pathSegments, so matching must fail. throw $this->matchException($path); } $doubleWildcardPieceCount = $pathPiecesCount - $flattenedKeySegmentTuplesCount + 1; $bindings = []; $pathPiecesIndex = 0; /** @var Segment $segment */ foreach ($flattenedKeySegmentTuples as list($segmentKey, $segment)) { // So long as there are tuples remaining, there will also be $pathPieces assert($pathPiecesIndex < $pathPiecesCount); // In our flattened list of segments, we should never encounter a variable segment assert($segment->getSegmentType() !== Segment::VARIABLE_SEGMENT); if ($segment->getSegmentType() == Segment::DOUBLE_WILDCARD_SEGMENT) { $pathPiecesForSegment = array_slice($pathPieces, $pathPiecesIndex, $doubleWildcardPieceCount); $pathPiece = implode('/', $pathPiecesForSegment); $pathPiecesIndex += $doubleWildcardPieceCount; } else { $pathPiece = $pathPieces[$pathPiecesIndex++]; } if (!$segment->matches($pathPiece)) { throw $this->matchException($path); } // If we have a valid key, add our $pathPiece to the $bindings array. Note that there // may be multiple copies of the same $segmentKey. This is because a flattened variable // segment can match multiple pieces from the path. We can add these to an array and // collapse them all once the bindings are complete. if (isset($segmentKey)) { $bindings += [$segmentKey => []]; $bindings[$segmentKey][] = $pathPiece; } } // It is possible that we have left over path pieces, which can occur if our template does // not have a double wildcard. In that case, the match should fail. if ($pathPiecesIndex !== $pathPiecesCount) { throw $this->matchException($path); } // Collapse the bindings from lists into strings $collapsedBindings = []; foreach ($bindings as $key => $boundPieces) { $collapsedBindings[$key] = implode('/', $boundPieces); } return $collapsedBindings; } private function matchException($path) { return new ValidationException("Could not match path '$path' to template '$this'"); } /** * @param Segment[] $segments * @return array[] A list of [string, Segment] tuples */ private static function buildKeySegmentTuples(array $segments) { $keySegmentTuples = []; $positionalArgumentCounter = 0; foreach ($segments as $segment) { switch ($segment->getSegmentType()) { case Segment::WILDCARD_SEGMENT: case Segment::DOUBLE_WILDCARD_SEGMENT: $positionalKey = "\$$positionalArgumentCounter"; $positionalArgumentCounter++; $keySegmentTuples[] = [$positionalKey, $segment]; break; default: $keySegmentTuples[] = [$segment->getKey(), $segment]; } } return $keySegmentTuples; } /** * @param array[] A list of [string, Segment] tuples * @return array[] A list of [string, Segment] tuples */ private static function flattenKeySegmentTuples(array $keySegmentTuples) { $flattenedKeySegmentTuples = []; foreach ($keySegmentTuples as list($key, $segment)) { /** @var Segment $segment */ switch ($segment->getSegmentType()) { case Segment::VARIABLE_SEGMENT: // For segment variables, replace the segment with the segments of its children $template = $segment->getTemplate(); $nestedKeySegmentTuples = self::buildKeySegmentTuples($template->segments); foreach ($nestedKeySegmentTuples as list($nestedKey, $nestedSegment)) { /** @var Segment $nestedSegment */ // Nested variables are not allowed assert($nestedSegment->getSegmentType() !== Segment::VARIABLE_SEGMENT); // Insert the nested segment with key set to the outer key of the // parent variable segment $flattenedKeySegmentTuples[] = [$key, $nestedSegment]; } break; default: // For all other segments, don't change the key or segment $flattenedKeySegmentTuples[] = [$key, $segment]; } } return $flattenedKeySegmentTuples; } /** * @param Segment[] $segments * @return int */ private static function countDoubleWildcards(array $segments) { $doubleWildcardCount = 0; foreach ($segments as $segment) { switch ($segment->getSegmentType()) { case Segment::DOUBLE_WILDCARD_SEGMENT: $doubleWildcardCount++; break; case Segment::VARIABLE_SEGMENT: $doubleWildcardCount += self::countDoubleWildcards($segment->getTemplate()->segments); break; } } return $doubleWildcardCount; } } src/ApiCore/ResourceTemplate/ResourceTemplateInterface.php000064400000007132151742741630017772 0ustar00"). (Note that a trailing verb without a * leading slash is not permitted). * * Examples: * projects * /projects * foo/{bar=**}/fizz/* * /foo/{bar=**}/fizz/*:action * * Templates use the syntax of the API platform; see * https://github.com/googleapis/api-common-protos/blob/master/google/api/http.proto * for details. A template consists of a sequence of literals, wildcards, and variable bindings, * where each binding can have a sub-path. A string representation can be parsed into an * instance of AbsoluteResourceTemplate, which can then be used to perform matching and instantiation. */ interface ResourceTemplateInterface { /** * @return string A string representation of the resource template */ public function __toString(); /** * Renders a resource template using the provided bindings. * * @param array $bindings An array matching var names to binding strings. * @return string A rendered representation of this resource template. * @throws ValidationException If $bindings does not contain all required keys * or if a sub-template can't be parsed. */ public function render(array $bindings); /** * Check if $path matches a resource string. * * @param string $path A resource string. * @return bool */ public function matches($path); /** * Matches a given $path to a resource template, and returns an array of bindings between * wildcards / variables in the template and values in the path. If $path does not match the * template, then a ValidationException is thrown. * * @param string $path A resource string. * @throws ValidationException if path can't be matched to the template. * @return array Array matching var names to binding values. */ public function match($path); } src/ApiCore/ResourceTemplate/Segment.php000064400000014112151742741630014264 0ustar00segmentType = $segmentType; $this->value = $value; $this->key = $key; $this->template = $template; switch ($this->segmentType) { case Segment::LITERAL_SEGMENT: $this->stringRepr = "{$this->value}"; break; case Segment::WILDCARD_SEGMENT: $this->stringRepr = "*"; break; case Segment::DOUBLE_WILDCARD_SEGMENT: $this->stringRepr = "**"; break; case Segment::VARIABLE_SEGMENT: $this->stringRepr = "{{$this->key}={$this->template}}"; break; default: throw new ValidationException( "Unexpected Segment type: {$this->segmentType}" ); } } /** * @return string A string representation of the segment. */ public function __toString() { return $this->stringRepr; } /** * Checks if $value matches the current segment, and creates a new literal Segment with value * equal to $value. If $value does not match the current Segment, throws a ValidationException. * * @param string $value * @return Segment * @throws ValidationException */ public function bindTo($value) { $value = (string) $value; if ($this->matches($value)) { return new Segment(Segment::LITERAL_SEGMENT, $value); } else { throw new ValidationException( "Cannot bind segment '$this' to value '$value'" ); } } /** * Checks if $value matches this Segment. * * @param string $value * @return bool * @throws ValidationException */ public function matches($value) { switch ($this->segmentType) { case Segment::LITERAL_SEGMENT: return $this->value === $value; case Segment::WILDCARD_SEGMENT: return self::isValidBinding($value); case Segment::DOUBLE_WILDCARD_SEGMENT: return self::isValidDoubleWildcardBinding($value); case Segment::VARIABLE_SEGMENT: return $this->template->matches($value); default: throw new ValidationException( "Unexpected Segment type: {$this->segmentType}" ); } } /** * @return int */ public function getSegmentType() { return $this->segmentType; } /** * @return string|null */ public function getKey() { return $this->key; } /** * @return string|null */ public function getValue() { return $this->value; } /** * @return RelativeResourceTemplate|null */ public function getTemplate() { return $this->template; } /** * Check if $binding is a valid segment binding. Segment bindings may contain any characters * except a forward slash ('/'), and may not be empty. * * @param $binding * @return bool */ private static function isValidBinding($binding) { return preg_match("-^[^/]+$-", $binding) === 1; } /** * Check if $binding is a valid double wildcard binding. Segment bindings may contain any * characters, but may not be empty. * * @param $binding * @return bool */ private static function isValidDoubleWildcardBinding($binding) { return preg_match("-^.+$-", $binding) === 1; } } src/ApiCore/RetrySettings.php000064400000044663151742741630012243 0ustar00 100, * 'retryDelayMultiplier' => 1.3, * 'maxRetryDelayMillis' => 60000, * 'initialRpcTimeoutMillis' => 20000, * 'rpcTimeoutMultiplier' => 1.0, * 'maxRpcTimeoutMillis' => 20000, * 'totalTimeoutMillis' => 600000, * 'retryableCodes' => [ApiStatus::DEADLINE_EXCEEDED, ApiStatus::UNAVAILABLE], * ]); * ``` * * It is also possible to create a new RetrySettings object from an existing * object using the {@see Google\ApiCore\RetrySettings::with()} method. * * Example modifying an existing RetrySettings object using `with()`: * ``` * $newRetrySettings = $retrySettings->with([ * 'totalTimeoutMillis' => 700000, * ]); * ``` * * Modifying the retry behavior of an RPC method * --------------------------------------------- * * RetrySettings objects can be used to control retries for many RPC methods in * [google-cloud-php](https://github.com/GoogleCloudPlatform/google-cloud-php). * The examples below make use of the * [GroupServiceClient](https://googlecloudplatform.github.io/google-cloud-php/#/docs/google-cloud/monitoring/v3/groupserviceclient) * from the [Monitoring V3 API](https://github.com/GoogleCloudPlatform/google-cloud-php/tree/master/src/Monitoring/V3), * but they can be applied to other APIs in the * [google-cloud-php](https://github.com/GoogleCloudPlatform/google-cloud-php) repository. * * It is possible to specify the retry behavior to be used by an RPC via the * `retrySettings` field in the `optionalArgs` parameter. The `retrySettings` * field can contain either a RetrySettings object, or a PHP array containing * the particular retry parameters to be updated. * * Example of disabling retries for a single call to the * [listGroups](https://googlecloudplatform.github.io/google-cloud-php/#/docs/google-cloud/monitoring/v3/groupserviceclient?method=listGroups) * method, and setting a custom timeout: * ``` * $result = $client->listGroups($name, [ * 'retrySettings' => [ * 'retriesEnabled' => false, * 'noRetriesRpcTimeoutMillis' => 5000, * ] * ]); * ``` * * Example of creating a new RetrySettings object and using it to override * the retry settings for a call to the * [listGroups](https://googlecloudplatform.github.io/google-cloud-php/#/docs/google-cloud/monitoring/v3/groupserviceclient?method=listGroups) * method: * ``` * $customRetrySettings = new RetrySettings([ * 'initialRetryDelayMillis' => 100, * 'retryDelayMultiplier' => 1.3, * 'maxRetryDelayMillis' => 60000, * 'initialRpcTimeoutMillis' => 20000, * 'rpcTimeoutMultiplier' => 1.0, * 'maxRpcTimeoutMillis' => 20000, * 'totalTimeoutMillis' => 600000, * 'retryableCodes' => [ApiStatus::DEADLINE_EXCEEDED, ApiStatus::UNAVAILABLE], * ]); * * $result = $client->listGroups($name, [ * 'retrySettings' => $customRetrySettings * ]); * ``` * * Modifying the default retry behavior for RPC methods on a Client object * ----------------------------------------------------------------------- * * It is also possible to specify the retry behavior for RPC methods when * constructing a client object using the 'retrySettingsArray'. The examples * below again make use of the * [GroupServiceClient](https://googlecloudplatform.github.io/google-cloud-php/#/docs/google-cloud/monitoring/v3/groupserviceclient) * from the [Monitoring V3 API](https://github.com/GoogleCloudPlatform/google-cloud-php/tree/master/src/Monitoring/V3), * but they can be applied to other APIs in the * [google-cloud-php](https://github.com/GoogleCloudPlatform/google-cloud-php) repository. * * The GroupServiceClient object accepts an optional `retrySettingsArray` * parameter, which can be used to specify retry behavior for RPC methods * on the client. The `retrySettingsArray` accepts a PHP array in which keys * are the names of RPC methods on the client, and values are either a * RetrySettings object or a PHP array containing the particular retry * parameters to be updated. * * Example updating the retry settings for four methods of GroupServiceClient: * ``` * use Google\Cloud\Monitoring\V3\GroupServiceClient; * * $customRetrySettings = new RetrySettings([ * 'initialRetryDelayMillis' => 100, * 'retryDelayMultiplier' => 1.3, * 'maxRetryDelayMillis' => 60000, * 'initialRpcTimeoutMillis' => 20000, * 'rpcTimeoutMultiplier' => 1.0, * 'maxRpcTimeoutMillis' => 20000, * 'totalTimeoutMillis' => 600000, * 'retryableCodes' => [ApiStatus::DEADLINE_EXCEEDED, ApiStatus::UNAVAILABLE], * ]); * * $updatedCustomRetrySettings = $customRetrySettings->with([ * 'totalTimeoutMillis' => 700000 * ]); * * $client = new GroupServiceClient([ * 'retrySettingsArray' => [ * 'listGroups' => ['retriesEnabled' => false], * 'getGroup' => [ * 'initialRpcTimeoutMillis' => 10000, * 'maxRpcTimeoutMillis' => 30000, * 'totalTimeoutMillis' => 60000, * ], * 'deleteGroup' => $customRetrySettings, * 'updateGroup' => $updatedCustomRetrySettings * ], * ]); * ``` */ class RetrySettings { use ValidationTrait; private $retriesEnabled; private $retryableCodes; private $initialRetryDelayMillis; private $retryDelayMultiplier; private $maxRetryDelayMillis; private $initialRpcTimeoutMillis; private $rpcTimeoutMultiplier; private $maxRpcTimeoutMillis; private $totalTimeoutMillis; private $noRetriesRpcTimeoutMillis; /** * Constructs an instance. * * @param array $settings { * Required. Settings for configuring the retry behavior. All parameters are required except * $retriesEnabled and $noRetriesRpcTimeoutMillis, which are optional and have defaults * determined based on the other settings provided. * * @type bool $retriesEnabled Optional. Enables retries. If not specified, the value is * determined using the $retryableCodes setting. If $retryableCodes is empty, * then $retriesEnabled is set to false; otherwise, it is set to true. * @type int $noRetriesRpcTimeoutMillis Optional. The timeout of the rpc call to be used * if $retriesEnabled is false, in milliseconds. It not specified, the value * of $initialRpcTimeoutMillis is used. * @type array $retryableCodes The Status codes that are retryable. Each status should be * either one of the string constants defined on {@see \Google\ApiCore\ApiStatus} * or an integer constant defined on {@see \Google\Rpc\Code}. * @type int $initialRetryDelayMillis The initial delay of retry in milliseconds. * @type int $retryDelayMultiplier The exponential multiplier of retry delay. * @type int $maxRetryDelayMillis The max delay of retry in milliseconds. * @type int $initialRpcTimeoutMillis The initial timeout of rpc call in milliseconds. * @type int $rpcTimeoutMultiplier The exponential multiplier of rpc timeout. * @type int $maxRpcTimeoutMillis The max timeout of rpc call in milliseconds. * @type int $totalTimeoutMillis The max accumulative timeout in total. * } */ public function __construct(array $settings) { $this->validateNotNull($settings, [ 'initialRetryDelayMillis', 'retryDelayMultiplier', 'maxRetryDelayMillis', 'initialRpcTimeoutMillis', 'rpcTimeoutMultiplier', 'maxRpcTimeoutMillis', 'totalTimeoutMillis', 'retryableCodes' ]); $this->initialRetryDelayMillis = $settings['initialRetryDelayMillis']; $this->retryDelayMultiplier = $settings['retryDelayMultiplier']; $this->maxRetryDelayMillis = $settings['maxRetryDelayMillis']; $this->initialRpcTimeoutMillis = $settings['initialRpcTimeoutMillis']; $this->rpcTimeoutMultiplier = $settings['rpcTimeoutMultiplier']; $this->maxRpcTimeoutMillis = $settings['maxRpcTimeoutMillis']; $this->totalTimeoutMillis = $settings['totalTimeoutMillis']; $this->retryableCodes = $settings['retryableCodes']; $this->retriesEnabled = array_key_exists('retriesEnabled', $settings) ? $settings['retriesEnabled'] : (count($this->retryableCodes) > 0); $this->noRetriesRpcTimeoutMillis = array_key_exists('noRetriesRpcTimeoutMillis', $settings) ? $settings['noRetriesRpcTimeoutMillis'] : $this->initialRpcTimeoutMillis; } /** * Constructs an array mapping method names to CallSettings. * * @param string $serviceName * The fully-qualified name of this service, used as a key into * the client config file. * @param array $clientConfig * An array parsed from the standard API client config file. * @param bool $disableRetries * Disable retries in all loaded RetrySettings objects. Defaults to false. * @throws ValidationException * @return RetrySettings[] $retrySettings */ public static function load( $serviceName, $clientConfig, $disableRetries = false ) { $serviceRetrySettings = []; $serviceConfig = $clientConfig['interfaces'][$serviceName]; $retryCodes = $serviceConfig['retry_codes']; $retryParams = $serviceConfig['retry_params']; foreach ($serviceConfig['methods'] as $methodName => $methodConfig) { $timeoutMillis = $methodConfig['timeout_millis']; if (empty($methodConfig['retry_codes_name']) || empty($methodConfig['retry_params_name'])) { // Construct a RetrySettings object with retries disabled $retrySettings = self::constructDefault()->with([ 'noRetriesRpcTimeoutMillis' => $timeoutMillis, ]); } else { $retryCodesName = $methodConfig['retry_codes_name']; $retryParamsName = $methodConfig['retry_params_name']; if (!array_key_exists($retryCodesName, $retryCodes)) { throw new ValidationException("Invalid retry_codes_name setting: '$retryCodesName'"); } if (!array_key_exists($retryParamsName, $retryParams)) { throw new ValidationException("Invalid retry_params_name setting: '$retryParamsName'"); } foreach ($retryCodes[$retryCodesName] as $status) { if (!ApiStatus::isValidStatus($status)) { throw new ValidationException("Invalid status code: '$status'"); } } $retryParameters = self::convertArrayFromSnakeCase($retryParams[$retryParamsName]) + [ 'retryableCodes' => $retryCodes[$retryCodesName], 'noRetriesRpcTimeoutMillis' => $timeoutMillis, ]; if ($disableRetries) { $retryParameters['retriesEnabled'] = false; } $retrySettings = new RetrySettings($retryParameters); } $serviceRetrySettings[$methodName] = $retrySettings; } return $serviceRetrySettings; } public static function constructDefault() { return new RetrySettings([ 'retriesEnabled' => false, 'noRetriesRpcTimeoutMillis' => 30000, 'initialRetryDelayMillis' => 100, 'retryDelayMultiplier' => 1.3, 'maxRetryDelayMillis' => 60000, 'initialRpcTimeoutMillis' => 20000, 'rpcTimeoutMultiplier' => 1, 'maxRpcTimeoutMillis' => 20000, 'totalTimeoutMillis' => 600000, 'retryableCodes' => []]); } /** * Creates a new instance of RetrySettings that updates the settings in the existing instance * with the settings specified in the $settings parameter. * * @param array $settings { * Settings for configuring the retry behavior. Supports all of the options supported by * the constructor; see {@see \Google\ApiCore\RetrySettings::__construct()}. All parameters * are optional - all unset parameters will default to the value in the existing instance. * } * @return RetrySettings */ public function with(array $settings) { $existingSettings = [ 'initialRetryDelayMillis' => $this->getInitialRetryDelayMillis(), 'retryDelayMultiplier' => $this->getRetryDelayMultiplier(), 'maxRetryDelayMillis' => $this->getMaxRetryDelayMillis(), 'initialRpcTimeoutMillis' => $this->getInitialRpcTimeoutMillis(), 'rpcTimeoutMultiplier' => $this->getRpcTimeoutMultiplier(), 'maxRpcTimeoutMillis' => $this->getMaxRpcTimeoutMillis(), 'totalTimeoutMillis' => $this->getTotalTimeoutMillis(), 'retryableCodes' => $this->getRetryableCodes(), 'retriesEnabled' => $this->retriesEnabled(), 'noRetriesRpcTimeoutMillis' => $this->getNoRetriesRpcTimeoutMillis(), ]; return new RetrySettings($settings + $existingSettings); } /** * @return bool Returns true if retries are enabled, otherwise returns false. */ public function retriesEnabled() { return $this->retriesEnabled; } /** * @return int The timeout of the rpc call to be used if $retriesEnabled is false, * in milliseconds. */ public function getNoRetriesRpcTimeoutMillis() { return $this->noRetriesRpcTimeoutMillis; } /** * @return int[] Status codes to retry */ public function getRetryableCodes() { return $this->retryableCodes; } /** * @return int The initial retry delay in milliseconds. If $this->retriesEnabled() * is false, this setting is unused. */ public function getInitialRetryDelayMillis() { return $this->initialRetryDelayMillis; } /** * @return float The retry delay multiplier. If $this->retriesEnabled() * is false, this setting is unused. */ public function getRetryDelayMultiplier() { return $this->retryDelayMultiplier; } /** * @return int The maximum retry delay in milliseconds. If $this->retriesEnabled() * is false, this setting is unused. */ public function getMaxRetryDelayMillis() { return $this->maxRetryDelayMillis; } /** * @return int The initial rpc timeout in milliseconds. If $this->retriesEnabled() * is false, this setting is unused - use noRetriesRpcTimeoutMillis to * set the timeout in that case. */ public function getInitialRpcTimeoutMillis() { return $this->initialRpcTimeoutMillis; } /** * @return float The rpc timeout multiplier. If $this->retriesEnabled() * is false, this setting is unused. */ public function getRpcTimeoutMultiplier() { return $this->rpcTimeoutMultiplier; } /** * @return int The maximum rpc timeout in milliseconds. If $this->retriesEnabled() * is false, this setting is unused - use noRetriesRpcTimeoutMillis to * set the timeout in that case. */ public function getMaxRpcTimeoutMillis() { return $this->maxRpcTimeoutMillis; } /** * @return int The total time in milliseconds to spend on the call, including all * retry attempts and delays between attempts. If $this->retriesEnabled() * is false, this setting is unused - use noRetriesRpcTimeoutMillis to * set the timeout in that case. */ public function getTotalTimeoutMillis() { return $this->totalTimeoutMillis; } private static function convertArrayFromSnakeCase($settings) { $camelCaseSettings = []; foreach ($settings as $key => $value) { $camelCaseKey = str_replace(' ', '', ucwords(str_replace('_', ' ', $key))); $camelCaseSettings[lcfirst($camelCaseKey)] = $value; } return $camelCaseSettings; } } src/ApiCore/Serializer.php000064400000037023151742741630011516 0ustar00 \Google\Rpc\RetryInfo::class, 'google.rpc.debuginfo-bin' => \Google\Rpc\DebugInfo::class, 'google.rpc.quotafailure-bin' => \Google\Rpc\QuotaFailure::class, 'google.rpc.badrequest-bin' => \Google\Rpc\BadRequest::class, 'google.rpc.requestinfo-bin' => \Google\Rpc\RequestInfo::class, 'google.rpc.resourceinfo-bin' => \Google\Rpc\ResourceInfo::class, 'google.rpc.help-bin' => \Google\Rpc\Help::class, 'google.rpc.localizedmessage-bin' => \Google\Rpc\LocalizedMessage::class, ]; private $fieldTransformers; private $messageTypeTransformers; private $decodeFieldTransformers; private $decodeMessageTypeTransformers; private $descriptorMaps = []; /** * Serializer constructor. * * @param array $fieldTransformers An array mapping field names to transformation functions * @param array $messageTypeTransformers An array mapping message names to transformation functions * @param array $decodeFieldTransformers An array mapping field names to transformation functions * @param array $decodeMessageTypeTransformers An array mapping message names to transformation functions */ public function __construct( $fieldTransformers = [], $messageTypeTransformers = [], $decodeFieldTransformers = [], $decodeMessageTypeTransformers = [] ) { $this->fieldTransformers = $fieldTransformers; $this->messageTypeTransformers = $messageTypeTransformers; $this->decodeFieldTransformers = $decodeFieldTransformers; $this->decodeMessageTypeTransformers = $decodeMessageTypeTransformers; } /** * Encode protobuf message as a PHP array * * @param mixed $message * @return array */ public function encodeMessage($message) { // Get message descriptor $pool = DescriptorPool::getGeneratedPool(); $messageType = $pool->getDescriptorByClassName(get_class($message)); return $this->encodeMessageImpl($message, $messageType); } /** * Decode PHP array into the specified protobuf message * * @param mixed $message * @param array $data * @return mixed */ public function decodeMessage($message, $data) { // Get message descriptor $pool = DescriptorPool::getGeneratedPool(); $messageType = $pool->getDescriptorByClassName(get_class($message)); return $this->decodeMessageImpl($message, $messageType, $data); } /** * @param \Google\Protobuf\Internal\Message $message * @return string Json representation of $message */ public static function serializeToJson($message) { return json_encode(self::serializeToPhpArray($message), JSON_PRETTY_PRINT); } /** * @param \Google\Protobuf\Internal\Message $message * @return array PHP array representation of $message */ public static function serializeToPhpArray($message) { return self::getPhpArraySerializer()->encodeMessage($message); } /** * Decode metadata received from gRPC status object * * @param array $metadata * @return array */ public static function decodeMetadata($metadata) { if (is_null($metadata) || count($metadata) == 0) { return []; } $result = []; foreach ($metadata as $key => $values) { foreach ($values as $value) { $decodedValue = [ '@type' => $key, ]; if (self::hasBinaryHeaderSuffix($key)) { if (isset(self::$metadataKnownTypes[$key])) { $class = self::$metadataKnownTypes[$key]; $message = new $class(); $message->mergeFromString($value); $decodedValue += self::serializeToPhpArray($message); } else { // The metadata contains an unexpected binary type $decodedValue += [ 'data' => '', ]; } } else { $decodedValue += [ 'data' => $value, ]; } $result[] = $decodedValue; } } return $result; } /** * Decode an array of Any messages into a printable PHP array. * * @param $anyArray * @return array */ public static function decodeAnyMessages($anyArray) { $results = []; foreach ($anyArray as $any) { try { /** @var Any $any */ $unpacked = $any->unpack(); $results[] = self::serializeToPhpArray($unpacked); } catch (\Exception $ex) { echo "$ex\n"; // failed to unpack the $any object - show as unknown binary data $results[] = [ 'typeUrl' => $any->getTypeUrl(), 'value' => '', ]; } } return $results; } private function encodeElement(FieldDescriptor $field, $data) { switch ($field->getType()) { case GPBType::MESSAGE: if (is_array($data)) { $result = $data; } else { $result = $this->encodeMessageImpl($data, $field->getMessageType()); } $messageType = $field->getMessageType()->getFullName(); if (isset($this->messageTypeTransformers[$messageType])) { $result = $this->messageTypeTransformers[$messageType]($result); } break; default: $result = $data; break; } if (isset($this->fieldTransformers[$field->getName()])) { $result = $this->fieldTransformers[$field->getName()]($result); } return $result; } private function getDescriptorMaps(Descriptor $descriptor) { if (!isset($this->descriptorMaps[$descriptor->getFullName()])) { $fieldsByName = []; $fieldCount = $descriptor->getFieldCount(); for ($i = 0; $i < $fieldCount; $i++) { $field = $descriptor->getField($i); $fieldsByName[$field->getName()] = $field; } $fieldToOneof = []; $oneofCount = $descriptor->getOneofDeclCount(); for ($i = 0; $i < $oneofCount; $i++) { $oneof = $descriptor->getOneofDecl($i); $oneofFieldCount = $oneof->getFieldCount(); for ($j = 0; $j < $oneofFieldCount; $j++) { $field = $oneof->getField($j); $fieldToOneof[$field->getName()] = $oneof->getName(); } } $this->descriptorMaps[$descriptor->getFullName()] = [$fieldsByName, $fieldToOneof]; } return $this->descriptorMaps[$descriptor->getFullName()]; } private function encodeMessageImpl($message, Descriptor $messageType) { $data = []; $fieldCount = $messageType->getFieldCount(); for ($i = 0; $i < $fieldCount; $i++) { $field = $messageType->getField($i); $key = $field->getName(); $getter = $this->getGetter($key); $v = $message->$getter(); if (is_null($v)) { continue; } // Check and skip unset fields inside oneofs list($_, $fieldsToOneof) = $this->getDescriptorMaps($messageType); if (isset($fieldsToOneof[$key])) { $oneofName = $fieldsToOneof[$key]; $oneofGetter = $this->getGetter($oneofName); if ($message->$oneofGetter() !== $key) { continue; } } if ($field->isMap()) { list($mapFieldsByName, $_) = $this->getDescriptorMaps($field->getMessageType()); $keyField = $mapFieldsByName[self::MAP_KEY_FIELD_NAME]; $valueField = $mapFieldsByName[self::MAP_VALUE_FIELD_NAME]; $arr = []; foreach ($v as $k => $vv) { $arr[$this->encodeElement($keyField, $k)] = $this->encodeElement($valueField, $vv); } $v = $arr; } elseif ($field->getLabel() === GPBLabel::REPEATED) { $arr = []; foreach ($v as $k => $vv) { $arr[$k] = $this->encodeElement($field, $vv); } $v = $arr; } else { $v = $this->encodeElement($field, $v); } $key = self::toCamelCase($key); $data[$key] = $v; } return $data; } private function decodeElement(FieldDescriptor $field, $data) { if (isset($this->decodeFieldTransformers[$field->getName()])) { $data = $this->decodeFieldTransformers[$field->getName()]($data); } switch ($field->getType()) { case GPBType::MESSAGE: if ($data instanceof \Google\Protobuf\Internal\Message) { return $data; } $messageType = $field->getMessageType(); $messageTypeName = $messageType->getFullName(); $klass = $messageType->getClass(); $msg = new $klass(); if (isset($this->decodeMessageTypeTransformers[$messageTypeName])) { $data = $this->decodeMessageTypeTransformers[$messageTypeName]($data); } return $this->decodeMessageImpl($msg, $messageType, $data); default: return $data; } } private function decodeMessageImpl($message, Descriptor $messageType, $data) { list($fieldsByName, $_) = $this->getDescriptorMaps($messageType); foreach ($data as $key => $v) { // Get the field by tag number or name $fieldName = self::toSnakeCase($key); // Unknown field found if (!isset($fieldsByName[$fieldName])) { throw new RuntimeException(sprintf( "cannot handle unknown field %s on message %s", $fieldName, $messageType->getFullName() )); } /** @var $field FieldDescriptor */ $field = $fieldsByName[$fieldName]; if ($field->isMap()) { list($mapFieldsByName, $_) = $this->getDescriptorMaps($field->getMessageType()); $keyField = $mapFieldsByName[self::MAP_KEY_FIELD_NAME]; $valueField = $mapFieldsByName[self::MAP_VALUE_FIELD_NAME]; $klass = $valueField->getType() === GPBType::MESSAGE ? $valueField->getMessageType()->getClass() : null; $arr = []; foreach ($v as $k => $vv) { $arr[$this->decodeElement($keyField, $k)] = $this->decodeElement($valueField, $vv); } $value = $arr; } elseif ($field->getLabel() === GPBLabel::REPEATED) { $arr = []; foreach ($v as $k => $vv) { $arr[$k] = $this->decodeElement($field, $vv); } $value = $arr; } else { $value = $this->decodeElement($field, $v); } $setter = $this->getSetter($field->getName()); $message->$setter($value); // We must unset $value here, otherwise the protobuf c extension will mix up the references // and setting one value will change all others unset($value); } return $message; } /** * @param string $name * @return string Getter function */ public static function getGetter($name) { return 'get' . ucfirst(self::toCamelCase($name)); } /** * @param string $name * @return string Setter function */ public static function getSetter($name) { return 'set' . ucfirst(self::toCamelCase($name)); } /** * Convert string from camelCase to snake_case * * @param string $key * @return string */ public static function toSnakeCase($key) { return strtolower(preg_replace(['/([a-z\d])([A-Z])/', '/([^_])([A-Z][a-z])/'], '$1_$2', $key)); } /** * Convert string from snake_case to camelCase * * @param string $key * @return string */ public static function toCamelCase($key) { return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $key)))); } private static function hasBinaryHeaderSuffix($key) { return substr_compare($key, "-bin", strlen($key) - 4) === 0; } private static function getPhpArraySerializer() { if (is_null(self::$phpArraySerializer)) { self::$phpArraySerializer = new Serializer(); } return self::$phpArraySerializer; } public static function loadKnownMetadataTypes() { foreach (self::$metadataKnownTypes as $key => $class) { new $class; } } } // It is necessary to call this when this file is included. Otherwise we cannot be // guaranteed that the relevant classes will be loaded into the protobuf descriptor // pool when we try to unpack an Any object containing that class. // phpcs:disable PSR1.Files.SideEffects Serializer::loadKnownMetadataTypes(); // phpcs:enable src/ApiCore/ServerStream.php000064400000006453151742741630012032 0ustar00call = $serverStreamingCall; if (array_key_exists('resourcesGetMethod', $streamingDescriptor)) { $this->resourcesGetMethod = $streamingDescriptor['resourcesGetMethod']; } } /** * A generator which yields results from the server until the streaming call * completes. Throws an ApiException if the streaming call failed. * * @throws ApiException * @return \Generator|mixed */ public function readAll() { $resourcesGetMethod = $this->resourcesGetMethod; if (!is_null($resourcesGetMethod)) { foreach ($this->call->responses() as $response) { foreach ($response->$resourcesGetMethod() as $resource) { yield $resource; } } } else { foreach ($this->call->responses() as $response) { yield $response; } } $status = $this->call->getStatus(); if (!($status->code == Code::OK)) { throw ApiException::createFromStdClass($status); } } /** * Return the underlying gRPC call object * * @return \Grpc\ServerStreamingCall|mixed */ public function getServerStreamingCall() { return $this->call; } } src/ApiCore/ServiceAddressTrait.php000064400000004527151742741630013322 0ustar00assertEquals($expected, $actual); } $this->assertSame(count($expected), count($actual)); $expectedValues = $this->getValues($expected); $actualValues = $this->getValues($actual); for ($i = 0; $i < count($expectedValues); $i++) { $expectedElement = $expectedValues[$i]; $actualElement = $actualValues[$i]; $this->assertProtobufEquals($expectedElement, $actualElement); } } else { $this->assertEquals($expected, $actual); if ($expected instanceof Message) { $pool = DescriptorPool::getGeneratedPool(); $descriptor = $pool->getDescriptorByClassName(get_class($expected)); $fieldCount = $descriptor->getFieldCount(); for ($i = 0; $i < $fieldCount; $i++) { $field = $descriptor->getField($i); $getter = Serializer::getGetter($field->getName()); $expectedFieldValue = $expected->$getter(); $actualFieldValue = $actual->$getter(); $this->assertProtobufEquals($expectedFieldValue, $actualFieldValue); } } } } private function getValues($field) { return array_values( is_array($field) ? $field : iterator_to_array($field) ); } } src/ApiCore/Testing/MessageAwareArrayComparator.php000064400000001561151742741630016413 0ustar00exporter = new MessageAwareExporter(); } } src/ApiCore/Testing/MessageAwareExporter.php000064400000002351151742741630015113 0ustar00responses = $responses; $this->deserialize = $deserialize; if (is_null($status)) { $status = new MockStatus(Code::OK); } $this->status = $status; } /** * @return mixed|null * @throws ApiException */ public function read() { if (count($this->responses) > 0) { $resp = array_shift($this->responses); if (is_null($resp)) { // Null was added to the responses list to simulate a failed stream // To ensure that getStatus can now be called, we clear the remaining // responses and set writesDone to true $this->responses = []; $this->writesDone(); return null; } $obj = $this->deserializeMessage($resp, $this->deserialize); return $obj; } elseif ($this->writesDone) { return null; } else { throw new ApiException( "No more responses to read, but closeWrite() not called - " . "this would be blocking", Grpc\STATUS_INTERNAL, null ); } } /** * @return MockStatus|null|\stdClass * @throws ApiException */ public function getStatus() { if (count($this->responses) > 0) { throw new ApiException( "Calls to getStatus() will block if all responses are not read", Grpc\STATUS_INTERNAL, null ); } if (!$this->writesDone) { throw new ApiException( "Calls to getStatus() will block if closeWrite() not called", Grpc\STATUS_INTERNAL, null ); } return $this->status; } /** * Save the request object, to be retrieved via getReceivedCalls() * @param \Google\Protobuf\Internal\Message|mixed $request The request object * @param array $options An array of options. * @throws ApiException */ public function write($request, array $options = []) { if ($this->writesDone) { throw new ApiException( "Cannot call write() after writesDone()", Grpc\STATUS_INTERNAL, null ); } if (is_a($request, '\Google\Protobuf\Internal\Message')) { $newRequest = new $request(); $newRequest->mergeFromString($request->serializeToString()); $request = $newRequest; } $this->receivedWrites[] = $request; } /** * Set writesDone to true */ public function writesDone() { $this->writesDone = true; } /** * Return a list of calls made to write(), and clear $receivedFuncCalls. * * @return mixed[] An array of received requests */ public function popReceivedCalls() { $receivedFuncCallsTemp = $this->receivedWrites; $this->receivedWrites = []; return $receivedFuncCallsTemp; } } src/ApiCore/Testing/MockClientStreamingCall.php000064400000010132151742741630015510 0ustar00mockUnaryCall = new MockUnaryCall($response, $deserialize, $status); } /** * Immediately return the preset response object and status. * @return array The response object and status. */ public function wait() { $this->waitCalled = true; return $this->mockUnaryCall->wait(); } /** * Save the request object, to be retrieved via getReceivedCalls() * @param \Google\Protobuf\Internal\Message|mixed $request The request object * @param array $options An array of options * @throws ApiException */ public function write($request, array $options = []) { if ($this->waitCalled) { throw new ApiException("Cannot call write() after wait()", Grpc\STATUS_INTERNAL); } if (is_a($request, '\Google\Protobuf\Internal\Message')) { $newRequest = new $request(); $newRequest->mergeFromString($request->serializeToString()); $request = $newRequest; } $this->receivedWrites[] = $request; } /** * Return a list of calls made to write(), and clear $receivedFuncCalls. * * @return mixed[] An array of received requests */ public function popReceivedCalls() { $receivedFuncCallsTemp = $this->receivedWrites; $this->receivedWrites = []; return $receivedFuncCallsTemp; } } src/ApiCore/Testing/MockGrpcTransport.php000064400000007223151742741630014443 0ustar00mockCall = $mockCall; $opts = ['credentials' => ChannelCredentials::createSsl()]; parent::__construct('', $opts); } protected function _simpleRequest( $method, $arguments, $deserialize, array $metadata = [], array $options = [] ) { $this->logCall($method, $deserialize, $metadata, $options, $arguments); return $this->mockCall; } protected function _clientStreamRequest( $method, $deserialize, array $metadata = [], array $options = [] ) { $this->logCall($method, $deserialize, $metadata, $options); return $this->mockCall; } protected function _serverStreamRequest( $method, $arguments, $deserialize, array $metadata = [], array $options = [] ) { $this->logCall($method, $deserialize, $metadata, $options, $arguments); return $this->mockCall; } protected function _bidiRequest( $method, $deserialize, array $metadata = [], array $options = [] ) { $this->logCall($method, $deserialize, $metadata, $options); return $this->mockCall; } private function logCall( $method, $deserialize, $metadata = [], $options = [], $arguments = null ) { $this->requestArguments = [ 'method' => $method, 'arguments' => $arguments, 'deserialize' => $deserialize, 'metadata' => $metadata, 'options' => $options, ]; } public function getRequestArguments() { return $this->requestArguments; } } src/ApiCore/Testing/MockRequest.php000064400000003312151742741630013256 0ustar00google.apicore.testing.MockRequest */ class MockRequest extends \Google\Protobuf\Internal\Message { /** * Generated from protobuf field string page_token = 1; */ private $page_token = ''; /** * Generated from protobuf field uint64 page_size = 2; */ private $page_size = 0; public function __construct() { \GPBMetadata\ApiCore\Testing\Mocks::initOnce(); parent::__construct(); } /** * Generated from protobuf field string page_token = 1; * @return string */ public function getPageToken() { return $this->page_token; } /** * Generated from protobuf field string page_token = 1; * @param string $var * @return $this */ public function setPageToken($var) { GPBUtil::checkString($var, True); $this->page_token = $var; return $this; } /** * Generated from protobuf field uint64 page_size = 2; * @return int|string */ public function getPageSize() { return $this->page_size; } /** * Generated from protobuf field uint64 page_size = 2; * @param int|string $var * @return $this */ public function setPageSize($var) { GPBUtil::checkUint64($var); $this->page_size = $var; return $this; } } src/ApiCore/Testing/MockRequestBody.php000064400000011264151742741630014101 0ustar00google.apicore.testing.MockRequestBody */ class MockRequestBody extends \Google\Protobuf\Internal\Message { /** * Generated from protobuf field string name = 1; */ private $name = ''; /** * Generated from protobuf field uint64 number = 2; */ private $number = 0; /** * Generated from protobuf field repeated string repeated_field = 3; */ private $repeated_field; /** * Generated from protobuf field .google.apicore.testing.MockRequestBody nested_message = 4; */ private $nested_message = null; /** * Generated from protobuf field .google.protobuf.FieldMask field_mask = 5; */ private $field_mask = null; /** * Generated from protobuf field .google.protobuf.StringValue string_value = 6; */ private $string_value = null; public function __construct() { \GPBMetadata\ApiCore\Testing\Mocks::initOnce(); parent::__construct(); } /** * Generated from protobuf field string name = 1; * @return string */ public function getName() { return $this->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; } /** * Generated from protobuf field uint64 number = 2; * @return int|string */ public function getNumber() { return $this->number; } /** * Generated from protobuf field uint64 number = 2; * @param int|string $var * @return $this */ public function setNumber($var) { GPBUtil::checkUint64($var); $this->number = $var; return $this; } /** * Generated from protobuf field repeated string repeated_field = 3; * @return \Google\Protobuf\Internal\RepeatedField */ public function getRepeatedField() { return $this->repeated_field; } /** * Generated from protobuf field repeated string repeated_field = 3; * @param string[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setRepeatedField($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->repeated_field = $arr; return $this; } /** * Generated from protobuf field .google.apicore.testing.MockRequestBody nested_message = 4; * @return \Google\ApiCore\Testing\MockRequestBody */ public function getNestedMessage() { return $this->nested_message; } /** * Generated from protobuf field .google.apicore.testing.MockRequestBody nested_message = 4; * @param \Google\ApiCore\Testing\MockRequestBody $var * @return $this */ public function setNestedMessage($var) { GPBUtil::checkMessage($var, \Google\ApiCore\Testing\MockRequestBody::class); $this->nested_message = $var; return $this; } /** * Generated from protobuf field .google.protobuf.FieldMask field_mask = 5; * @return \Google\Protobuf\FieldMask */ public function getFieldMask() { return $this->field_mask; } /** * Generated from protobuf field .google.protobuf.FieldMask field_mask = 5; * @param \Google\Protobuf\FieldMask $var * @return $this */ public function setFieldMask($var) { GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); $this->field_mask = $var; return $this; } /** * Generated from protobuf field .google.protobuf.StringValue string_value = 6; * @return \Google\Protobuf\StringValue */ public function getStringValue() { return $this->string_value; } /** * Generated from protobuf field .google.protobuf.StringValue string_value = 6; * @param \Google\Protobuf\StringValue $var * @return $this */ public function setStringValue($var) { GPBUtil::checkMessage($var, \Google\Protobuf\StringValue::class); $this->string_value = $var; return $this; } } src/ApiCore/Testing/MockResponse.php000064400000006020151742741630013423 0ustar00google.apicore.testing.MockResponse */ class MockResponse extends \Google\Protobuf\Internal\Message { /** * Generated from protobuf field string name = 1; */ private $name = ''; /** * Generated from protobuf field uint64 number = 2; */ private $number = 0; /** * Generated from protobuf field repeated string resources_list = 3; */ private $resources_list; /** * Generated from protobuf field string next_page_token = 4; */ private $next_page_token = ''; public function __construct() { \GPBMetadata\ApiCore\Testing\Mocks::initOnce(); parent::__construct(); } /** * Generated from protobuf field string name = 1; * @return string */ public function getName() { return $this->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; } /** * Generated from protobuf field uint64 number = 2; * @return int|string */ public function getNumber() { return $this->number; } /** * Generated from protobuf field uint64 number = 2; * @param int|string $var * @return $this */ public function setNumber($var) { GPBUtil::checkUint64($var); $this->number = $var; return $this; } /** * Generated from protobuf field repeated string resources_list = 3; * @return \Google\Protobuf\Internal\RepeatedField */ public function getResourcesList() { return $this->resources_list; } /** * Generated from protobuf field repeated string resources_list = 3; * @param string[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setResourcesList($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->resources_list = $arr; return $this; } /** * Generated from protobuf field string next_page_token = 4; * @return string */ public function getNextPageToken() { return $this->next_page_token; } /** * Generated from protobuf field string next_page_token = 4; * @param string $var * @return $this */ public function setNextPageToken($var) { GPBUtil::checkString($var, True); $this->next_page_token = $var; return $this; } } src/ApiCore/Testing/MockServerStreamingCall.php000064400000006140151742741630015544 0ustar00responses = $responses; $this->deserialize = $deserialize; if (is_null($status)) { $status = new MockStatus(Code::OK); } $this->status = $status; } public function responses() { while (count($this->responses) > 0) { $resp = array_shift($this->responses); $obj = $this->deserializeMessage($resp, $this->deserialize); yield $obj; } } public function getStatus() { if (count($this->responses) > 0) { throw new ApiException( "Calls to getStatus() will block if all responses are not read", Grpc\STATUS_INTERNAL ); } return $this->status; } } src/ApiCore/Testing/MockStatus.php000064400000003603151742741630013114 0ustar00code = $code; $this->details = $details; $this->metadata = $metadata; } } src/ApiCore/Testing/MockStubTrait.php000064400000025221151742741630013552 0ustar00deserialize = $deserialize; } /** * Overrides the _simpleRequest method in \Grpc\BaseStub * (https://github.com/grpc/grpc/blob/master/src/php/lib/Grpc/BaseStub.php) * Returns a MockUnaryCall object that will return the first item from $responses * @param string $method The API method name to be called * @param \Google\Protobuf\Internal\Message $argument The request object to the API method * @param callable $deserialize A function to deserialize the response object * @param array $metadata * @param array $options * @return MockUnaryCall */ public function _simpleRequest( $method, $argument, $deserialize, array $metadata = [], array $options = [] ) { $this->receivedFuncCalls[] = new ReceivedRequest($method, $argument, $deserialize, $metadata, $options); if (count($this->responses) < 1) { throw new UnderflowException("ran out of responses"); } list($response, $status) = array_shift($this->responses); $call = new MockUnaryCall($response, $deserialize, $status); $this->callObjects[] = $call; return $call; } /** * Overrides the _clientStreamRequest method in \Grpc\BaseStub * (https://github.com/grpc/grpc/blob/master/src/php/lib/Grpc/BaseStub.php) * Returns a MockClientStreamingCall object that will return the first item from $responses * * @param string $method The name of the method to call * @param callable $deserialize A function that deserializes the responses * @param array $metadata A metadata map to send to the server * (optional) * @param array $options An array of options (optional) * * @return MockClientStreamingCall The active call object */ public function _clientStreamRequest( $method, $deserialize, array $metadata = [], array $options = [] ) { $this->receivedFuncCalls[] = new ReceivedRequest($method, null, $deserialize, $metadata, $options); if (count($this->responses) < 1) { throw new UnderflowException("ran out of responses"); } list($response, $status) = array_shift($this->responses); $call = new MockClientStreamingCall($response, $deserialize, $status); $this->callObjects[] = $call; return $call; } /** * Overrides the _serverStreamRequest method in \Grpc\BaseStub * (https://github.com/grpc/grpc/blob/master/src/php/lib/Grpc/BaseStub.php) * Returns a MockServerStreamingCall object that will stream items from $responses, and return * a final status of $serverStreamingStatus. * * @param string $method The name of the method to call * @param \Google\Protobuf\Internal\Message $argument The argument to the method * @param callable $deserialize A function that deserializes the responses * @param array $metadata A metadata map to send to the server * (optional) * @param array $options An array of options (optional) * * @return MockServerStreamingCall The active call object */ public function _serverStreamRequest( $method, $argument, $deserialize, array $metadata = [], array $options = [] ) { if (is_a($argument, '\Google\Protobuf\Internal\Message')) { $newArgument = new $argument(); $newArgument->mergeFromString($argument->serializeToString()); $argument = $newArgument; } $this->receivedFuncCalls[] = new ReceivedRequest($method, $argument, $deserialize, $metadata, $options); $responses = MockStubTrait::stripStatusFromResponses($this->responses); $this->responses = []; $call = new MockServerStreamingCall($responses, $deserialize, $this->serverStreamingStatus); $this->callObjects[] = $call; return $call; } /** * Overrides the _bidiRequest method in \Grpc\BaseStub * (https://github.com/grpc/grpc/blob/master/src/php/lib/Grpc/BaseStub.php) * Returns a MockBidiStreamingCall object that will stream items from $responses, and return * a final status of $serverStreamingStatus. * * @param string $method The name of the method to call * @param callable $deserialize A function that deserializes the responses * @param array $metadata A metadata map to send to the server * (optional) * @param array $options An array of options (optional) * * @return MockBidiStreamingCall The active call object */ public function _bidiRequest( $method, $deserialize, array $metadata = [], array $options = [] ) { $this->receivedFuncCalls[] = new ReceivedRequest($method, null, $deserialize, $metadata, $options); $responses = MockStubTrait::stripStatusFromResponses($this->responses); $this->responses = []; $call = new MockBidiStreamingCall($responses, $deserialize, $this->serverStreamingStatus); $this->callObjects[] = $call; return $call; } public static function stripStatusFromResponses($responses) { $strippedResponses = []; foreach ($responses as $response) { list($resp, $status) = $response; $strippedResponses[] = $resp; } return $strippedResponses; } /** * Add a response object, and an optional status, to the list of responses to be returned via * _simpleRequest. * @param \Google\Protobuf\Internal\Message $response * @param Status $status */ public function addResponse($response, $status = null) { if (!$this->deserialize && $response) { $this->deserialize = [get_class($response), 'decode']; } if (is_a($response, '\Google\Protobuf\Internal\Message')) { $response = $response->serializeToString(); } $this->responses[] = [$response, $status]; } /** * Set the status object to be used when creating streaming calls. * * @param Status $status */ public function setStreamingStatus($status) { $this->serverStreamingStatus = $status; } /** * Return a list of calls made to _simpleRequest, and clear $receivedFuncCalls. * * @return ReceivedRequest[] An array of received requests */ public function popReceivedCalls() { $receivedFuncCallsTemp = $this->receivedFuncCalls; $this->receivedFuncCalls = []; return $receivedFuncCallsTemp; } /** * @return int The number of calls received. */ public function getReceivedCallCount() { return count($this->receivedFuncCalls); } /** * @return mixed[] The call objects created by calls to the stub */ public function popCallObjects() { $callObjectsTemp = $this->callObjects; $this->callObjects = []; return $callObjectsTemp; } /** * @return bool True if $receivedFuncCalls and $response are empty. */ public function isExhausted() { return count($this->receivedFuncCalls) === 0 && count($this->responses) === 0; } /** * @param mixed $responseObject * @param $status * @param callable $deserialize * @return static An instance of the current class type. */ public static function create($responseObject, $status = null, $deserialize = null) { $stub = new static($deserialize); $stub->addResponse($responseObject, $status); return $stub; } /** * Creates a sequence such that the responses are returned in order. * @param mixed[] $sequence * @param callable $deserialize * @param Status $finalStatus * @return static An instance of the current class type. */ public static function createWithResponseSequence($sequence, $deserialize = null, $finalStatus = null) { $stub = new static($deserialize); foreach ($sequence as $elem) { if (count($elem) == 1) { list($resp, $status) = [$elem, null]; } else { list($resp, $status) = $elem; } $stub->addResponse($resp, $status); } if ($finalStatus) { $stub->setStreamingStatus($finalStatus); } return $stub; } } src/ApiCore/Testing/MockTransport.php000064400000010144151742741630013623 0ustar00agentHeaderDescriptor = $agentHeaderDescriptor; } public function startUnaryCall(Call $call, array $options) { $call = call_user_func([$this, $call->getMethod()], $call, $options); return $promise = new Promise( function () use ($call, &$promise) { list($response, $status) = $call->wait(); if ($status->code == Code::OK) { $promise->resolve($response); } else { throw ApiException::createFromStdClass($status); } }, [$call, 'cancel'] ); } public function startBidiStreamingCall(Call $call, array $options) { $newArgs = ['/' . $call->getMethod(), $this->deserialize, $options, $options]; $response = call_user_func_array(array($this, '_bidiRequest'), $newArgs); return new BidiStream($response, $call->getDescriptor()); } public function startClientStreamingCall(Call $call, array $options) { $newArgs = ['/' . $call->getMethod(), $this->deserialize, $options, $options]; $response = call_user_func_array(array($this, '_clientStreamRequest'), $newArgs); return new ClientStream($response, $call->getDescriptor()); } public function startServerStreamingCall(Call $call, array $options) { $newArgs = ['/' . $call->getMethod(), $call->getMessage(), $this->deserialize, $options, $options]; $response = call_user_func_array(array($this, '_serverStreamRequest'), $newArgs); return new ServerStream($response, $call->getDescriptor()); } public function __call($name, $arguments) { $call = $arguments[0]; $options = $arguments[1]; $decode = $call->getDecodeType() ? [$call->getDecodeType(), 'decode'] : null; return $this->_simpleRequest( '/' . $call->getMethod(), $call->getMessage(), $decode, isset($options['headers']) ? $options['headers'] : [], $options ); } public function close() { // does nothing } } src/ApiCore/Testing/MockUnaryCall.php000064400000005752151742741630013532 0ustar00response = $response; $this->deserialize = $deserialize; if (is_null($status)) { $status = new MockStatus(Code::OK); } $this->status = $status; } /** * Immediately return the preset response object and status. * @return array The response object and status. */ public function wait() { return [ $this->deserializeMessage($this->response, $this->deserialize), $this->status, ]; } } src/ApiCore/Testing/ProtobufGPBEmptyComparator.php000064400000004054151742741630016220 0ustar00exporter = new MessageAwareExporter(); } /** * Returns whether the comparator can compare two values. * * @param mixed $expected The first value to compare * @param mixed $actual The second value to compare * @return boolean */ public function accepts($expected, $actual) { return $expected instanceof Message && $actual instanceof Message; } /** * Asserts that two values are equal. * * @param Message $expected The first value to compare * @param Message $actual The second value to compare * @param float|int $delta The allowed numerical distance between two values to * consider them equal * @param bool $canonicalize If set to TRUE, arrays are sorted before * comparison * @param bool $ignoreCase If set to TRUE, upper- and lowercasing is * ignored when comparing string values * @throws \PHPUnit_Framework_ComparisonFailure Thrown when the comparison * fails. Contains information about the * specific errors that lead to the failure. */ public function assertEquals($expected, $actual, $delta = 0, $canonicalize = FALSE, $ignoreCase = FALSE) { if ($expected->serializeToString() !== $actual->serializeToString()) { throw new ComparisonFailure( $expected, $actual, $this->exporter->shortenedExport($expected), $this->exporter->shortenedExport($actual), false, 'Given 2 Message objects are not the same' ); } } } src/ApiCore/Testing/ReceivedRequest.php000064400000005033151742741630014115 0ustar00actualCall = [ 'funcCall' => $funcCall, 'request' => $requestObject, 'deserialize' => $deserialize, 'metadata' => $metadata, 'options' => $options, ]; } public function getArray() { return $this->actualCall; } public function getFuncCall() { return $this->actualCall['funcCall']; } public function getRequestObject() { return $this->actualCall['request']; } public function getMetadata() { return $this->actualCall['metadata']; } public function getOptions() { return $this->actualCall['options']; } } src/ApiCore/Testing/SerializationTrait.php000064400000004506151742741630014643 0ustar00$deserializeFunc($message); } elseif (is_string($message)) { $obj->mergeFromString($message); } return $obj; } // Protobuf-PHP implementation return call_user_func($deserialize, $message); } } src/ApiCore/Testing/mocks.proto000064400000001172151742741630012506 0ustar00syntax = "proto3"; package google.apicore.testing; import "google/protobuf/field_mask.proto"; import "google/protobuf/wrappers.proto"; option php_namespace = "Google\\ApiCore\\Testing"; message MockRequest { string page_token = 1; uint64 page_size = 2; } message MockResponse { string name = 1; uint64 number = 2; repeated string resources_list = 3; string next_page_token = 4; } message MockRequestBody { string name = 1; uint64 number = 2; repeated string repeated_field = 3; MockRequestBody nested_message = 4; google.protobuf.FieldMask field_mask = 5; google.protobuf.StringValue string_value = 6; } src/ApiCore/Transport/Grpc/ForwardingCall.php000064400000005111151742741630015163 0ustar00innerCall = $innerCall; } /** * @return mixed The metadata sent by the server */ public function getMetadata() { return $this->innerCall->getMetadata(); } /** * @return mixed The trailing metadata sent by the server */ public function getTrailingMetadata() { return $this->innerCall->getTrailingMetadata(); } /** * @return string The URI of the endpoint */ public function getPeer() { return $this->innerCall->getPeer(); } /** * Cancels the call. */ public function cancel() { $this->innerCall->cancel(); } } src/ApiCore/Transport/Grpc/ForwardingUnaryCall.php000064400000003645151742741630016214 0ustar00innerCall->wait(); } } src/ApiCore/Transport/Grpc/UnaryInterceptorInterface.php000064400000004123151742741630017425 0ustar00baseUri = $baseUri; $this->httpHandler = $httpHandler; $this->transportName = 'grpc-fallback'; } /** * Builds a GrpcFallbackTransport. * * @param string $serviceAddress * The address of the API remote host, for example "example.googleapis.com". * @param array $config { * Config options used to construct the grpc-fallback transport. * * @type callable $httpHandler A handler used to deliver PSR-7 requests. * } * @return GrpcFallbackTransport * @throws ValidationException */ public static function build($serviceAddress, array $config = []) { $config += [ 'httpHandler' => null, ]; list($baseUri, $port) = self::normalizeServiceAddress($serviceAddress); $httpHandler = $config['httpHandler'] ?: self::buildHttpHandlerAsync(); return new GrpcFallbackTransport("$baseUri:$port", $httpHandler); } /** * {@inheritdoc} */ public function startUnaryCall(Call $call, array $options) { $httpHandler = $this->httpHandler; return $httpHandler( $this->buildRequest($call, $options), $this->getCallOptions($options) )->then( function (ResponseInterface $response) use ($options) { if (isset($options['metadataCallback'])) { $metadataCallback = $options['metadataCallback']; $metadataCallback($response->getHeaders()); } return $response; } )->then( function (ResponseInterface $response) use ($call) { return $this->unpackResponse($call, $response); }, function (\Exception $ex) { throw $this->transformException($ex); } ); } /** * @param Call $call * @param array $options * @return RequestInterface */ private function buildRequest(Call $call, array $options) { // Build common headers and set the content type to 'application/x-protobuf' $headers = ['Content-Type' => 'application/x-protobuf'] + self::buildCommonHeaders($options); // It is necessary to supply 'grpc-web' in the 'x-goog-api-client' header // when using the grpc-fallback protocol. $headers += ['x-goog-api-client' => []]; $headers['x-goog-api-client'][] = 'grpc-web'; // Uri format: https:///$rpc/ $uri = "https://{$this->baseUri}/\$rpc/{$call->getMethod()}"; return new Request( 'POST', $uri, $headers, $call->getMessage()->serializeToString() ); } /** * @param Call $call * @param ResponseInterface $response * @return Message */ private function unpackResponse(Call $call, ResponseInterface $response) { $decodeType = $call->getDecodeType(); /** @var Message $responseMessage */ $responseMessage = new $decodeType; $responseMessage->mergeFromString((string)$response->getBody()); return $responseMessage; } /** * @param array $options * @return array */ private function getCallOptions(array $options) { $callOptions = isset($options['transportOptions']['grpcFallbackOptions']) ? $options['transportOptions']['grpcFallbackOptions'] : []; if (isset($options['timeoutMillis'])) { $callOptions['timeout'] = $options['timeoutMillis'] / 1000; } return $callOptions; } /** * @param \Exception $ex * @return \Exception */ private function transformException(\Exception $ex) { if ($ex instanceof RequestException && $ex->hasResponse()) { $res = $ex->getResponse(); $body = (string) $res->getBody(); $status = new Status(); try { $status->mergeFromString($body); return ApiException::createFromRpcStatus($status); } catch (\Exception $parseException) { // We were unable to parse the response body into a $status object. Instead, // create an ApiException using the unparsed $body as message. $code = ApiStatus::rpcCodeFromHttpStatusCode($res->getStatusCode()); return ApiException::createFromApiResponse($body, $code, null, $parseException); } } else { return $ex; } } } src/ApiCore/Transport/GrpcTransport.php000064400000022764151742741630014217 0ustar00interceptors = $interceptors; } /** * Builds a GrpcTransport. * * @param string $serviceAddress * The address of the API remote host, for example "example.googleapis.com. May also * include the port, for example "example.googleapis.com:443" * @param array $config { * Config options used to construct the gRPC transport. * * @type array $stubOpts Options used to construct the gRPC stub. * @type Channel $channel Grpc channel to be used. * @type UnaryInterceptorInterface[] $interceptors *EXPERIMENTAL* Interceptor support, required until * gRPC interceptors are available. * } * @return GrpcTransport * @throws ValidationException */ public static function build($serviceAddress, array $config = []) { self::validateGrpcSupport(); $config += [ 'stubOpts' => [], 'channel' => null, 'interceptors' => [], ]; list($addr, $port) = self::normalizeServiceAddress($serviceAddress); $host = "$addr:$port"; $stubOpts = $config['stubOpts']; // Set the required 'credentials' key in stubOpts if it is not already set. Use // array_key_exists because null is a valid value. if (!array_key_exists('credentials', $stubOpts)) { $stubOpts['credentials'] = ChannelCredentials::createSsl(); } $channel = $config['channel']; if (!is_null($channel) && !($channel instanceof Channel)) { throw new ValidationException( "Channel argument to GrpcTransport must be of type \Grpc\Channel, " . "instead got: " . print_r($channel, true) ); } try { return new GrpcTransport($host, $stubOpts, $channel, $config['interceptors']); } catch (Exception $ex) { throw new ValidationException( "Failed to build GrpcTransport: " . $ex->getMessage(), $ex->getCode(), $ex ); } } /** * {@inheritdoc} */ public function startBidiStreamingCall(Call $call, array $options) { return new BidiStream( $this->_bidiRequest( '/' . $call->getMethod(), [$call->getDecodeType(), 'decode'], isset($options['headers']) ? $options['headers'] : [], $this->getCallOptions($options) ), $call->getDescriptor() ); } /** * {@inheritdoc} */ public function startClientStreamingCall(Call $call, array $options) { return new ClientStream( $this->_clientStreamRequest( '/' . $call->getMethod(), [$call->getDecodeType(), 'decode'], isset($options['headers']) ? $options['headers'] : [], $this->getCallOptions($options) ), $call->getDescriptor() ); } /** * {@inheritdoc} */ public function startServerStreamingCall(Call $call, array $options) { $message = $call->getMessage(); if (!$message) { throw new \InvalidArgumentException('A message is required for ServerStreaming calls.'); } return new ServerStream( $this->_serverStreamRequest( '/' . $call->getMethod(), $message, [$call->getDecodeType(), 'decode'], isset($options['headers']) ? $options['headers'] : [], $this->getCallOptions($options) ), $call->getDescriptor() ); } private function wrapExecuteWithInterceptor(callable $execute, UnaryInterceptorInterface $interceptor) { return function ( $method, $argument, array $metadata = [], array $options = [] ) use ( $execute, $interceptor ) { return $interceptor->interceptUnaryUnary($method, $argument, $metadata, $options, $execute); }; } protected function _simpleRequest( $method, $argument, $deserialize, array $metadata = [], array $options = [] ) { $execute = function ($method, $argument, $metadata, array $options) use ($deserialize) { return parent::_simpleRequest( $method, $argument, $deserialize, $metadata, $options ); }; foreach ($this->interceptors as $interceptor) { $execute = $this->wrapExecuteWithInterceptor($execute, $interceptor); } return $execute($method, $argument, $metadata, $options); } /** * {@inheritdoc} */ public function startUnaryCall(Call $call, array $options) { $unaryCall = $this->_simpleRequest( '/' . $call->getMethod(), $call->getMessage(), [$call->getDecodeType(), 'decode'], isset($options['headers']) ? $options['headers'] : [], $this->getCallOptions($options) ); $promise = new Promise( function () use ($unaryCall, $options, &$promise) { list($response, $status) = $unaryCall->wait(); if ($status->code == Code::OK) { if (isset($options['metadataCallback'])) { $metadataCallback = $options['metadataCallback']; $metadataCallback($unaryCall->getMetadata()); } $promise->resolve($response); } else { throw ApiException::createFromStdClass($status); } }, [$unaryCall, 'cancel'] ); return $promise; } private function getCallOptions(array $options) { $callOptions = isset($options['transportOptions']['grpcOptions']) ? $options['transportOptions']['grpcOptions'] : []; if (isset($options['credentialsWrapper'])) { $credentialsWrapper = $options['credentialsWrapper']; $callOptions['call_credentials_callback'] = $credentialsWrapper->getAuthorizationHeaderCallback(); } if (isset($options['timeoutMillis'])) { $callOptions['timeout'] = $options['timeoutMillis'] * 1000; } return $callOptions; } } src/ApiCore/Transport/HttpUnaryTransportTrait.php000064400000007253151742741630016262 0ustar00throwUnsupportedException(); } /** * {@inheritdoc} * @throws \BadMethodCallException */ public function startServerStreamingCall(Call $call, array $options) { $this->throwUnsupportedException(); } /** * {@inheritdoc} * @throws \BadMethodCallException */ public function startBidiStreamingCall(Call $call, array $options) { $this->throwUnsupportedException(); } /** * {@inheritdoc} */ public function close() { // Nothing to do. } /** * @param array $options * @return array */ private static function buildCommonHeaders(array $options) { $headers = isset($options['headers']) ? $options['headers'] : []; // If not already set, add an auth header to the request if (!isset($headers['Authorization']) && isset($options['credentialsWrapper'])) { $headers['Authorization'] = $options['credentialsWrapper']->getBearerString(); } return $headers; } /** * @return callable * @throws ValidationException */ private static function buildHttpHandlerAsync() { try { return [HttpHandlerFactory::build(), 'async']; } catch (Exception $ex) { throw new ValidationException("Failed to build HttpHandler", $ex->getCode(), $ex); } } private function throwUnsupportedException() { throw new \BadMethodCallException( "Streaming calls are not supported while using the {$this->transportName} transport." ); } } src/ApiCore/Transport/RestTransport.php000064400000013652151742741630014235 0ustar00requestBuilder = $requestBuilder; $this->httpHandler = $httpHandler; $this->transportName = 'REST'; } /** * Builds a RestTransport. * * @param string $serviceAddress * The address of the API remote host, for example "example.googleapis.com". * @param string $restConfigPath * Path to rest config file. * @param array $config { * Config options used to construct the gRPC transport. * * @type callable $httpHandler A handler used to deliver PSR-7 requests. * } * @return RestTransport * @throws ValidationException */ public static function build($serviceAddress, $restConfigPath, array $config = []) { $config += [ 'httpHandler' => null, ]; list($baseUri, $port) = self::normalizeServiceAddress($serviceAddress); $requestBuilder = new RequestBuilder("$baseUri:$port", $restConfigPath); $httpHandler = $config['httpHandler'] ?: self::buildHttpHandlerAsync(); return new RestTransport($requestBuilder, $httpHandler); } /** * {@inheritdoc} */ public function startUnaryCall(Call $call, array $options) { $headers = self::buildCommonHeaders($options); // call the HTTP handler $httpHandler = $this->httpHandler; return $httpHandler( $this->requestBuilder->build( $call->getMethod(), $call->getMessage(), $headers ), $this->getCallOptions($options) )->then( function (ResponseInterface $response) use ($call, $options) { $decodeType = $call->getDecodeType(); $return = new $decodeType; $return->mergeFromJsonString( (string) $response->getBody() ); if (isset($options['metadataCallback'])) { $metadataCallback = $options['metadataCallback']; $metadataCallback($response->getHeaders()); } return $return; }, function (\Exception $ex) { if ($ex instanceof RequestException && $ex->hasResponse()) { throw $this->convertToApiException($ex); } throw $ex; } ); } private function getCallOptions(array $options) { $callOptions = isset($options['transportOptions']['restOptions']) ? $options['transportOptions']['restOptions'] : []; if (isset($options['timeoutMillis'])) { $callOptions['timeout'] = $options['timeoutMillis'] / 1000; } return $callOptions; } /** * @param \Exception $ex * @return ApiException */ private function convertToApiException(\Exception $ex) { $res = $ex->getResponse(); $body = (string) $res->getBody(); if ($error = json_decode($body, true)['error']) { $basicMessage = $error['message']; $code = ApiStatus::rpcCodeFromStatus($error['status']); $metadata = isset($error['details']) ? $error['details'] : null; return ApiException::createFromApiResponse($basicMessage, $code, $metadata); } // Use the RPC code instead of the HTTP Status Code. $code = ApiStatus::rpcCodeFromHttpStatusCode($res->getStatusCode()); return ApiException::createFromApiResponse($body, $code); } } src/ApiCore/Transport/TransportInterface.php000064400000005366151742741630015223 0ustar00 &$v) { if (is_bool($v)) { $v = $v ? 'true' : 'false'; } } return Psr7\uri_for($uri) ->withQuery( Psr7\build_query($query) ); } } src/ApiCore/ValidationException.php000064400000003323151742741630013352 0ustar00google.cloud.audit.AuditLog */ class AuditLog extends \Google\Protobuf\Internal\Message { /** * The name of the API service performing the operation. For example, * `"datastore.googleapis.com"`. * * Generated from protobuf field string service_name = 7; */ private $service_name = ''; /** * The name of the service method or operation. * For API calls, this should be the name of the API method. * For example, * "google.datastore.v1.Datastore.RunQuery" * "google.logging.v1.LoggingService.DeleteLog" * * Generated from protobuf field string method_name = 8; */ private $method_name = ''; /** * The resource or collection that is the target of the operation. * The name is a scheme-less URI, not including the API service name. * For example: * "shelves/SHELF_ID/books" * "shelves/SHELF_ID/books/BOOK_ID" * * Generated from protobuf field string resource_name = 11; */ private $resource_name = ''; /** * The number of items returned from a List or Query API method, * if applicable. * * Generated from protobuf field int64 num_response_items = 12; */ private $num_response_items = 0; /** * The status of the overall operation. * * Generated from protobuf field .google.rpc.Status status = 2; */ private $status = null; /** * Authentication information. * * Generated from protobuf field .google.cloud.audit.AuthenticationInfo authentication_info = 3; */ private $authentication_info = null; /** * Authorization information. If there are multiple * resources or permissions involved, then there is * one AuthorizationInfo element for each {resource, permission} tuple. * * Generated from protobuf field repeated .google.cloud.audit.AuthorizationInfo authorization_info = 9; */ private $authorization_info; /** * Metadata about the operation. * * Generated from protobuf field .google.cloud.audit.RequestMetadata request_metadata = 4; */ private $request_metadata = null; /** * The operation request. This may not include all request parameters, * such as those that are too large, privacy-sensitive, or duplicated * elsewhere in the log record. * It should never include user-generated data, such as file contents. * When the JSON object represented here has a proto equivalent, the proto * name will be indicated in the `@type` property. * * Generated from protobuf field .google.protobuf.Struct request = 16; */ private $request = null; /** * The operation response. This may not include all response elements, * such as those that are too large, privacy-sensitive, or duplicated * elsewhere in the log record. * It should never include user-generated data, such as file contents. * When the JSON object represented here has a proto equivalent, the proto * name will be indicated in the `@type` property. * * Generated from protobuf field .google.protobuf.Struct response = 17; */ private $response = null; /** * Other service-specific data about the request, response, and other * activities. * * Generated from protobuf field .google.protobuf.Any service_data = 15; */ private $service_data = null; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $service_name * The name of the API service performing the operation. For example, * `"datastore.googleapis.com"`. * @type string $method_name * The name of the service method or operation. * For API calls, this should be the name of the API method. * For example, * "google.datastore.v1.Datastore.RunQuery" * "google.logging.v1.LoggingService.DeleteLog" * @type string $resource_name * The resource or collection that is the target of the operation. * The name is a scheme-less URI, not including the API service name. * For example: * "shelves/SHELF_ID/books" * "shelves/SHELF_ID/books/BOOK_ID" * @type int|string $num_response_items * The number of items returned from a List or Query API method, * if applicable. * @type \Google\Rpc\Status $status * The status of the overall operation. * @type \Google\Cloud\Audit\AuthenticationInfo $authentication_info * Authentication information. * @type \Google\Cloud\Audit\AuthorizationInfo[]|\Google\Protobuf\Internal\RepeatedField $authorization_info * Authorization information. If there are multiple * resources or permissions involved, then there is * one AuthorizationInfo element for each {resource, permission} tuple. * @type \Google\Cloud\Audit\RequestMetadata $request_metadata * Metadata about the operation. * @type \Google\Protobuf\Struct $request * The operation request. This may not include all request parameters, * such as those that are too large, privacy-sensitive, or duplicated * elsewhere in the log record. * It should never include user-generated data, such as file contents. * When the JSON object represented here has a proto equivalent, the proto * name will be indicated in the `@type` property. * @type \Google\Protobuf\Struct $response * The operation response. This may not include all response elements, * such as those that are too large, privacy-sensitive, or duplicated * elsewhere in the log record. * It should never include user-generated data, such as file contents. * When the JSON object represented here has a proto equivalent, the proto * name will be indicated in the `@type` property. * @type \Google\Protobuf\Any $service_data * Other service-specific data about the request, response, and other * activities. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Audit\AuditLog::initOnce(); parent::__construct($data); } /** * The name of the API service performing the operation. For example, * `"datastore.googleapis.com"`. * * Generated from protobuf field string service_name = 7; * @return string */ public function getServiceName() { return $this->service_name; } /** * The name of the API service performing the operation. For example, * `"datastore.googleapis.com"`. * * Generated from protobuf field string service_name = 7; * @param string $var * @return $this */ public function setServiceName($var) { GPBUtil::checkString($var, True); $this->service_name = $var; return $this; } /** * The name of the service method or operation. * For API calls, this should be the name of the API method. * For example, * "google.datastore.v1.Datastore.RunQuery" * "google.logging.v1.LoggingService.DeleteLog" * * Generated from protobuf field string method_name = 8; * @return string */ public function getMethodName() { return $this->method_name; } /** * The name of the service method or operation. * For API calls, this should be the name of the API method. * For example, * "google.datastore.v1.Datastore.RunQuery" * "google.logging.v1.LoggingService.DeleteLog" * * Generated from protobuf field string method_name = 8; * @param string $var * @return $this */ public function setMethodName($var) { GPBUtil::checkString($var, True); $this->method_name = $var; return $this; } /** * The resource or collection that is the target of the operation. * The name is a scheme-less URI, not including the API service name. * For example: * "shelves/SHELF_ID/books" * "shelves/SHELF_ID/books/BOOK_ID" * * Generated from protobuf field string resource_name = 11; * @return string */ public function getResourceName() { return $this->resource_name; } /** * The resource or collection that is the target of the operation. * The name is a scheme-less URI, not including the API service name. * For example: * "shelves/SHELF_ID/books" * "shelves/SHELF_ID/books/BOOK_ID" * * Generated from protobuf field string resource_name = 11; * @param string $var * @return $this */ public function setResourceName($var) { GPBUtil::checkString($var, True); $this->resource_name = $var; return $this; } /** * The number of items returned from a List or Query API method, * if applicable. * * Generated from protobuf field int64 num_response_items = 12; * @return int|string */ public function getNumResponseItems() { return $this->num_response_items; } /** * The number of items returned from a List or Query API method, * if applicable. * * Generated from protobuf field int64 num_response_items = 12; * @param int|string $var * @return $this */ public function setNumResponseItems($var) { GPBUtil::checkInt64($var); $this->num_response_items = $var; return $this; } /** * The status of the overall operation. * * Generated from protobuf field .google.rpc.Status status = 2; * @return \Google\Rpc\Status */ public function getStatus() { return $this->status; } /** * The status of the overall operation. * * Generated from protobuf field .google.rpc.Status status = 2; * @param \Google\Rpc\Status $var * @return $this */ public function setStatus($var) { GPBUtil::checkMessage($var, \Google\Rpc\Status::class); $this->status = $var; return $this; } /** * Authentication information. * * Generated from protobuf field .google.cloud.audit.AuthenticationInfo authentication_info = 3; * @return \Google\Cloud\Audit\AuthenticationInfo */ public function getAuthenticationInfo() { return $this->authentication_info; } /** * Authentication information. * * Generated from protobuf field .google.cloud.audit.AuthenticationInfo authentication_info = 3; * @param \Google\Cloud\Audit\AuthenticationInfo $var * @return $this */ public function setAuthenticationInfo($var) { GPBUtil::checkMessage($var, \Google\Cloud\Audit\AuthenticationInfo::class); $this->authentication_info = $var; return $this; } /** * Authorization information. If there are multiple * resources or permissions involved, then there is * one AuthorizationInfo element for each {resource, permission} tuple. * * Generated from protobuf field repeated .google.cloud.audit.AuthorizationInfo authorization_info = 9; * @return \Google\Protobuf\Internal\RepeatedField */ public function getAuthorizationInfo() { return $this->authorization_info; } /** * Authorization information. If there are multiple * resources or permissions involved, then there is * one AuthorizationInfo element for each {resource, permission} tuple. * * Generated from protobuf field repeated .google.cloud.audit.AuthorizationInfo authorization_info = 9; * @param \Google\Cloud\Audit\AuthorizationInfo[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setAuthorizationInfo($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Audit\AuthorizationInfo::class); $this->authorization_info = $arr; return $this; } /** * Metadata about the operation. * * Generated from protobuf field .google.cloud.audit.RequestMetadata request_metadata = 4; * @return \Google\Cloud\Audit\RequestMetadata */ public function getRequestMetadata() { return $this->request_metadata; } /** * Metadata about the operation. * * Generated from protobuf field .google.cloud.audit.RequestMetadata request_metadata = 4; * @param \Google\Cloud\Audit\RequestMetadata $var * @return $this */ public function setRequestMetadata($var) { GPBUtil::checkMessage($var, \Google\Cloud\Audit\RequestMetadata::class); $this->request_metadata = $var; return $this; } /** * The operation request. This may not include all request parameters, * such as those that are too large, privacy-sensitive, or duplicated * elsewhere in the log record. * It should never include user-generated data, such as file contents. * When the JSON object represented here has a proto equivalent, the proto * name will be indicated in the `@type` property. * * Generated from protobuf field .google.protobuf.Struct request = 16; * @return \Google\Protobuf\Struct */ public function getRequest() { return $this->request; } /** * The operation request. This may not include all request parameters, * such as those that are too large, privacy-sensitive, or duplicated * elsewhere in the log record. * It should never include user-generated data, such as file contents. * When the JSON object represented here has a proto equivalent, the proto * name will be indicated in the `@type` property. * * Generated from protobuf field .google.protobuf.Struct request = 16; * @param \Google\Protobuf\Struct $var * @return $this */ public function setRequest($var) { GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); $this->request = $var; return $this; } /** * The operation response. This may not include all response elements, * such as those that are too large, privacy-sensitive, or duplicated * elsewhere in the log record. * It should never include user-generated data, such as file contents. * When the JSON object represented here has a proto equivalent, the proto * name will be indicated in the `@type` property. * * Generated from protobuf field .google.protobuf.Struct response = 17; * @return \Google\Protobuf\Struct */ public function getResponse() { return $this->response; } /** * The operation response. This may not include all response elements, * such as those that are too large, privacy-sensitive, or duplicated * elsewhere in the log record. * It should never include user-generated data, such as file contents. * When the JSON object represented here has a proto equivalent, the proto * name will be indicated in the `@type` property. * * Generated from protobuf field .google.protobuf.Struct response = 17; * @param \Google\Protobuf\Struct $var * @return $this */ public function setResponse($var) { GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); $this->response = $var; return $this; } /** * Other service-specific data about the request, response, and other * activities. * * Generated from protobuf field .google.protobuf.Any service_data = 15; * @return \Google\Protobuf\Any */ public function getServiceData() { return $this->service_data; } /** * Other service-specific data about the request, response, and other * activities. * * Generated from protobuf field .google.protobuf.Any service_data = 15; * @param \Google\Protobuf\Any $var * @return $this */ public function setServiceData($var) { GPBUtil::checkMessage($var, \Google\Protobuf\Any::class); $this->service_data = $var; return $this; } } src/Cloud/Audit/AuthenticationInfo.php000064400000003362151742741630013771 0ustar00google.cloud.audit.AuthenticationInfo */ class AuthenticationInfo extends \Google\Protobuf\Internal\Message { /** * The email address of the authenticated user making the request. * * Generated from protobuf field string principal_email = 1; */ private $principal_email = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $principal_email * The email address of the authenticated user making the request. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Audit\AuditLog::initOnce(); parent::__construct($data); } /** * The email address of the authenticated user making the request. * * Generated from protobuf field string principal_email = 1; * @return string */ public function getPrincipalEmail() { return $this->principal_email; } /** * The email address of the authenticated user making the request. * * Generated from protobuf field string principal_email = 1; * @param string $var * @return $this */ public function setPrincipalEmail($var) { GPBUtil::checkString($var, True); $this->principal_email = $var; return $this; } } src/Cloud/Audit/AuthorizationInfo.php000064400000007352151742741630013655 0ustar00google.cloud.audit.AuthorizationInfo */ class AuthorizationInfo extends \Google\Protobuf\Internal\Message { /** * The resource being accessed, as a REST-style string. For example: * bigquery.googlapis.com/projects/PROJECTID/datasets/DATASETID * * Generated from protobuf field string resource = 1; */ private $resource = ''; /** * The required IAM permission. * * Generated from protobuf field string permission = 2; */ private $permission = ''; /** * Whether or not authorization for `resource` and `permission` * was granted. * * Generated from protobuf field bool granted = 3; */ private $granted = false; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $resource * The resource being accessed, as a REST-style string. For example: * bigquery.googlapis.com/projects/PROJECTID/datasets/DATASETID * @type string $permission * The required IAM permission. * @type bool $granted * Whether or not authorization for `resource` and `permission` * was granted. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Audit\AuditLog::initOnce(); parent::__construct($data); } /** * The resource being accessed, as a REST-style string. For example: * bigquery.googlapis.com/projects/PROJECTID/datasets/DATASETID * * Generated from protobuf field string resource = 1; * @return string */ public function getResource() { return $this->resource; } /** * The resource being accessed, as a REST-style string. For example: * bigquery.googlapis.com/projects/PROJECTID/datasets/DATASETID * * Generated from protobuf field string resource = 1; * @param string $var * @return $this */ public function setResource($var) { GPBUtil::checkString($var, True); $this->resource = $var; return $this; } /** * The required IAM permission. * * Generated from protobuf field string permission = 2; * @return string */ public function getPermission() { return $this->permission; } /** * The required IAM permission. * * Generated from protobuf field string permission = 2; * @param string $var * @return $this */ public function setPermission($var) { GPBUtil::checkString($var, True); $this->permission = $var; return $this; } /** * Whether or not authorization for `resource` and `permission` * was granted. * * Generated from protobuf field bool granted = 3; * @return bool */ public function getGranted() { return $this->granted; } /** * Whether or not authorization for `resource` and `permission` * was granted. * * Generated from protobuf field bool granted = 3; * @param bool $var * @return $this */ public function setGranted($var) { GPBUtil::checkBool($var); $this->granted = $var; return $this; } } src/Cloud/Audit/RequestMetadata.php000064400000011076151742741630013270 0ustar00google.cloud.audit.RequestMetadata */ class RequestMetadata extends \Google\Protobuf\Internal\Message { /** * The IP address of the caller. * * Generated from protobuf field string caller_ip = 1; */ private $caller_ip = ''; /** * The user agent of the caller. * This information is not authenticated and should be treated accordingly. * For example: * + `google-api-python-client/1.4.0`: * The request was made by the Google API client for Python. * + `Cloud SDK Command Line Tool apitools-client/1.0 gcloud/0.9.62`: * The request was made by the Google Cloud SDK CLI (gcloud). * + `AppEngine-Google; (+http://code.google.com/appengine; appid: s~my-project`: * The request was made from the `my-project` App Engine app. * * Generated from protobuf field string caller_supplied_user_agent = 2; */ private $caller_supplied_user_agent = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $caller_ip * The IP address of the caller. * @type string $caller_supplied_user_agent * The user agent of the caller. * This information is not authenticated and should be treated accordingly. * For example: * + `google-api-python-client/1.4.0`: * The request was made by the Google API client for Python. * + `Cloud SDK Command Line Tool apitools-client/1.0 gcloud/0.9.62`: * The request was made by the Google Cloud SDK CLI (gcloud). * + `AppEngine-Google; (+http://code.google.com/appengine; appid: s~my-project`: * The request was made from the `my-project` App Engine app. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Audit\AuditLog::initOnce(); parent::__construct($data); } /** * The IP address of the caller. * * Generated from protobuf field string caller_ip = 1; * @return string */ public function getCallerIp() { return $this->caller_ip; } /** * The IP address of the caller. * * Generated from protobuf field string caller_ip = 1; * @param string $var * @return $this */ public function setCallerIp($var) { GPBUtil::checkString($var, True); $this->caller_ip = $var; return $this; } /** * The user agent of the caller. * This information is not authenticated and should be treated accordingly. * For example: * + `google-api-python-client/1.4.0`: * The request was made by the Google API client for Python. * + `Cloud SDK Command Line Tool apitools-client/1.0 gcloud/0.9.62`: * The request was made by the Google Cloud SDK CLI (gcloud). * + `AppEngine-Google; (+http://code.google.com/appengine; appid: s~my-project`: * The request was made from the `my-project` App Engine app. * * Generated from protobuf field string caller_supplied_user_agent = 2; * @return string */ public function getCallerSuppliedUserAgent() { return $this->caller_supplied_user_agent; } /** * The user agent of the caller. * This information is not authenticated and should be treated accordingly. * For example: * + `google-api-python-client/1.4.0`: * The request was made by the Google API client for Python. * + `Cloud SDK Command Line Tool apitools-client/1.0 gcloud/0.9.62`: * The request was made by the Google Cloud SDK CLI (gcloud). * + `AppEngine-Google; (+http://code.google.com/appengine; appid: s~my-project`: * The request was made from the `my-project` App Engine app. * * Generated from protobuf field string caller_supplied_user_agent = 2; * @param string $var * @return $this */ public function setCallerSuppliedUserAgent($var) { GPBUtil::checkString($var, True); $this->caller_supplied_user_agent = $var; return $this; } } src/Cloud/DevTools/Source/V1/AliasContext.php000064400000004475151742741630015021 0ustar00google.devtools.source.v1.AliasContext */ class AliasContext extends \Google\Protobuf\Internal\Message { /** * The alias kind. * * Generated from protobuf field .google.devtools.source.v1.AliasContext.Kind kind = 1; */ private $kind = 0; /** * The alias name. * * Generated from protobuf field string name = 2; */ private $name = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type int $kind * The alias kind. * @type string $name * The alias name. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Devtools\Source\V1\SourceContext::initOnce(); parent::__construct($data); } /** * The alias kind. * * Generated from protobuf field .google.devtools.source.v1.AliasContext.Kind kind = 1; * @return int */ public function getKind() { return $this->kind; } /** * The alias kind. * * Generated from protobuf field .google.devtools.source.v1.AliasContext.Kind kind = 1; * @param int $var * @return $this */ public function setKind($var) { GPBUtil::checkEnum($var, \Google\Cloud\DevTools\Source\V1\AliasContext_Kind::class); $this->kind = $var; return $this; } /** * The alias name. * * Generated from protobuf field string name = 2; * @return string */ public function getName() { return $this->name; } /** * The alias name. * * Generated from protobuf field string name = 2; * @param string $var * @return $this */ public function setName($var) { GPBUtil::checkString($var, True); $this->name = $var; return $this; } } src/Cloud/DevTools/Source/V1/AliasContext/Kind.php000064400000002161151742741630015674 0ustar00google.devtools.source.v1.AliasContext.Kind */ class Kind { /** * Do not use. * * Generated from protobuf enum ANY = 0; */ const ANY = 0; /** * Git tag * * Generated from protobuf enum FIXED = 1; */ const FIXED = 1; /** * Git branch * * Generated from protobuf enum MOVABLE = 2; */ const MOVABLE = 2; /** * OTHER is used to specify non-standard aliases, those not of the kinds * above. For example, if a Git repo has a ref named "refs/foo/bar", it * is considered to be of kind OTHER. * * Generated from protobuf enum OTHER = 4; */ const OTHER = 4; } // Adding a class alias for backwards compatibility with the previous class name. class_alias(Kind::class, \Google\Cloud\DevTools\Source\V1\AliasContext_Kind::class); src/Cloud/DevTools/Source/V1/AliasContext_Kind.php000064400000001124151742741630015752 0ustar00google.devtools.source.v1.CloudRepoSourceContext */ class CloudRepoSourceContext extends \Google\Protobuf\Internal\Message { /** * The ID of the repo. * * Generated from protobuf field .google.devtools.source.v1.RepoId repo_id = 1; */ private $repo_id = null; protected $revision; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Cloud\DevTools\Source\V1\RepoId $repo_id * The ID of the repo. * @type string $revision_id * A revision ID. * @type string $alias_name * The name of an alias (branch, tag, etc.). * @type \Google\Cloud\DevTools\Source\V1\AliasContext $alias_context * An alias, which may be a branch or tag. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Devtools\Source\V1\SourceContext::initOnce(); parent::__construct($data); } /** * The ID of the repo. * * Generated from protobuf field .google.devtools.source.v1.RepoId repo_id = 1; * @return \Google\Cloud\DevTools\Source\V1\RepoId */ public function getRepoId() { return $this->repo_id; } /** * The ID of the repo. * * Generated from protobuf field .google.devtools.source.v1.RepoId repo_id = 1; * @param \Google\Cloud\DevTools\Source\V1\RepoId $var * @return $this */ public function setRepoId($var) { GPBUtil::checkMessage($var, \Google\Cloud\DevTools\Source\V1\RepoId::class); $this->repo_id = $var; return $this; } /** * A revision ID. * * Generated from protobuf field string revision_id = 2; * @return string */ public function getRevisionId() { return $this->readOneof(2); } /** * A revision ID. * * Generated from protobuf field string revision_id = 2; * @param string $var * @return $this */ public function setRevisionId($var) { GPBUtil::checkString($var, True); $this->writeOneof(2, $var); return $this; } /** * The name of an alias (branch, tag, etc.). * * Generated from protobuf field string alias_name = 3; * @return string */ public function getAliasName() { return $this->readOneof(3); } /** * The name of an alias (branch, tag, etc.). * * Generated from protobuf field string alias_name = 3; * @param string $var * @return $this */ public function setAliasName($var) { GPBUtil::checkString($var, True); $this->writeOneof(3, $var); return $this; } /** * An alias, which may be a branch or tag. * * Generated from protobuf field .google.devtools.source.v1.AliasContext alias_context = 4; * @return \Google\Cloud\DevTools\Source\V1\AliasContext */ public function getAliasContext() { return $this->readOneof(4); } /** * An alias, which may be a branch or tag. * * Generated from protobuf field .google.devtools.source.v1.AliasContext alias_context = 4; * @param \Google\Cloud\DevTools\Source\V1\AliasContext $var * @return $this */ public function setAliasContext($var) { GPBUtil::checkMessage($var, \Google\Cloud\DevTools\Source\V1\AliasContext::class); $this->writeOneof(4, $var); return $this; } /** * @return string */ public function getRevision() { return $this->whichOneof("revision"); } } src/Cloud/DevTools/Source/V1/CloudWorkspaceId.php000064400000006256151742741630015624 0ustar00google.devtools.source.v1.CloudWorkspaceId */ class CloudWorkspaceId extends \Google\Protobuf\Internal\Message { /** * The ID of the repo containing the workspace. * * Generated from protobuf field .google.devtools.source.v1.RepoId repo_id = 1; */ private $repo_id = null; /** * The unique name of the workspace within the repo. This is the name * chosen by the client in the Source API's CreateWorkspace method. * * Generated from protobuf field string name = 2; */ private $name = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Cloud\DevTools\Source\V1\RepoId $repo_id * The ID of the repo containing the workspace. * @type string $name * The unique name of the workspace within the repo. This is the name * chosen by the client in the Source API's CreateWorkspace method. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Devtools\Source\V1\SourceContext::initOnce(); parent::__construct($data); } /** * The ID of the repo containing the workspace. * * Generated from protobuf field .google.devtools.source.v1.RepoId repo_id = 1; * @return \Google\Cloud\DevTools\Source\V1\RepoId */ public function getRepoId() { return $this->repo_id; } /** * The ID of the repo containing the workspace. * * Generated from protobuf field .google.devtools.source.v1.RepoId repo_id = 1; * @param \Google\Cloud\DevTools\Source\V1\RepoId $var * @return $this */ public function setRepoId($var) { GPBUtil::checkMessage($var, \Google\Cloud\DevTools\Source\V1\RepoId::class); $this->repo_id = $var; return $this; } /** * The unique name of the workspace within the repo. This is the name * chosen by the client in the Source API's CreateWorkspace method. * * Generated from protobuf field string name = 2; * @return string */ public function getName() { return $this->name; } /** * The unique name of the workspace within the repo. This is the name * chosen by the client in the Source API's CreateWorkspace method. * * Generated from protobuf field string name = 2; * @param string $var * @return $this */ public function setName($var) { GPBUtil::checkString($var, True); $this->name = $var; return $this; } } src/Cloud/DevTools/Source/V1/CloudWorkspaceSourceContext.php000064400000005747151742741630020101 0ustar00google.devtools.source.v1.CloudWorkspaceSourceContext */ class CloudWorkspaceSourceContext extends \Google\Protobuf\Internal\Message { /** * The ID of the workspace. * * Generated from protobuf field .google.devtools.source.v1.CloudWorkspaceId workspace_id = 1; */ private $workspace_id = null; /** * The ID of the snapshot. * An empty snapshot_id refers to the most recent snapshot. * * Generated from protobuf field string snapshot_id = 2; */ private $snapshot_id = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Cloud\DevTools\Source\V1\CloudWorkspaceId $workspace_id * The ID of the workspace. * @type string $snapshot_id * The ID of the snapshot. * An empty snapshot_id refers to the most recent snapshot. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Devtools\Source\V1\SourceContext::initOnce(); parent::__construct($data); } /** * The ID of the workspace. * * Generated from protobuf field .google.devtools.source.v1.CloudWorkspaceId workspace_id = 1; * @return \Google\Cloud\DevTools\Source\V1\CloudWorkspaceId */ public function getWorkspaceId() { return $this->workspace_id; } /** * The ID of the workspace. * * Generated from protobuf field .google.devtools.source.v1.CloudWorkspaceId workspace_id = 1; * @param \Google\Cloud\DevTools\Source\V1\CloudWorkspaceId $var * @return $this */ public function setWorkspaceId($var) { GPBUtil::checkMessage($var, \Google\Cloud\DevTools\Source\V1\CloudWorkspaceId::class); $this->workspace_id = $var; return $this; } /** * The ID of the snapshot. * An empty snapshot_id refers to the most recent snapshot. * * Generated from protobuf field string snapshot_id = 2; * @return string */ public function getSnapshotId() { return $this->snapshot_id; } /** * The ID of the snapshot. * An empty snapshot_id refers to the most recent snapshot. * * Generated from protobuf field string snapshot_id = 2; * @param string $var * @return $this */ public function setSnapshotId($var) { GPBUtil::checkString($var, True); $this->snapshot_id = $var; return $this; } } src/Cloud/DevTools/Source/V1/ExtendedSourceContext.php000064400000005565151742741630016712 0ustar00google.devtools.source.v1.ExtendedSourceContext */ class ExtendedSourceContext extends \Google\Protobuf\Internal\Message { /** * Any source context. * * Generated from protobuf field .google.devtools.source.v1.SourceContext context = 1; */ private $context = null; /** * Labels with user defined metadata. * * Generated from protobuf field map labels = 2; */ private $labels; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Cloud\DevTools\Source\V1\SourceContext $context * Any source context. * @type array|\Google\Protobuf\Internal\MapField $labels * Labels with user defined metadata. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Devtools\Source\V1\SourceContext::initOnce(); parent::__construct($data); } /** * Any source context. * * Generated from protobuf field .google.devtools.source.v1.SourceContext context = 1; * @return \Google\Cloud\DevTools\Source\V1\SourceContext */ public function getContext() { return $this->context; } /** * Any source context. * * Generated from protobuf field .google.devtools.source.v1.SourceContext context = 1; * @param \Google\Cloud\DevTools\Source\V1\SourceContext $var * @return $this */ public function setContext($var) { GPBUtil::checkMessage($var, \Google\Cloud\DevTools\Source\V1\SourceContext::class); $this->context = $var; return $this; } /** * Labels with user defined metadata. * * Generated from protobuf field map labels = 2; * @return \Google\Protobuf\Internal\MapField */ public function getLabels() { return $this->labels; } /** * Labels with user defined metadata. * * Generated from protobuf field map labels = 2; * @param array|\Google\Protobuf\Internal\MapField $var * @return $this */ public function setLabels($var) { $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); $this->labels = $arr; return $this; } } src/Cloud/DevTools/Source/V1/GerritSourceContext.php000064400000012545151742741630016402 0ustar00google.devtools.source.v1.GerritSourceContext */ class GerritSourceContext extends \Google\Protobuf\Internal\Message { /** * The URI of a running Gerrit instance. * * Generated from protobuf field string host_uri = 1; */ private $host_uri = ''; /** * The full project name within the host. Projects may be nested, so * "project/subproject" is a valid project name. * The "repo name" is hostURI/project. * * Generated from protobuf field string gerrit_project = 2; */ private $gerrit_project = ''; protected $revision; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $host_uri * The URI of a running Gerrit instance. * @type string $gerrit_project * The full project name within the host. Projects may be nested, so * "project/subproject" is a valid project name. * The "repo name" is hostURI/project. * @type string $revision_id * A revision (commit) ID. * @type string $alias_name * The name of an alias (branch, tag, etc.). * @type \Google\Cloud\DevTools\Source\V1\AliasContext $alias_context * An alias, which may be a branch or tag. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Devtools\Source\V1\SourceContext::initOnce(); parent::__construct($data); } /** * The URI of a running Gerrit instance. * * Generated from protobuf field string host_uri = 1; * @return string */ public function getHostUri() { return $this->host_uri; } /** * The URI of a running Gerrit instance. * * Generated from protobuf field string host_uri = 1; * @param string $var * @return $this */ public function setHostUri($var) { GPBUtil::checkString($var, True); $this->host_uri = $var; return $this; } /** * The full project name within the host. Projects may be nested, so * "project/subproject" is a valid project name. * The "repo name" is hostURI/project. * * Generated from protobuf field string gerrit_project = 2; * @return string */ public function getGerritProject() { return $this->gerrit_project; } /** * The full project name within the host. Projects may be nested, so * "project/subproject" is a valid project name. * The "repo name" is hostURI/project. * * Generated from protobuf field string gerrit_project = 2; * @param string $var * @return $this */ public function setGerritProject($var) { GPBUtil::checkString($var, True); $this->gerrit_project = $var; return $this; } /** * A revision (commit) ID. * * Generated from protobuf field string revision_id = 3; * @return string */ public function getRevisionId() { return $this->readOneof(3); } /** * A revision (commit) ID. * * Generated from protobuf field string revision_id = 3; * @param string $var * @return $this */ public function setRevisionId($var) { GPBUtil::checkString($var, True); $this->writeOneof(3, $var); return $this; } /** * The name of an alias (branch, tag, etc.). * * Generated from protobuf field string alias_name = 4; * @return string */ public function getAliasName() { return $this->readOneof(4); } /** * The name of an alias (branch, tag, etc.). * * Generated from protobuf field string alias_name = 4; * @param string $var * @return $this */ public function setAliasName($var) { GPBUtil::checkString($var, True); $this->writeOneof(4, $var); return $this; } /** * An alias, which may be a branch or tag. * * Generated from protobuf field .google.devtools.source.v1.AliasContext alias_context = 5; * @return \Google\Cloud\DevTools\Source\V1\AliasContext */ public function getAliasContext() { return $this->readOneof(5); } /** * An alias, which may be a branch or tag. * * Generated from protobuf field .google.devtools.source.v1.AliasContext alias_context = 5; * @param \Google\Cloud\DevTools\Source\V1\AliasContext $var * @return $this */ public function setAliasContext($var) { GPBUtil::checkMessage($var, \Google\Cloud\DevTools\Source\V1\AliasContext::class); $this->writeOneof(5, $var); return $this; } /** * @return string */ public function getRevision() { return $this->whichOneof("revision"); } } src/Cloud/DevTools/Source/V1/GitSourceContext.php000064400000004606151742741630015670 0ustar00google.devtools.source.v1.GitSourceContext */ class GitSourceContext extends \Google\Protobuf\Internal\Message { /** * Git repository URL. * * Generated from protobuf field string url = 1; */ private $url = ''; /** * Git commit hash. * required. * * Generated from protobuf field string revision_id = 2; */ private $revision_id = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $url * Git repository URL. * @type string $revision_id * Git commit hash. * required. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Devtools\Source\V1\SourceContext::initOnce(); parent::__construct($data); } /** * Git repository URL. * * Generated from protobuf field string url = 1; * @return string */ public function getUrl() { return $this->url; } /** * Git repository URL. * * Generated from protobuf field string url = 1; * @param string $var * @return $this */ public function setUrl($var) { GPBUtil::checkString($var, True); $this->url = $var; return $this; } /** * Git commit hash. * required. * * Generated from protobuf field string revision_id = 2; * @return string */ public function getRevisionId() { return $this->revision_id; } /** * Git commit hash. * required. * * Generated from protobuf field string revision_id = 2; * @param string $var * @return $this */ public function setRevisionId($var) { GPBUtil::checkString($var, True); $this->revision_id = $var; return $this; } } src/Cloud/DevTools/Source/V1/ProjectRepoId.php000064400000005031151742741630015121 0ustar00google.devtools.source.v1.ProjectRepoId */ class ProjectRepoId extends \Google\Protobuf\Internal\Message { /** * The ID of the project. * * Generated from protobuf field string project_id = 1; */ private $project_id = ''; /** * The name of the repo. Leave empty for the default repo. * * Generated from protobuf field string repo_name = 2; */ private $repo_name = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $project_id * The ID of the project. * @type string $repo_name * The name of the repo. Leave empty for the default repo. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Devtools\Source\V1\SourceContext::initOnce(); parent::__construct($data); } /** * The ID of the project. * * Generated from protobuf field string project_id = 1; * @return string */ public function getProjectId() { return $this->project_id; } /** * The ID of the project. * * Generated from protobuf field string project_id = 1; * @param string $var * @return $this */ public function setProjectId($var) { GPBUtil::checkString($var, True); $this->project_id = $var; return $this; } /** * The name of the repo. Leave empty for the default repo. * * Generated from protobuf field string repo_name = 2; * @return string */ public function getRepoName() { return $this->repo_name; } /** * The name of the repo. Leave empty for the default repo. * * Generated from protobuf field string repo_name = 2; * @param string $var * @return $this */ public function setRepoName($var) { GPBUtil::checkString($var, True); $this->repo_name = $var; return $this; } } src/Cloud/DevTools/Source/V1/RepoId.php000064400000005015151742741630013574 0ustar00google.devtools.source.v1.RepoId */ class RepoId extends \Google\Protobuf\Internal\Message { protected $id; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Cloud\DevTools\Source\V1\ProjectRepoId $project_repo_id * A combination of a project ID and a repo name. * @type string $uid * A server-assigned, globally unique identifier. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Devtools\Source\V1\SourceContext::initOnce(); parent::__construct($data); } /** * A combination of a project ID and a repo name. * * Generated from protobuf field .google.devtools.source.v1.ProjectRepoId project_repo_id = 1; * @return \Google\Cloud\DevTools\Source\V1\ProjectRepoId */ public function getProjectRepoId() { return $this->readOneof(1); } /** * A combination of a project ID and a repo name. * * Generated from protobuf field .google.devtools.source.v1.ProjectRepoId project_repo_id = 1; * @param \Google\Cloud\DevTools\Source\V1\ProjectRepoId $var * @return $this */ public function setProjectRepoId($var) { GPBUtil::checkMessage($var, \Google\Cloud\DevTools\Source\V1\ProjectRepoId::class); $this->writeOneof(1, $var); return $this; } /** * A server-assigned, globally unique identifier. * * Generated from protobuf field string uid = 2; * @return string */ public function getUid() { return $this->readOneof(2); } /** * A server-assigned, globally unique identifier. * * Generated from protobuf field string uid = 2; * @param string $var * @return $this */ public function setUid($var) { GPBUtil::checkString($var, True); $this->writeOneof(2, $var); return $this; } /** * @return string */ public function getId() { return $this->whichOneof("id"); } } src/Cloud/DevTools/Source/V1/SourceContext.php000064400000012044151742741630015217 0ustar00google.devtools.source.v1.SourceContext */ class SourceContext extends \Google\Protobuf\Internal\Message { protected $context; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Cloud\DevTools\Source\V1\CloudRepoSourceContext $cloud_repo * A SourceContext referring to a revision in a cloud repo. * @type \Google\Cloud\DevTools\Source\V1\CloudWorkspaceSourceContext $cloud_workspace * A SourceContext referring to a snapshot in a cloud workspace. * @type \Google\Cloud\DevTools\Source\V1\GerritSourceContext $gerrit * A SourceContext referring to a Gerrit project. * @type \Google\Cloud\DevTools\Source\V1\GitSourceContext $git * A SourceContext referring to any third party Git repo (e.g. GitHub). * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Devtools\Source\V1\SourceContext::initOnce(); parent::__construct($data); } /** * A SourceContext referring to a revision in a cloud repo. * * Generated from protobuf field .google.devtools.source.v1.CloudRepoSourceContext cloud_repo = 1; * @return \Google\Cloud\DevTools\Source\V1\CloudRepoSourceContext */ public function getCloudRepo() { return $this->readOneof(1); } /** * A SourceContext referring to a revision in a cloud repo. * * Generated from protobuf field .google.devtools.source.v1.CloudRepoSourceContext cloud_repo = 1; * @param \Google\Cloud\DevTools\Source\V1\CloudRepoSourceContext $var * @return $this */ public function setCloudRepo($var) { GPBUtil::checkMessage($var, \Google\Cloud\DevTools\Source\V1\CloudRepoSourceContext::class); $this->writeOneof(1, $var); return $this; } /** * A SourceContext referring to a snapshot in a cloud workspace. * * Generated from protobuf field .google.devtools.source.v1.CloudWorkspaceSourceContext cloud_workspace = 2; * @return \Google\Cloud\DevTools\Source\V1\CloudWorkspaceSourceContext */ public function getCloudWorkspace() { return $this->readOneof(2); } /** * A SourceContext referring to a snapshot in a cloud workspace. * * Generated from protobuf field .google.devtools.source.v1.CloudWorkspaceSourceContext cloud_workspace = 2; * @param \Google\Cloud\DevTools\Source\V1\CloudWorkspaceSourceContext $var * @return $this */ public function setCloudWorkspace($var) { GPBUtil::checkMessage($var, \Google\Cloud\DevTools\Source\V1\CloudWorkspaceSourceContext::class); $this->writeOneof(2, $var); return $this; } /** * A SourceContext referring to a Gerrit project. * * Generated from protobuf field .google.devtools.source.v1.GerritSourceContext gerrit = 3; * @return \Google\Cloud\DevTools\Source\V1\GerritSourceContext */ public function getGerrit() { return $this->readOneof(3); } /** * A SourceContext referring to a Gerrit project. * * Generated from protobuf field .google.devtools.source.v1.GerritSourceContext gerrit = 3; * @param \Google\Cloud\DevTools\Source\V1\GerritSourceContext $var * @return $this */ public function setGerrit($var) { GPBUtil::checkMessage($var, \Google\Cloud\DevTools\Source\V1\GerritSourceContext::class); $this->writeOneof(3, $var); return $this; } /** * A SourceContext referring to any third party Git repo (e.g. GitHub). * * Generated from protobuf field .google.devtools.source.v1.GitSourceContext git = 6; * @return \Google\Cloud\DevTools\Source\V1\GitSourceContext */ public function getGit() { return $this->readOneof(6); } /** * A SourceContext referring to any third party Git repo (e.g. GitHub). * * Generated from protobuf field .google.devtools.source.v1.GitSourceContext git = 6; * @param \Google\Cloud\DevTools\Source\V1\GitSourceContext $var * @return $this */ public function setGit($var) { GPBUtil::checkMessage($var, \Google\Cloud\DevTools\Source\V1\GitSourceContext::class); $this->writeOneof(6, $var); return $this; } /** * @return string */ public function getContext() { return $this->whichOneof("context"); } } src/Cloud/Iam/V1/Binding.php000064400000015357151742741630011505 0ustar00google.iam.v1.Binding */ class Binding extends \Google\Protobuf\Internal\Message { /** * Role that is assigned to `members`. * For example, `roles/viewer`, `roles/editor`, or `roles/owner`. * Required * * Generated from protobuf field string role = 1; */ private $role = ''; /** * Specifies the identities requesting access for a Cloud Platform resource. * `members` can have the following values: * * `allUsers`: A special identifier that represents anyone who is * on the internet; with or without a Google account. * * `allAuthenticatedUsers`: A special identifier that represents anyone * who is authenticated with a Google account or a service account. * * `user:{emailid}`: An email address that represents a specific Google * account. For example, `alice@gmail.com` or `joe@example.com`. * * `serviceAccount:{emailid}`: An email address that represents a service * account. For example, `my-other-app@appspot.gserviceaccount.com`. * * `group:{emailid}`: An email address that represents a Google group. * For example, `admins@example.com`. * * `domain:{domain}`: A Google Apps domain name that represents all the * users of that domain. For example, `google.com` or `example.com`. * * Generated from protobuf field repeated string members = 2; */ private $members; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $role * Role that is assigned to `members`. * For example, `roles/viewer`, `roles/editor`, or `roles/owner`. * Required * @type string[]|\Google\Protobuf\Internal\RepeatedField $members * Specifies the identities requesting access for a Cloud Platform resource. * `members` can have the following values: * * `allUsers`: A special identifier that represents anyone who is * on the internet; with or without a Google account. * * `allAuthenticatedUsers`: A special identifier that represents anyone * who is authenticated with a Google account or a service account. * * `user:{emailid}`: An email address that represents a specific Google * account. For example, `alice@gmail.com` or `joe@example.com`. * * `serviceAccount:{emailid}`: An email address that represents a service * account. For example, `my-other-app@appspot.gserviceaccount.com`. * * `group:{emailid}`: An email address that represents a Google group. * For example, `admins@example.com`. * * `domain:{domain}`: A Google Apps domain name that represents all the * users of that domain. For example, `google.com` or `example.com`. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Iam\V1\Policy::initOnce(); parent::__construct($data); } /** * Role that is assigned to `members`. * For example, `roles/viewer`, `roles/editor`, or `roles/owner`. * Required * * Generated from protobuf field string role = 1; * @return string */ public function getRole() { return $this->role; } /** * Role that is assigned to `members`. * For example, `roles/viewer`, `roles/editor`, or `roles/owner`. * Required * * Generated from protobuf field string role = 1; * @param string $var * @return $this */ public function setRole($var) { GPBUtil::checkString($var, True); $this->role = $var; return $this; } /** * Specifies the identities requesting access for a Cloud Platform resource. * `members` can have the following values: * * `allUsers`: A special identifier that represents anyone who is * on the internet; with or without a Google account. * * `allAuthenticatedUsers`: A special identifier that represents anyone * who is authenticated with a Google account or a service account. * * `user:{emailid}`: An email address that represents a specific Google * account. For example, `alice@gmail.com` or `joe@example.com`. * * `serviceAccount:{emailid}`: An email address that represents a service * account. For example, `my-other-app@appspot.gserviceaccount.com`. * * `group:{emailid}`: An email address that represents a Google group. * For example, `admins@example.com`. * * `domain:{domain}`: A Google Apps domain name that represents all the * users of that domain. For example, `google.com` or `example.com`. * * Generated from protobuf field repeated string members = 2; * @return \Google\Protobuf\Internal\RepeatedField */ public function getMembers() { return $this->members; } /** * Specifies the identities requesting access for a Cloud Platform resource. * `members` can have the following values: * * `allUsers`: A special identifier that represents anyone who is * on the internet; with or without a Google account. * * `allAuthenticatedUsers`: A special identifier that represents anyone * who is authenticated with a Google account or a service account. * * `user:{emailid}`: An email address that represents a specific Google * account. For example, `alice@gmail.com` or `joe@example.com`. * * `serviceAccount:{emailid}`: An email address that represents a service * account. For example, `my-other-app@appspot.gserviceaccount.com`. * * `group:{emailid}`: An email address that represents a Google group. * For example, `admins@example.com`. * * `domain:{domain}`: A Google Apps domain name that represents all the * users of that domain. For example, `google.com` or `example.com`. * * Generated from protobuf field repeated string members = 2; * @param string[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setMembers($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->members = $arr; return $this; } } src/Cloud/Iam/V1/BindingDelta.php000064400000010177151742741630012452 0ustar00google.iam.v1.BindingDelta */ class BindingDelta extends \Google\Protobuf\Internal\Message { /** * The action that was performed on a Binding. * Required * * Generated from protobuf field .google.iam.v1.BindingDelta.Action action = 1; */ private $action = 0; /** * Role that is assigned to `members`. * For example, `roles/viewer`, `roles/editor`, or `roles/owner`. * Required * * Generated from protobuf field string role = 2; */ private $role = ''; /** * A single identity requesting access for a Cloud Platform resource. * Follows the same format of Binding.members. * Required * * Generated from protobuf field string member = 3; */ private $member = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type int $action * The action that was performed on a Binding. * Required * @type string $role * Role that is assigned to `members`. * For example, `roles/viewer`, `roles/editor`, or `roles/owner`. * Required * @type string $member * A single identity requesting access for a Cloud Platform resource. * Follows the same format of Binding.members. * Required * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Iam\V1\Policy::initOnce(); parent::__construct($data); } /** * The action that was performed on a Binding. * Required * * Generated from protobuf field .google.iam.v1.BindingDelta.Action action = 1; * @return int */ public function getAction() { return $this->action; } /** * The action that was performed on a Binding. * Required * * Generated from protobuf field .google.iam.v1.BindingDelta.Action action = 1; * @param int $var * @return $this */ public function setAction($var) { GPBUtil::checkEnum($var, \Google\Cloud\Iam\V1\BindingDelta_Action::class); $this->action = $var; return $this; } /** * Role that is assigned to `members`. * For example, `roles/viewer`, `roles/editor`, or `roles/owner`. * Required * * Generated from protobuf field string role = 2; * @return string */ public function getRole() { return $this->role; } /** * Role that is assigned to `members`. * For example, `roles/viewer`, `roles/editor`, or `roles/owner`. * Required * * Generated from protobuf field string role = 2; * @param string $var * @return $this */ public function setRole($var) { GPBUtil::checkString($var, True); $this->role = $var; return $this; } /** * A single identity requesting access for a Cloud Platform resource. * Follows the same format of Binding.members. * Required * * Generated from protobuf field string member = 3; * @return string */ public function getMember() { return $this->member; } /** * A single identity requesting access for a Cloud Platform resource. * Follows the same format of Binding.members. * Required * * Generated from protobuf field string member = 3; * @param string $var * @return $this */ public function setMember($var) { GPBUtil::checkString($var, True); $this->member = $var; return $this; } } src/Cloud/Iam/V1/BindingDelta/Action.php000064400000001552151742741630013664 0ustar00google.iam.v1.BindingDelta.Action */ class Action { /** * Unspecified. * * Generated from protobuf enum ACTION_UNSPECIFIED = 0; */ const ACTION_UNSPECIFIED = 0; /** * Addition of a Binding. * * Generated from protobuf enum ADD = 1; */ const ADD = 1; /** * Removal of a Binding. * * Generated from protobuf enum REMOVE = 2; */ const REMOVE = 2; } // Adding a class alias for backwards compatibility with the previous class name. class_alias(Action::class, \Google\Cloud\Iam\V1\BindingDelta_Action::class); src/Cloud/Iam/V1/BindingDelta_Action.php000064400000001032151742741630013735 0ustar00google.iam.v1.GetIamPolicyRequest */ class GetIamPolicyRequest extends \Google\Protobuf\Internal\Message { /** * REQUIRED: The resource for which the policy is being requested. * `resource` is usually specified as a path. For example, a Project * resource is specified as `projects/{project}`. * * Generated from protobuf field string resource = 1; */ private $resource = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $resource * REQUIRED: The resource for which the policy is being requested. * `resource` is usually specified as a path. For example, a Project * resource is specified as `projects/{project}`. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Iam\V1\IamPolicy::initOnce(); parent::__construct($data); } /** * REQUIRED: The resource for which the policy is being requested. * `resource` is usually specified as a path. For example, a Project * resource is specified as `projects/{project}`. * * Generated from protobuf field string resource = 1; * @return string */ public function getResource() { return $this->resource; } /** * REQUIRED: The resource for which the policy is being requested. * `resource` is usually specified as a path. For example, a Project * resource is specified as `projects/{project}`. * * Generated from protobuf field string resource = 1; * @param string $var * @return $this */ public function setResource($var) { GPBUtil::checkString($var, True); $this->resource = $var; return $this; } } src/Cloud/Iam/V1/IAMPolicyGrpcClient.php000064400000007620151742741630013666 0ustar00_simpleRequest('/google.iam.v1.IAMPolicy/SetIamPolicy', $argument, ['\Google\Cloud\Iam\V1\Policy', 'decode'], $metadata, $options); } /** * Gets the access control policy for a resource. * Returns an empty policy if the resource exists and does not have a policy * set. * @param \Google\Cloud\Iam\V1\GetIamPolicyRequest $argument input argument * @param array $metadata metadata * @param array $options call options */ public function GetIamPolicy(\Google\Cloud\Iam\V1\GetIamPolicyRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/google.iam.v1.IAMPolicy/GetIamPolicy', $argument, ['\Google\Cloud\Iam\V1\Policy', 'decode'], $metadata, $options); } /** * Returns permissions that a caller has on the specified resource. * If the resource does not exist, this will return an empty set of * permissions, not a NOT_FOUND error. * @param \Google\Cloud\Iam\V1\TestIamPermissionsRequest $argument input argument * @param array $metadata metadata * @param array $options call options */ public function TestIamPermissions(\Google\Cloud\Iam\V1\TestIamPermissionsRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/google.iam.v1.IAMPolicy/TestIamPermissions', $argument, ['\Google\Cloud\Iam\V1\TestIamPermissionsResponse', 'decode'], $metadata, $options); } } src/Cloud/Iam/V1/Policy.php000064400000016706151742741630011371 0ustar00google.iam.v1.Policy */ class Policy extends \Google\Protobuf\Internal\Message { /** * Version of the `Policy`. The default version is 0. * * Generated from protobuf field int32 version = 1; */ private $version = 0; /** * Associates a list of `members` to a `role`. * Multiple `bindings` must not be specified for the same `role`. * `bindings` with no members will result in an error. * * Generated from protobuf field repeated .google.iam.v1.Binding bindings = 4; */ private $bindings; /** * `etag` is used for optimistic concurrency control as a way to help * prevent simultaneous updates of a policy from overwriting each other. * It is strongly suggested that systems make use of the `etag` in the * read-modify-write cycle to perform policy updates in order to avoid race * conditions: An `etag` is returned in the response to `getIamPolicy`, and * systems are expected to put that etag in the request to `setIamPolicy` to * ensure that their change will be applied to the same version of the policy. * If no `etag` is provided in the call to `setIamPolicy`, then the existing * policy is overwritten blindly. * * Generated from protobuf field bytes etag = 3; */ private $etag = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type int $version * Version of the `Policy`. The default version is 0. * @type \Google\Cloud\Iam\V1\Binding[]|\Google\Protobuf\Internal\RepeatedField $bindings * Associates a list of `members` to a `role`. * Multiple `bindings` must not be specified for the same `role`. * `bindings` with no members will result in an error. * @type string $etag * `etag` is used for optimistic concurrency control as a way to help * prevent simultaneous updates of a policy from overwriting each other. * It is strongly suggested that systems make use of the `etag` in the * read-modify-write cycle to perform policy updates in order to avoid race * conditions: An `etag` is returned in the response to `getIamPolicy`, and * systems are expected to put that etag in the request to `setIamPolicy` to * ensure that their change will be applied to the same version of the policy. * If no `etag` is provided in the call to `setIamPolicy`, then the existing * policy is overwritten blindly. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Iam\V1\Policy::initOnce(); parent::__construct($data); } /** * Version of the `Policy`. The default version is 0. * * Generated from protobuf field int32 version = 1; * @return int */ public function getVersion() { return $this->version; } /** * Version of the `Policy`. The default version is 0. * * Generated from protobuf field int32 version = 1; * @param int $var * @return $this */ public function setVersion($var) { GPBUtil::checkInt32($var); $this->version = $var; return $this; } /** * Associates a list of `members` to a `role`. * Multiple `bindings` must not be specified for the same `role`. * `bindings` with no members will result in an error. * * Generated from protobuf field repeated .google.iam.v1.Binding bindings = 4; * @return \Google\Protobuf\Internal\RepeatedField */ public function getBindings() { return $this->bindings; } /** * Associates a list of `members` to a `role`. * Multiple `bindings` must not be specified for the same `role`. * `bindings` with no members will result in an error. * * Generated from protobuf field repeated .google.iam.v1.Binding bindings = 4; * @param \Google\Cloud\Iam\V1\Binding[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setBindings($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Iam\V1\Binding::class); $this->bindings = $arr; return $this; } /** * `etag` is used for optimistic concurrency control as a way to help * prevent simultaneous updates of a policy from overwriting each other. * It is strongly suggested that systems make use of the `etag` in the * read-modify-write cycle to perform policy updates in order to avoid race * conditions: An `etag` is returned in the response to `getIamPolicy`, and * systems are expected to put that etag in the request to `setIamPolicy` to * ensure that their change will be applied to the same version of the policy. * If no `etag` is provided in the call to `setIamPolicy`, then the existing * policy is overwritten blindly. * * Generated from protobuf field bytes etag = 3; * @return string */ public function getEtag() { return $this->etag; } /** * `etag` is used for optimistic concurrency control as a way to help * prevent simultaneous updates of a policy from overwriting each other. * It is strongly suggested that systems make use of the `etag` in the * read-modify-write cycle to perform policy updates in order to avoid race * conditions: An `etag` is returned in the response to `getIamPolicy`, and * systems are expected to put that etag in the request to `setIamPolicy` to * ensure that their change will be applied to the same version of the policy. * If no `etag` is provided in the call to `setIamPolicy`, then the existing * policy is overwritten blindly. * * Generated from protobuf field bytes etag = 3; * @param string $var * @return $this */ public function setEtag($var) { GPBUtil::checkString($var, False); $this->etag = $var; return $this; } } src/Cloud/Iam/V1/PolicyDelta.php000064400000003727151742741630012342 0ustar00google.iam.v1.PolicyDelta */ class PolicyDelta extends \Google\Protobuf\Internal\Message { /** * The delta for Bindings between two policies. * * Generated from protobuf field repeated .google.iam.v1.BindingDelta binding_deltas = 1; */ private $binding_deltas; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Cloud\Iam\V1\BindingDelta[]|\Google\Protobuf\Internal\RepeatedField $binding_deltas * The delta for Bindings between two policies. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Iam\V1\Policy::initOnce(); parent::__construct($data); } /** * The delta for Bindings between two policies. * * Generated from protobuf field repeated .google.iam.v1.BindingDelta binding_deltas = 1; * @return \Google\Protobuf\Internal\RepeatedField */ public function getBindingDeltas() { return $this->binding_deltas; } /** * The delta for Bindings between two policies. * * Generated from protobuf field repeated .google.iam.v1.BindingDelta binding_deltas = 1; * @param \Google\Cloud\Iam\V1\BindingDelta[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setBindingDeltas($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Iam\V1\BindingDelta::class); $this->binding_deltas = $arr; return $this; } } src/Cloud/Iam/V1/SetIamPolicyRequest.php000064400000007717151742741630014047 0ustar00google.iam.v1.SetIamPolicyRequest */ class SetIamPolicyRequest extends \Google\Protobuf\Internal\Message { /** * REQUIRED: The resource for which the policy is being specified. * `resource` is usually specified as a path. For example, a Project * resource is specified as `projects/{project}`. * * Generated from protobuf field string resource = 1; */ private $resource = ''; /** * REQUIRED: The complete policy to be applied to the `resource`. The size of * the policy is limited to a few 10s of KB. An empty policy is a * valid policy but certain Cloud Platform services (such as Projects) * might reject them. * * Generated from protobuf field .google.iam.v1.Policy policy = 2; */ private $policy = null; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $resource * REQUIRED: The resource for which the policy is being specified. * `resource` is usually specified as a path. For example, a Project * resource is specified as `projects/{project}`. * @type \Google\Cloud\Iam\V1\Policy $policy * REQUIRED: The complete policy to be applied to the `resource`. The size of * the policy is limited to a few 10s of KB. An empty policy is a * valid policy but certain Cloud Platform services (such as Projects) * might reject them. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Iam\V1\IamPolicy::initOnce(); parent::__construct($data); } /** * REQUIRED: The resource for which the policy is being specified. * `resource` is usually specified as a path. For example, a Project * resource is specified as `projects/{project}`. * * Generated from protobuf field string resource = 1; * @return string */ public function getResource() { return $this->resource; } /** * REQUIRED: The resource for which the policy is being specified. * `resource` is usually specified as a path. For example, a Project * resource is specified as `projects/{project}`. * * Generated from protobuf field string resource = 1; * @param string $var * @return $this */ public function setResource($var) { GPBUtil::checkString($var, True); $this->resource = $var; return $this; } /** * REQUIRED: The complete policy to be applied to the `resource`. The size of * the policy is limited to a few 10s of KB. An empty policy is a * valid policy but certain Cloud Platform services (such as Projects) * might reject them. * * Generated from protobuf field .google.iam.v1.Policy policy = 2; * @return \Google\Cloud\Iam\V1\Policy */ public function getPolicy() { return $this->policy; } /** * REQUIRED: The complete policy to be applied to the `resource`. The size of * the policy is limited to a few 10s of KB. An empty policy is a * valid policy but certain Cloud Platform services (such as Projects) * might reject them. * * Generated from protobuf field .google.iam.v1.Policy policy = 2; * @param \Google\Cloud\Iam\V1\Policy $var * @return $this */ public function setPolicy($var) { GPBUtil::checkMessage($var, \Google\Cloud\Iam\V1\Policy::class); $this->policy = $var; return $this; } } src/Cloud/Iam/V1/TestIamPermissionsRequest.php000064400000010117151742741630015273 0ustar00google.iam.v1.TestIamPermissionsRequest */ class TestIamPermissionsRequest extends \Google\Protobuf\Internal\Message { /** * REQUIRED: The resource for which the policy detail is being requested. * `resource` is usually specified as a path. For example, a Project * resource is specified as `projects/{project}`. * * Generated from protobuf field string resource = 1; */ private $resource = ''; /** * The set of permissions to check for the `resource`. Permissions with * wildcards (such as '*' or 'storage.*') are not allowed. For more * information see * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). * * Generated from protobuf field repeated string permissions = 2; */ private $permissions; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $resource * REQUIRED: The resource for which the policy detail is being requested. * `resource` is usually specified as a path. For example, a Project * resource is specified as `projects/{project}`. * @type string[]|\Google\Protobuf\Internal\RepeatedField $permissions * The set of permissions to check for the `resource`. Permissions with * wildcards (such as '*' or 'storage.*') are not allowed. For more * information see * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Iam\V1\IamPolicy::initOnce(); parent::__construct($data); } /** * REQUIRED: The resource for which the policy detail is being requested. * `resource` is usually specified as a path. For example, a Project * resource is specified as `projects/{project}`. * * Generated from protobuf field string resource = 1; * @return string */ public function getResource() { return $this->resource; } /** * REQUIRED: The resource for which the policy detail is being requested. * `resource` is usually specified as a path. For example, a Project * resource is specified as `projects/{project}`. * * Generated from protobuf field string resource = 1; * @param string $var * @return $this */ public function setResource($var) { GPBUtil::checkString($var, True); $this->resource = $var; return $this; } /** * The set of permissions to check for the `resource`. Permissions with * wildcards (such as '*' or 'storage.*') are not allowed. For more * information see * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). * * Generated from protobuf field repeated string permissions = 2; * @return \Google\Protobuf\Internal\RepeatedField */ public function getPermissions() { return $this->permissions; } /** * The set of permissions to check for the `resource`. Permissions with * wildcards (such as '*' or 'storage.*') are not allowed. For more * information see * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). * * Generated from protobuf field repeated string permissions = 2; * @param string[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setPermissions($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->permissions = $arr; return $this; } } src/Cloud/Iam/V1/TestIamPermissionsResponse.php000064400000003760151742741630015447 0ustar00google.iam.v1.TestIamPermissionsResponse */ class TestIamPermissionsResponse extends \Google\Protobuf\Internal\Message { /** * A subset of `TestPermissionsRequest.permissions` that the caller is * allowed. * * Generated from protobuf field repeated string permissions = 1; */ private $permissions; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string[]|\Google\Protobuf\Internal\RepeatedField $permissions * A subset of `TestPermissionsRequest.permissions` that the caller is * allowed. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Iam\V1\IamPolicy::initOnce(); parent::__construct($data); } /** * A subset of `TestPermissionsRequest.permissions` that the caller is * allowed. * * Generated from protobuf field repeated string permissions = 1; * @return \Google\Protobuf\Internal\RepeatedField */ public function getPermissions() { return $this->permissions; } /** * A subset of `TestPermissionsRequest.permissions` that the caller is * allowed. * * Generated from protobuf field repeated string permissions = 1; * @param string[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setPermissions($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->permissions = $arr; return $this; } } src/Cloud/Logging/Type/HttpRequest.php000064400000044002151742741630013723 0ustar00google.logging.type.HttpRequest */ class HttpRequest extends \Google\Protobuf\Internal\Message { /** * The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. * * Generated from protobuf field string request_method = 1; */ private $request_method = ''; /** * The scheme (http, https), the host name, the path and the query * portion of the URL that was requested. * Example: `"http://example.com/some/info?color=red"`. * * Generated from protobuf field string request_url = 2; */ private $request_url = ''; /** * The size of the HTTP request message in bytes, including the request * headers and the request body. * * Generated from protobuf field int64 request_size = 3; */ private $request_size = 0; /** * The response code indicating the status of response. * Examples: 200, 404. * * Generated from protobuf field int32 status = 4; */ private $status = 0; /** * The size of the HTTP response message sent back to the client, in bytes, * including the response headers and the response body. * * Generated from protobuf field int64 response_size = 5; */ private $response_size = 0; /** * The user agent sent by the client. Example: * `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)"`. * * Generated from protobuf field string user_agent = 6; */ private $user_agent = ''; /** * The IP address (IPv4 or IPv6) of the client that issued the HTTP * request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`. * * Generated from protobuf field string remote_ip = 7; */ private $remote_ip = ''; /** * The IP address (IPv4 or IPv6) of the origin server that the request was * sent to. * * Generated from protobuf field string server_ip = 13; */ private $server_ip = ''; /** * The referer URL of the request, as defined in * [HTTP/1.1 Header Field Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). * * Generated from protobuf field string referer = 8; */ private $referer = ''; /** * The request processing latency on the server, from the time the request was * received until the response was sent. * * Generated from protobuf field .google.protobuf.Duration latency = 14; */ private $latency = null; /** * Whether or not a cache lookup was attempted. * * Generated from protobuf field bool cache_lookup = 11; */ private $cache_lookup = false; /** * Whether or not an entity was served from cache * (with or without validation). * * Generated from protobuf field bool cache_hit = 9; */ private $cache_hit = false; /** * Whether or not the response was validated with the origin server before * being served from cache. This field is only meaningful if `cache_hit` is * True. * * Generated from protobuf field bool cache_validated_with_origin_server = 10; */ private $cache_validated_with_origin_server = false; /** * The number of HTTP response bytes inserted into cache. Set only when a * cache fill was attempted. * * Generated from protobuf field int64 cache_fill_bytes = 12; */ private $cache_fill_bytes = 0; /** * Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" * * Generated from protobuf field string protocol = 15; */ private $protocol = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $request_method * The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. * @type string $request_url * The scheme (http, https), the host name, the path and the query * portion of the URL that was requested. * Example: `"http://example.com/some/info?color=red"`. * @type int|string $request_size * The size of the HTTP request message in bytes, including the request * headers and the request body. * @type int $status * The response code indicating the status of response. * Examples: 200, 404. * @type int|string $response_size * The size of the HTTP response message sent back to the client, in bytes, * including the response headers and the response body. * @type string $user_agent * The user agent sent by the client. Example: * `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)"`. * @type string $remote_ip * The IP address (IPv4 or IPv6) of the client that issued the HTTP * request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`. * @type string $server_ip * The IP address (IPv4 or IPv6) of the origin server that the request was * sent to. * @type string $referer * The referer URL of the request, as defined in * [HTTP/1.1 Header Field Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). * @type \Google\Protobuf\Duration $latency * The request processing latency on the server, from the time the request was * received until the response was sent. * @type bool $cache_lookup * Whether or not a cache lookup was attempted. * @type bool $cache_hit * Whether or not an entity was served from cache * (with or without validation). * @type bool $cache_validated_with_origin_server * Whether or not the response was validated with the origin server before * being served from cache. This field is only meaningful if `cache_hit` is * True. * @type int|string $cache_fill_bytes * The number of HTTP response bytes inserted into cache. Set only when a * cache fill was attempted. * @type string $protocol * Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Logging\Type\HttpRequest::initOnce(); parent::__construct($data); } /** * The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. * * Generated from protobuf field string request_method = 1; * @return string */ public function getRequestMethod() { return $this->request_method; } /** * The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. * * Generated from protobuf field string request_method = 1; * @param string $var * @return $this */ public function setRequestMethod($var) { GPBUtil::checkString($var, True); $this->request_method = $var; return $this; } /** * The scheme (http, https), the host name, the path and the query * portion of the URL that was requested. * Example: `"http://example.com/some/info?color=red"`. * * Generated from protobuf field string request_url = 2; * @return string */ public function getRequestUrl() { return $this->request_url; } /** * The scheme (http, https), the host name, the path and the query * portion of the URL that was requested. * Example: `"http://example.com/some/info?color=red"`. * * Generated from protobuf field string request_url = 2; * @param string $var * @return $this */ public function setRequestUrl($var) { GPBUtil::checkString($var, True); $this->request_url = $var; return $this; } /** * The size of the HTTP request message in bytes, including the request * headers and the request body. * * Generated from protobuf field int64 request_size = 3; * @return int|string */ public function getRequestSize() { return $this->request_size; } /** * The size of the HTTP request message in bytes, including the request * headers and the request body. * * Generated from protobuf field int64 request_size = 3; * @param int|string $var * @return $this */ public function setRequestSize($var) { GPBUtil::checkInt64($var); $this->request_size = $var; return $this; } /** * The response code indicating the status of response. * Examples: 200, 404. * * Generated from protobuf field int32 status = 4; * @return int */ public function getStatus() { return $this->status; } /** * The response code indicating the status of response. * Examples: 200, 404. * * Generated from protobuf field int32 status = 4; * @param int $var * @return $this */ public function setStatus($var) { GPBUtil::checkInt32($var); $this->status = $var; return $this; } /** * The size of the HTTP response message sent back to the client, in bytes, * including the response headers and the response body. * * Generated from protobuf field int64 response_size = 5; * @return int|string */ public function getResponseSize() { return $this->response_size; } /** * The size of the HTTP response message sent back to the client, in bytes, * including the response headers and the response body. * * Generated from protobuf field int64 response_size = 5; * @param int|string $var * @return $this */ public function setResponseSize($var) { GPBUtil::checkInt64($var); $this->response_size = $var; return $this; } /** * The user agent sent by the client. Example: * `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)"`. * * Generated from protobuf field string user_agent = 6; * @return string */ public function getUserAgent() { return $this->user_agent; } /** * The user agent sent by the client. Example: * `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)"`. * * Generated from protobuf field string user_agent = 6; * @param string $var * @return $this */ public function setUserAgent($var) { GPBUtil::checkString($var, True); $this->user_agent = $var; return $this; } /** * The IP address (IPv4 or IPv6) of the client that issued the HTTP * request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`. * * Generated from protobuf field string remote_ip = 7; * @return string */ public function getRemoteIp() { return $this->remote_ip; } /** * The IP address (IPv4 or IPv6) of the client that issued the HTTP * request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`. * * Generated from protobuf field string remote_ip = 7; * @param string $var * @return $this */ public function setRemoteIp($var) { GPBUtil::checkString($var, True); $this->remote_ip = $var; return $this; } /** * The IP address (IPv4 or IPv6) of the origin server that the request was * sent to. * * Generated from protobuf field string server_ip = 13; * @return string */ public function getServerIp() { return $this->server_ip; } /** * The IP address (IPv4 or IPv6) of the origin server that the request was * sent to. * * Generated from protobuf field string server_ip = 13; * @param string $var * @return $this */ public function setServerIp($var) { GPBUtil::checkString($var, True); $this->server_ip = $var; return $this; } /** * The referer URL of the request, as defined in * [HTTP/1.1 Header Field Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). * * Generated from protobuf field string referer = 8; * @return string */ public function getReferer() { return $this->referer; } /** * The referer URL of the request, as defined in * [HTTP/1.1 Header Field Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). * * Generated from protobuf field string referer = 8; * @param string $var * @return $this */ public function setReferer($var) { GPBUtil::checkString($var, True); $this->referer = $var; return $this; } /** * The request processing latency on the server, from the time the request was * received until the response was sent. * * Generated from protobuf field .google.protobuf.Duration latency = 14; * @return \Google\Protobuf\Duration */ public function getLatency() { return $this->latency; } /** * The request processing latency on the server, from the time the request was * received until the response was sent. * * Generated from protobuf field .google.protobuf.Duration latency = 14; * @param \Google\Protobuf\Duration $var * @return $this */ public function setLatency($var) { GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); $this->latency = $var; return $this; } /** * Whether or not a cache lookup was attempted. * * Generated from protobuf field bool cache_lookup = 11; * @return bool */ public function getCacheLookup() { return $this->cache_lookup; } /** * Whether or not a cache lookup was attempted. * * Generated from protobuf field bool cache_lookup = 11; * @param bool $var * @return $this */ public function setCacheLookup($var) { GPBUtil::checkBool($var); $this->cache_lookup = $var; return $this; } /** * Whether or not an entity was served from cache * (with or without validation). * * Generated from protobuf field bool cache_hit = 9; * @return bool */ public function getCacheHit() { return $this->cache_hit; } /** * Whether or not an entity was served from cache * (with or without validation). * * Generated from protobuf field bool cache_hit = 9; * @param bool $var * @return $this */ public function setCacheHit($var) { GPBUtil::checkBool($var); $this->cache_hit = $var; return $this; } /** * Whether or not the response was validated with the origin server before * being served from cache. This field is only meaningful if `cache_hit` is * True. * * Generated from protobuf field bool cache_validated_with_origin_server = 10; * @return bool */ public function getCacheValidatedWithOriginServer() { return $this->cache_validated_with_origin_server; } /** * Whether or not the response was validated with the origin server before * being served from cache. This field is only meaningful if `cache_hit` is * True. * * Generated from protobuf field bool cache_validated_with_origin_server = 10; * @param bool $var * @return $this */ public function setCacheValidatedWithOriginServer($var) { GPBUtil::checkBool($var); $this->cache_validated_with_origin_server = $var; return $this; } /** * The number of HTTP response bytes inserted into cache. Set only when a * cache fill was attempted. * * Generated from protobuf field int64 cache_fill_bytes = 12; * @return int|string */ public function getCacheFillBytes() { return $this->cache_fill_bytes; } /** * The number of HTTP response bytes inserted into cache. Set only when a * cache fill was attempted. * * Generated from protobuf field int64 cache_fill_bytes = 12; * @param int|string $var * @return $this */ public function setCacheFillBytes($var) { GPBUtil::checkInt64($var); $this->cache_fill_bytes = $var; return $this; } /** * Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" * * Generated from protobuf field string protocol = 15; * @return string */ public function getProtocol() { return $this->protocol; } /** * Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" * * Generated from protobuf field string protocol = 15; * @param string $var * @return $this */ public function setProtocol($var) { GPBUtil::checkString($var, True); $this->protocol = $var; return $this; } } src/Cloud/Logging/Type/LogSeverity.php000064400000005026151742741630013712 0ustar00 DEBUG AND severity <= WARNING * If you are writing log entries, you should map other severity encodings to * one of these standard levels. For example, you might map all of Java's FINE, * FINER, and FINEST levels to `LogSeverity.DEBUG`. You can preserve the * original severity level in the log entry payload if you wish. * * Protobuf type google.logging.type.LogSeverity */ class LogSeverity { /** * (0) The log entry has no assigned severity level. * * Generated from protobuf enum DEFAULT = 0; */ const PBDEFAULT = 0; /** * (100) Debug or trace information. * * Generated from protobuf enum DEBUG = 100; */ const DEBUG = 100; /** * (200) Routine information, such as ongoing status or performance. * * Generated from protobuf enum INFO = 200; */ const INFO = 200; /** * (300) Normal but significant events, such as start up, shut down, or * a configuration change. * * Generated from protobuf enum NOTICE = 300; */ const NOTICE = 300; /** * (400) Warning events might cause problems. * * Generated from protobuf enum WARNING = 400; */ const WARNING = 400; /** * (500) Error events are likely to cause problems. * * Generated from protobuf enum ERROR = 500; */ const ERROR = 500; /** * (600) Critical events cause more severe problems or outages. * * Generated from protobuf enum CRITICAL = 600; */ const CRITICAL = 600; /** * (700) A person must take an action immediately. * * Generated from protobuf enum ALERT = 700; */ const ALERT = 700; /** * (800) One or more systems are unusable. * * Generated from protobuf enum EMERGENCY = 800; */ const EMERGENCY = 800; } src/Iam/V1/Logging/AuditData.php000064400000003767151742741630012315 0ustar00google.iam.v1.logging.AuditData */ class AuditData extends \Google\Protobuf\Internal\Message { /** * Policy delta between the original policy and the newly set policy. * * Generated from protobuf field .google.iam.v1.PolicyDelta policy_delta = 2; */ private $policy_delta = null; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Cloud\Iam\V1\PolicyDelta $policy_delta * Policy delta between the original policy and the newly set policy. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Iam\V1\Logging\AuditData::initOnce(); parent::__construct($data); } /** * Policy delta between the original policy and the newly set policy. * * Generated from protobuf field .google.iam.v1.PolicyDelta policy_delta = 2; * @return \Google\Cloud\Iam\V1\PolicyDelta */ public function getPolicyDelta() { return $this->policy_delta; } /** * Policy delta between the original policy and the newly set policy. * * Generated from protobuf field .google.iam.v1.PolicyDelta policy_delta = 2; * @param \Google\Cloud\Iam\V1\PolicyDelta $var * @return $this */ public function setPolicyDelta($var) { GPBUtil::checkMessage($var, \Google\Cloud\Iam\V1\PolicyDelta::class); $this->policy_delta = $var; return $this; } } src/LongRunning/CancelOperationRequest.php000064400000003243151742741630014737 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.php000064400000003233151742741630014753 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.php000064400000003127151742741630014272 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.php000064400000007636151742741630014662 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.php000064400000005751151742741630015024 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.php000064400000021505151742741630012261 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/OperationsGrpcClient.php000064400000012113151742741630014412 0ustar00_simpleRequest('/google.longrunning.Operations/ListOperations', $argument, ['\Google\LongRunning\ListOperationsResponse', 'decode'], $metadata, $options); } /** * 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. * @param \Google\LongRunning\GetOperationRequest $argument input argument * @param array $metadata metadata * @param array $options call options */ public function GetOperation(\Google\LongRunning\GetOperationRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/google.longrunning.Operations/GetOperation', $argument, ['\Google\LongRunning\Operation', 'decode'], $metadata, $options); } /** * 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`. * @param \Google\LongRunning\DeleteOperationRequest $argument input argument * @param array $metadata metadata * @param array $options call options */ public function DeleteOperation(\Google\LongRunning\DeleteOperationRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/google.longrunning.Operations/DeleteOperation', $argument, ['\Google\Protobuf\GPBEmpty', 'decode'], $metadata, $options); } /** * 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`. * @param \Google\LongRunning\CancelOperationRequest $argument input argument * @param array $metadata metadata * @param array $options call options */ public function CancelOperation(\Google\LongRunning\CancelOperationRequest $argument, $metadata = [], $options = []) { return $this->_simpleRequest('/google.longrunning.Operations/CancelOperation', $argument, ['\Google\Protobuf\GPBEmpty', 'decode'], $metadata, $options); } } src/Rpc/BadRequest.php000064400000004123151742741630010641 0ustar00google.rpc.BadRequest */ class BadRequest extends \Google\Protobuf\Internal\Message { /** * Describes all violations in a client request. * * Generated from protobuf field repeated .google.rpc.BadRequest.FieldViolation field_violations = 1; */ private $field_violations; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Rpc\BadRequest\FieldViolation[]|\Google\Protobuf\Internal\RepeatedField $field_violations * Describes all violations in a client request. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); parent::__construct($data); } /** * Describes all violations in a client request. * * Generated from protobuf field repeated .google.rpc.BadRequest.FieldViolation field_violations = 1; * @return \Google\Protobuf\Internal\RepeatedField */ public function getFieldViolations() { return $this->field_violations; } /** * Describes all violations in a client request. * * Generated from protobuf field repeated .google.rpc.BadRequest.FieldViolation field_violations = 1; * @param \Google\Rpc\BadRequest\FieldViolation[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setFieldViolations($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\BadRequest\FieldViolation::class); $this->field_violations = $arr; return $this; } } src/Rpc/BadRequest/FieldViolation.php000064400000006474151742741630013564 0ustar00google.rpc.BadRequest.FieldViolation */ class FieldViolation extends \Google\Protobuf\Internal\Message { /** * A path leading to a field in the request body. The value will be a * sequence of dot-separated identifiers that identify a protocol buffer * field. E.g., "field_violations.field" would identify this field. * * Generated from protobuf field string field = 1; */ private $field = ''; /** * A description of why the request element is bad. * * Generated from protobuf field string description = 2; */ private $description = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $field * A path leading to a field in the request body. The value will be a * sequence of dot-separated identifiers that identify a protocol buffer * field. E.g., "field_violations.field" would identify this field. * @type string $description * A description of why the request element is bad. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); parent::__construct($data); } /** * A path leading to a field in the request body. The value will be a * sequence of dot-separated identifiers that identify a protocol buffer * field. E.g., "field_violations.field" would identify this field. * * Generated from protobuf field string field = 1; * @return string */ public function getField() { return $this->field; } /** * A path leading to a field in the request body. The value will be a * sequence of dot-separated identifiers that identify a protocol buffer * field. E.g., "field_violations.field" would identify this field. * * Generated from protobuf field string field = 1; * @param string $var * @return $this */ public function setField($var) { GPBUtil::checkString($var, True); $this->field = $var; return $this; } /** * A description of why the request element is bad. * * Generated from protobuf field string description = 2; * @return string */ public function getDescription() { return $this->description; } /** * A description of why the request element is bad. * * Generated from protobuf field string description = 2; * @param string $var * @return $this */ public function setDescription($var) { GPBUtil::checkString($var, True); $this->description = $var; return $this; } } // Adding a class alias for backwards compatibility with the previous class name. class_alias(FieldViolation::class, \Google\Rpc\BadRequest_FieldViolation::class); src/Rpc/BadRequest_FieldViolation.php000064400000001030151742741630013623 0ustar00google.rpc.Code */ class Code { /** * Not an error; returned on success * HTTP Mapping: 200 OK * * Generated from protobuf enum OK = 0; */ const OK = 0; /** * The operation was cancelled, typically by the caller. * HTTP Mapping: 499 Client Closed Request * * Generated from protobuf enum CANCELLED = 1; */ const CANCELLED = 1; /** * Unknown error. For example, this error may be returned when * a `Status` value received from another address space belongs to * an error space that is not known in this address space. Also * errors raised by APIs that do not return enough error information * may be converted to this error. * HTTP Mapping: 500 Internal Server Error * * Generated from protobuf enum UNKNOWN = 2; */ const UNKNOWN = 2; /** * The client specified an invalid argument. Note that this differs * from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments * that are problematic regardless of the state of the system * (e.g., a malformed file name). * HTTP Mapping: 400 Bad Request * * Generated from protobuf enum INVALID_ARGUMENT = 3; */ const INVALID_ARGUMENT = 3; /** * The deadline expired before the operation could complete. For operations * that change the state of the system, this error may be returned * even if the operation has completed successfully. For example, a * successful response from a server could have been delayed long * enough for the deadline to expire. * HTTP Mapping: 504 Gateway Timeout * * Generated from protobuf enum DEADLINE_EXCEEDED = 4; */ const DEADLINE_EXCEEDED = 4; /** * Some requested entity (e.g., file or directory) was not found. * Note to server developers: if a request is denied for an entire class * of users, such as gradual feature rollout or undocumented whitelist, * `NOT_FOUND` may be used. If a request is denied for some users within * a class of users, such as user-based access control, `PERMISSION_DENIED` * must be used. * HTTP Mapping: 404 Not Found * * Generated from protobuf enum NOT_FOUND = 5; */ const NOT_FOUND = 5; /** * The entity that a client attempted to create (e.g., file or directory) * already exists. * HTTP Mapping: 409 Conflict * * Generated from protobuf enum ALREADY_EXISTS = 6; */ const ALREADY_EXISTS = 6; /** * The caller does not have permission to execute the specified * operation. `PERMISSION_DENIED` must not be used for rejections * caused by exhausting some resource (use `RESOURCE_EXHAUSTED` * instead for those errors). `PERMISSION_DENIED` must not be * used if the caller can not be identified (use `UNAUTHENTICATED` * instead for those errors). This error code does not imply the * request is valid or the requested entity exists or satisfies * other pre-conditions. * HTTP Mapping: 403 Forbidden * * Generated from protobuf enum PERMISSION_DENIED = 7; */ const PERMISSION_DENIED = 7; /** * The request does not have valid authentication credentials for the * operation. * HTTP Mapping: 401 Unauthorized * * Generated from protobuf enum UNAUTHENTICATED = 16; */ const UNAUTHENTICATED = 16; /** * Some resource has been exhausted, perhaps a per-user quota, or * perhaps the entire file system is out of space. * HTTP Mapping: 429 Too Many Requests * * Generated from protobuf enum RESOURCE_EXHAUSTED = 8; */ const RESOURCE_EXHAUSTED = 8; /** * The operation was rejected because the system is not in a state * required for the operation's execution. For example, the directory * to be deleted is non-empty, an rmdir operation is applied to * a non-directory, etc. * Service implementors can use the following guidelines to decide * between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: * (a) Use `UNAVAILABLE` if the client can retry just the failing call. * (b) Use `ABORTED` if the client should retry at a higher level * (e.g., when a client-specified test-and-set fails, indicating the * client should restart a read-modify-write sequence). * (c) Use `FAILED_PRECONDITION` if the client should not retry until * the system state has been explicitly fixed. E.g., if an "rmdir" * fails because the directory is non-empty, `FAILED_PRECONDITION` * should be returned since the client should not retry unless * the files are deleted from the directory. * HTTP Mapping: 400 Bad Request * * Generated from protobuf enum FAILED_PRECONDITION = 9; */ const FAILED_PRECONDITION = 9; /** * The operation was aborted, typically due to a concurrency issue such as * a sequencer check failure or transaction abort. * See the guidelines above for deciding between `FAILED_PRECONDITION`, * `ABORTED`, and `UNAVAILABLE`. * HTTP Mapping: 409 Conflict * * Generated from protobuf enum ABORTED = 10; */ const ABORTED = 10; /** * The operation was attempted past the valid range. E.g., seeking or * reading past end-of-file. * Unlike `INVALID_ARGUMENT`, this error indicates a problem that may * be fixed if the system state changes. For example, a 32-bit file * system will generate `INVALID_ARGUMENT` if asked to read at an * offset that is not in the range [0,2^32-1], but it will generate * `OUT_OF_RANGE` if asked to read from an offset past the current * file size. * There is a fair bit of overlap between `FAILED_PRECONDITION` and * `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific * error) when it applies so that callers who are iterating through * a space can easily look for an `OUT_OF_RANGE` error to detect when * they are done. * HTTP Mapping: 400 Bad Request * * Generated from protobuf enum OUT_OF_RANGE = 11; */ const OUT_OF_RANGE = 11; /** * The operation is not implemented or is not supported/enabled in this * service. * HTTP Mapping: 501 Not Implemented * * Generated from protobuf enum UNIMPLEMENTED = 12; */ const UNIMPLEMENTED = 12; /** * Internal errors. This means that some invariants expected by the * underlying system have been broken. This error code is reserved * for serious errors. * HTTP Mapping: 500 Internal Server Error * * Generated from protobuf enum INTERNAL = 13; */ const INTERNAL = 13; /** * The service is currently unavailable. This is most likely a * transient condition, which can be corrected by retrying with * a backoff. * See the guidelines above for deciding between `FAILED_PRECONDITION`, * `ABORTED`, and `UNAVAILABLE`. * HTTP Mapping: 503 Service Unavailable * * Generated from protobuf enum UNAVAILABLE = 14; */ const UNAVAILABLE = 14; /** * Unrecoverable data loss or corruption. * HTTP Mapping: 500 Internal Server Error * * Generated from protobuf enum DATA_LOSS = 15; */ const DATA_LOSS = 15; } src/Rpc/DebugInfo.php000064400000005327151742741630010453 0ustar00google.rpc.DebugInfo */ class DebugInfo extends \Google\Protobuf\Internal\Message { /** * The stack trace entries indicating where the error occurred. * * Generated from protobuf field repeated string stack_entries = 1; */ private $stack_entries; /** * Additional debugging information provided by the server. * * Generated from protobuf field string detail = 2; */ private $detail = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string[]|\Google\Protobuf\Internal\RepeatedField $stack_entries * The stack trace entries indicating where the error occurred. * @type string $detail * Additional debugging information provided by the server. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); parent::__construct($data); } /** * The stack trace entries indicating where the error occurred. * * Generated from protobuf field repeated string stack_entries = 1; * @return \Google\Protobuf\Internal\RepeatedField */ public function getStackEntries() { return $this->stack_entries; } /** * The stack trace entries indicating where the error occurred. * * Generated from protobuf field repeated string stack_entries = 1; * @param string[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setStackEntries($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->stack_entries = $arr; return $this; } /** * Additional debugging information provided by the server. * * Generated from protobuf field string detail = 2; * @return string */ public function getDetail() { return $this->detail; } /** * Additional debugging information provided by the server. * * Generated from protobuf field string detail = 2; * @param string $var * @return $this */ public function setDetail($var) { GPBUtil::checkString($var, True); $this->detail = $var; return $this; } } src/Rpc/Help.php000064400000004263151742741630007477 0ustar00google.rpc.Help */ class Help extends \Google\Protobuf\Internal\Message { /** * URL(s) pointing to additional information on handling the current error. * * Generated from protobuf field repeated .google.rpc.Help.Link links = 1; */ private $links; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Rpc\Help\Link[]|\Google\Protobuf\Internal\RepeatedField $links * URL(s) pointing to additional information on handling the current error. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); parent::__construct($data); } /** * URL(s) pointing to additional information on handling the current error. * * Generated from protobuf field repeated .google.rpc.Help.Link links = 1; * @return \Google\Protobuf\Internal\RepeatedField */ public function getLinks() { return $this->links; } /** * URL(s) pointing to additional information on handling the current error. * * Generated from protobuf field repeated .google.rpc.Help.Link links = 1; * @param \Google\Rpc\Help\Link[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setLinks($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Help\Link::class); $this->links = $arr; return $this; } } src/Rpc/Help/Link.php000064400000004546151742741630010400 0ustar00google.rpc.Help.Link */ class Link extends \Google\Protobuf\Internal\Message { /** * Describes what the link offers. * * Generated from protobuf field string description = 1; */ private $description = ''; /** * The URL of the link. * * Generated from protobuf field string url = 2; */ private $url = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $description * Describes what the link offers. * @type string $url * The URL of the link. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); parent::__construct($data); } /** * Describes what the link offers. * * Generated from protobuf field string description = 1; * @return string */ public function getDescription() { return $this->description; } /** * Describes what the link offers. * * Generated from protobuf field string description = 1; * @param string $var * @return $this */ public function setDescription($var) { GPBUtil::checkString($var, True); $this->description = $var; return $this; } /** * The URL of the link. * * Generated from protobuf field string url = 2; * @return string */ public function getUrl() { return $this->url; } /** * The URL of the link. * * Generated from protobuf field string url = 2; * @param string $var * @return $this */ public function setUrl($var) { GPBUtil::checkString($var, True); $this->url = $var; return $this; } } // Adding a class alias for backwards compatibility with the previous class name. class_alias(Link::class, \Google\Rpc\Help_Link::class); src/Rpc/Help_Link.php000064400000000710151742741630010445 0ustar00google.rpc.LocalizedMessage */ class LocalizedMessage extends \Google\Protobuf\Internal\Message { /** * The locale used following the specification defined at * http://www.rfc-editor.org/rfc/bcp/bcp47.txt. * Examples are: "en-US", "fr-CH", "es-MX" * * Generated from protobuf field string locale = 1; */ private $locale = ''; /** * The localized error message in the above locale. * * Generated from protobuf field string message = 2; */ private $message = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $locale * The locale used following the specification defined at * http://www.rfc-editor.org/rfc/bcp/bcp47.txt. * Examples are: "en-US", "fr-CH", "es-MX" * @type string $message * The localized error message in the above locale. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); parent::__construct($data); } /** * The locale used following the specification defined at * http://www.rfc-editor.org/rfc/bcp/bcp47.txt. * Examples are: "en-US", "fr-CH", "es-MX" * * Generated from protobuf field string locale = 1; * @return string */ public function getLocale() { return $this->locale; } /** * The locale used following the specification defined at * http://www.rfc-editor.org/rfc/bcp/bcp47.txt. * Examples are: "en-US", "fr-CH", "es-MX" * * Generated from protobuf field string locale = 1; * @param string $var * @return $this */ public function setLocale($var) { GPBUtil::checkString($var, True); $this->locale = $var; return $this; } /** * The localized error message in the above locale. * * Generated from protobuf field string message = 2; * @return string */ public function getMessage() { return $this->message; } /** * The localized error message in the above locale. * * Generated from protobuf field string message = 2; * @param string $var * @return $this */ public function setMessage($var) { GPBUtil::checkString($var, True); $this->message = $var; return $this; } } src/Rpc/PreconditionFailure.php000064400000004236151742741630012554 0ustar00google.rpc.PreconditionFailure */ class PreconditionFailure extends \Google\Protobuf\Internal\Message { /** * Describes all precondition violations. * * Generated from protobuf field repeated .google.rpc.PreconditionFailure.Violation violations = 1; */ private $violations; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Rpc\PreconditionFailure\Violation[]|\Google\Protobuf\Internal\RepeatedField $violations * Describes all precondition violations. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); parent::__construct($data); } /** * Describes all precondition violations. * * Generated from protobuf field repeated .google.rpc.PreconditionFailure.Violation violations = 1; * @return \Google\Protobuf\Internal\RepeatedField */ public function getViolations() { return $this->violations; } /** * Describes all precondition violations. * * Generated from protobuf field repeated .google.rpc.PreconditionFailure.Violation violations = 1; * @param \Google\Rpc\PreconditionFailure\Violation[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setViolations($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\PreconditionFailure\Violation::class); $this->violations = $arr; return $this; } } src/Rpc/PreconditionFailure/Violation.php000064400000012246151742741630014520 0ustar00google.rpc.PreconditionFailure.Violation */ class Violation extends \Google\Protobuf\Internal\Message { /** * The type of PreconditionFailure. We recommend using a service-specific * enum type to define the supported precondition violation types. For * example, "TOS" for "Terms of Service violation". * * Generated from protobuf field string type = 1; */ private $type = ''; /** * The subject, relative to the type, that failed. * For example, "google.com/cloud" relative to the "TOS" type would * indicate which terms of service is being referenced. * * Generated from protobuf field string subject = 2; */ private $subject = ''; /** * A description of how the precondition failed. Developers can use this * description to understand how to fix the failure. * For example: "Terms of service not accepted". * * Generated from protobuf field string description = 3; */ private $description = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $type * The type of PreconditionFailure. We recommend using a service-specific * enum type to define the supported precondition violation types. For * example, "TOS" for "Terms of Service violation". * @type string $subject * The subject, relative to the type, that failed. * For example, "google.com/cloud" relative to the "TOS" type would * indicate which terms of service is being referenced. * @type string $description * A description of how the precondition failed. Developers can use this * description to understand how to fix the failure. * For example: "Terms of service not accepted". * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); parent::__construct($data); } /** * The type of PreconditionFailure. We recommend using a service-specific * enum type to define the supported precondition violation types. For * example, "TOS" for "Terms of Service violation". * * Generated from protobuf field string type = 1; * @return string */ public function getType() { return $this->type; } /** * The type of PreconditionFailure. We recommend using a service-specific * enum type to define the supported precondition violation types. For * example, "TOS" for "Terms of Service violation". * * Generated from protobuf field string type = 1; * @param string $var * @return $this */ public function setType($var) { GPBUtil::checkString($var, True); $this->type = $var; return $this; } /** * The subject, relative to the type, that failed. * For example, "google.com/cloud" relative to the "TOS" type would * indicate which terms of service is being referenced. * * Generated from protobuf field string subject = 2; * @return string */ public function getSubject() { return $this->subject; } /** * The subject, relative to the type, that failed. * For example, "google.com/cloud" relative to the "TOS" type would * indicate which terms of service is being referenced. * * Generated from protobuf field string subject = 2; * @param string $var * @return $this */ public function setSubject($var) { GPBUtil::checkString($var, True); $this->subject = $var; return $this; } /** * A description of how the precondition failed. Developers can use this * description to understand how to fix the failure. * For example: "Terms of service not accepted". * * Generated from protobuf field string description = 3; * @return string */ public function getDescription() { return $this->description; } /** * A description of how the precondition failed. Developers can use this * description to understand how to fix the failure. * For example: "Terms of service not accepted". * * Generated from protobuf field string description = 3; * @param string $var * @return $this */ public function setDescription($var) { GPBUtil::checkString($var, True); $this->description = $var; return $this; } } // Adding a class alias for backwards compatibility with the previous class name. class_alias(Violation::class, \Google\Rpc\PreconditionFailure_Violation::class); src/Rpc/PreconditionFailure_Violation.php000064400000001054151742741630014573 0ustar00google.rpc.QuotaFailure */ class QuotaFailure extends \Google\Protobuf\Internal\Message { /** * Describes all quota violations. * * Generated from protobuf field repeated .google.rpc.QuotaFailure.Violation violations = 1; */ private $violations; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Rpc\QuotaFailure\Violation[]|\Google\Protobuf\Internal\RepeatedField $violations * Describes all quota violations. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); parent::__construct($data); } /** * Describes all quota violations. * * Generated from protobuf field repeated .google.rpc.QuotaFailure.Violation violations = 1; * @return \Google\Protobuf\Internal\RepeatedField */ public function getViolations() { return $this->violations; } /** * Describes all quota violations. * * Generated from protobuf field repeated .google.rpc.QuotaFailure.Violation violations = 1; * @param \Google\Rpc\QuotaFailure\Violation[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setViolations($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\QuotaFailure\Violation::class); $this->violations = $arr; return $this; } } src/Rpc/QuotaFailure/Violation.php000064400000010510151742741630013144 0ustar00google.rpc.QuotaFailure.Violation */ class Violation extends \Google\Protobuf\Internal\Message { /** * The subject on which the quota check failed. * For example, "clientip:" or "project:". * * Generated from protobuf field string subject = 1; */ private $subject = ''; /** * A description of how the quota check failed. Clients can use this * description to find more about the quota configuration in the service's * public documentation, or find the relevant quota limit to adjust through * developer console. * For example: "Service disabled" or "Daily Limit for read operations * exceeded". * * Generated from protobuf field string description = 2; */ private $description = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $subject * The subject on which the quota check failed. * For example, "clientip:" or "project:". * @type string $description * A description of how the quota check failed. Clients can use this * description to find more about the quota configuration in the service's * public documentation, or find the relevant quota limit to adjust through * developer console. * For example: "Service disabled" or "Daily Limit for read operations * exceeded". * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); parent::__construct($data); } /** * The subject on which the quota check failed. * For example, "clientip:" or "project:". * * Generated from protobuf field string subject = 1; * @return string */ public function getSubject() { return $this->subject; } /** * The subject on which the quota check failed. * For example, "clientip:" or "project:". * * Generated from protobuf field string subject = 1; * @param string $var * @return $this */ public function setSubject($var) { GPBUtil::checkString($var, True); $this->subject = $var; return $this; } /** * A description of how the quota check failed. Clients can use this * description to find more about the quota configuration in the service's * public documentation, or find the relevant quota limit to adjust through * developer console. * For example: "Service disabled" or "Daily Limit for read operations * exceeded". * * Generated from protobuf field string description = 2; * @return string */ public function getDescription() { return $this->description; } /** * A description of how the quota check failed. Clients can use this * description to find more about the quota configuration in the service's * public documentation, or find the relevant quota limit to adjust through * developer console. * For example: "Service disabled" or "Daily Limit for read operations * exceeded". * * Generated from protobuf field string description = 2; * @param string $var * @return $this */ public function setDescription($var) { GPBUtil::checkString($var, True); $this->description = $var; return $this; } } // Adding a class alias for backwards compatibility with the previous class name. class_alias(Violation::class, \Google\Rpc\QuotaFailure_Violation::class); src/Rpc/QuotaFailure_Violation.php000064400000001011151742741630013220 0ustar00google.rpc.RequestInfo */ class RequestInfo extends \Google\Protobuf\Internal\Message { /** * An opaque string that should only be interpreted by the service generating * it. For example, it can be used to identify requests in the service's logs. * * Generated from protobuf field string request_id = 1; */ private $request_id = ''; /** * Any data that was used to serve this request. For example, an encrypted * stack trace that can be sent back to the service provider for debugging. * * Generated from protobuf field string serving_data = 2; */ private $serving_data = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $request_id * An opaque string that should only be interpreted by the service generating * it. For example, it can be used to identify requests in the service's logs. * @type string $serving_data * Any data that was used to serve this request. For example, an encrypted * stack trace that can be sent back to the service provider for debugging. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); parent::__construct($data); } /** * An opaque string that should only be interpreted by the service generating * it. For example, it can be used to identify requests in the service's logs. * * Generated from protobuf field string request_id = 1; * @return string */ public function getRequestId() { return $this->request_id; } /** * An opaque string that should only be interpreted by the service generating * it. For example, it can be used to identify requests in the service's logs. * * Generated from protobuf field string request_id = 1; * @param string $var * @return $this */ public function setRequestId($var) { GPBUtil::checkString($var, True); $this->request_id = $var; return $this; } /** * Any data that was used to serve this request. For example, an encrypted * stack trace that can be sent back to the service provider for debugging. * * Generated from protobuf field string serving_data = 2; * @return string */ public function getServingData() { return $this->serving_data; } /** * Any data that was used to serve this request. For example, an encrypted * stack trace that can be sent back to the service provider for debugging. * * Generated from protobuf field string serving_data = 2; * @param string $var * @return $this */ public function setServingData($var) { GPBUtil::checkString($var, True); $this->serving_data = $var; return $this; } } src/Rpc/ResourceInfo.php000064400000015126151742741630011212 0ustar00google.rpc.ResourceInfo */ class ResourceInfo extends \Google\Protobuf\Internal\Message { /** * A name for the type of resource being accessed, e.g. "sql table", * "cloud storage bucket", "file", "Google calendar"; or the type URL * of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic". * * Generated from protobuf field string resource_type = 1; */ private $resource_type = ''; /** * The name of the resource being accessed. For example, a shared calendar * name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current * error is [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. * * Generated from protobuf field string resource_name = 2; */ private $resource_name = ''; /** * The owner of the resource (optional). * For example, "user:" or "project:". * * Generated from protobuf field string owner = 3; */ private $owner = ''; /** * Describes what error is encountered when accessing this resource. * For example, updating a cloud project may require the `writer` permission * on the developer console project. * * Generated from protobuf field string description = 4; */ private $description = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $resource_type * A name for the type of resource being accessed, e.g. "sql table", * "cloud storage bucket", "file", "Google calendar"; or the type URL * of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic". * @type string $resource_name * The name of the resource being accessed. For example, a shared calendar * name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current * error is [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. * @type string $owner * The owner of the resource (optional). * For example, "user:" or "project:". * @type string $description * Describes what error is encountered when accessing this resource. * For example, updating a cloud project may require the `writer` permission * on the developer console project. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); parent::__construct($data); } /** * A name for the type of resource being accessed, e.g. "sql table", * "cloud storage bucket", "file", "Google calendar"; or the type URL * of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic". * * Generated from protobuf field string resource_type = 1; * @return string */ public function getResourceType() { return $this->resource_type; } /** * A name for the type of resource being accessed, e.g. "sql table", * "cloud storage bucket", "file", "Google calendar"; or the type URL * of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic". * * Generated from protobuf field string resource_type = 1; * @param string $var * @return $this */ public function setResourceType($var) { GPBUtil::checkString($var, True); $this->resource_type = $var; return $this; } /** * The name of the resource being accessed. For example, a shared calendar * name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current * error is [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. * * Generated from protobuf field string resource_name = 2; * @return string */ public function getResourceName() { return $this->resource_name; } /** * The name of the resource being accessed. For example, a shared calendar * name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current * error is [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. * * Generated from protobuf field string resource_name = 2; * @param string $var * @return $this */ public function setResourceName($var) { GPBUtil::checkString($var, True); $this->resource_name = $var; return $this; } /** * The owner of the resource (optional). * For example, "user:" or "project:". * * Generated from protobuf field string owner = 3; * @return string */ public function getOwner() { return $this->owner; } /** * The owner of the resource (optional). * For example, "user:" or "project:". * * Generated from protobuf field string owner = 3; * @param string $var * @return $this */ public function setOwner($var) { GPBUtil::checkString($var, True); $this->owner = $var; return $this; } /** * Describes what error is encountered when accessing this resource. * For example, updating a cloud project may require the `writer` permission * on the developer console project. * * Generated from protobuf field string description = 4; * @return string */ public function getDescription() { return $this->description; } /** * Describes what error is encountered when accessing this resource. * For example, updating a cloud project may require the `writer` permission * on the developer console project. * * Generated from protobuf field string description = 4; * @param string $var * @return $this */ public function setDescription($var) { GPBUtil::checkString($var, True); $this->description = $var; return $this; } } src/Rpc/RetryInfo.php000064400000004676151742741630010540 0ustar00google.rpc.RetryInfo */ class RetryInfo extends \Google\Protobuf\Internal\Message { /** * Clients should wait at least this long between retrying the same request. * * Generated from protobuf field .google.protobuf.Duration retry_delay = 1; */ private $retry_delay = null; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type \Google\Protobuf\Duration $retry_delay * Clients should wait at least this long between retrying the same request. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Rpc\ErrorDetails::initOnce(); parent::__construct($data); } /** * Clients should wait at least this long between retrying the same request. * * Generated from protobuf field .google.protobuf.Duration retry_delay = 1; * @return \Google\Protobuf\Duration */ public function getRetryDelay() { return $this->retry_delay; } /** * Clients should wait at least this long between retrying the same request. * * Generated from protobuf field .google.protobuf.Duration retry_delay = 1; * @param \Google\Protobuf\Duration $var * @return $this */ public function setRetryDelay($var) { GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); $this->retry_delay = $var; return $this; } } src/Rpc/Status.php000064400000016106151742741630010071 0ustar00google.rpc.Status */ class Status extends \Google\Protobuf\Internal\Message { /** * The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. * * Generated from protobuf field int32 code = 1; */ private $code = 0; /** * A developer-facing error message, which should be in English. Any * user-facing error message should be localized and sent in the * [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. * * Generated from protobuf field string message = 2; */ private $message = ''; /** * A list of messages that carry the error details. There is a common set of * message types for APIs to use. * * Generated from protobuf field repeated .google.protobuf.Any details = 3; */ private $details; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type int $code * The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. * @type string $message * A developer-facing error message, which should be in English. Any * user-facing error message should be localized and sent in the * [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. * @type \Google\Protobuf\Any[]|\Google\Protobuf\Internal\RepeatedField $details * A list of messages that carry the error details. There is a common set of * message types for APIs to use. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Rpc\Status::initOnce(); parent::__construct($data); } /** * The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. * * Generated from protobuf field int32 code = 1; * @return int */ public function getCode() { return $this->code; } /** * The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. * * Generated from protobuf field int32 code = 1; * @param int $var * @return $this */ public function setCode($var) { GPBUtil::checkInt32($var); $this->code = $var; return $this; } /** * A developer-facing error message, which should be in English. Any * user-facing error message should be localized and sent in the * [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. * * Generated from protobuf field string message = 2; * @return string */ public function getMessage() { return $this->message; } /** * A developer-facing error message, which should be in English. Any * user-facing error message should be localized and sent in the * [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. * * Generated from protobuf field string message = 2; * @param string $var * @return $this */ public function setMessage($var) { GPBUtil::checkString($var, True); $this->message = $var; return $this; } /** * A list of messages that carry the error details. There is a common set of * message types for APIs to use. * * Generated from protobuf field repeated .google.protobuf.Any details = 3; * @return \Google\Protobuf\Internal\RepeatedField */ public function getDetails() { return $this->details; } /** * A list of messages that carry the error details. There is a common set of * message types for APIs to use. * * Generated from protobuf field repeated .google.protobuf.Any details = 3; * @param \Google\Protobuf\Any[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setDetails($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Any::class); $this->details = $arr; return $this; } } src/Type/Color.php000064400000025255151742741630010066 0ustar00google.type.Color */ class Color extends \Google\Protobuf\Internal\Message { /** * The amount of red in the color as a value in the interval [0, 1]. * * Generated from protobuf field float red = 1; */ private $red = 0.0; /** * The amount of green in the color as a value in the interval [0, 1]. * * Generated from protobuf field float green = 2; */ private $green = 0.0; /** * The amount of blue in the color as a value in the interval [0, 1]. * * Generated from protobuf field float blue = 3; */ private $blue = 0.0; /** * The fraction of this color that should be applied to the pixel. That is, * the final pixel color is defined by the equation: * pixel color = alpha * (this color) + (1.0 - alpha) * (background color) * This means that a value of 1.0 corresponds to a solid color, whereas * a value of 0.0 corresponds to a completely transparent color. This * uses a wrapper message rather than a simple float scalar so that it is * possible to distinguish between a default value and the value being unset. * If omitted, this color object is to be rendered as a solid color * (as if the alpha value had been explicitly given with a value of 1.0). * * Generated from protobuf field .google.protobuf.FloatValue alpha = 4; */ private $alpha = null; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type float $red * The amount of red in the color as a value in the interval [0, 1]. * @type float $green * The amount of green in the color as a value in the interval [0, 1]. * @type float $blue * The amount of blue in the color as a value in the interval [0, 1]. * @type \Google\Protobuf\FloatValue $alpha * The fraction of this color that should be applied to the pixel. That is, * the final pixel color is defined by the equation: * pixel color = alpha * (this color) + (1.0 - alpha) * (background color) * This means that a value of 1.0 corresponds to a solid color, whereas * a value of 0.0 corresponds to a completely transparent color. This * uses a wrapper message rather than a simple float scalar so that it is * possible to distinguish between a default value and the value being unset. * If omitted, this color object is to be rendered as a solid color * (as if the alpha value had been explicitly given with a value of 1.0). * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Type\Color::initOnce(); parent::__construct($data); } /** * The amount of red in the color as a value in the interval [0, 1]. * * Generated from protobuf field float red = 1; * @return float */ public function getRed() { return $this->red; } /** * The amount of red in the color as a value in the interval [0, 1]. * * Generated from protobuf field float red = 1; * @param float $var * @return $this */ public function setRed($var) { GPBUtil::checkFloat($var); $this->red = $var; return $this; } /** * The amount of green in the color as a value in the interval [0, 1]. * * Generated from protobuf field float green = 2; * @return float */ public function getGreen() { return $this->green; } /** * The amount of green in the color as a value in the interval [0, 1]. * * Generated from protobuf field float green = 2; * @param float $var * @return $this */ public function setGreen($var) { GPBUtil::checkFloat($var); $this->green = $var; return $this; } /** * The amount of blue in the color as a value in the interval [0, 1]. * * Generated from protobuf field float blue = 3; * @return float */ public function getBlue() { return $this->blue; } /** * The amount of blue in the color as a value in the interval [0, 1]. * * Generated from protobuf field float blue = 3; * @param float $var * @return $this */ public function setBlue($var) { GPBUtil::checkFloat($var); $this->blue = $var; return $this; } /** * The fraction of this color that should be applied to the pixel. That is, * the final pixel color is defined by the equation: * pixel color = alpha * (this color) + (1.0 - alpha) * (background color) * This means that a value of 1.0 corresponds to a solid color, whereas * a value of 0.0 corresponds to a completely transparent color. This * uses a wrapper message rather than a simple float scalar so that it is * possible to distinguish between a default value and the value being unset. * If omitted, this color object is to be rendered as a solid color * (as if the alpha value had been explicitly given with a value of 1.0). * * Generated from protobuf field .google.protobuf.FloatValue alpha = 4; * @return \Google\Protobuf\FloatValue */ public function getAlpha() { return $this->alpha; } /** * The fraction of this color that should be applied to the pixel. That is, * the final pixel color is defined by the equation: * pixel color = alpha * (this color) + (1.0 - alpha) * (background color) * This means that a value of 1.0 corresponds to a solid color, whereas * a value of 0.0 corresponds to a completely transparent color. This * uses a wrapper message rather than a simple float scalar so that it is * possible to distinguish between a default value and the value being unset. * If omitted, this color object is to be rendered as a solid color * (as if the alpha value had been explicitly given with a value of 1.0). * * Generated from protobuf field .google.protobuf.FloatValue alpha = 4; * @param \Google\Protobuf\FloatValue $var * @return $this */ public function setAlpha($var) { GPBUtil::checkMessage($var, \Google\Protobuf\FloatValue::class); $this->alpha = $var; return $this; } } src/Type/Date.php000064400000010055151742741630007655 0ustar00google.type.Date */ class Date extends \Google\Protobuf\Internal\Message { /** * Year of date. Must be from 1 to 9999, or 0 if specifying a date without * a year. * * Generated from protobuf field int32 year = 1; */ private $year = 0; /** * Month of year. Must be from 1 to 12. * * Generated from protobuf field int32 month = 2; */ private $month = 0; /** * Day of month. Must be from 1 to 31 and valid for the year and month, or 0 * if specifying a year/month where the day is not significant. * * Generated from protobuf field int32 day = 3; */ private $day = 0; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type int $year * Year of date. Must be from 1 to 9999, or 0 if specifying a date without * a year. * @type int $month * Month of year. Must be from 1 to 12. * @type int $day * Day of month. Must be from 1 to 31 and valid for the year and month, or 0 * if specifying a year/month where the day is not significant. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Type\Date::initOnce(); parent::__construct($data); } /** * Year of date. Must be from 1 to 9999, or 0 if specifying a date without * a year. * * Generated from protobuf field int32 year = 1; * @return int */ public function getYear() { return $this->year; } /** * Year of date. Must be from 1 to 9999, or 0 if specifying a date without * a year. * * Generated from protobuf field int32 year = 1; * @param int $var * @return $this */ public function setYear($var) { GPBUtil::checkInt32($var); $this->year = $var; return $this; } /** * Month of year. Must be from 1 to 12. * * Generated from protobuf field int32 month = 2; * @return int */ public function getMonth() { return $this->month; } /** * Month of year. Must be from 1 to 12. * * Generated from protobuf field int32 month = 2; * @param int $var * @return $this */ public function setMonth($var) { GPBUtil::checkInt32($var); $this->month = $var; return $this; } /** * Day of month. Must be from 1 to 31 and valid for the year and month, or 0 * if specifying a year/month where the day is not significant. * * Generated from protobuf field int32 day = 3; * @return int */ public function getDay() { return $this->day; } /** * Day of month. Must be from 1 to 31 and valid for the year and month, or 0 * if specifying a year/month where the day is not significant. * * Generated from protobuf field int32 day = 3; * @param int $var * @return $this */ public function setDay($var) { GPBUtil::checkInt32($var); $this->day = $var; return $this; } } src/Type/DayOfWeek.php000064400000002615151742741630010621 0ustar00google.type.DayOfWeek */ class DayOfWeek { /** * The unspecified day-of-week. * * Generated from protobuf enum DAY_OF_WEEK_UNSPECIFIED = 0; */ const DAY_OF_WEEK_UNSPECIFIED = 0; /** * The day-of-week of Monday. * * Generated from protobuf enum MONDAY = 1; */ const MONDAY = 1; /** * The day-of-week of Tuesday. * * Generated from protobuf enum TUESDAY = 2; */ const TUESDAY = 2; /** * The day-of-week of Wednesday. * * Generated from protobuf enum WEDNESDAY = 3; */ const WEDNESDAY = 3; /** * The day-of-week of Thursday. * * Generated from protobuf enum THURSDAY = 4; */ const THURSDAY = 4; /** * The day-of-week of Friday. * * Generated from protobuf enum FRIDAY = 5; */ const FRIDAY = 5; /** * The day-of-week of Saturday. * * Generated from protobuf enum SATURDAY = 6; */ const SATURDAY = 6; /** * The day-of-week of Sunday. * * Generated from protobuf enum SUNDAY = 7; */ const SUNDAY = 7; } src/Type/LatLng.php000064400000010420151742741630010155 0ustar00WGS84 * standard. Values must be within normalized ranges. * Example of normalization code in Python: * def NormalizeLongitude(longitude): * """Wraps decimal degrees longitude to [-180.0, 180.0].""" * q, r = divmod(longitude, 360.0) * if r > 180.0 or (r == 180.0 and q <= -1.0): * return r - 360.0 * return r * def NormalizeLatLng(latitude, longitude): * """Wraps decimal degrees latitude and longitude to * [-90.0, 90.0] and [-180.0, 180.0], respectively.""" * r = latitude % 360.0 * if r <= 90.0: * return r, NormalizeLongitude(longitude) * elif r >= 270.0: * return r - 360, NormalizeLongitude(longitude) * else: * return 180 - r, NormalizeLongitude(longitude + 180.0) * assert 180.0 == NormalizeLongitude(180.0) * assert -180.0 == NormalizeLongitude(-180.0) * assert -179.0 == NormalizeLongitude(181.0) * assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0) * assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0) * assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0) * assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0) * assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0) * assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0) * assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0) * assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0) * assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0) * assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0) * * Generated from protobuf message google.type.LatLng */ class LatLng extends \Google\Protobuf\Internal\Message { /** * The latitude in degrees. It must be in the range [-90.0, +90.0]. * * Generated from protobuf field double latitude = 1; */ private $latitude = 0.0; /** * The longitude in degrees. It must be in the range [-180.0, +180.0]. * * Generated from protobuf field double longitude = 2; */ private $longitude = 0.0; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type float $latitude * The latitude in degrees. It must be in the range [-90.0, +90.0]. * @type float $longitude * The longitude in degrees. It must be in the range [-180.0, +180.0]. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Type\Latlng::initOnce(); parent::__construct($data); } /** * The latitude in degrees. It must be in the range [-90.0, +90.0]. * * Generated from protobuf field double latitude = 1; * @return float */ public function getLatitude() { return $this->latitude; } /** * The latitude in degrees. It must be in the range [-90.0, +90.0]. * * Generated from protobuf field double latitude = 1; * @param float $var * @return $this */ public function setLatitude($var) { GPBUtil::checkDouble($var); $this->latitude = $var; return $this; } /** * The longitude in degrees. It must be in the range [-180.0, +180.0]. * * Generated from protobuf field double longitude = 2; * @return float */ public function getLongitude() { return $this->longitude; } /** * The longitude in degrees. It must be in the range [-180.0, +180.0]. * * Generated from protobuf field double longitude = 2; * @param float $var * @return $this */ public function setLongitude($var) { GPBUtil::checkDouble($var); $this->longitude = $var; return $this; } } src/Type/Money.php000064400000011642151742741630010072 0ustar00google.type.Money */ class Money extends \Google\Protobuf\Internal\Message { /** * The 3-letter currency code defined in ISO 4217. * * Generated from protobuf field string currency_code = 1; */ private $currency_code = ''; /** * The whole units of the amount. * For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. * * Generated from protobuf field int64 units = 2; */ private $units = 0; /** * Number of nano (10^-9) units of the amount. * The value must be between -999,999,999 and +999,999,999 inclusive. * If `units` is positive, `nanos` must be positive or zero. * If `units` is zero, `nanos` can be positive, zero, or negative. * If `units` is negative, `nanos` must be negative or zero. * For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. * * Generated from protobuf field int32 nanos = 3; */ private $nanos = 0; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $currency_code * The 3-letter currency code defined in ISO 4217. * @type int|string $units * The whole units of the amount. * For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. * @type int $nanos * Number of nano (10^-9) units of the amount. * The value must be between -999,999,999 and +999,999,999 inclusive. * If `units` is positive, `nanos` must be positive or zero. * If `units` is zero, `nanos` can be positive, zero, or negative. * If `units` is negative, `nanos` must be negative or zero. * For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Type\Money::initOnce(); parent::__construct($data); } /** * The 3-letter currency code defined in ISO 4217. * * Generated from protobuf field string currency_code = 1; * @return string */ public function getCurrencyCode() { return $this->currency_code; } /** * The 3-letter currency code defined in ISO 4217. * * Generated from protobuf field string currency_code = 1; * @param string $var * @return $this */ public function setCurrencyCode($var) { GPBUtil::checkString($var, True); $this->currency_code = $var; return $this; } /** * The whole units of the amount. * For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. * * Generated from protobuf field int64 units = 2; * @return int|string */ public function getUnits() { return $this->units; } /** * The whole units of the amount. * For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. * * Generated from protobuf field int64 units = 2; * @param int|string $var * @return $this */ public function setUnits($var) { GPBUtil::checkInt64($var); $this->units = $var; return $this; } /** * Number of nano (10^-9) units of the amount. * The value must be between -999,999,999 and +999,999,999 inclusive. * If `units` is positive, `nanos` must be positive or zero. * If `units` is zero, `nanos` can be positive, zero, or negative. * If `units` is negative, `nanos` must be negative or zero. * For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. * * Generated from protobuf field int32 nanos = 3; * @return int */ public function getNanos() { return $this->nanos; } /** * Number of nano (10^-9) units of the amount. * The value must be between -999,999,999 and +999,999,999 inclusive. * If `units` is positive, `nanos` must be positive or zero. * If `units` is zero, `nanos` can be positive, zero, or negative. * If `units` is negative, `nanos` must be negative or zero. * For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. * * Generated from protobuf field int32 nanos = 3; * @param int $var * @return $this */ public function setNanos($var) { GPBUtil::checkInt32($var); $this->nanos = $var; return $this; } } src/Type/PostalAddress.php000064400000064155151742741630011562 0ustar00google.type.PostalAddress */ class PostalAddress extends \Google\Protobuf\Internal\Message { /** * The schema revision of the `PostalAddress`. * All new revisions **must** be backward compatible with old revisions. * * Generated from protobuf field int32 revision = 1; */ private $revision = 0; /** * Required. CLDR region code of the country/region of the address. This * is never inferred and it is up to the user to ensure the value is * correct. See http://cldr.unicode.org/ and * http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html * for details. Example: "CH" for Switzerland. * * Generated from protobuf field string region_code = 2; */ private $region_code = ''; /** * Optional. BCP-47 language code of the contents of this address (if * known). This is often the UI language of the input form or is expected * to match one of the languages used in the address' country/region, or their * transliterated equivalents. * This can affect formatting in certain countries, but is not critical * to the correctness of the data and will never affect any validation or * other non-formatting related operations. * If this value is not known, it should be omitted (rather than specifying a * possibly incorrect default). * Examples: "zh-Hant", "ja", "ja-Latn", "en". * * Generated from protobuf field string language_code = 3; */ private $language_code = ''; /** * Optional. Postal code of the address. Not all countries use or require * postal codes to be present, but where they are used, they may trigger * additional validation with other parts of the address (e.g. state/zip * validation in the U.S.A.). * * Generated from protobuf field string postal_code = 4; */ private $postal_code = ''; /** * Optional. Additional, country-specific, sorting code. This is not used * in most regions. Where it is used, the value is either a string like * "CEDEX", optionally followed by a number (e.g. "CEDEX 7"), or just a number * alone, representing the "sector code" (Jamaica), "delivery area indicator" * (Malawi) or "post office indicator" (e.g. CĂ´te d'Ivoire). * * Generated from protobuf field string sorting_code = 5; */ private $sorting_code = ''; /** * Optional. Highest administrative subdivision which is used for postal * addresses of a country or region. * For example, this can be a state, a province, an oblast, or a prefecture. * Specifically, for Spain this is the province and not the autonomous * community (e.g. "Barcelona" and not "Catalonia"). * Many countries don't use an administrative area in postal addresses. E.g. * in Switzerland this should be left unpopulated. * * Generated from protobuf field string administrative_area = 6; */ private $administrative_area = ''; /** * Optional. Generally refers to the city/town portion of the address. * Examples: US city, IT comune, UK post town. * In regions of the world where localities are not well defined or do not fit * into this structure well, leave locality empty and use address_lines. * * Generated from protobuf field string locality = 7; */ private $locality = ''; /** * Optional. Sublocality of the address. * For example, this can be neighborhoods, boroughs, districts. * * Generated from protobuf field string sublocality = 8; */ private $sublocality = ''; /** * Unstructured address lines describing the lower levels of an address. * Because values in address_lines do not have type information and may * sometimes contain multiple values in a single field (e.g. * "Austin, TX"), it is important that the line order is clear. The order of * address lines should be "envelope order" for the country/region of the * address. In places where this can vary (e.g. Japan), address_language is * used to make it explicit (e.g. "ja" for large-to-small ordering and * "ja-Latn" or "en" for small-to-large). This way, the most specific line of * an address can be selected based on the language. * The minimum permitted structural representation of an address consists * of a region_code with all remaining information placed in the * address_lines. It would be possible to format such an address very * approximately without geocoding, but no semantic reasoning could be * made about any of the address components until it was at least * partially resolved. * Creating an address only containing a region_code and address_lines, and * then geocoding is the recommended way to handle completely unstructured * addresses (as opposed to guessing which parts of the address should be * localities or administrative areas). * * Generated from protobuf field repeated string address_lines = 9; */ private $address_lines; /** * Optional. The recipient at the address. * This field may, under certain circumstances, contain multiline information. * For example, it might contain "care of" information. * * Generated from protobuf field repeated string recipients = 10; */ private $recipients; /** * Optional. The name of the organization at the address. * * Generated from protobuf field string organization = 11; */ private $organization = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type int $revision * The schema revision of the `PostalAddress`. * All new revisions **must** be backward compatible with old revisions. * @type string $region_code * Required. CLDR region code of the country/region of the address. This * is never inferred and it is up to the user to ensure the value is * correct. See http://cldr.unicode.org/ and * http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html * for details. Example: "CH" for Switzerland. * @type string $language_code * Optional. BCP-47 language code of the contents of this address (if * known). This is often the UI language of the input form or is expected * to match one of the languages used in the address' country/region, or their * transliterated equivalents. * This can affect formatting in certain countries, but is not critical * to the correctness of the data and will never affect any validation or * other non-formatting related operations. * If this value is not known, it should be omitted (rather than specifying a * possibly incorrect default). * Examples: "zh-Hant", "ja", "ja-Latn", "en". * @type string $postal_code * Optional. Postal code of the address. Not all countries use or require * postal codes to be present, but where they are used, they may trigger * additional validation with other parts of the address (e.g. state/zip * validation in the U.S.A.). * @type string $sorting_code * Optional. Additional, country-specific, sorting code. This is not used * in most regions. Where it is used, the value is either a string like * "CEDEX", optionally followed by a number (e.g. "CEDEX 7"), or just a number * alone, representing the "sector code" (Jamaica), "delivery area indicator" * (Malawi) or "post office indicator" (e.g. CĂ´te d'Ivoire). * @type string $administrative_area * Optional. Highest administrative subdivision which is used for postal * addresses of a country or region. * For example, this can be a state, a province, an oblast, or a prefecture. * Specifically, for Spain this is the province and not the autonomous * community (e.g. "Barcelona" and not "Catalonia"). * Many countries don't use an administrative area in postal addresses. E.g. * in Switzerland this should be left unpopulated. * @type string $locality * Optional. Generally refers to the city/town portion of the address. * Examples: US city, IT comune, UK post town. * In regions of the world where localities are not well defined or do not fit * into this structure well, leave locality empty and use address_lines. * @type string $sublocality * Optional. Sublocality of the address. * For example, this can be neighborhoods, boroughs, districts. * @type string[]|\Google\Protobuf\Internal\RepeatedField $address_lines * Unstructured address lines describing the lower levels of an address. * Because values in address_lines do not have type information and may * sometimes contain multiple values in a single field (e.g. * "Austin, TX"), it is important that the line order is clear. The order of * address lines should be "envelope order" for the country/region of the * address. In places where this can vary (e.g. Japan), address_language is * used to make it explicit (e.g. "ja" for large-to-small ordering and * "ja-Latn" or "en" for small-to-large). This way, the most specific line of * an address can be selected based on the language. * The minimum permitted structural representation of an address consists * of a region_code with all remaining information placed in the * address_lines. It would be possible to format such an address very * approximately without geocoding, but no semantic reasoning could be * made about any of the address components until it was at least * partially resolved. * Creating an address only containing a region_code and address_lines, and * then geocoding is the recommended way to handle completely unstructured * addresses (as opposed to guessing which parts of the address should be * localities or administrative areas). * @type string[]|\Google\Protobuf\Internal\RepeatedField $recipients * Optional. The recipient at the address. * This field may, under certain circumstances, contain multiline information. * For example, it might contain "care of" information. * @type string $organization * Optional. The name of the organization at the address. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Type\PostalAddress::initOnce(); parent::__construct($data); } /** * The schema revision of the `PostalAddress`. * All new revisions **must** be backward compatible with old revisions. * * Generated from protobuf field int32 revision = 1; * @return int */ public function getRevision() { return $this->revision; } /** * The schema revision of the `PostalAddress`. * All new revisions **must** be backward compatible with old revisions. * * Generated from protobuf field int32 revision = 1; * @param int $var * @return $this */ public function setRevision($var) { GPBUtil::checkInt32($var); $this->revision = $var; return $this; } /** * Required. CLDR region code of the country/region of the address. This * is never inferred and it is up to the user to ensure the value is * correct. See http://cldr.unicode.org/ and * http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html * for details. Example: "CH" for Switzerland. * * Generated from protobuf field string region_code = 2; * @return string */ public function getRegionCode() { return $this->region_code; } /** * Required. CLDR region code of the country/region of the address. This * is never inferred and it is up to the user to ensure the value is * correct. See http://cldr.unicode.org/ and * http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html * for details. Example: "CH" for Switzerland. * * Generated from protobuf field string region_code = 2; * @param string $var * @return $this */ public function setRegionCode($var) { GPBUtil::checkString($var, True); $this->region_code = $var; return $this; } /** * Optional. BCP-47 language code of the contents of this address (if * known). This is often the UI language of the input form or is expected * to match one of the languages used in the address' country/region, or their * transliterated equivalents. * This can affect formatting in certain countries, but is not critical * to the correctness of the data and will never affect any validation or * other non-formatting related operations. * If this value is not known, it should be omitted (rather than specifying a * possibly incorrect default). * Examples: "zh-Hant", "ja", "ja-Latn", "en". * * Generated from protobuf field string language_code = 3; * @return string */ public function getLanguageCode() { return $this->language_code; } /** * Optional. BCP-47 language code of the contents of this address (if * known). This is often the UI language of the input form or is expected * to match one of the languages used in the address' country/region, or their * transliterated equivalents. * This can affect formatting in certain countries, but is not critical * to the correctness of the data and will never affect any validation or * other non-formatting related operations. * If this value is not known, it should be omitted (rather than specifying a * possibly incorrect default). * Examples: "zh-Hant", "ja", "ja-Latn", "en". * * Generated from protobuf field string language_code = 3; * @param string $var * @return $this */ public function setLanguageCode($var) { GPBUtil::checkString($var, True); $this->language_code = $var; return $this; } /** * Optional. Postal code of the address. Not all countries use or require * postal codes to be present, but where they are used, they may trigger * additional validation with other parts of the address (e.g. state/zip * validation in the U.S.A.). * * Generated from protobuf field string postal_code = 4; * @return string */ public function getPostalCode() { return $this->postal_code; } /** * Optional. Postal code of the address. Not all countries use or require * postal codes to be present, but where they are used, they may trigger * additional validation with other parts of the address (e.g. state/zip * validation in the U.S.A.). * * Generated from protobuf field string postal_code = 4; * @param string $var * @return $this */ public function setPostalCode($var) { GPBUtil::checkString($var, True); $this->postal_code = $var; return $this; } /** * Optional. Additional, country-specific, sorting code. This is not used * in most regions. Where it is used, the value is either a string like * "CEDEX", optionally followed by a number (e.g. "CEDEX 7"), or just a number * alone, representing the "sector code" (Jamaica), "delivery area indicator" * (Malawi) or "post office indicator" (e.g. CĂ´te d'Ivoire). * * Generated from protobuf field string sorting_code = 5; * @return string */ public function getSortingCode() { return $this->sorting_code; } /** * Optional. Additional, country-specific, sorting code. This is not used * in most regions. Where it is used, the value is either a string like * "CEDEX", optionally followed by a number (e.g. "CEDEX 7"), or just a number * alone, representing the "sector code" (Jamaica), "delivery area indicator" * (Malawi) or "post office indicator" (e.g. CĂ´te d'Ivoire). * * Generated from protobuf field string sorting_code = 5; * @param string $var * @return $this */ public function setSortingCode($var) { GPBUtil::checkString($var, True); $this->sorting_code = $var; return $this; } /** * Optional. Highest administrative subdivision which is used for postal * addresses of a country or region. * For example, this can be a state, a province, an oblast, or a prefecture. * Specifically, for Spain this is the province and not the autonomous * community (e.g. "Barcelona" and not "Catalonia"). * Many countries don't use an administrative area in postal addresses. E.g. * in Switzerland this should be left unpopulated. * * Generated from protobuf field string administrative_area = 6; * @return string */ public function getAdministrativeArea() { return $this->administrative_area; } /** * Optional. Highest administrative subdivision which is used for postal * addresses of a country or region. * For example, this can be a state, a province, an oblast, or a prefecture. * Specifically, for Spain this is the province and not the autonomous * community (e.g. "Barcelona" and not "Catalonia"). * Many countries don't use an administrative area in postal addresses. E.g. * in Switzerland this should be left unpopulated. * * Generated from protobuf field string administrative_area = 6; * @param string $var * @return $this */ public function setAdministrativeArea($var) { GPBUtil::checkString($var, True); $this->administrative_area = $var; return $this; } /** * Optional. Generally refers to the city/town portion of the address. * Examples: US city, IT comune, UK post town. * In regions of the world where localities are not well defined or do not fit * into this structure well, leave locality empty and use address_lines. * * Generated from protobuf field string locality = 7; * @return string */ public function getLocality() { return $this->locality; } /** * Optional. Generally refers to the city/town portion of the address. * Examples: US city, IT comune, UK post town. * In regions of the world where localities are not well defined or do not fit * into this structure well, leave locality empty and use address_lines. * * Generated from protobuf field string locality = 7; * @param string $var * @return $this */ public function setLocality($var) { GPBUtil::checkString($var, True); $this->locality = $var; return $this; } /** * Optional. Sublocality of the address. * For example, this can be neighborhoods, boroughs, districts. * * Generated from protobuf field string sublocality = 8; * @return string */ public function getSublocality() { return $this->sublocality; } /** * Optional. Sublocality of the address. * For example, this can be neighborhoods, boroughs, districts. * * Generated from protobuf field string sublocality = 8; * @param string $var * @return $this */ public function setSublocality($var) { GPBUtil::checkString($var, True); $this->sublocality = $var; return $this; } /** * Unstructured address lines describing the lower levels of an address. * Because values in address_lines do not have type information and may * sometimes contain multiple values in a single field (e.g. * "Austin, TX"), it is important that the line order is clear. The order of * address lines should be "envelope order" for the country/region of the * address. In places where this can vary (e.g. Japan), address_language is * used to make it explicit (e.g. "ja" for large-to-small ordering and * "ja-Latn" or "en" for small-to-large). This way, the most specific line of * an address can be selected based on the language. * The minimum permitted structural representation of an address consists * of a region_code with all remaining information placed in the * address_lines. It would be possible to format such an address very * approximately without geocoding, but no semantic reasoning could be * made about any of the address components until it was at least * partially resolved. * Creating an address only containing a region_code and address_lines, and * then geocoding is the recommended way to handle completely unstructured * addresses (as opposed to guessing which parts of the address should be * localities or administrative areas). * * Generated from protobuf field repeated string address_lines = 9; * @return \Google\Protobuf\Internal\RepeatedField */ public function getAddressLines() { return $this->address_lines; } /** * Unstructured address lines describing the lower levels of an address. * Because values in address_lines do not have type information and may * sometimes contain multiple values in a single field (e.g. * "Austin, TX"), it is important that the line order is clear. The order of * address lines should be "envelope order" for the country/region of the * address. In places where this can vary (e.g. Japan), address_language is * used to make it explicit (e.g. "ja" for large-to-small ordering and * "ja-Latn" or "en" for small-to-large). This way, the most specific line of * an address can be selected based on the language. * The minimum permitted structural representation of an address consists * of a region_code with all remaining information placed in the * address_lines. It would be possible to format such an address very * approximately without geocoding, but no semantic reasoning could be * made about any of the address components until it was at least * partially resolved. * Creating an address only containing a region_code and address_lines, and * then geocoding is the recommended way to handle completely unstructured * addresses (as opposed to guessing which parts of the address should be * localities or administrative areas). * * Generated from protobuf field repeated string address_lines = 9; * @param string[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setAddressLines($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->address_lines = $arr; return $this; } /** * Optional. The recipient at the address. * This field may, under certain circumstances, contain multiline information. * For example, it might contain "care of" information. * * Generated from protobuf field repeated string recipients = 10; * @return \Google\Protobuf\Internal\RepeatedField */ public function getRecipients() { return $this->recipients; } /** * Optional. The recipient at the address. * This field may, under certain circumstances, contain multiline information. * For example, it might contain "care of" information. * * Generated from protobuf field repeated string recipients = 10; * @param string[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setRecipients($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->recipients = $arr; return $this; } /** * Optional. The name of the organization at the address. * * Generated from protobuf field string organization = 11; * @return string */ public function getOrganization() { return $this->organization; } /** * Optional. The name of the organization at the address. * * Generated from protobuf field string organization = 11; * @param string $var * @return $this */ public function setOrganization($var) { GPBUtil::checkString($var, True); $this->organization = $var; return $this; } } src/Type/TimeOfDay.php000064400000011736151742741630010630 0ustar00google.type.TimeOfDay */ class TimeOfDay extends \Google\Protobuf\Internal\Message { /** * Hours of day in 24 hour format. Should be from 0 to 23. An API may choose * to allow the value "24:00:00" for scenarios like business closing time. * * Generated from protobuf field int32 hours = 1; */ private $hours = 0; /** * Minutes of hour of day. Must be from 0 to 59. * * Generated from protobuf field int32 minutes = 2; */ private $minutes = 0; /** * Seconds of minutes of the time. Must normally be from 0 to 59. An API may * allow the value 60 if it allows leap-seconds. * * Generated from protobuf field int32 seconds = 3; */ private $seconds = 0; /** * Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. * * Generated from protobuf field int32 nanos = 4; */ private $nanos = 0; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type int $hours * Hours of day in 24 hour format. Should be from 0 to 23. An API may choose * to allow the value "24:00:00" for scenarios like business closing time. * @type int $minutes * Minutes of hour of day. Must be from 0 to 59. * @type int $seconds * Seconds of minutes of the time. Must normally be from 0 to 59. An API may * allow the value 60 if it allows leap-seconds. * @type int $nanos * Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Type\Timeofday::initOnce(); parent::__construct($data); } /** * Hours of day in 24 hour format. Should be from 0 to 23. An API may choose * to allow the value "24:00:00" for scenarios like business closing time. * * Generated from protobuf field int32 hours = 1; * @return int */ public function getHours() { return $this->hours; } /** * Hours of day in 24 hour format. Should be from 0 to 23. An API may choose * to allow the value "24:00:00" for scenarios like business closing time. * * Generated from protobuf field int32 hours = 1; * @param int $var * @return $this */ public function setHours($var) { GPBUtil::checkInt32($var); $this->hours = $var; return $this; } /** * Minutes of hour of day. Must be from 0 to 59. * * Generated from protobuf field int32 minutes = 2; * @return int */ public function getMinutes() { return $this->minutes; } /** * Minutes of hour of day. Must be from 0 to 59. * * Generated from protobuf field int32 minutes = 2; * @param int $var * @return $this */ public function setMinutes($var) { GPBUtil::checkInt32($var); $this->minutes = $var; return $this; } /** * Seconds of minutes of the time. Must normally be from 0 to 59. An API may * allow the value 60 if it allows leap-seconds. * * Generated from protobuf field int32 seconds = 3; * @return int */ public function getSeconds() { return $this->seconds; } /** * Seconds of minutes of the time. Must normally be from 0 to 59. An API may * allow the value 60 if it allows leap-seconds. * * Generated from protobuf field int32 seconds = 3; * @param int $var * @return $this */ public function setSeconds($var) { GPBUtil::checkInt32($var); $this->seconds = $var; return $this; } /** * Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. * * Generated from protobuf field int32 nanos = 4; * @return int */ public function getNanos() { return $this->nanos; } /** * Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. * * Generated from protobuf field int32 nanos = 4; * @param int $var * @return $this */ public function setNanos($var) { GPBUtil::checkInt32($var); $this->nanos = $var; return $this; } } tests/ApiCore/Tests/Unit/AgentHeaderTest.php000064400000010145151742741630015004 0ustar00 [ 'gl-php/' . phpversion() . ' gapic/' . ' gax/' . Version::getApiCoreVersion() . ' grpc/' . phpversion('grpc') ]]; $header = AgentHeader::buildAgentHeader([]); $this->assertSame($expectedHeader, $header); } public function testWithInput() { $expectedHeader = [AgentHeader::AGENT_HEADER_KEY => [ 'gl-php/4.4.4 gccl/1.1.1 gapic/2.2.2 gax/3.3.3 grpc/5.5.5' ]]; $header = AgentHeader::buildAgentHeader([ 'libName' => 'gccl', 'libVersion' => '1.1.1', 'gapicVersion' => '2.2.2', 'apiCoreVersion' => '3.3.3', 'phpVersion' => '4.4.4', 'grpcVersion' => '5.5.5', ]); $this->assertSame($expectedHeader, $header); } public function testWithoutVersionInput() { $expectedHeader = [AgentHeader::AGENT_HEADER_KEY => [ 'gl-php/' . phpversion() . ' gccl/ gapic/ gax/' . Version::getApiCoreVersion() . ' grpc/' . phpversion('grpc') ]]; $header = AgentHeader::buildAgentHeader([ 'libName' => 'gccl', ]); $this->assertSame($expectedHeader, $header); } public function testWithNullVersionInput() { $expectedHeader = [AgentHeader::AGENT_HEADER_KEY => [ 'gl-php/' . phpversion() . ' gccl/ gapic/ gax/' . Version::getApiCoreVersion() . ' grpc/' . phpversion('grpc') ]]; $header = AgentHeader::buildAgentHeader([ 'libName' => 'gccl', 'libVersion' => null, 'gapicVersion' => null, 'apiCoreVersion' => null, 'phpVersion' => null, 'grpcVersion' => null, ]); $this->assertSame($expectedHeader, $header); } public function testGetGapicVersionWithVersionFile() { require_once __DIR__ . '/testdata/src/GapicClientStub.php'; $expectedVersion = '1.2.3-dev'; $actualVersion = AgentHeader::readGapicVersionFromFile(\GapicClientStub::class); $this->assertEquals($expectedVersion, $actualVersion); } public function testGetGapicVersionWithNoAvailableVersion() { $this->assertEquals('', AgentHeader::readGapicVersionFromFile(__CLASS__)); } } tests/ApiCore/Tests/Unit/ApiExceptionTest.php000064400000020477151742741630015236 0ustar00code = Code::OK; $status->details = 'testWithoutMetadata'; $apiException = ApiException::createFromStdClass($status); $expectedMessage = json_encode([ 'message' => 'testWithoutMetadata', 'code' => Code::OK, 'status' => 'OK', 'details' => [] ], JSON_PRETTY_PRINT); $this->assertSame(Code::OK, $apiException->getCode()); $this->assertSame($expectedMessage, $apiException->getMessage()); $this->assertNull($apiException->getMetadata()); } /** * @dataProvider getMetadata */ public function testWithMetadata($metadata, $metadataArray) { $status = new \stdClass(); $status->code = Code::OK; $status->details = 'testWithMetadata'; $status->metadata = $metadata; $apiException = ApiException::createFromStdClass($status); $expectedMessage = json_encode([ 'message' => 'testWithMetadata', 'code' => Code::OK, 'status' => 'OK', 'details' => $metadataArray ], JSON_PRETTY_PRINT); $this->assertSame(Code::OK, $apiException->getCode()); $this->assertSame($expectedMessage, $apiException->getMessage()); $this->assertSame($metadata, $apiException->getMetadata()); } public function getMetadata() { $retryInfo = new RetryInfo(); $duration = new Duration(); $duration->setSeconds(1); $duration->setNanos(2); $retryInfo->setRetryDelay($duration); $unknownBinData = [ [ '@type' => 'unknown-bin', 'data' => '' ] ]; $asciiData = [ [ '@type' => 'ascii', 'data' => 'ascii-data' ] ]; $retryInfoData = [ [ '@type' => 'google.rpc.retryinfo-bin', 'retryDelay' => [ 'seconds' => 1, 'nanos' => 2, ], ] ]; $allKnownTypesData = [ [ '@type' => 'google.rpc.retryinfo-bin', ], [ '@type' => 'google.rpc.debuginfo-bin', "stackEntries" => [], "detail" => "" ], [ '@type' => 'google.rpc.quotafailure-bin', 'violations' => [], ], [ '@type' => 'google.rpc.badrequest-bin', 'fieldViolations' => [] ], [ '@type' => 'google.rpc.requestinfo-bin', 'requestId' => '', 'servingData' => '', ], [ '@type' => 'google.rpc.resourceinfo-bin', 'resourceType' => '', 'resourceName' => '', 'owner' => '', 'description' => '', ], [ '@type' => 'google.rpc.help-bin', 'links' => [], ], [ '@type' => 'google.rpc.localizedmessage-bin', 'locale' => '', 'message' => '', ], ]; return [ [['unknown-bin' => ['some-data-that-should-not-appear']], $unknownBinData], [['ascii' => ['ascii-data']], $asciiData], [['google.rpc.retryinfo-bin' => [$retryInfo->serializeToString()]], $retryInfoData], [[ 'google.rpc.retryinfo-bin' => [(new RetryInfo())->serializeToString()], 'google.rpc.debuginfo-bin' => [(new DebugInfo())->serializeToString()], 'google.rpc.quotafailure-bin' => [(new QuotaFailure())->serializeToString()], 'google.rpc.badrequest-bin' => [(new BadRequest())->serializeToString()], 'google.rpc.requestinfo-bin' => [(new RequestInfo())->serializeToString()], 'google.rpc.resourceinfo-bin' => [(new ResourceInfo())->serializeToString()], 'google.rpc.help-bin' => [(new Help())->serializeToString()], 'google.rpc.localizedmessage-bin' => [(new LocalizedMessage())->serializeToString()], ], $allKnownTypesData], ]; } /** * @dataProvider getMetadata */ public function testCreateFromApiResponse($metadata, $metadataArray) { $basicMessage = 'testWithMetadata'; $code = Code::OK; $status = 'OK'; $apiException = ApiException::createFromApiResponse($basicMessage, $code, $metadata); $expectedMessage = json_encode([ 'message' => $basicMessage, 'code' => $code, 'status' => $status, 'details' => $metadataArray ], JSON_PRETTY_PRINT); $this->assertSame(Code::OK, $apiException->getCode()); $this->assertSame($expectedMessage, $apiException->getMessage()); $this->assertSame($metadata, $apiException->getMetadata()); } /** * @dataProvider getRpcStatusData */ public function testCreateFromRpcStatus($status, $expectedApiException) { $actualApiException = ApiException::createFromRpcStatus($status); $this->assertEquals($expectedApiException, $actualApiException); } public function getRpcStatusData() { $debugInfo = new DebugInfo(); $debugInfo->setDetail("debug detail"); $any = new Any(); $any->pack($debugInfo); $status = new Status(); $status->setMessage("status string"); $status->setCode(Code::OK); $status->setDetails([$any]); $expectedMessage = json_encode([ 'message' => $status->getMessage(), 'code' => $status->getCode(), 'status' => 'OK', 'details' => [ [ 'stackEntries' => [], 'detail' => 'debug detail', ] ], ], JSON_PRETTY_PRINT); return [ [ $status, new ApiException($expectedMessage, Code::OK, 'OK', [ 'metadata' => $status->getDetails(), 'basicMessage' => $status->getMessage(), ] ) ] ]; } } tests/ApiCore/Tests/Unit/ApiStatusTest.php000064400000010073151742741630014552 0ustar00assertTrue(ApiStatus::isValidStatus($status)); } /** * @dataProvider getInvalidStatus */ public function testValidateInvalid($status) { $this->assertFalse(ApiStatus::isValidStatus($status)); } public function getValidStatus() { return [ ['OK'], ['CANCELLED'], ['UNKNOWN'], ['INVALID_ARGUMENT'], ['DEADLINE_EXCEEDED'], ['NOT_FOUND'], ['ALREADY_EXISTS'], ['PERMISSION_DENIED'], ['RESOURCE_EXHAUSTED'], ['FAILED_PRECONDITION'], ['ABORTED'], ['OUT_OF_RANGE'], ['UNIMPLEMENTED'], ['INTERNAL'], ['UNAVAILABLE'], ['DATA_LOSS'], ['UNAUTHENTICATED'], ]; } public function getInvalidStatus() { return [ ['UNRECOGNIZED_STATUS'], [''], ['NONSENSE'], ]; } /** * @dataProvider getCodeAndStatus */ public function testStatusFromRpcCode($code, $status) { $this->assertSame($status, ApiStatus::statusFromRpcCode($code)); } public function getCodeAndStatus() { return [ [Code::OK, ApiStatus::OK], [Code::CANCELLED, ApiStatus::CANCELLED], [Code::UNKNOWN, ApiStatus::UNKNOWN], [Code::INVALID_ARGUMENT, ApiStatus::INVALID_ARGUMENT], [Code::DEADLINE_EXCEEDED, ApiStatus::DEADLINE_EXCEEDED], [Code::NOT_FOUND, ApiStatus::NOT_FOUND], [Code::ALREADY_EXISTS, ApiStatus::ALREADY_EXISTS], [Code::PERMISSION_DENIED, ApiStatus::PERMISSION_DENIED], [Code::RESOURCE_EXHAUSTED, ApiStatus::RESOURCE_EXHAUSTED], [Code::FAILED_PRECONDITION, ApiStatus::FAILED_PRECONDITION], [Code::ABORTED, ApiStatus::ABORTED], [Code::OUT_OF_RANGE, ApiStatus::OUT_OF_RANGE], [Code::UNIMPLEMENTED, ApiStatus::UNIMPLEMENTED], [Code::INTERNAL, ApiStatus::INTERNAL], [Code::UNAVAILABLE, ApiStatus::UNAVAILABLE], [Code::DATA_LOSS, ApiStatus::DATA_LOSS], [Code::UNAUTHENTICATED, ApiStatus::UNAUTHENTICATED], [-1, ApiStatus::UNRECOGNIZED_STATUS] ]; } } tests/ApiCore/Tests/Unit/ArrayTraitTest.php000064400000011671151742741630014724 0ustar00implementation = new ArrayTraitStub(); } public function testPluck() { $value = '123'; $key = 'key'; $array = [$key => $value]; $actualValue = $this->implementation->call('pluck', [$key, &$array]); $this->assertEquals($value, $actualValue); $this->assertEquals([], $array); } /** * @expectedException InvalidArgumentException */ public function testPluckThrowsExceptionWithInvalidKey() { $array = []; $this->implementation->call('pluck', ['not_here', &$array]); } public function testPluckArray() { $keys = ['key1', 'key2']; $array = [ 'key1' => 'test', 'key2' => 'test' ]; $expectedArray = $array; $actualValues = $this->implementation->call('pluckArray', [$keys, &$array]); $this->assertEquals($expectedArray, $actualValues); $this->assertEquals([], $array); } public function testIsAssocTrue() { $actual = $this->implementation->call('isAssoc', [[ 'test' => 1, 'test' => 2 ]]); $this->assertTrue($actual); } public function testIsAssocFalse() { $actual = $this->implementation->call('isAssoc', [[1, 2, 3]]); $this->assertFalse($actual); } public function testArrayFilterRemoveNull() { $input = [ 'null' => null, 'false' => false, 'zero' => 0, 'float' => 0.0, 'empty' => '', 'array' => [], ]; $res = $this->implementation->call('arrayFilterRemoveNull', [$input]); $this->assertFalse(array_key_exists('null', $res)); $this->assertTrue(array_key_exists('false', $res)); $this->assertTrue(array_key_exists('zero', $res)); $this->assertTrue(array_key_exists('float', $res)); $this->assertTrue(array_key_exists('empty', $res)); $this->assertTrue(array_key_exists('array', $res)); } /** * @dataProvider subsetArrayData */ public function testSubsetArray($keys, $array, $expectedSubset) { $actualSubset = $this->implementation->call('subsetArray', [$keys, $array]); $this->assertSame($expectedSubset, $actualSubset); } public function subsetArrayData() { return [ [ ['one', 2], [ 'one' => 'value-of-one', 2 => 'value-of-two', 'three' => 'value-of-three' ], [ 'one' => 'value-of-one', 2 => 'value-of-two', ], ], [ ['one', 2, 'four'], [ 'one' => 'value-of-one', 2 => 'value-of-two', 'three' => 'value-of-three' ], [ 'one' => 'value-of-one', 2 => 'value-of-two', ], ] ]; } } class ArrayTraitStub { use ArrayTrait; public function call($fn, array $args) { return call_user_func_array([$this, $fn], $args); } } tests/ApiCore/Tests/Unit/BidiStreamTest.php000064400000026032151742741630014662 0ustar00assertSame($call, $stream->getBidiStreamingCall()); $this->assertSame([], iterator_to_array($stream->closeWriteAndReadAll())); } /** * @expectedException \Google\ApiCore\ApiException * @expectedExceptionMessage empty failure read */ public function testEmptyFailureRead() { $call = new MockBidiStreamingCall([], null, new MockStatus(Code::INTERNAL, 'empty failure read')); $stream = new BidiStream($call); $this->assertSame($call, $stream->getBidiStreamingCall()); $stream->closeWrite(); $stream->read(); } /** * @expectedException \Google\ApiCore\ApiException * @expectedExceptionMessage empty failure readall */ public function testEmptyFailureReadAll() { $call = new MockBidiStreamingCall([], null, new MockStatus(Code::INTERNAL, 'empty failure readall')); $stream = new BidiStream($call); $this->assertSame($call, $stream->getBidiStreamingCall()); iterator_to_array($stream->closeWriteAndReadAll()); } /** * @expectedException \Google\ApiCore\ValidationException * @expectedExceptionMessage Cannot call read() after streaming call is complete. */ public function testReadAfterComplete() { $call = new MockBidiStreamingCall([]); $stream = new BidiStream($call); $this->assertSame($call, $stream->getBidiStreamingCall()); $stream->closeWrite(); $this->assertNull($stream->read()); $stream->read(); } /** * @expectedException \Google\ApiCore\ValidationException * @expectedExceptionMessage Cannot call write() after streaming call is complete. */ public function testWriteAfterComplete() { $call = new MockBidiStreamingCall([]); $stream = new BidiStream($call); $this->assertSame($call, $stream->getBidiStreamingCall()); $stream->closeWrite(); $this->assertNull($stream->read()); $stream->write('request'); } /** * @expectedException \Google\ApiCore\ValidationException * @expectedExceptionMessage Cannot call write() after calling closeWrite(). */ public function testWriteAfterCloseWrite() { $call = new MockBidiStreamingCall([]); $stream = new BidiStream($call); $this->assertSame($call, $stream->getBidiStreamingCall()); $stream->closeWrite(); $stream->write('request'); } public function testReadStringsSuccess() { $responses = ['abc', 'def']; $call = new MockBidiStreamingCall($responses); $stream = new BidiStream($call); $this->assertSame($call, $stream->getBidiStreamingCall()); $this->assertSame($responses, iterator_to_array($stream->closeWriteAndReadAll())); } public function testReadObjectsSuccess() { $responses = [ $this->createStatus(Code::OK, 'response1'), $this->createStatus(Code::OK, 'response2') ]; $serializedResponses = []; foreach ($responses as $response) { $serializedResponses[] = $response->serializeToString(); } $call = new MockBidiStreamingCall($serializedResponses, ['\Google\Rpc\Status', 'mergeFromString']); $stream = new BidiStream($call); $this->assertSame($call, $stream->getBidiStreamingCall()); $this->assertEquals($responses, iterator_to_array($stream->closeWriteAndReadAll())); } public function testReadCloseReadSuccess() { $responses = [ $this->createStatus(Code::OK, 'response1'), $this->createStatus(Code::OK, 'response2') ]; $serializedResponses = []; foreach ($responses as $response) { $serializedResponses[] = $response->serializeToString(); } $call = new MockBidiStreamingCall($serializedResponses, ['\Google\Rpc\Status', 'mergeFromString']); $stream = new BidiStream($call); $this->assertSame($call, $stream->getBidiStreamingCall()); $response = $stream->read(); $stream->closeWrite(); $index = 0; while (!is_null($response)) { $this->assertEquals($response, $responses[$index]); $response = $stream->read(); $index++; } } /** * @expectedException \Google\ApiCore\ApiException * @expectedExceptionMessage read failure */ public function testReadFailure() { $responses = ['abc', 'def']; $call = new MockBidiStreamingCall( $responses, null, new MockStatus(Code::INTERNAL, 'read failure') ); $stream = new BidiStream($call); $this->assertSame($call, $stream->getBidiStreamingCall()); $index = 0; try { foreach ($stream->closeWriteAndReadAll() as $response) { $this->assertSame($response, $responses[$index]); $index++; } } finally { $this->assertSame(2, $index); } } public function testWriteStringsSuccess() { $requests = ['request1', 'request2']; $responses = []; $call = new MockBidiStreamingCall($responses); $stream = new BidiStream($call); $stream->writeAll($requests); $this->assertSame($call, $stream->getBidiStreamingCall()); $this->assertSame([], iterator_to_array($stream->closeWriteAndReadAll())); $this->assertEquals($requests, $call->popReceivedCalls()); } public function testWriteObjectsSuccess() { $requests = [ $this->createStatus(Code::OK, 'request1'), $this->createStatus(Code::OK, 'request2') ]; $responses = []; $call = new MockBidiStreamingCall($responses, ['\Google\Rpc\Status', 'mergeFromString']); $stream = new BidiStream($call); $stream->writeAll($requests); $this->assertSame($call, $stream->getBidiStreamingCall()); $this->assertSame([], iterator_to_array($stream->closeWriteAndReadAll())); $this->assertEquals($requests, $call->popReceivedCalls()); } public function testAlternateReadWriteObjectsSuccess() { $requests = [ $this->createStatus(Code::OK, 'request1'), $this->createStatus(Code::OK, 'request2'), $this->createStatus(Code::OK, 'request3') ]; $responses = [ $this->createStatus(Code::OK, 'response1'), $this->createStatus(Code::OK, 'response2'), $this->createStatus(Code::OK, 'response3'), $this->createStatus(Code::OK, 'response4') ]; $serializedResponses = []; foreach ($responses as $response) { $serializedResponses[] = $response->serializeToString(); } $call = new MockBidiStreamingCall($serializedResponses, ['\Google\Rpc\Status', 'mergeFromString']); $stream = new BidiStream($call); $index = 0; foreach ($requests as $request) { $stream->write($request); $response = $stream->read(); $this->assertEquals($response, $responses[$index]); $index++; } $stream->closeWrite(); $response = $stream->read(); while (!is_null($response)) { $this->assertEquals($response, $responses[$index]); $index++; $response = $stream->read(); } $this->assertSame($call, $stream->getBidiStreamingCall()); $this->assertEquals($requests, $call->popReceivedCalls()); } /** * @expectedException \Google\ApiCore\ApiException * @expectedExceptionMessage write failure without close */ public function testWriteFailureWithoutClose() { $request = 'request'; $responses = [null]; $call = new MockBidiStreamingCall( $responses, null, new MockStatus(Code::INTERNAL, 'write failure without close') ); $stream = new BidiStream($call); $this->assertSame($call, $stream->getBidiStreamingCall()); $stream->write($request); try { $stream->read(); } finally { $this->assertEquals([$request], $call->popReceivedCalls()); } } public function testResourcesSuccess() { $resources = ['resource1', 'resource2', 'resource3']; $repeatedField1 = new RepeatedField(GPBType::STRING); $repeatedField1[] = 'resource1'; $repeatedField2 = new RepeatedField(GPBType::STRING); $repeatedField2[] = 'resource2'; $repeatedField2[] = 'resource3'; $responses = [ $this->createMockResponse('nextPageToken1', $repeatedField1), $this->createMockResponse('nextPageToken1', $repeatedField2) ]; $call = new MockBidiStreamingCall($responses); $stream = new BidiStream($call, [ 'resourcesGetMethod' => 'getResourcesList' ]); $this->assertSame($call, $stream->getBidiStreamingCall()); $this->assertEquals($resources, iterator_to_array($stream->closeWriteAndReadAll())); } } tests/ApiCore/Tests/Unit/ClientStreamTest.php000064400000013577151742741630015243 0ustar00assertSame($call, $stream->getClientStreamingCall()); $this->assertSame($response, $stream->readResponse()); $this->assertSame([], $call->popReceivedCalls()); } /** * @expectedException \Google\ApiCore\ApiException * @expectedExceptionMessage no writes failure */ public function testNoWritesFailure() { $response = 'response'; $call = new MockClientStreamingCall( $response, null, new MockStatus(Code::INTERNAL, 'no writes failure') ); $stream = new ClientStream($call); $this->assertSame($call, $stream->getClientStreamingCall()); $this->assertSame([], $call->popReceivedCalls()); $stream->readResponse(); } public function testManualWritesSuccess() { $requests = [ $this->createStatus(Code::OK, 'request1'), $this->createStatus(Code::OK, 'request2') ]; $response = $this->createStatus(Code::OK, 'response'); $call = new MockClientStreamingCall($response->serializeToString(), ['\Google\Rpc\Status', 'mergeFromString']); $stream = new ClientStream($call); foreach ($requests as $request) { $stream->write($request); } $this->assertSame($call, $stream->getClientStreamingCall()); $this->assertEquals($response, $stream->readResponse()); $this->assertEquals($requests, $call->popReceivedCalls()); } /** * @expectedException \Google\ApiCore\ApiException * @expectedExceptionMessage manual writes failure */ public function testManualWritesFailure() { $requests = [ $this->createStatus(Code::OK, 'request1'), $this->createStatus(Code::OK, 'request2') ]; $response = $this->createStatus(Code::OK, 'response'); $call = new MockClientStreamingCall( $response->serializeToString(), ['\Google\Rpc\Status', 'mergeFromString'], new MockStatus(Code::INTERNAL, 'manual writes failure') ); $stream = new ClientStream($call); foreach ($requests as $request) { $stream->write($request); } $this->assertSame($call, $stream->getClientStreamingCall()); $this->assertEquals($requests, $call->popReceivedCalls()); $stream->readResponse(); } public function testWriteAllSuccess() { $requests = [ $this->createStatus(Code::OK, 'request1'), $this->createStatus(Code::OK, 'request2') ]; $response = $this->createStatus(Code::OK, 'response'); $call = new MockClientStreamingCall($response->serializeToString(), ['\Google\Rpc\Status', 'mergeFromString']); $stream = new ClientStream($call); $actualResponse = $stream->writeAllAndReadResponse($requests); $this->assertSame($call, $stream->getClientStreamingCall()); $this->assertEquals($response, $actualResponse); $this->assertEquals($requests, $call->popReceivedCalls()); } /** * @expectedException \Google\ApiCore\ApiException * @expectedExceptionMessage write all failure */ public function testWriteAllFailure() { $requests = [ $this->createStatus(Code::OK, 'request1'), $this->createStatus(Code::OK, 'request2') ]; $response = $this->createStatus(Code::OK, 'response'); $call = new MockClientStreamingCall( $response->serializeToString(), ['\Google\Rpc\Status', 'mergeFromString'], new MockStatus(Code::INTERNAL, 'write all failure') ); $stream = new ClientStream($call); try { $stream->writeAllAndReadResponse($requests); } finally { $this->assertSame($call, $stream->getClientStreamingCall()); $this->assertEquals($requests, $call->popReceivedCalls()); } } } tests/ApiCore/Tests/Unit/CredentialsWrapperTest.php000064400000022057151742741630016440 0ustar00assertEquals($expectedCredentialsWrapper, $actualCredentialsWrapper); } public function buildData() { return $this->buildDataWithoutKeyFile() + $this->buildDataWithKeyFile(); } private function buildDataWithoutKeyFile() { $scopes = ['myscope']; $defaultAuthHttpHandler = HttpHandlerFactory::build(); $authHttpHandler = HttpHandlerFactory::build(); $asyncAuthHttpHandler = function ($request, $options) use ($authHttpHandler) { return $authHttpHandler->async($request, $options)->wait(); }; $defaultAuthCache = new MemoryCacheItemPool(); $authCache = new SysVCacheItemPool(); $authCacheOptions = ['lifetime' => 600]; return [ [ [], new CredentialsWrapper(ApplicationDefaultCredentials::getCredentials(null, $defaultAuthHttpHandler, null, $defaultAuthCache), $defaultAuthHttpHandler), ], [ ['scopes' => $scopes], new CredentialsWrapper(ApplicationDefaultCredentials::getCredentials($scopes, $defaultAuthHttpHandler, null, $defaultAuthCache), $defaultAuthHttpHandler), ], [ ['scopes' => $scopes, 'authHttpHandler' => $asyncAuthHttpHandler], new CredentialsWrapper(ApplicationDefaultCredentials::getCredentials($scopes, $asyncAuthHttpHandler, null, $defaultAuthCache), $asyncAuthHttpHandler), ], [ ['enableCaching' => false], new CredentialsWrapper(ApplicationDefaultCredentials::getCredentials(null, $defaultAuthHttpHandler, null, null), $defaultAuthHttpHandler), ], [ ['authCacheOptions' => $authCacheOptions], new CredentialsWrapper(ApplicationDefaultCredentials::getCredentials(null, $defaultAuthHttpHandler, $authCacheOptions, $defaultAuthCache), $defaultAuthHttpHandler), ], [ ['authCache' => $authCache], new CredentialsWrapper(ApplicationDefaultCredentials::getCredentials(null, $defaultAuthHttpHandler, null, $authCache), $defaultAuthHttpHandler), ], ]; } private function buildDataWithKeyFile() { $keyFilePath = __DIR__ . '/testdata/json-key-file.json'; $keyFile = json_decode(file_get_contents($keyFilePath), true); $scopes = ['myscope']; $authHttpHandler = function () {}; $defaultAuthCache = new MemoryCacheItemPool(); $authCache = new SysVCacheItemPool(); $authCacheOptions = ['lifetime' => 600]; return [ [ ['keyFile' => $keyFile], $this->makeExpectedKeyFileCreds($keyFile, null, $defaultAuthCache, null, null), ], [ ['keyFile' => $keyFilePath], $this->makeExpectedKeyFileCreds($keyFile, null, $defaultAuthCache, null, null), ], [ ['keyFile' => $keyFile, 'scopes' => $scopes], $this->makeExpectedKeyFileCreds($keyFile, $scopes, $defaultAuthCache, null, null), ], [ ['keyFile' => $keyFile, 'scopes' => $scopes, 'authHttpHandler' => $authHttpHandler], $this->makeExpectedKeyFileCreds($keyFile, $scopes, $defaultAuthCache, null, $authHttpHandler), ], [ ['keyFile' => $keyFile, 'enableCaching' => false], $this->makeExpectedKeyFileCreds($keyFile, null, null, null, null), ], [ ['keyFile' => $keyFile, 'authCacheOptions' => $authCacheOptions], $this->makeExpectedKeyFileCreds($keyFile, null, $defaultAuthCache, $authCacheOptions, null), ], [ ['keyFile' => $keyFile, 'authCache' => $authCache], $this->makeExpectedKeyFileCreds($keyFile, null, $authCache, null, null), ], ]; } private function makeExpectedKeyFileCreds($keyFile, $scopes, $cache, $cacheConfig, $httpHandler) { $loader = CredentialsLoader::makeCredentials($scopes, $keyFile); if ($cache) { $loader = new FetchAuthTokenCache($loader, $cacheConfig, $cache); } return new CredentialsWrapper($loader, $httpHandler); } /** * @dataProvider getBearerStringData */ public function testGetBearerString($fetcher, $expectedBearerString) { $credentialsWrapper = new CredentialsWrapper($fetcher); $bearerString = $credentialsWrapper->getBearerString(); $this->assertSame($expectedBearerString, $bearerString); } public function getBearerStringData() { $expiredFetcher = $this->prophesize(FetchAuthTokenInterface::class); $expiredFetcher->getLastReceivedToken() ->willReturn([ 'access_token' => 123, 'expires_at' => time() - 1 ]); $expiredFetcher->fetchAuthToken(Argument::any()) ->willReturn([ 'access_token' => 456, 'expires_at' => time() + 1000 ]); $unexpiredFetcher = $this->prophesize(FetchAuthTokenInterface::class); $unexpiredFetcher->getLastReceivedToken() ->willReturn([ 'access_token' => 123, 'expires_at' => time() + 100, ]); return [ [$expiredFetcher->reveal(), 'Bearer 456'], [$unexpiredFetcher->reveal(), 'Bearer 123'], ]; } /** * @dataProvider getAuthorizationHeaderCallbackData */ public function testGetAuthorizationHeaderCallback($fetcher, $expectedCallbackResponse) { $credentialsWrapper = new CredentialsWrapper($fetcher); $callback = $credentialsWrapper->getAuthorizationHeaderCallback(); $actualResponse = $callback(); $this->assertSame($expectedCallbackResponse, $actualResponse); } public function getAuthorizationHeaderCallbackData() { $expiredFetcher = $this->prophesize(FetchAuthTokenInterface::class); $expiredFetcher->getLastReceivedToken() ->willReturn([ 'access_token' => 123, 'expires_at' => time() - 1 ]); $expiredFetcher->fetchAuthToken(Argument::any()) ->willReturn([ 'access_token' => 456, 'expires_at' => time() + 1000 ]); $unexpiredFetcher = $this->prophesize(FetchAuthTokenInterface::class); $unexpiredFetcher->getLastReceivedToken() ->willReturn([ 'access_token' => 123, 'expires_at' => time() + 100, ]); return [ [$expiredFetcher->reveal(), ['authorization' => ['Bearer 456']]], [$unexpiredFetcher->reveal(), ['authorization' => ['Bearer 123']]], ]; } } tests/ApiCore/Tests/Unit/FixedSizeCollectionTest.php000064400000016623151742741630016552 0ustar00createMockRequest('token', 3); $pageStreamingDescriptor = PageStreamingDescriptor::createFromFields([ 'requestPageTokenField' => 'pageToken', 'requestPageSizeField' => 'pageSize', 'responsePageTokenField' => 'nextPageToken', 'resourceField' => 'resourcesList' ]); $internalCall = $this->createCallWithResponseSequence($responseSequence); $callable = function () use ($internalCall) { list($response, $status) = call_user_func_array( array($internalCall, 'takeAction'), func_get_args() ); return $promise = new \GuzzleHttp\Promise\Promise(function () use (&$promise, $response) { $promise->resolve($response); }); }; $call = new Call('method', 'decodeType', $mockRequest); $options = []; $response = $callable($call, $options)->wait(); return new Page($call, $options, $callable, $pageStreamingDescriptor, $response); } public function testFixedCollectionMethods() { $responseA = $this->createMockResponse( 'nextPageToken1', ['resource1', 'resource2'] ); $responseB = $this->createMockResponse( 'nextPageToken2', ['resource3', 'resource4', 'resource5'] ); $responseC = $this->createMockResponse( 'nextPageToken3', ['resource6', 'resource7'] ); $responseD = $this->createMockResponse( '', ['resource8', 'resource9'] ); $page = $this->createPage([ [$responseA, new MockStatus(Code::OK, '')], [$responseB, new MockStatus(Code::OK, '')], [$responseC, new MockStatus(Code::OK, '')], [$responseD, new MockStatus(Code::OK, '')], ]); $fixedSizeCollection = new FixedSizeCollection($page, 5); $this->assertEquals($fixedSizeCollection->getCollectionSize(), 5); $this->assertEquals($fixedSizeCollection->hasNextCollection(), true); $this->assertEquals($fixedSizeCollection->getNextPageToken(), 'nextPageToken2'); $results = iterator_to_array($fixedSizeCollection); $this->assertEquals( $results, ['resource1', 'resource2', 'resource3', 'resource4', 'resource5'] ); $nextCollection = $fixedSizeCollection->getNextCollection(); $this->assertEquals($nextCollection->getCollectionSize(), 4); $this->assertEquals($nextCollection->hasNextCollection(), false); $this->assertEquals($nextCollection->getNextPageToken(), ''); $results = iterator_to_array($nextCollection); $this->assertEquals( $results, ['resource6', 'resource7', 'resource8', 'resource9'] ); } public function testIterateCollections() { $responseA = $this->createMockResponse( 'nextPageToken1', ['resource1', 'resource2'] ); $responseB = $this->createMockResponse( '', ['resource3', 'resource4'] ); $page = $this->createPage([ [$responseA, new MockStatus(Code::OK, '')], [$responseB, new MockStatus(Code::OK, '')], ]); $collection = new FixedSizeCollection($page, 2); $results = []; $iterations = 0; foreach ($collection->iterateCollections() as $nextCollection) { $results = array_merge($results, iterator_to_array($nextCollection)); $iterations++; } $this->assertEquals( $results, ['resource1', 'resource2', 'resource3', 'resource4'] ); $this->assertEquals(2, $iterations); } /** * @expectedException LengthException * @expectedExceptionMessage API returned a number of elements exceeding the specified page size limit */ public function testApiReturningMoreElementsThanPageSize() { $responseA = $this->createMockResponse( 'nextPageToken1', ['resource1', 'resource2'] ); $responseB = $this->createMockResponse( 'nextPageToken2', ['resource3', 'resource4', 'resource5'] ); $page = $this->createPage([ [$responseA, new MockStatus(Code::OK, '')], [$responseB, new MockStatus(Code::OK, '')], ]); $collection = new FixedSizeCollection($page, 3); $collection->getNextCollection(); } /** * @expectedException InvalidArgumentException * @expectedExceptionMessage collectionSize must be > 0. */ public function testEmptyCollectionThrowsException() { $collectionSize = 0; $page = $this->getMockBuilder(Page::class) ->disableOriginalConstructor() ->getMock(); new FixedSizeCollection($page, $collectionSize); } /** * @expectedException InvalidArgumentException * @expectedExceptionMessage collectionSize must be greater than or equal to the number of elements in initialPage */ public function testInvalidPageCount() { $collectionSize = 1; $page = $this->getMockBuilder(Page::class) ->disableOriginalConstructor() ->getMock(); $page->expects($this->exactly(2)) ->method('getPageElementCount') ->will($this->returnValue(2)); new FixedSizeCollection($page, $collectionSize); } } tests/ApiCore/Tests/Unit/GapicClientTraitTest.php000064400000064345151742741630016036 0ustar00set('gapicVersionFromFile', null, true); } public function testHeadersOverwriteBehavior() { $header = AgentHeader::buildAgentHeader([ 'libName' => 'gccl', 'libVersion' => '0.0.0', 'gapicVersion' => '0.9.0', 'apiCoreVersion' => '1.0.0', 'phpVersion' => '5.5.0', 'grpcVersion' => '1.0.1' ]); $headers = [ 'x-goog-api-client' => ['this-should-not-be-used'], 'new-header' => ['this-should-be-used'] ]; $expectedHeaders = [ 'x-goog-api-client' => ['gl-php/5.5.0 gccl/0.0.0 gapic/0.9.0 gax/1.0.0 grpc/1.0.1'], 'new-header' => ['this-should-be-used'], ]; $transport = $this->getMock(TransportInterface::class); $credentialsWrapper = CredentialsWrapper::build([]); $transport->expects($this->once()) ->method('startUnaryCall') ->with( $this->isInstanceOf(Call::class), $this->equalTo([ 'headers' => $expectedHeaders, 'credentialsWrapper' => $credentialsWrapper, ]) ); $client = new GapicClientTraitStub(); $client->set('agentHeader', $header); $client->set('retrySettings', [ 'method' => $this->getMockBuilder(RetrySettings::class) ->disableOriginalConstructor() ->getMock() ] ); $client->set('transport', $transport); $client->set('credentialsWrapper', $credentialsWrapper); $client->call('startCall', [ 'method', 'decodeType', ['headers' => $headers] ]); } public function testStartOperationsCall() { $header = AgentHeader::buildAgentHeader([]); $retrySettings = $this->getMockBuilder(RetrySettings::class) ->disableOriginalConstructor() ->getMock(); $longRunningDescriptors = [ 'longRunning' => [ 'operationReturnType' => 'operationType', 'metadataReturnType' => 'metadataType', 'initialPollDelayMillis' => 100, 'pollDelayMultiplier' => 1.0, 'maxPollDelayMillis' => 200, 'totalPollTimeoutMillis' => 300, ] ]; $expectedPromise = new FulfilledPromise(new Operation()); $transport = $this->getMock(TransportInterface::class); $transport->expects($this->once()) ->method('startUnaryCall') ->will($this->returnValue($expectedPromise)); $credentialsWrapper = CredentialsWrapper::build([]); $client = new GapicClientTraitStub(); $client->set('transport', $transport); $client->set('credentialsWrapper', $credentialsWrapper); $client->set('agentHeader', $header); $client->set('retrySettings', ['method' => $retrySettings]); $client->set('descriptors', ['method' => $longRunningDescriptors]); $message = new MockRequest(); $operationsClient = $this->getMockBuilder(OperationsClient::class) ->disableOriginalConstructor() ->getMock(); $response = $client->call('startOperationsCall', [ 'method', [], $message, $operationsClient ])->wait(); $expectedResponse = new OperationResponse( '', $operationsClient, $longRunningDescriptors['longRunning'] + ['lastProtoResponse' => new Operation()] ); $this->assertEquals($expectedResponse, $response); } public function testGetGapicVersionWithVersionFile() { require_once __DIR__ . '/testdata/src/GapicClientStub.php'; $version = '1.2.3-dev'; $client = new \GapicClientStub(); $this->assertEquals($version, $client->call('getGapicVersion', [[]])); } public function testGetGapicVersionWithNoAvailableVersion() { $client = new GapicClientTraitStub(); $this->assertEquals('', $client->call('getGapicVersion', [[]])); } public function testGetGapicVersionWithLibVersion() { $version = '1.2.3-dev'; $client = new GapicClientTraitStub(); $client->set('gapicVersionFromFile', $version, true); $options = ['libVersion' => $version]; $this->assertEquals($version, $client->call('getGapicVersion', [ $options ])); } /** * @dataProvider createCredentialsWrapperData */ public function testCreateCredentialsWrapper($auth, $authConfig, $expectedCredentialsWrapper) { $client = new GapicClientTraitStub(); $actualCredentialsWrapper = $client->call('createCredentialsWrapper', [ $auth, $authConfig, ]); $this->assertEquals($expectedCredentialsWrapper, $actualCredentialsWrapper); } public function createCredentialsWrapperData() { $keyFilePath = __DIR__ . '/testdata/json-key-file.json'; $keyFile = json_decode(file_get_contents($keyFilePath), true); $fetcher = $this->prophesize(FetchAuthTokenInterface::class)->reveal(); $credentialsWrapper = new CredentialsWrapper($fetcher); return [ [null, [], CredentialsWrapper::build()], [$keyFilePath, [], CredentialsWrapper::build(['keyFile' => $keyFile])], [$keyFile, [], CredentialsWrapper::build(['keyFile' => $keyFile])], [$fetcher, [], new CredentialsWrapper($fetcher)], [$credentialsWrapper, [], $credentialsWrapper], ]; } /** * @dataProvider createCredentialsWrapperValidationExceptionData * @expectedException \Google\ApiCore\ValidationException */ public function testCreateCredentialsWrapperValidationException($auth, $authConfig) { $client = new GapicClientTraitStub(); $client->call('createCredentialsWrapper', [ $auth, $authConfig, ]); } public function createCredentialsWrapperValidationExceptionData() { return [ ['not a json string', []], [new \stdClass(), []], ]; } /** * @dataProvider createCredentialsWrapperInvalidArgumentExceptionData * @expectedException \InvalidArgumentException */ public function testCreateCredentialsWrapperInvalidArgumentException($auth, $authConfig) { $client = new GapicClientTraitStub(); $client->call('createCredentialsWrapper', [ $auth, $authConfig, ]); } public function createCredentialsWrapperInvalidArgumentExceptionData() { return [ [['array' => 'without right keys'], []], ]; } /** * @dataProvider createTransportData */ public function testCreateTransport($serviceAddress, $transport, $transportConfig, $expectedTransportClass) { if ($expectedTransportClass == GrpcTransport::class) { $this->requiresGrpcExtension(); } $client = new GapicClientTraitStub(); $transport = $client->call('createTransport', [ $serviceAddress, $transport, $transportConfig ]); $this->assertEquals($expectedTransportClass, get_class($transport)); } public function createTransportData() { $defaultTransportClass = extension_loaded('grpc') ? GrpcTransport::class : RestTransport::class; $serviceAddress = 'address:443'; $transport = extension_loaded('grpc') ? 'grpc' : 'rest'; $transportConfig = [ 'rest' => [ 'restClientConfigPath' => __DIR__ . '/testdata/test_service_rest_client_config.php', ], ]; return [ [$serviceAddress, $transport, $transportConfig, $defaultTransportClass], [$serviceAddress, 'grpc', $transportConfig, GrpcTransport::class], [$serviceAddress, 'rest', $transportConfig, RestTransport::class], [$serviceAddress, 'grpc-fallback', $transportConfig, GrpcFallbackTransport::class], ]; } /** * @dataProvider createTransportDataInvalid * @expectedException \Google\ApiCore\ValidationException */ public function testCreateTransportInvalid($serviceAddress, $transport, $transportConfig) { $client = new GapicClientTraitStub(); $client->call('createTransport', [ $serviceAddress, $transport, $transportConfig ]); } public function createTransportDataInvalid() { $serviceAddress = 'address:443'; $transportConfig = [ 'rest' => [ 'restConfigPath' => __DIR__ . '/testdata/test_service_rest_client_config.php', ], ]; return [ [$serviceAddress, null, $transportConfig], [$serviceAddress, ['transport' => 'weirdstring'], $transportConfig], [$serviceAddress, ['transport' => new \stdClass()], $transportConfig], [$serviceAddress, ['transport' => 'rest'], []], ]; } /** * @dataProvider setClientOptionsData */ public function testSetClientOptions($options, $expectedProperties) { $client = new GapicClientTraitStub(); $updatedOptions = $client->call('buildClientOptions', [$options]); $client->call('setClientOptions', [$updatedOptions]); foreach ($expectedProperties as $propertyName => $expectedValue) { $actualValue = $client->get($propertyName); $this->assertEquals($expectedValue, $actualValue); } } public function setClientOptionsData() { $clientDefaults = GapicClientTraitStub::getClientDefaults(); $expectedRetrySettings = RetrySettings::load( $clientDefaults['serviceName'], json_decode(file_get_contents($clientDefaults['clientConfig']), true), [] ); $disabledRetrySettings = []; foreach ($expectedRetrySettings as $method => $retrySettingsItem) { $disabledRetrySettings[$method] = $retrySettingsItem->with([ 'retriesEnabled' => false ]); } $expectedProperties = [ 'serviceName' => 'test.interface.v1.api', 'agentHeader' => AgentHeader::buildAgentHeader([]), 'retrySettings' => $expectedRetrySettings, ]; return [ [[], $expectedProperties], [['disableRetries' => true], ['retrySettings' => $disabledRetrySettings] + $expectedProperties], ]; } /** * @dataProvider buildClientOptionsProvider */ public function testBuildClientOptions($options, $expectedUpdatedOptions) { if (!extension_loaded('sysvshm')) { $this->markTestSkipped('The sysvshm extension must be installed to execute this test.'); } $client = new GapicClientTraitStub(); $updatedOptions = $client->call('buildClientOptions', [$options]); $this->assertEquals($expectedUpdatedOptions, $updatedOptions); } public function buildClientOptionsProvider() { $apiConfig = new ApiConfig(); $apiConfig->mergeFromJsonString( file_get_contents(__DIR__.'/testdata/test_service_grpc_config.json') ); $grpcGcpConfig = new Config('test.address.com:443', $apiConfig); $defaultOptions = [ 'serviceAddress' => 'test.address.com:443', 'serviceName' => 'test.interface.v1.api', 'clientConfig' => __DIR__ . '/testdata/test_service_client_config.json', 'descriptorsConfigPath' => __DIR__.'/testdata/test_service_descriptor_config.php', 'gcpApiConfigPath' => __DIR__.'/testdata/test_service_grpc_config.json', 'disableRetries' => false, 'auth' => null, 'authConfig' => null, 'transport' => null, 'transportConfig' => [ 'grpc' => [ 'stubOpts' => [ 'grpc_call_invoker' => $grpcGcpConfig->callInvoker() ] ], 'rest' => [ 'restClientConfigPath' => __DIR__.'/testdata/test_service_rest_client_config.php', ], 'grpc-fallback' => [], ], 'credentials' => null, 'credentialsConfig' => [], 'gapicVersion' => null, 'libName' => null, 'libVersion' => null, ]; $restConfigOptions = $defaultOptions; $restConfigOptions['transportConfig']['rest'] += [ 'customRestConfig' => 'value' ]; $grpcConfigOptions = $defaultOptions; $grpcConfigOptions['transportConfig']['grpc'] += [ 'customGrpcConfig' => 'value' ]; return [ [[], $defaultOptions], [ [ 'transportConfig' => [ 'rest' => [ 'customRestConfig' => 'value' ] ] ], $restConfigOptions ], [ [ 'transportConfig' => [ 'grpc' => [ 'customGrpcConfig' => 'value' ] ] ], $grpcConfigOptions ], ]; } public function testModifyClientOptions() { $options = []; $client = new GapicClientTraitStubExtension(); $updatedOptions = $client->call('buildClientOptions', [$options]); $this->assertArrayHasKey('addNewOption', $updatedOptions); $this->assertSame(true, $updatedOptions['disableRetries']); } private function buildClientToTestModifyCallMethods() { $header = AgentHeader::buildAgentHeader([]); $retrySettings = $this->getMockBuilder(RetrySettings::class) ->disableOriginalConstructor() ->getMock(); $longRunningDescriptors = [ 'longRunning' => [ 'operationReturnType' => 'operationType', 'metadataReturnType' => 'metadataType', ] ]; $pageStreamingDescriptors = [ 'pageStreaming' => [ 'requestPageTokenGetMethod' => 'getPageToken', 'requestPageTokenSetMethod' => 'setPageToken', 'requestPageSizeGetMethod' => 'getPageSize', 'requestPageSizeSetMethod' => 'setPageSize', 'responsePageTokenGetMethod' => 'getNextPageToken', 'resourcesGetMethod' => 'getResources', ], ]; $transport = $this->getMock(TransportInterface::class); $credentialsWrapper = CredentialsWrapper::build([]); $client = new GapicClientTraitStubExtension(); $client->set('transport', $transport); $client->set('credentialsWrapper', $credentialsWrapper); $client->set('agentHeader', $header); $client->set('retrySettings', [ 'simpleMethod' => $retrySettings, 'longRunningMethod' => $retrySettings, 'pagedMethod' => $retrySettings, 'bidiStreamingMethod' => $retrySettings, 'clientStreamingMethod' => $retrySettings, 'serverStreamingMethod' => $retrySettings, ]); $client->set('descriptors', [ 'longRunningMethod' => $longRunningDescriptors, 'pagedMethod' => $pageStreamingDescriptors, ]); return [$client, $transport]; } public function testModifyUnaryCallFromStartCall() { list($client, $transport) = $this->buildClientToTestModifyCallMethods(); $transport->expects($this->once()) ->method('startUnaryCall') ->with( $this->isInstanceOf(Call::class), $this->equalTo([ 'transportOptions' => [ 'custom' => ['addModifyUnaryCallableOption' => true] ], 'headers' => AgentHeader::buildAgentHeader([]), 'credentialsWrapper' => CredentialsWrapper::build([]) ]) ) ->willReturn(new FulfilledPromise(new Operation())); $client->call('startCall', [ 'simpleMethod', 'decodeType', [], new MockRequest(), ])->wait(); } public function testModifyUnaryCallFromOperationsCall() { list($client, $transport) = $this->buildClientToTestModifyCallMethods(); $transport->expects($this->once()) ->method('startUnaryCall') ->with( $this->isInstanceOf(Call::class), $this->equalTo([ 'transportOptions' => [ 'custom' => ['addModifyUnaryCallableOption' => true] ], 'headers' => AgentHeader::buildAgentHeader([]), 'credentialsWrapper' => CredentialsWrapper::build([]) ]) ) ->willReturn(new FulfilledPromise(new Operation())); $operationsClient = $this->getMockBuilder(OperationsClient::class) ->disableOriginalConstructor() ->getMock(); $client->call('startOperationsCall', [ 'longRunningMethod', [], new MockRequest(), $operationsClient ])->wait(); } public function testModifyUnaryCallFromGetPagedListResponse() { list($client, $transport) = $this->buildClientToTestModifyCallMethods(); $transport->expects($this->once()) ->method('startUnaryCall') ->with( $this->isInstanceOf(Call::class), $this->equalTo([ 'transportOptions' => [ 'custom' => ['addModifyUnaryCallableOption' => true] ], 'headers' => AgentHeader::buildAgentHeader([]), 'credentialsWrapper' => CredentialsWrapper::build([]) ]) ) ->willReturn(new FulfilledPromise(new Operation())); $client->call('getPagedListResponse', [ 'pagedMethod', [], 'decodeType', new MockRequest(), ]); } /** * @dataProvider modifyStreamingCallFromStartCallData */ public function testModifyStreamingCallFromStartCall($callArgs, $expectedMethod, $expectedResponse) { list($client, $transport) = $this->buildClientToTestModifyCallMethods(); $transport->expects($this->once()) ->method($expectedMethod) ->with( $this->isInstanceOf(Call::class), $this->equalTo([ 'transportOptions' => [ 'custom' => ['addModifyStreamingCallable' => true] ], 'headers' => AgentHeader::buildAgentHeader([]), 'credentialsWrapper' => CredentialsWrapper::build([]) ]) ) ->willReturn($expectedResponse); $client->call('startCall', $callArgs); } public function modifyStreamingCallFromStartCallData() { return [ [ [ 'bidiStreamingMethod', '', [], null, Call::BIDI_STREAMING_CALL ], 'startBidiStreamingCall', $this->getMockBuilder(BidiStream::class) ->disableOriginalConstructor() ->getMock() ], [ [ 'clientStreamingMethod', '', [], null, Call::CLIENT_STREAMING_CALL ], 'startClientStreamingCall', $this->getMockBuilder(ClientStream::class) ->disableOriginalConstructor() ->getMock() ], [ [ 'serverStreamingMethod', '', [], new MockRequest(), Call::SERVER_STREAMING_CALL ], 'startServerStreamingCall', $this->getMockBuilder(ServerStream::class) ->disableOriginalConstructor() ->getMock() ], ]; } public function testGetTransport() { $transport = $this->getMock(TransportInterface::class); $client = new GapicClientTraitStub(); $client->set('transport', $transport); $this->assertEquals($transport, $client->call('getTransport')); } public function testGetCredentialsWrapper() { $credentialsWrapper = $this->getMockBuilder(CredentialsWrapper::class) ->disableOriginalConstructor() ->getMock(); $client = new GapicClientTraitStub(); $client->set('credentialsWrapper', $credentialsWrapper); $this->assertEquals($credentialsWrapper, $client->call('getCredentialsWrapper')); } } class GapicClientTraitStub { use GapicClientTrait; public static function getClientDefaults() { return [ 'serviceAddress' => 'test.address.com:443', 'serviceName' => 'test.interface.v1.api', 'clientConfig' => __DIR__ . '/testdata/test_service_client_config.json', 'descriptorsConfigPath' => __DIR__.'/testdata/test_service_descriptor_config.php', 'gcpApiConfigPath' => __DIR__.'/testdata/test_service_grpc_config.json', 'disableRetries' => false, 'auth' => null, 'authConfig' => null, 'transport' => null, 'transportConfig' => [ 'rest' => [ 'restClientConfigPath' => __DIR__.'/testdata/test_service_rest_client_config.php', ] ], ]; } public function call($fn, array $args = []) { return call_user_func_array([$this, $fn], $args); } public function set($name, $val, $static = false) { if (!property_exists($this, $name)) { throw new \InvalidArgumentException("Property not found: $name"); } if ($static) { $this::$$name = $val; } else { $this->$name = $val; } } public function get($name) { if (!property_exists($this, $name)) { throw new \InvalidArgumentException("Property not found: $name"); } return $this->$name; } } class GapicClientTraitStubExtension extends GapicClientTraitStub { protected function modifyClientOptions(array &$options) { $options['disableRetries'] = true; $options['addNewOption'] = true; } protected function modifyUnaryCallable(callable &$callable) { $originalCallable = $callable; $callable = function ($call, $options) use ($originalCallable) { $options['transportOptions'] = [ 'custom' => ['addModifyUnaryCallableOption' => true] ]; return $originalCallable($call, $options); }; } protected function modifyStreamingCallable(callable &$callable) { $originalCallable = $callable; $callable = function ($call, $options) use ($originalCallable) { $options['transportOptions'] = [ 'custom' => ['addModifyStreamingCallable' => true] ]; return $originalCallable($call, $options); }; } } tests/ApiCore/Tests/Unit/GeneratedTestTest.php000064400000010757151742741630015404 0ustar00assertProtobufEquals($expected, $actual); } /** * @dataProvider getFailureCases */ public function testFailure($expected, $actual) { try { $this->assertProtobufEquals($expected, $actual); } catch (PHPUnit_Framework_ExpectationFailedException $ex) { // As expected the assertion failed, silently return return; } // The assertion did not fail, make the test fail $this->fail('This test did not fail as expected'); } public function getSuccessCases() { $monitoringA = new Monitoring_MonitoringDestination(); $monitoringA->setMonitoredResource("type"); $monitoringB = new Monitoring_MonitoringDestination(); $monitoringB->setMonitoredResource("type"); $emptyRepeatedA = $monitoringA->getMetrics(); $emptyRepeatedB = $monitoringB->getMetrics(); $monitoringC = new Monitoring_MonitoringDestination(); $monitoringD = new Monitoring_MonitoringDestination(); $repeatedC = $monitoringC->getMetrics(); $repeatedC[] = "metric"; $repeatedD = $monitoringD->getMetrics(); $repeatedD[] = "metric"; return [ [[], []], [[], $emptyRepeatedB], [$emptyRepeatedA, []], [$emptyRepeatedA, $emptyRepeatedB], [[1, 2], [1, 2]], [["abc", $monitoringA], ["abc", $monitoringB]], [["metric"], $repeatedD], [$repeatedC, ["metric"]], [$repeatedC, $repeatedD], ]; } public function getFailureCases() { $monitoringA = new Monitoring_MonitoringDestination(); $monitoringA->setMonitoredResource("typeA"); $monitoringB = new Monitoring_MonitoringDestination(); $monitoringB->setMonitoredResource("typeB"); $emptyRepeatedA = $monitoringA->getMetrics(); $emptyRepeatedB = $monitoringB->getMetrics(); $monitoringC = new Monitoring_MonitoringDestination(); $monitoringD = new Monitoring_MonitoringDestination(); $repeatedC = $monitoringC->getMetrics(); $repeatedC[] = "metricA"; $repeatedD = $monitoringD->getMetrics(); $repeatedD[] = "metricB"; return [ [[], [1]], [[1], []], [[1], [2]], [[$monitoringA], [$monitoringB]], [[], $repeatedD], [$repeatedC, []], [$emptyRepeatedA, [1]], [[1], $emptyRepeatedB], [$emptyRepeatedA, $repeatedD], [$repeatedC, $emptyRepeatedB], [$repeatedC, $repeatedD], ]; } } tests/ApiCore/Tests/Unit/GrpcSupportTraitTest.php000064400000002576151742741630016142 0ustar00requiresGrpcExtension(); $instance = new $class('dummyhostname', ['credentials' => null]); } else { $instance = new $class(); } $this->assertNotNull($instance); } public function testClassesProvider() { $classes = iterator_to_array($this->classesProvider()); $this->assertSame(132, count($classes)); $this->assertGreaterThan(0, count($classes)); } public function classesProvider() { $folder = 'src/'; $folderLength = strlen($folder); $namespacePrefix = 'Google'; $excludePatterns = [ 'ApiCore', 'OperationsClient', 'OperationsGapicClient', 'OperationsGrpcClient', ]; $dir = new RecursiveDirectoryIterator($folder); $it = new RecursiveIteratorIterator($dir); $reg = new RegexIterator($it, '#.+\.php$#', RecursiveRegexIterator::GET_MATCH); foreach ($reg as $files) { $file = $files[0]; $exclude = false; foreach ($excludePatterns as $exclusion) { if (strpos($file, $exclusion) !== false) { $exclude = true; break; } } if ($exclude) { continue; } $unprefixedFile = substr($file, $folderLength); $fileWithouExtension = explode('.', $unprefixedFile)[0]; $partialClass = str_replace("/", "\\", $fileWithouExtension); $class = "$namespacePrefix\\$partialClass"; yield [$class]; } } } tests/ApiCore/Tests/Unit/LongRunning/OperationsClientTest.php000064400000030376151742741630020367 0ustar00 '', 'scopes' => [], ]); } /** * @test */ public function getOperationTest() { $transport = $this->createTransport(); $client = $this->createClient(['transport' => $transport]); $this->assertTrue($transport->isExhausted()); // Mock response $name2 = 'name2-1052831874'; $done = true; $expectedResponse = new Operation(); $expectedResponse->setName($name2); $expectedResponse->setDone($done); $transport->addResponse($expectedResponse); // Mock request $name = 'name3373707'; $response = $client->getOperation($name); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); $this->assertSame('/google.longrunning.Operations/GetOperation', $actualFuncCall); $actualValue = $actualRequestObject->getName(); $this->assertProtobufEquals($name, $actualValue); $this->assertTrue($transport->isExhausted()); } /** * @test */ public function getOperationExceptionTest() { $transport = $this->createTransport(); $client = $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 $name = 'name3373707'; try { $client->getOperation($name); // If the $client 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 listOperationsTest() { $transport = $this->createTransport(); $client = $this->createClient(['transport' => $transport]); $this->assertTrue($transport->isExhausted()); // Mock response $nextPageToken = ''; $operationsElement = new Operation(); $operations = [$operationsElement]; $expectedResponse = new ListOperationsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setOperations($operations); $transport->addResponse($expectedResponse); // Mock request $name = 'name3373707'; $filter = 'filter-1274492040'; $response = $client->listOperations($name, $filter); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); $this->assertSame(1, count($resources)); $this->assertEquals($expectedResponse->getOperations()[0], $resources[0]); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); $this->assertSame('/google.longrunning.Operations/ListOperations', $actualFuncCall); $actualValue = $actualRequestObject->getName(); $this->assertProtobufEquals($name, $actualValue); $actualValue = $actualRequestObject->getFilter(); $this->assertProtobufEquals($filter, $actualValue); $this->assertTrue($transport->isExhausted()); } /** * @test */ public function listOperationsExceptionTest() { $transport = $this->createTransport(); $client = $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 $name = 'name3373707'; $filter = 'filter-1274492040'; try { $client->listOperations($name, $filter); // If the $client 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 cancelOperationTest() { $transport = $this->createTransport(); $client = $this->createClient(['transport' => $transport]); $this->assertTrue($transport->isExhausted()); // Mock response $expectedResponse = new GPBEmpty(); $transport->addResponse($expectedResponse); // Mock request $name = 'name3373707'; $client->cancelOperation($name); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); $this->assertSame('/google.longrunning.Operations/CancelOperation', $actualFuncCall); $actualValue = $actualRequestObject->getName(); $this->assertProtobufEquals($name, $actualValue); $this->assertTrue($transport->isExhausted()); } /** * @test */ public function cancelOperationExceptionTest() { $transport = $this->createTransport(); $client = $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 $name = 'name3373707'; try { $client->cancelOperation($name); // If the $client 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 deleteOperationTest() { $transport = $this->createTransport(); $client = $this->createClient(['transport' => $transport]); $this->assertTrue($transport->isExhausted()); // Mock response $expectedResponse = new GPBEmpty(); $transport->addResponse($expectedResponse); // Mock request $name = 'name3373707'; $client->deleteOperation($name); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); $this->assertSame('/google.longrunning.Operations/DeleteOperation', $actualFuncCall); $actualValue = $actualRequestObject->getName(); $this->assertProtobufEquals($name, $actualValue); $this->assertTrue($transport->isExhausted()); } /** * @test */ public function deleteOperationExceptionTest() { $transport = $this->createTransport(); $client = $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 $name = 'name3373707'; try { $client->deleteOperation($name); // If the $client 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()); } } tests/ApiCore/Tests/Unit/Middleware/FixedHeaderMiddlewareTest.php000064400000010646151742741630021066 0ustar00getMock(Call::class, [], [], '', false); $fixedHeader = [ 'x-goog-api-client' => ['gl-php/5.5.0 gccl/0.0.0 gapic/0.9.0 gax/1.0.0 grpc/1.0.1'] ]; $handlerCalled = false; $callable = function(Call $call, $options) use ($fixedHeader, &$handlerCalled) { $this->assertEquals($fixedHeader, $options['headers']); $handlerCalled = true; }; $middleware = new FixedHeaderMiddleware($callable, $fixedHeader); $middleware($call, []); $this->assertTrue($handlerCalled); } public function testCustomHeaderNoOverride() { $call = $this->getMock(Call::class, [], [], '', false); $fixedHeader = [ 'my-header' => ['some header string'], 'fixed-only' => ['fixed header only'], ]; $userHeader = [ 'my-header' => ['some alternate string'], 'user-only' => ['user only header'], ]; $expectedHeader = [ 'my-header' => ['some alternate string'], 'fixed-only' => ['fixed header only'], 'user-only' => ['user only header'], ]; $handlerCalled = false; $callable = function(Call $call, $options) use ($expectedHeader, &$handlerCalled) { $this->assertEquals($expectedHeader, $options['headers']); $handlerCalled = true; }; $middleware = new FixedHeaderMiddleware($callable, $fixedHeader); $middleware($call, ['headers' => $userHeader]); $this->assertTrue($handlerCalled); } public function testCustomHeaderOverride() { $call = $this->getMock(Call::class, [], [], '', false); $fixedHeader = [ 'my-header' => ['some header string'], 'fixed-only' => ['fixed header only'], ]; $userHeader = [ 'my-header' => ['some alternate string'], 'user-only' => ['user only header'], ]; $expectedHeader = [ 'my-header' => ['some header string'], 'fixed-only' => ['fixed header only'], 'user-only' => ['user only header'], ]; $handlerCalled = false; $callable = function(Call $call, $options) use ($expectedHeader, &$handlerCalled) { $this->assertEquals($expectedHeader, $options['headers']); $handlerCalled = true; }; $middleware = new FixedHeaderMiddleware($callable, $fixedHeader, true); $middleware($call, ['headers' => $userHeader]); $this->assertTrue($handlerCalled); } } tests/ApiCore/Tests/Unit/Middleware/RetryMiddlewareTest.php000064400000015016151742741630020017 0ustar00getMock(Call::class, [], [], '', false); $retrySettings = RetrySettings::constructDefault() ->with([ 'retriesEnabled' => false, 'retryableCodes' => [] ]); $callCount = 0; $handler = function(Call $call, $options) use (&$callCount) { return new Promise(function () use (&$callCount) { throw new ApiException('Call Count: ' . $callCount += 1, 0, ''); }); }; $middleware = new RetryMiddleware($handler, $retrySettings); $response = $middleware( $call, [] )->wait(); } public function testRetryBackoff() { $call = $this->getMock(Call::class, [], [], '', false); $retrySettings = RetrySettings::constructDefault() ->with([ 'retriesEnabled' => true, 'retryableCodes' => [ApiStatus::CANCELLED], ]); $callCount = 0; $handler = function(Call $call, $options) use (&$callCount) { $callCount += 1; return $promise = new Promise(function () use (&$promise, $callCount) { if ($callCount < 3) { throw new ApiException('Cancelled!', Code::CANCELLED, ApiStatus::CANCELLED); } $promise->resolve('Ok!'); }); }; $middleware = new RetryMiddleware($handler, $retrySettings); $response = $middleware( $call, [] )->wait(); $this->assertEquals('Ok!', $response); $this->assertEquals(3, $callCount); } /** * @expectedException Google\ApiCore\ApiException * @expectedExceptionMessage Retry total timeout exceeded. */ public function testRetryTimeoutExceedsMaxTimeout() { $call = $this->getMock(Call::class, [], [], '', false); $retrySettings = RetrySettings::constructDefault() ->with([ 'retriesEnabled' => true, 'retryableCodes' => [ApiStatus::CANCELLED], 'totalTimeoutMillis' => 0, ]); $handler = function(Call $call, $options) { return new Promise(function () { throw new ApiException('Cancelled!', Code::CANCELLED, ApiStatus::CANCELLED); }); }; $middleware = new RetryMiddleware($handler, $retrySettings); $response = $middleware( $call, [] )->wait(); } /** * @expectedException Google\ApiCore\ApiException * @expectedExceptionMessage Retry total timeout exceeded. */ public function testRetryTimeoutExceedsRealTime() { $call = $this->getMock(Call::class, [], [], '', false); $retrySettings = RetrySettings::constructDefault() ->with([ 'retriesEnabled' => true, 'retryableCodes' => [ApiStatus::CANCELLED], 'initialRpcTimeoutMillis' => 500, 'totalTimeoutMillis' => 1000, ]); $handler = function(Call $call, $options) { return new Promise(function () use ($options) { // sleep for the duration of the timeout if (isset($options['timeoutMillis'])) { usleep($options['timeoutMillis'] * 1000); } throw new ApiException('Cancelled!', Code::CANCELLED, ApiStatus::CANCELLED); }); }; $middleware = new RetryMiddleware($handler, $retrySettings); $response = $middleware( $call, [] )->wait(); } public function testTimeoutMillisCallSettingsOverwrite() { $handlerCalled = false; $timeout = 1234; $handler = function (Call $call, array $options) use (&$handlerCalled, $timeout) { $handlerCalled = true; $this->assertEquals($timeout, $options['timeoutMillis']); return $this->getMock(Promise::class); }; $retrySettings = RetrySettings::constructDefault() ->with([ 'retriesEnabled' => true, 'retryableCodes' => [ApiStatus::CANCELLED], ]); $middleware = new RetryMiddleware($handler, $retrySettings); $call = $this->getMock(Call::class, [], [], '', false); $options = ['timeoutMillis' => $timeout]; $middleware($call, $options); $this->assertTrue($handlerCalled); } } tests/ApiCore/Tests/Unit/MyMessage.php000064400000001310151742741630013661 0ustar00google.apicore.tests.unit.MyMessage */ class MyMessage extends \Google\Protobuf\Internal\Message { /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * } */ public function __construct($data = NULL) { \GPBMetadata\Google\ApiCore\Tests\Unit\Example::initOnce(); parent::__construct($data); } } tests/ApiCore/Tests/Unit/OperationResponseTest.php000064400000021513151742741630016315 0ustar00createOperationsClient(); $op = new OperationResponse($opName, $opClient); $this->assertSame($opName, $op->getName()); $this->assertSame($opClient, $op->getOperationsClient()); } public function testWithoutResponse() { $opName = 'operations/opname'; $opClient = $this->createOperationsClient(); $op = new OperationResponse($opName, $opClient); $this->assertNull($op->getLastProtoResponse()); $this->assertFalse($op->isDone()); $this->assertNull($op->getResult()); $this->assertNull($op->getError()); $this->assertNull($op->getMetadata()); $this->assertFalse($op->operationSucceeded()); $this->assertFalse($op->operationFailed()); $this->assertEquals([ 'operationReturnType' => null, 'metadataReturnType' => null, 'initialPollDelayMillis' => 1000.0, 'pollDelayMultiplier' => 2.0, 'maxPollDelayMillis' => 60000.0, 'totalPollTimeoutMillis' => 0.0, ], $op->getDescriptorOptions()); } public function testWithResponse() { $opName = 'operations/opname'; $opClient = $this->createOperationsClient(); $protoResponse = new Operation(); $op = new OperationResponse($opName, $opClient, [ 'lastProtoResponse' => $protoResponse, ]); $this->assertSame($protoResponse, $op->getLastProtoResponse()); $this->assertFalse($op->isDone()); $this->assertNull($op->getResult()); $this->assertNull($op->getError()); $this->assertNull($op->getMetadata()); $this->assertFalse($op->operationSucceeded()); $this->assertFalse($op->operationFailed()); $this->assertEquals([ 'operationReturnType' => null, 'metadataReturnType' => null, 'initialPollDelayMillis' => 1000.0, 'pollDelayMultiplier' => 2.0, 'maxPollDelayMillis' => 60000.0, 'totalPollTimeoutMillis' => 0.0, ], $op->getDescriptorOptions()); $response = $this->createAny($this->createStatus(0, "response")); $error = $this->createStatus(2, "error"); $metadata = $this->createAny($this->createStatus(0, "metadata")); $protoResponse->setDone(true); $protoResponse->setResponse($response); $protoResponse->setMetadata($metadata); $this->assertTrue($op->isDone()); $this->assertSame($response, $op->getResult()); $this->assertSame($metadata, $op->getMetadata()); $this->assertTrue($op->operationSucceeded()); $this->assertFalse($op->operationFailed()); $protoResponse->setError($error); $this->assertNull($op->getResult()); $this->assertSame($error, $op->getError()); $this->assertFalse($op->operationSucceeded()); $this->assertTrue($op->operationFailed()); } public function testWithOptions() { $opName = 'operations/opname'; $opClient = $this->createOperationsClient(); $protoResponse = new Operation(); $op = new OperationResponse($opName, $opClient, [ 'operationReturnType' => '\Google\Rpc\Status', 'metadataReturnType' => '\Google\Protobuf\Any', 'lastProtoResponse' => $protoResponse, ]); $this->assertSame($protoResponse, $op->getLastProtoResponse()); $this->assertFalse($op->isDone()); $this->assertNull($op->getResult()); $this->assertNull($op->getError()); $this->assertNull($op->getMetadata()); $this->assertEquals([ 'operationReturnType' => '\Google\Rpc\Status', 'metadataReturnType' => '\Google\Protobuf\Any', 'initialPollDelayMillis' => 1000.0, 'pollDelayMultiplier' => 2.0, 'maxPollDelayMillis' => 60000.0, 'totalPollTimeoutMillis' => 0.0, ], $op->getDescriptorOptions()); $innerResponse = $this->createStatus(0, "response"); $innerMetadata = new Any(); $innerMetadata->setValue("metadata"); $response = $this->createAny($innerResponse); $metadata = $this->createAny($innerMetadata); $protoResponse->setDone(true); $protoResponse->setResponse($response); $protoResponse->setMetadata($metadata); $this->assertTrue($op->isDone()); $this->assertEquals($innerResponse, $op->getResult()); $this->assertEquals($innerMetadata, $op->getMetadata()); } /** * @dataProvider pollingDataProvider */ public function testPolling($op, $pollArgs, $expectedSleeps, $expectedComplete) { $op->pollUntilComplete($pollArgs); $this->assertEquals($op->isDone(), $expectedComplete); $this->assertEquals($op->getSleeps(), $expectedSleeps); } public function pollingDataProvider() { $pollingArgs = [ 'initialPollDelayMillis' => 10.0, 'pollDelayMultiplier' => 3.0, 'maxPollDelayMillis' => 50.0, 'totalPollTimeoutMillis' => 100.0, ]; return [ [$this->createOperationResponse([], 3), [], [1000.0, 2000.0, 4000.0], true], // Defaults [$this->createOperationResponse([], 3), $pollingArgs, [10, 30, 50], true], // Args to pollUntilComplete [$this->createOperationResponse($pollingArgs, 3), [], [10, 30, 50], true], // Args to constructor [$this->createOperationResponse([], 4), [ 'totalPollTimeoutMillis' => 80.0, ] + $pollingArgs, [10, 30, 50], false], // Polling timeout ]; } private function createOperationResponse($options, $reloadCount) { $opName = 'operations/opname'; return new FakeOperationResponse($opName, $this->createOperationClient($reloadCount), $options); } private function createOperationClient($reloadCount) { $opClient = $this->getMock( OperationsClient::class, ['getOperation'], [[ 'serviceAddress' => '', 'scopes' => [], ]] ); for ($i = 0; $i < $reloadCount - 1; $i++) { $opClient->expects($this->at($i)) ->method('getOperation') ->willReturn(new Operation()); } $opClient->expects($this->at($reloadCount - 1)) ->method('getOperation') ->willReturn((new Operation())->setDone(true)); return $opClient; } } class FakeOperationResponse extends OperationResponse { private $currentTime = 0; public function getSleeps() { return $this->sleeps; } public function sleepMillis($millis) { $this->currentTime += $millis; $this->sleeps[] = $millis; } public function setTimes($times) { $this->times = $times; } public function getCurrentTimeMillis() { return $this->currentTime; } } tests/ApiCore/Tests/Unit/PageStreamingDescriptorTest.php000064400000004141151742741630017421 0ustar00 'getNextPageToken', // Missing field // 'responsePageTokenField' => 'getNextPageToken', 'resourceField' => 'getResourcesList' ]); } } tests/ApiCore/Tests/Unit/PageTest.php000064400000012031151742741630013505 0ustar00createMockRequest('token'); $pageStreamingDescriptor = PageStreamingDescriptor::createFromFields([ 'requestPageTokenField' => 'pageToken', 'responsePageTokenField' => 'nextPageToken', 'resourceField' => 'resourcesList' ]); $internalCall = $this->createCallWithResponseSequence($responseSequence); $callable = function () use ($internalCall) { list($response, $status) = call_user_func_array( array($internalCall, 'takeAction'), func_get_args() ); return $promise = new \GuzzleHttp\Promise\Promise(function () use (&$promise, $response) { $promise->resolve($response); }); }; $call = new Call('method', [], $mockRequest); $options = []; $response = $callable($call, $options)->wait(); return new Page($call, $options, $callable, $pageStreamingDescriptor, $response); } public function testNextPageMethods() { $responseA = $this->createMockResponse('nextPageToken1', ['resource1']); $responseB = $this->createMockResponse('', ['resource2']); $page = $this->createPage([ [$responseA, new MockStatus(Code::OK, '')], [$responseB, new MockStatus(Code::OK, '')], ]); $this->assertEquals($page->hasNextPage(), true); $this->assertEquals($page->getNextPageToken(), 'nextPageToken1'); $nextPage = $page->getNextPage(); $this->assertEquals($nextPage->hasNextPage(), false); $this->assertEquals($nextPage->getNextPageToken(), ''); } /** * @expectedException \Google\ApiCore\ValidationException * @expectedExceptionMessage Could not complete getNextPage operation */ public function testNextPageMethodsFailWithNoNextPage() { $responseA = $this->createMockResponse('', ['resource1']); $page = $this->createPage([ [$responseA, new MockStatus(Code::OK, '')], ]); $this->assertEquals($page->hasNextPage(), false); $page->getNextPage(); } /** * @expectedException \Google\ApiCore\ValidationException * @expectedExceptionMessage pageSize argument was defined, but the method does not */ public function testNextPageMethodsFailWithPageSizeUnsupported() { $responseA = $this->createMockResponse('nextPageToken1', ['resource1']); $responseB = $this->createMockResponse('', ['resource2']); $page = $this->createPage([ [$responseA, new MockStatus(Code::OK, '')], [$responseB, new MockStatus(Code::OK, '')], ]); $page->getNextPage(3); } public function testPageElementMethods() { $response = $this->createMockResponse( 'nextPageToken1', ['resource1', 'resource2', 'resource3'] ); $page = $this->createPage([ [$response, new MockStatus(Code::OK, '')], ]); $this->assertEquals($page->getPageElementCount(), 3); $results = iterator_to_array($page); $this->assertEquals($results, ['resource1', 'resource2', 'resource3']); } } tests/ApiCore/Tests/Unit/PagedListResponseTest.php000064400000005742151742741630016237 0ustar00createMockRequest('mockToken'); $mockResponse = $this->createMockResponse('nextPageToken1', ['resource1']); $pageStreamingDescriptor = PageStreamingDescriptor::createFromFields([ 'requestPageTokenField' => 'pageToken', 'responsePageTokenField' => 'nextPageToken', 'resourceField' => 'resourcesList' ]); $callable = function () use ($mockResponse) { return $promise = new \GuzzleHttp\Promise\Promise(function () use (&$promise, $mockResponse) { $promise->resolve($mockResponse); }); }; $call = new Call('method', [], $mockRequest); $options = []; $response = $callable($call, $options)->wait(); $page = new Page($call, $options, $callable, $pageStreamingDescriptor, $response); $pageAccessor = new PagedListResponse($page); $page = $pageAccessor->getPage(); $this->assertEquals($page->getNextPageToken(), 'nextPageToken1'); $this->assertEquals(iterator_to_array($page->getIterator()), ['resource1']); } } tests/ApiCore/Tests/Unit/PathTemplateTest.php000064400000021776151742741630015241 0ustar00match('hello'); } /** * @expectedException \Google\ApiCore\ValidationException * @expectedExceptionMessage Could not match path */ public function testFailWhenImpossibleMatch02() { $template = new PathTemplate('hello/world'); $template->match('hello/world/fail'); } /** * @expectedException \Google\ApiCore\ValidationException * @expectedExceptionMessage Could not match path */ public function testFailMismatchedLiteral() { $template = new PathTemplate('hello/world'); $template->match('hello/world2'); } /** * @expectedException \Google\ApiCore\ValidationException * @expectedExceptionMessage Cannot parse */ public function testFailWhenMultiplePathWildcards() { new PathTemplate('buckets/*/**/**/objects/*'); } /** * @expectedException \Google\ApiCore\ValidationException * @expectedExceptionMessage Unexpected '{' */ public function testFailIfInnerBinding() { new PathTemplate('buckets/{hello={world}}'); } /** * @expectedException \Google\ApiCore\ValidationException * @expectedExceptionMessage Expected '}' */ public function testFailUnexpectedEof() { new PathTemplate('a/{hello=world'); } /** * @expectedException \Google\ApiCore\ValidationException * @expectedExceptionMessage Cannot construct PathTemplate from empty string */ public function testFailNullString() { new PathTemplate(null); } /** * @expectedException \Google\ApiCore\ValidationException * @expectedExceptionMessage Cannot construct PathTemplate from empty string */ public function testFailEmptyString() { new PathTemplate(""); } public function testMatchAtomicResourceName() { $template = new PathTemplate('buckets/*/*/objects/*'); $this->assertEquals( ['$0' => 'f', '$1' => 'o', '$2' => 'bar'], $template->match('buckets/f/o/objects/bar') ); $template = new PathTemplate('/buckets/{hello}'); $this->assertEquals( ['hello' => 'world'], $template->match('/buckets/world') ); $template = new PathTemplate('/buckets/{hello=*}'); $this->assertEquals( ['hello' => 'world'], $template->match('/buckets/world') ); } public function testMatchEscapedChars() { $template = new PathTemplate('buckets/*/objects'); $this->assertEquals( ['$0' => 'hello%2F%2Bworld'], $template->match('buckets/hello%2F%2Bworld/objects') ); } /** * @expectedException \Google\ApiCore\ValidationException */ public function testFailMatchWildcardWithColonInMiddle() { new PathTemplate('/buckets/*:action/objects'); } public function testMatchWildcardWithColon() { $template = new PathTemplate('/buckets/*:action'); $this->assertEquals( ['$0' => 'foo'], $template->match('/buckets/foo:action') ); } public function testMatchColonInWildcardAndTemplate() { $template = new PathTemplate('/buckets/*/*/*/objects/*:action'); $url = $template->render( ['$0' => 'f', '$1' => 'o', '$2' => 'o', '$3' => 'google.com:a-b'] ); $this->assertEquals($url, '/buckets/f/o/o/objects/google.com:a-b:action'); } public function testMatchUnboundedWildcardWithColon() { $template = new PathTemplate('/buckets/*/objects/**:action'); $this->assertEquals( ['$0' => 'foo', '$1' => 'bar/baz'], $template->match('/buckets/foo/objects/bar/baz:action') ); } /** * @expectedException \Google\ApiCore\ValidationException */ public function testFailMatchUnboundedWildcardWithColonInMiddle() { new PathTemplate('/buckets/*/objects/**:action/path'); } public function testMatchTemplateWithUnboundedWildcard() { $template = new PathTemplate('buckets/*/objects/**'); $this->assertEquals( ['$0' => 'foo', '$1' => 'bar/baz'], $template->match('buckets/foo/objects/bar/baz') ); } public function testMatchWithUnboundInMiddle() { $template = new PathTemplate('bar/**/foo/*'); $this->assertEquals( ['$0' => 'foo/foo', '$1' => 'bar'], $template->match('bar/foo/foo/foo/bar') ); } public function testRenderAtomicResource() { $template = new PathTemplate('buckets/*/*/*/objects/*'); $url = $template->render( ['$0' => 'f', '$1' => 'o', '$2' => 'o', '$3' => 'google.com:a-b'] ); $this->assertEquals($url, 'buckets/f/o/o/objects/google.com:a-b'); } /** * @expectedException \Google\ApiCore\ValidationException * @expectedExceptionMessage Rendering error */ public function testRenderFailWhenTooFewVariables() { $template = new PathTemplate('buckets/*/*/*/objects/*'); $template->render(['$0' => 'f', '$1' => 'l', '$2' => 'o']); } public function testRenderWithUnboundInMiddle() { $template = new PathTemplate('bar/**/foo/*'); $url = $template->render(['$0' => '1/2', '$1' => '3']); $this->assertEquals($url, 'bar/1/2/foo/3'); } public function testToString() { $template = new PathTemplate('bar/**/foo/*'); $this->assertEquals((string) $template, 'bar/**/foo/*'); $template = new PathTemplate('buckets/*/objects/*'); $this->assertEquals( (string) ($template), 'buckets/*/objects/*' ); $template = new PathTemplate('/buckets/{hello}'); $this->assertEquals((string) ($template), '/buckets/{hello=*}'); $template = new PathTemplate('/buckets/{hello=what}/{world}'); $this->assertEquals( (string) ($template), '/buckets/{hello=what}/{world=*}' ); $template = new PathTemplate('/buckets/helloazAZ09-.~_what'); $this->assertEquals( (string) ($template), '/buckets/helloazAZ09-.~_what' ); } public function testSubstitutionOddChars() { $template = new PathTemplate('projects/{project}/topics/{topic}'); $url = $template->render( ['project' => 'google.com:proj-test', 'topic' => 'some-topic'] ); $this->assertEquals( $url, 'projects/google.com:proj-test/topics/some-topic' ); $template = new PathTemplate('projects/{project}/topics/{topic}'); $url = $template->render( ['project' => 'g.,;:~`!@#$%^&()+-', 'topic' => 'sdf<>,.?[]'] ); $this->assertEquals( $url, 'projects/g.,;:~`!@#$%^&()+-/topics/sdf<>,.?[]' ); } } tests/ApiCore/Tests/Unit/ProtobufBandaidTest.php000064400000002157151742741630015704 0ustar00assertEquals($expected, $actual); } public function protobufMessageProvider() { $msg1 = new MyMessage(); $msg2 = new Mymessage(); return [ [$msg1, $msg2], [[$msg1, $msg2], [$msg1, $msg2]] ]; } } tests/ApiCore/Tests/Unit/ProtobufExtensionTest.php000064400000004164151742741630016336 0ustar00markTestSkipped('Must have the protobuf extension installed to run this test.'); } } public function testForProtobufExtension() { // This test should always pass - we have it here so that we can determine whether the // protobuf extension is installed, based on whether this test passes or is skipped $this->assertTrue(true); } } tests/ApiCore/Tests/Unit/RequestBuilderTest.php000064400000022700151742741630015574 0ustar00builder = new RequestBuilder( 'www.example.com', __DIR__ . '/testdata/test_service_rest_client_config.php' ); } public function testMethodWithUrlPlaceholder() { $message = new MockRequestBody(); $message->setName('message/foo'); $request = $this->builder->build(self::SERVICE_NAME . '/MethodWithUrlPlaceholder', $message); $uri = $request->getUri(); $this->assertEquals('/v1/message/foo', $uri->getPath()); $this->assertEquals('number=0', $uri->getQuery()); $this->assertEquals('', (string) $request->getBody()); } public function testMethodWithBody() { $message = new MockRequestBody(); $message->setName('message/foo'); $nestedMessage = new MockRequestBody(); $nestedMessage->setName('nested/foo'); $message->setNestedMessage($nestedMessage); $request = $this->builder->build(self::SERVICE_NAME . '/MethodWithBody', $message); $uri = $request->getUri(); $this->assertEquals('/v1/message/foo', $uri->getPath()); $this->assertEquals('', $uri->getQuery()); $this->assertEquals( ['name' => 'message/foo', 'nestedMessage' => ['name' => 'nested/foo']], json_decode($request->getBody(), true) ); } public function testMethodWithNestedMessageAsBody() { $message = new MockRequestBody(); $message->setName('message/foo'); $nestedMessage = new MockRequestBody(); $nestedMessage->setName('nested/foo'); $message->setNestedMessage($nestedMessage); $request = $this->builder->build(self::SERVICE_NAME . '/MethodWithNestedMessageAsBody', $message); $uri = $request->getUri(); $this->assertEquals('/v1/message/foo', $uri->getPath()); $this->assertEquals('number=0', $uri->getQuery()); $this->assertEquals( ['name' => 'nested/foo'], json_decode($request->getBody(), true) ); } public function testMethodWithNestedUrlPlaceholder() { $message = new MockRequestBody(); $message->setName('message/foo'); $nestedMessage = new MockRequestBody(); $nestedMessage->setName('nested/foo'); $message->setNestedMessage($nestedMessage); $request = $this->builder->build(self::SERVICE_NAME . '/MethodWithNestedUrlPlaceholder', $message); $uri = $request->getUri(); $this->assertEquals('/v1/nested/foo', $uri->getPath()); $this->assertEquals('', $uri->getQuery()); $this->assertEquals( ['name' => 'message/foo', 'nestedMessage' => ['name' => 'nested/foo']], json_decode($request->getBody(), true) ); } public function testMethodWithUrlRepeatedField() { $message = new MockRequestBody(); $message->setName('message/foo'); $message->setRepeatedField(['bar1', 'bar2']); $request = $this->builder->build(self::SERVICE_NAME . '/MethodWithUrlPlaceholder', $message); $uri = $request->getUri(); $this->assertEquals('/v1/message/foo', $uri->getPath()); $this->assertEquals('number=0&repeated_field=bar1&repeated_field=bar2', $uri->getQuery()); $this->assertEquals('', (string) $request->getBody()); } public function testMethodWithHeaders() { $message = new MockRequestBody(); $message->setName('message/foo'); $request = $this->builder->build(self::SERVICE_NAME . '/MethodWithUrlPlaceholder', $message, [ 'header1' => 'value1', 'header2' => 'value2'] ); $this->assertEquals('value1', $request->getHeaderLine('header1')); $this->assertEquals('value2', $request->getHeaderLine('header2')); $this->assertEquals('application/json', $request->getHeaderLine('Content-Type')); } public function testMethodWithColon() { $message = new MockRequestBody(); $message->setName('message/foo'); $request = $this->builder->build(self::SERVICE_NAME . '/MethodWithColonInUrl', $message); $uri = $request->getUri(); $this->assertEquals('/v1/message/foo:action', $uri->getPath()); $this->assertEquals('number=0', $uri->getQuery()); } public function testMethodWithMultipleWildcardsAndColonInUrl() { $message = new MockRequestBody(); $message->setName('message/foo'); $message->setNumber(10); $request = $this->builder->build( self::SERVICE_NAME . '/MethodWithMultipleWildcardsAndColonInUrl', $message ); $uri = $request->getUri(); $this->assertEquals('/v1/message/foo/number/10:action', $uri->getPath()); $this->assertEquals('', $uri->getQuery()); } public function testMethodWithSimplePlaceholder() { $message = new MockRequestBody(); $message->setName('message-name'); $request = $this->builder->build( self::SERVICE_NAME . '/MethodWithSimplePlaceholder', $message ); $uri = $request->getUri(); $this->assertEquals('/v1/message-name', $uri->getPath()); } public function testMethodWithAdditionalBindings() { $message = new MockRequestBody(); $message->setName('message/foo'); $request = $this->builder->build(self::SERVICE_NAME . '/MethodWithAdditionalBindings', $message); $this->assertEquals('/v1/message/foo/additional/bindings', $request->getUri()->getPath()); $message->setName('different/format/foo'); $request = $this->builder->build(self::SERVICE_NAME . '/MethodWithAdditionalBindings', $message); $this->assertEquals('/v1/different/format/foo/additional/bindings', $request->getUri()->getPath()); $nestedMessage = new MockRequestBody(); $nestedMessage->setName('nested/foo'); $message->setNestedMessage($nestedMessage); $request = $this->builder->build(self::SERVICE_NAME . '/MethodWithAdditionalBindings', $message); $this->assertEquals('/v2/nested/foo/additional/bindings', $request->getUri()->getPath()); } public function testMethodWithSpecialJsonMapping() { if (extension_loaded('protobuf')) { $this->markTestSkipped('This is currently broken for the protobuf extension'); } $stringValue = (new StringValue) ->setValue('some-value'); $fieldMask = (new FieldMask) ->setPaths(['path1', 'path2']); $message = (new MockRequestBody()) ->setStringValue($stringValue) ->setFieldMask($fieldMask); $request = $this->builder->build(self::SERVICE_NAME . '/MethodWithSpecialJsonMapping', $message); parse_str($request->getUri()->getQuery(), $query); $this->assertEquals('path1,path2', $query['field_mask']); $this->assertEquals('some-value', $query['string_value']); } public function testMethodWithoutPlaceholders() { if (extension_loaded('protobuf')) { $this->markTestSkipped('This is currently broken for the protobuf extension'); } $stringValue = (new StringValue) ->setValue('some-value'); $fieldMask = (new FieldMask) ->setPaths(['path1', 'path2']); $message = (new MockRequestBody()) ->setStringValue($stringValue) ->setFieldMask($fieldMask); $request = $this->builder->build(self::SERVICE_NAME . '/MethodWithoutPlaceholders', $message); parse_str($request->getUri()->getQuery(), $query); $this->assertEquals('path1,path2', $query['field_mask']); $this->assertEquals('some-value', $query['string_value']); } /** * @expectedException \Google\ApiCore\ValidationException * @expectedExceptionMessage Could not map bindings for test.interface.v1.api/MethodWithAdditionalBindings to any Uri template. */ public function testThrowsExceptionWithNonMatchingFormat() { $message = new MockRequestBody(); $message->setName('invalid/name/format'); $request = $this->builder->build(self::SERVICE_NAME . '/MethodWithAdditionalBindings', $message); } /** * @expectedException \Google\ApiCore\ValidationException * @expectedExceptionMessage Failed to build request, as the provided path (myResource/doesntExist) was not found in the configuration. */ public function testThrowsExceptionWithNonExistantMethod() { $message = new MockRequestBody(); $this->builder->build('myResource/doesntExist', $message); } } tests/ApiCore/Tests/Unit/RequestParamsHeaderDescriptorTest.php000064400000005457151742741630020613 0ustar00 ['']]; $agentHeaderDescriptor = new RequestParamsHeaderDescriptor([]); $header = $agentHeaderDescriptor->getHeader(); $this->assertEquals($expectedHeader, $header); } public function testSingleValue() { $expectedHeader = [RequestParamsHeaderDescriptor::HEADER_KEY => ['field1=value_1']]; $agentHeaderDescriptor = new RequestParamsHeaderDescriptor(['field1' => 'value_1']); $header = $agentHeaderDescriptor->getHeader(); $this->assertSame($expectedHeader, $header); } public function testMultipleValues() { $expectedHeader = [ RequestParamsHeaderDescriptor::HEADER_KEY => ['field1=value_1&field2.field3=value_2'] ]; $agentHeaderDescriptor = new RequestParamsHeaderDescriptor([ 'field1' => 'value_1', 'field2.field3' => 'value_2' ]); $header = $agentHeaderDescriptor->getHeader(); $this->assertSame($expectedHeader, $header); } }tests/ApiCore/Tests/Unit/ResourceTemplate/AbsoluteResourceTemplateTest.php000064400000023030151742741630023077 0ustar00assertEquals($expectedString ?: $path, $template->__toString()); } public function validPathProvider() { return [ ["/foo"], ["/*"], ["/**"], ["/{foo}", "/{foo=*}"], ["/{foo=*}"], ["/{foo=**}"], ["/foo/*"], ["/*/foo"], ["/foo/*:bar"], ["/*/foo:bar"], ["/*/*/*/*:foo"], ["/**/*/*:foo"], ["/foo/**/bar/*"], ["/foo/*/bar/**"], ["/foo/helloazAZ09-.~_what"], ]; } /** * @dataProvider invalidPathProvider * @expectedException \Google\ApiCore\ValidationException * @param string $path */ public function testInvalidPaths($path) { new AbsoluteResourceTemplate($path); } public function invalidPathProvider() { return [ [null], // Null path [""], // Empty path ["foo"], // No leading '/' ["/foo:bar/baz"], // Action containing '/' ["/foo:bar:baz"], // Multiple ':' ["/foo/bar*baz"], // Mixed literal and '*' ["/foo/**/**"], // Multiple '**' ["/foo/**/{var=**}"], // Multiple '**' nested ["/foo/{bizz=**}/{var=**}"],// Multiple '**' nested ["/foo/{bizz=**/**}"], // Multiple '**' nested ["/foo/{bar={baz}}"], // Nested {} ["/foo/{bar=fizz=buzz}"], // Multiple '=' in variable ["/foo/{bar"], // Unmatched '{' ["/foo/{bar}/{bar}"], // Duplicate variable key ["/foo/{bar/baz}"], // Variable containing '/' ]; } /** * @param string $pathTemplate * @param string $path * @param array $expectedBindings * @dataProvider matchData */ public function testMatch($pathTemplate, $path, $expectedBindings) { $template = new AbsoluteResourceTemplate($pathTemplate); $this->assertEquals( $expectedBindings, $template->match($path) ); } /** * @param string $pathTemplate * @param string $path * @dataProvider matchData */ public function testMatches($pathTemplate, $path) { $template = new AbsoluteResourceTemplate($pathTemplate); $this->assertTrue($template->matches($path)); } /** * @param string $pathTemplate * @param string $expectedPath * @param array $bindings * @dataProvider matchData */ public function testRender($pathTemplate, $expectedPath, $bindings) { $template = new AbsoluteResourceTemplate($pathTemplate); $this->assertEquals($expectedPath, $template->render($bindings)); } public function matchData() { return [ [ '/buckets/*/*/objects/*', '/buckets/f/o/objects/bar', ['$0' => 'f', '$1' => 'o', '$2' => 'bar'], ], [ '/buckets/{hello}', '/buckets/world', ['hello' => 'world'], ], [ '/buckets/{hello=*}', '/buckets/world', ['hello' => 'world'], ], [ '/buckets/*:action', '/buckets/foo:action', ['$0' => 'foo'], ], [ '/buckets/*/*/*/objects/*:action', '/buckets/f/o/o/objects/google.com:a-b:action', ['$0' => 'f', '$1' => 'o', '$2' => 'o', '$3' => 'google.com:a-b'], ], [ '/buckets/*/objects/**:action', '/buckets/foo/objects/bar/baz:action', ['$0' => 'foo', '$1' => 'bar/baz'], ], [ '/foo/*/{bar=*/rar/*}/**/*:action', '/foo/fizz/fuzz/rar/bar/bizz/buzz/baz:action', ['$0' => 'fizz', '$1' => 'bizz/buzz', '$2' => 'baz', 'bar' => 'fuzz/rar/bar'], ], [ '/buckets/*', '/buckets/{}!@#$%^&*()+=[]\|`~-_', ['$0' => '{}!@#$%^&*()+=[]\|`~-_'], ], ]; } /** * @param string $pathTemplate * @param string $path * @dataProvider invalidMatchData * @expectedException \Google\ApiCore\ValidationException */ public function testFailMatch($pathTemplate, $path) { $template = new AbsoluteResourceTemplate($pathTemplate); $template->match($path); } /** * @param string $pathTemplate * @param string $path * @dataProvider invalidMatchData */ public function testFailMatches($pathTemplate, $path) { $template = new AbsoluteResourceTemplate($pathTemplate); $this->assertFalse($template->matches($path)); } public function invalidMatchData() { return [ [ '/buckets/*/*/objects/*', '/buckets/f/o/objects/bar/far', // Extra '/far' ], [ '/buckets/*/*/objects/*', '/buckets/f/o/objects', // Missing final wildcard ], [ '/foo/*/bar', '/foo/bar', // Missing middle wildcard ], [ '/foo/*/bar', '/foo/fizz/buzz/bar', // Too many segments for middle wildcard ], [ '/foo/**/bar', '/foo/bar', // Missing middle wildcard ], [ '/buckets/*:action', '/buckets/foo', // Missing action ], [ '/buckets/*:action', '/buckets/foo:actingout', // Wrong action ], [ '/buckets/*:action', '/buckets/foo:actionstations', // Wrong action ], [ '/buckets', '/bouquets', // Wrong literal ], [ '/buckets', '/bucketseller', // Wrong literal ], [ '/foo/*/{bar=*/rar/*}/**/*:action', '/foo/fizz/fuzz/rat/bar/bizz/buzz/baz:action', ], ]; } /** * @param string $pathTemplate * @param array $bindings * @dataProvider invalidRenderData * @expectedException \Google\ApiCore\ValidationException */ public function testFailRender($pathTemplate, $bindings) { $template = new AbsoluteResourceTemplate($pathTemplate); $template->render($bindings); } public function invalidRenderData() { return [ [ '/buckets/*/*/objects/*', ['$0' => 'f', '$2' => 'bar'], // Missing key ], [ '/buckets/{hello}', ['hellop' => 'world'], // Wrong key ], [ '/buckets/{hello=*}', ['hello' => 'world/weary'], // Invalid binding ], [ '/buckets/{hello=*}', ['hello' => ''], // Invalid binding ], [ '/buckets/*/objects/**:action', ['$0' => 'foo', '$1' => ''], // Invalid binding ], [ '/foo/*/{bar=*/rar/*}/**/*:action', ['$0' => 'fizz', '$1' => 'bizz/buzz', '$2' => 'baz', 'bar' => 'fuzz/rat/bar'], // Invalid binding ], ]; } } tests/ApiCore/Tests/Unit/ResourceTemplate/ParserTest.php000064400000023375151742741630017365 0ustar00assertEquals($expectedSegments, $actualSegments); } public function validPathProvider() { $singlePathTests = [ ["foo", [self::literalSegment("foo")]], ["helloazAZ09-.~_what", [self::literalSegment("helloazAZ09-.~_what")]], ["*", [self::wildcardSegment()]], ["**", [self::doubleWildcardSegment()]], ["{foo}", Parser::parseSegments("{foo=*}")], ["{foo=*}", [self::variableSegment("foo", new RelativeResourceTemplate("*"))]], ["{foo=**}", [self::variableSegment("foo", new RelativeResourceTemplate("**"))]], ]; $comboPathPieces = [ ["foo", [self::literalSegment("foo")]], ["helloazAZ09-.~_what", [self::literalSegment("helloazAZ09-.~_what")]], ["*", [self::wildcardSegment()]], ["*", [self::wildcardSegment()]], ["**", [self::doubleWildcardSegment()]], ]; // Combine the pieces in $comboPathPieces in every possible order $comboPathTests = []; foreach (self::yieldAllSequences($comboPathPieces) as $comboSequence) { $pathPieces = []; $segments = []; foreach ($comboSequence as list($path, $segmentArray)) { $pathPieces[] = $path; $segments = array_merge($segments, $segmentArray); } $comboPathTests[] = [implode('/', $pathPieces), $segments]; } return $singlePathTests + $comboPathTests; } /** * @dataProvider sequenceProvider * @param $sequence * @param $expectedSequences */ public function testYieldAllSequences($sequence, $expectedSequences) { $actual = iterator_to_array(self::yieldAllSequences($sequence)); $this->assertEquals($expectedSequences, $actual); } public function sequenceProvider() { return [ [['a'], [['a']]], [['a', 'b'], [ ['a'], ['a', 'b'], ['b'], ['b', 'a'], ]], [['a', 'b', 'c'], [ ['a'], ['a', 'b'], ['a', 'b', 'c'], ['a', 'c'], ['a', 'c', 'b'], ['b'], ['b', 'a'], ['b', 'a', 'c'], ['b', 'c'], ['b', 'c', 'a'], ['c'], ['c', 'a'], ['c', 'a', 'b'], ['c', 'b'], ['c', 'b', 'a'], ]], ]; } private static function yieldAllSequences($items) { $keys = array_keys($items); foreach ($keys as $key) { $itemsCopy = $items; $value = $itemsCopy[$key]; yield [$value]; unset($itemsCopy[$key]); foreach (self::yieldAllSequences($itemsCopy) as $subsequence) { yield array_merge([$value], $subsequence); } } } /** * @dataProvider invalidPathProvider * @expectedException \Google\ApiCore\ValidationException * @param string $path */ public function testParseInvalid($path) { Parser::parseSegments($path); } public function invalidPathProvider() { return [ [null], // Null path [""], // Empty path ["/foo"], // Leading '/' ["foo:bar"], // Contains ':' ["foo{barbaz"], // Contains '{' ["foo}barbaz"], // Contains '}' ["foo{bar}baz"], // Contains '{' and '}' ["{}"], // Empty var ["{foo#bar}"], // Invalid var ["{foo.bar=baz"], // Unbalanced '{' ["{foo.bar=baz=fizz}"], // Multiple '=' in variable ["{foo.bar=**/**}"], // Invalid resource template ]; } /** * @param string $literal * @dataProvider validLiterals */ public function testIsValidLiteral($literal) { $this->assertTrue($this->invokeStaticMethod(Parser::class, 'isValidLiteral', [$literal])); } public function validLiterals() { return [ ["foo"], ["helloazAZ09-.~_what"], ["5"], ["5five"], ]; } /** * @param string $literal * @dataProvider invalidLiterals */ public function testFailIsValidLiteral($literal) { $this->assertFalse($this->invokeStaticMethod(Parser::class, 'isValidLiteral', [$literal])); } public function invalidLiterals() { return [ [null], [""], ["fo\$o"], ["fo{o"], ["fo}o"], ["fo/o"], ["fo#o"], ["fo%o"], ["fo\\o"], ]; } /** * @param string $binding * @dataProvider validBindings */ public function testIsValidBinding($binding) { $this->assertTrue($this->invokeStaticMethod(Segment::class, 'isValidBinding', [$binding])); } public function validBindings() { return array_merge( $this->validLiterals(), [ ["fo#o"], ["fo%o"], ["fo!o"], ["fo@o"], ["fo#o"], ["fo\$o"], ["fo%o"], ["fo^o"], ["fo&o"], ["fo*o"], ["fo(o"], ["fo)o"], ["fo{o"], ["fo}o"], ["fo+o"], ["fo=o"], ] ); } /** * @param string $binding * @dataProvider invalidBindings */ public function testFailIsValidBinding($binding) { $this->assertFalse($this->invokeStaticMethod(Segment::class, 'isValidBinding', [$binding])); } public function invalidBindings() { return [ [null], [""], ["fo/o"], ]; } /** * @param string $binding * @dataProvider validDoubleWildcardBindings */ public function testIsValidDoubleWildcardBinding($binding) { $this->assertTrue($this->invokeStaticMethod(Segment::class, 'isValidDoubleWildcardBinding', [$binding])); } public function validDoubleWildcardBindings() { return array_merge( $this->validBindings(), [ ["fo/o"] ] ); } /** * @param string $binding * @dataProvider invalidDoubleWildcardBindings */ public function testFailIsValidDoubleWildcardBinding($binding) { $this->assertFalse($this->invokeStaticMethod(Segment::class, 'isValidDoubleWildcardBinding', [$binding])); } public function invalidDoubleWildcardBindings() { return [ [null], [""], ]; } private function invokeStaticMethod($class, $methodName, array $parameters) { $reflection = new \ReflectionClass($class); $method = $reflection->getMethod($methodName); $method->setAccessible(true); return $method->invokeArgs(null, $parameters); } } tests/ApiCore/Tests/Unit/ResourceTemplate/RelativeResourceTemplateTest.php000064400000022120151742741630023073 0ustar00assertEquals($expectedString ?: $path, $template->__toString()); } public function validPathProvider() { return [ ["foo"], ["5"], ["5five/4/four"], ["*"], ["**"], ["{foo}", "{foo=*}"], ["{foo=*}"], ["{foo=**}"], ["foo/*"], ["*/foo"], ["*/*/*/*"], ["**/*/*"], ["foo/**/bar/*"], ["foo/*/bar/**"], ["foo/helloazAZ09-.~_what"], ]; } /** * @dataProvider invalidPathProvider * @expectedException \Google\ApiCore\ValidationException * @param string $path */ public function testInvalidPaths($path) { new RelativeResourceTemplate($path); } public function invalidPathProvider() { return [ [null], // Null path [""], // Empty path ["foo:bar/baz"], // Action containing '/' ["foo:bar:baz"], // Multiple ':' ["foo/bar*baz"], // Mixed literal and '*' ["foo/**/**"], // Multiple '**' ["foo/**/{var=**}"], // Multiple '**' nested ["foo/{bizz=**}/{var=**}"],// Multiple '**' nested ["foo/{bizz=**/**}"], // Multiple '**' nested ["foo/{bar={baz}}"], // Nested {} ["foo/{bar=fizz=buzz}"], // Multiple '=' in variable ["foo/{bar"], // Unmatched '{' ["foo/{bar}/{bar}"], // Duplicate variable key ["foo/{bar/baz}"], // Variable containing '/' ]; } /** * @param string $pathTemplate * @param string $path * @param array $expectedBindings * @dataProvider matchData */ public function testMatch($pathTemplate, $path, $expectedBindings) { $template = new RelativeResourceTemplate($pathTemplate); $this->assertEquals( $expectedBindings, $template->match($path) ); } /** * @param string $pathTemplate * @param string $path * @dataProvider matchData */ public function testMatches($pathTemplate, $path) { $template = new RelativeResourceTemplate($pathTemplate); $this->assertTrue($template->matches($path)); } /** * @param string $pathTemplate * @param string $expectedPath * @param array $bindings * @dataProvider matchData */ public function testRender($pathTemplate, $expectedPath, $bindings) { $template = new RelativeResourceTemplate($pathTemplate); $this->assertEquals($expectedPath, $template->render($bindings)); } public function matchData() { return [ [ 'buckets/*/*/objects/*', 'buckets/f/o/objects/bar', ['$0' => 'f', '$1' => 'o', '$2' => 'bar'], ], [ 'buckets/{hello}', 'buckets/world', ['hello' => 'world'], ], [ 'buckets/{hello}', 'buckets/5', ['hello' => '5'], ], [ 'buckets/{hello=*}', 'buckets/world', ['hello' => 'world'], ], [ 'buckets/*', 'buckets/foo', ['$0' => 'foo'], ], [ 'buckets/*/*/*/objects/*', 'buckets/f/o/o/objects/google.com:a-b', ['$0' => 'f', '$1' => 'o', '$2' => 'o', '$3' => 'google.com:a-b'], ], [ 'buckets/*/objects/**', 'buckets/foo/objects/bar/baz', ['$0' => 'foo', '$1' => 'bar/baz'], ], [ 'foo/*/{bar=*/rar/*}/**/*', 'foo/fizz/fuzz/rar/bar/bizz/buzz/baz', ['$0' => 'fizz', '$1' => 'bizz/buzz', '$2' => 'baz', 'bar' => 'fuzz/rar/bar'], ], [ 'buckets/*', 'buckets/{}!@#$%^&*()+=[]\|`~-_', ['$0' => '{}!@#$%^&*()+=[]\|`~-_'], ], ]; } /** * @param string $pathTemplate * @param string $path * @dataProvider invalidMatchData * @expectedException \Google\ApiCore\ValidationException */ public function testFailMatch($pathTemplate, $path) { $template = new RelativeResourceTemplate($pathTemplate); $template->match($path); } /** * @param string $pathTemplate * @param string $path * @dataProvider invalidMatchData */ public function testFailMatches($pathTemplate, $path) { $template = new RelativeResourceTemplate($pathTemplate); $this->assertFalse($template->matches($path)); } public function invalidMatchData() { return [ [ 'buckets/*/*/objects/*', 'buckets/f/o/objects/bar/far', // Extra '/far' ], [ 'buckets/*/*/objects/*', 'buckets/f/o/objects', // Missing final wildcard ], [ 'foo/*/bar', 'foo/bar', // Missing middle wildcard ], [ 'foo/*/bar', 'foo/fizz/buzz/bar', // Too many segments for middle wildcard ], [ 'foo/**/bar', 'foo/bar', // Missing middle wildcard ], [ 'buckets', 'bouquets', // Wrong literal ], [ 'buckets', 'bucketseller', // Wrong literal ], [ 'foo/*/{bar=*/rar/*}/**/*', 'foo/fizz/fuzz/rat/bar/bizz/buzz/baz', ], ]; } /** * @param string $pathTemplate * @param array $bindings * @dataProvider invalidRenderData * @expectedException \Google\ApiCore\ValidationException */ public function testFailRender($pathTemplate, $bindings) { $template = new RelativeResourceTemplate($pathTemplate); $template->render($bindings); } public function invalidRenderData() { return [ [ 'buckets/*/*/objects/*', ['$0' => 'f', '$2' => 'bar'], // Missing key ], [ 'buckets/{hello}', ['hellop' => 'world'], // Wrong key ], [ 'buckets/{hello=*}', ['hello' => 'world/weary'], // Invalid binding ], [ 'buckets/{hello=*}', ['hello' => ''], // Invalid binding ], [ 'buckets/*/objects/**', ['$0' => 'foo', '$1' => ''], // Invalid binding ], [ 'foo/*/{bar=*/rar/*}/**/*:action', ['$0' => 'fizz', '$1' => 'bizz/buzz', '$2' => 'baz', 'bar' => 'fuzz/rat/bar'], // Invalid binding ], ]; } } tests/ApiCore/Tests/Unit/RetrySettingsTest.php000064400000027606151742741630015475 0ustar00assertTrue($simpleMethod->retriesEnabled()); $this->assertEquals(40000, $simpleMethod->getNoRetriesRpcTimeoutMillis()); $this->assertEquals(['DEADLINE_EXCEEDED', 'UNAVAILABLE'], $simpleMethod->getRetryableCodes()); $this->assertEquals(100, $simpleMethod->getInitialRetryDelayMillis()); $pageStreamingMethod = $defaultRetrySettings['PageStreamingMethod']; $this->assertEquals(['INTERNAL'], $pageStreamingMethod->getRetryableCodes()); $timeoutOnlyMethod = $defaultRetrySettings['TimeoutOnlyMethod']; $this->assertFalse($timeoutOnlyMethod->retriesEnabled()); $this->assertEquals(40000, $timeoutOnlyMethod->getNoRetriesRpcTimeoutMillis()); } /** * @expectedException \Google\ApiCore\ValidationException */ public function testLoadInvalid() { $inputConfig = RetrySettingsTest::buildInvalidInputConfig(); RetrySettings::load( RetrySettingsTest::SERVICE_NAME, $inputConfig ); } public function testDisableRetries() { $inputConfig = RetrySettingsTest::buildInputConfig(); $defaultRetrySettings = RetrySettings::load( RetrySettingsTest::SERVICE_NAME, $inputConfig, true ); $simpleMethod = $defaultRetrySettings['SimpleMethod']; $this->assertFalse($simpleMethod->retriesEnabled()); $this->assertEquals(40000, $simpleMethod->getNoRetriesRpcTimeoutMillis()); $pageStreamingMethod = $defaultRetrySettings['PageStreamingMethod']; $this->assertEquals(['INTERNAL'], $pageStreamingMethod->getRetryableCodes()); $timeoutOnlyMethod = $defaultRetrySettings['TimeoutOnlyMethod']; $this->assertFalse($timeoutOnlyMethod->retriesEnabled()); $this->assertEquals(40000, $timeoutOnlyMethod->getNoRetriesRpcTimeoutMillis()); } /** * @expectedException \Google\ApiCore\ValidationException */ public function testRetrySettingsMissingFields() { $retrySettings = new RetrySettings([ 'initialRetryDelayMillis' => 100, 'retryDelayMultiplier' => 1.3, // Missing field: //'maxRetryDelayMillis' => 400, 'initialRpcTimeoutMillis' => 150, 'rpcTimeoutMultiplier' => 2, 'maxRpcTimeoutMillis' => 600, 'totalTimeoutMillis' => 2000 ]); } /** * @dataProvider retrySettingsProvider * @param $settings * @param $expectedValues */ public function testRetrySettings($settings, $expectedValues) { $retrySettings = new RetrySettings($settings); $this->compare($retrySettings, $expectedValues); } /** * @dataProvider withRetrySettingsProvider * @param $settings * @param $withSettings * @param $expectedValues */ public function testWith($settings, $withSettings, $expectedValues) { $retrySettings = new RetrySettings($settings); $withRetrySettings = $retrySettings->with($withSettings); $this->compare($withRetrySettings, $expectedValues); } private function compare(RetrySettings $retrySettings, $expectedValues) { $this->assertSame( $expectedValues['initialRetryDelayMillis'], $retrySettings->getInitialRetryDelayMillis() ); $this->assertSame( $expectedValues['retryDelayMultiplier'], $retrySettings->getRetryDelayMultiplier() ); $this->assertSame( $expectedValues['maxRetryDelayMillis'], $retrySettings->getMaxRetryDelayMillis() ); $this->assertSame( $expectedValues['rpcTimeoutMultiplier'], $retrySettings->getRpcTimeoutMultiplier() ); $this->assertSame( $expectedValues['maxRpcTimeoutMillis'], $retrySettings->getMaxRpcTimeoutMillis() ); $this->assertSame( $expectedValues['totalTimeoutMillis'], $retrySettings->getTotalTimeoutMillis() ); $this->assertSame( $expectedValues['retryableCodes'], $retrySettings->getRetryableCodes() ); $this->assertSame( $expectedValues['retriesEnabled'], $retrySettings->retriesEnabled() ); $this->assertSame( $expectedValues['noRetriesRpcTimeoutMillis'], $retrySettings->getNoRetriesRpcTimeoutMillis() ); } public function retrySettingsProvider() { $defaultSettings = [ 'initialRetryDelayMillis' => 100, 'retryDelayMultiplier' => 1.3, 'maxRetryDelayMillis' => 400, 'initialRpcTimeoutMillis' => 150, 'rpcTimeoutMultiplier' => 2, 'maxRpcTimeoutMillis' => 600, 'totalTimeoutMillis' => 2000, 'retryableCodes' => [1], ]; $defaultExpectedValues = [ 'initialRetryDelayMillis' => 100, 'retryDelayMultiplier' => 1.3, 'maxRetryDelayMillis' => 400, 'initialRpcTimeoutMillis' => 150, 'rpcTimeoutMultiplier' => 2, 'maxRpcTimeoutMillis' => 600, 'totalTimeoutMillis' => 2000, 'retryableCodes' => [1], 'noRetriesRpcTimeoutMillis' => 150, 'retriesEnabled' => true ]; return [ [ // Test with retryableCodes, without retriesEnabled or noRetriesRpcTimeoutMillis $defaultSettings, $defaultExpectedValues ], [ // Test with empty retryableCodes, without retriesEnabled or noRetriesRpcTimeoutMillis [ 'retryableCodes' => [], ] + $defaultSettings, [ 'retryableCodes' => [], 'retriesEnabled' => false ] + $defaultExpectedValues ], [ // Test with retryableCodes, with retriesEnabled=false [ 'retriesEnabled' => false ] + $defaultSettings, [ 'retriesEnabled' => false ] + $defaultExpectedValues ], [ // Test with empty retryableCodes, with retriesEnabled=true [ 'retryableCodes' => [], 'retriesEnabled' => true ] + $defaultSettings, [ 'retryableCodes' => [], 'retriesEnabled' => true ] + $defaultExpectedValues ], [ // Test with noRetriesRpcTimeoutMillis [ 'noRetriesRpcTimeoutMillis' => 151, ] + $defaultSettings, [ 'noRetriesRpcTimeoutMillis' => 151, ] + $defaultExpectedValues ] ]; } public function withRetrySettingsProvider() { $defaultSettings = [ 'initialRetryDelayMillis' => 1, 'retryDelayMultiplier' => 1, 'maxRetryDelayMillis' => 1, 'initialRpcTimeoutMillis' => 1, 'rpcTimeoutMultiplier' => 1, 'maxRpcTimeoutMillis' => 1, 'totalTimeoutMillis' => 1, 'retryableCodes' => [1], 'noRetriesRpcTimeoutMillis' => 1, 'retriesEnabled' => true, ]; $defaultExpectedValues = [ 'initialRetryDelayMillis' => 1, 'retryDelayMultiplier' => 1, 'maxRetryDelayMillis' => 1, 'initialRpcTimeoutMillis' => 1, 'rpcTimeoutMultiplier' => 1, 'maxRpcTimeoutMillis' => 1, 'totalTimeoutMillis' => 1, 'retryableCodes' => [1], 'noRetriesRpcTimeoutMillis' => 1, 'retriesEnabled' => true, ]; return [ [ // Test with no changes $defaultSettings, [], $defaultExpectedValues ], [ // Test disable retries $defaultSettings, [ 'retriesEnabled' => false, ], [ 'retriesEnabled' => false, ] + $defaultExpectedValues ], [ // Test change all settings $defaultSettings, [ 'initialRetryDelayMillis' => 2, 'retryDelayMultiplier' => 3, 'maxRetryDelayMillis' => 4, 'initialRpcTimeoutMillis' => 5, 'rpcTimeoutMultiplier' => 6, 'maxRpcTimeoutMillis' => 7, 'totalTimeoutMillis' => 8, 'retryableCodes' => [9], 'noRetriesRpcTimeoutMillis' => 10, 'retriesEnabled' => false, ], [ 'initialRetryDelayMillis' => 2, 'retryDelayMultiplier' => 3, 'maxRetryDelayMillis' => 4, 'initialRpcTimeoutMillis' => 5, 'rpcTimeoutMultiplier' => 6, 'maxRpcTimeoutMillis' => 7, 'totalTimeoutMillis' => 8, 'retryableCodes' => [9], 'noRetriesRpcTimeoutMillis' => 10, 'retriesEnabled' => false, ] ] ]; } } tests/ApiCore/Tests/Unit/SerializerTest.php000064400000023540151742741630014751 0ustar00encodeMessage($message); $this->assertEquals($arrayStructure, $serializedMessage); // Check that $message when encoded and decoded is unchanged $deserializedMessage = $serializer->decodeMessage(new $klass(), $serializedMessage); $this->assertEquals($message, $deserializedMessage); // Check that $arrayStructure when decoded is equal to $message $deserializedStructure = $serializer->decodeMessage(new $klass(), $arrayStructure); $this->assertEquals($message, $deserializedStructure); // Check that $arrayStructure when decoded and encoded is unchanged $reserializedStructure = $serializer->encodeMessage($deserializedStructure); $this->assertEquals($arrayStructure, $reserializedStructure); } public function testStatusMessage() { $details = [new Any()]; $message = new Status(); $message->setMessage("message"); $message->setCode(0); $message->setDetails($details); $encodedMessage = [ 'message' => 'message', 'code' => 0, 'details' => [ [ 'typeUrl' => '', 'value' => '', ], ] ]; $this->verifySerializeAndDeserialize($message, $encodedMessage); } public function testHttpRule() { $message = new HttpRule(); $encodedMessage = [ 'selector' => '', 'body' => '', 'responseBody' => '', 'additionalBindings' => [], ]; $this->verifySerializeAndDeserialize($message, $encodedMessage); } public function testHttpRuleSetOneof() { $message = new HttpRule(); $message->setPatch(''); $encodedMessage = [ 'selector' => '', 'patch' => '', 'body' => '', 'responseBody' => '', 'additionalBindings' => [], ]; $this->verifySerializeAndDeserialize($message, $encodedMessage); } public function testHttpRuleSetOneofToValue() { $message = new HttpRule(); $message->setPatch('test'); $encodedMessage = [ 'selector' => '', 'patch' => 'test', 'body' => '', 'responseBody' => '', 'additionalBindings' => [], ]; $this->verifySerializeAndDeserialize($message, $encodedMessage); } public function testFieldMask() { $message = new FieldMask(); $encodedMessage = [ 'paths' => [] ]; $this->verifySerializeAndDeserialize($message, $encodedMessage); } public function testProperlyHandlesMessage() { $value = 'test'; // Using this class because it contains maps, oneofs and structs $message = new \Google\Protobuf\Struct(); $innerValue1 = new Value(); $innerValue1->setStringValue($value); $innerValue2 = new Value(); $innerValue2->setBoolValue(true); $structValue1 = new Value(); $structValue1->setStringValue(strtoupper($value)); $structValue2 = new Value(); $structValue2->setStringValue($value); $labels = [ strtoupper($value) => $structValue1, $value => $structValue2, ]; $innerStruct = new Struct(); $innerStruct->setFields($labels); $innerValue3 = new Value(); $innerValue3->setStructValue($innerStruct); $innerValues = [$innerValue1, $innerValue2, $innerValue3]; $listValue = new ListValue(); $listValue->setValues($innerValues); $fieldValue = new Value(); $fieldValue->setListValue($listValue); $fields = [ 'listField' => $fieldValue, ]; $message->setFields($fields); $encodedMessage = [ 'fields' => [ 'listField' => [ 'listValue' => [ 'values' => [ [ 'stringValue' => $value, ], [ 'boolValue' => true, ], [ 'structValue' => [ 'fields' => [ strtoupper($value) => [ 'stringValue' => strtoupper($value), ], $value => [ 'stringValue' => $value, ] ], ], ] ] ] ] ], ]; $this->verifySerializeAndDeserialize($message, $encodedMessage); } public function testSpecialEncodingDecodingByFieldName() { $serializer = new Serializer([ 'red' => function ($v) { return $v * 2; } ], [], [ 'red' => function ($v) { return $v / 2; } ]); $data = [ 'red' => 0.2, 'green' => 0.3, 'blue' => 0.4, 'alpha' => [ 'value' => 1.0 ] ]; $color = $serializer->decodeMessage(new Color(), $data); $this->assertEquals(0.1, $color->getRed(), '', 0.0000001); $this->assertEquals(0.3, $color->getGreen(), '', 0.0000001); $this->assertEquals(0.4, $color->getBlue(), '', 0.0000001); $alpha = $color->getAlpha(); $this->assertEquals(1.0, $alpha->getValue(), '', 0.0000001); $array = $serializer->encodeMessage($color); $this->assertEquals($data['red'], $array['red'], '', 0.0000001); $this->assertEquals($data['green'], $array['green'], '', 0.0000001); $this->assertEquals($data['blue'], $array['blue'], '', 0.0000001); $this->assertEquals($data['alpha']['value'], $array['alpha']['value'], '', 0.0000001); } public function testSpecialEncodingDecodingByFieldType() { $serializer = new Serializer([], [ 'google.protobuf.FloatValue' => function ($v) { return [ 'value' => $v['value'] * 2 ]; } ], [], [ 'google.protobuf.FloatValue' => function ($v) { return [ 'value' => $v['value'] / 2 ]; } ]); $data = [ 'red' => 0.2, 'green' => 0.3, 'blue' => 0.4, 'alpha' => [ 'value' => 1.0 ] ]; $color = $serializer->decodeMessage(new Color(), $data); $this->assertEquals(0.2, $color->getRed(), '', 0.0000001); $this->assertEquals(0.3, $color->getGreen(), '', 0.0000001); $this->assertEquals(0.4, $color->getBlue(), '', 0.0000001); $alpha = $color->getAlpha(); $this->assertEquals(0.5, $alpha->getValue(), '', 0.0000001); $array = $serializer->encodeMessage($color); $this->assertEquals($data['red'], $array['red'], '', 0.0000001); $this->assertEquals($data['green'], $array['green'], '', 0.0000001); $this->assertEquals($data['blue'], $array['blue'], '', 0.0000001); $this->assertEquals($data['alpha']['value'], $array['alpha']['value'], '', 0.0000001); } } tests/ApiCore/Tests/Unit/ServerStreamTest.php000064400000016335151742741630015266 0ustar00assertSame($call, $stream->getServerStreamingCall()); $this->assertSame([], iterator_to_array($stream->readAll())); } /** * @expectedException \Google\ApiCore\ApiException * @expectedExceptionMessage empty failure */ public function testEmptyFailure() { $call = new MockServerStreamingCall([], null, new MockStatus(Code::INTERNAL, 'empty failure')); $stream = new ServerStream($call); $this->assertSame($call, $stream->getServerStreamingCall()); iterator_to_array($stream->readAll()); } public function testStringsSuccess() { $responses = ['abc', 'def']; $call = new MockServerStreamingCall($responses); $stream = new ServerStream($call); $this->assertSame($call, $stream->getServerStreamingCall()); $this->assertSame($responses, iterator_to_array($stream->readAll())); } /** * @expectedException \Google\ApiCore\ApiException * @expectedExceptionMessage strings failure */ public function testStringsFailure() { $responses = ['abc', 'def']; $call = new MockServerStreamingCall( $responses, null, new MockStatus(Code::INTERNAL, 'strings failure') ); $stream = new ServerStream($call); $this->assertSame($call, $stream->getServerStreamingCall()); $index = 0; try { foreach ($stream->readAll() as $response) { $this->assertSame($response, $responses[$index]); $index++; } } finally { $this->assertSame(2, $index); } } public function testObjectsSuccess() { $responses = [ $this->createStatus(Code::OK, 'response1'), $this->createStatus(Code::OK, 'response2') ]; $serializedResponses = []; foreach ($responses as $response) { $serializedResponses[] = $response->serializeToString(); } $call = new MockServerStreamingCall($serializedResponses, ['\Google\Rpc\Status', 'mergeFromString']); $stream = new ServerStream($call); $this->assertSame($call, $stream->getServerStreamingCall()); $this->assertEquals($responses, iterator_to_array($stream->readAll())); } /** * @expectedException \Google\ApiCore\ApiException * @expectedExceptionMessage objects failure */ public function testObjectsFailure() { $responses = [ $this->createStatus(Code::OK, 'response1'), $this->createStatus(Code::OK, 'response2') ]; $serializedResponses = []; foreach ($responses as $response) { $serializedResponses[] = $response->serializeToString(); } $call = new MockServerStreamingCall( $serializedResponses, ['\Google\Rpc\Status', 'mergeFromString'], new MockStatus(Code::INTERNAL, 'objects failure') ); $stream = new ServerStream($call); $this->assertSame($call, $stream->getServerStreamingCall()); $index = 0; try { foreach ($stream->readAll() as $response) { $this->assertEquals($response, $responses[$index]); $index++; } } finally { $this->assertSame(2, $index); } } public function testResourcesSuccess() { $resources = ['resource1', 'resource2', 'resource3']; $repeatedField1 = new RepeatedField(GPBType::STRING); $repeatedField1[] = 'resource1'; $repeatedField2 = new RepeatedField(GPBType::STRING); $repeatedField2[] = 'resource2'; $repeatedField2[] = 'resource3'; $responses = [ $this->createMockResponse('nextPageToken1', $repeatedField1), $this->createMockResponse('nextPageToken1', $repeatedField2) ]; $call = new MockServerStreamingCall($responses); $stream = new ServerStream($call, [ 'resourcesGetMethod' => 'getResourcesList' ]); $this->assertSame($call, $stream->getServerStreamingCall()); $this->assertEquals($resources, iterator_to_array($stream->readAll())); } /** * @expectedException \Google\ApiCore\ApiException * @expectedExceptionMessage resources failure */ public function testResourcesFailure() { $resources = ['resource1', 'resource2', 'resource3']; $responses = [ $this->createMockResponse('nextPageToken1', ['resource1']), $this->createMockResponse('nextPageToken1', ['resource2', 'resource3']) ]; $call = new MockServerStreamingCall( $responses, null, new MockStatus(Code::INTERNAL, 'resources failure') ); $stream = new ServerStream($call, [ 'resourcesGetMethod' => 'getResourcesList' ]); $this->assertSame($call, $stream->getServerStreamingCall()); $index = 0; try { foreach ($stream->readAll() as $response) { $this->assertSame($response, $resources[$index]); $index++; } } finally { $this->assertSame(3, $index); } } } tests/ApiCore/Tests/Unit/ServiceAddressTraitTest.php000064400000003677151742741630016563 0ustar00assertSame($expectedAddress, $actualAddress); $this->assertSame($expectedPort, $actualPort); } public function normalizeServiceAddressData() { return [ ["simple.com:123", "simple.com", "123"], ["really.long.and.dotted:456", "really.long.and.dotted", "456"], ["noport.com", "noport.com", self::$defaultPort], ]; } /** * @dataProvider normalizeServiceAddressInvalidData * @expectedException \Google\ApiCore\ValidationException * @expectedExceptionMessage Invalid serviceAddress */ public function testNormalizeServiceAddressInvalid($serviceAddressString) { self::normalizeServiceAddress($serviceAddressString); } public function normalizeServiceAddressInvalidData() { return [ ["too.many:colons:123"], ["too:many:colons"], ]; } }tests/ApiCore/Tests/Unit/TestTrait.php000064400000010767151742741630013732 0ustar00setPageToken($token); } if ($pageSize) { $request->setPageSize($pageSize); } return $request; } public function createMockResponse($pageToken = null, $resourcesList = []) { $mockResponse = new MockResponse(); if ($pageToken) { $mockResponse->setNextPageToken($pageToken); } if ($resourcesList) { $mockResponse->setResourcesList($resourcesList); } return $mockResponse; } public function createMockCall($response = null, $status = null) { $status = $status ?: new MockStatus(Code::OK); $call = $this->getMockBuilder(UnaryCall::class) ->disableOriginalConstructor() ->getMock(); $call->method('wait') ->will($this->returnValue([$response, $status])); return $call; } public function createCallWithResponseSequence($sequence) { foreach ($sequence as $key => $value) { if (!is_array($value)) { $sequence[$key] = [$value, null]; } } $mockCall = $this->getMockBuilder(MockCall::class) ->setMethods(['takeAction']) ->getMock(); $mockCall->method('takeAction') ->will(call_user_func_array([$this, 'onConsecutiveCalls'], $sequence)); return $mockCall; } public function createOperationsClient($transport = null) { $this->requiresGrpcExtension(); $client = new OperationsClient([ 'serviceAddress' => '', 'scopes' => [], 'transport' => $transport, ]); return $client; } /** * @param \Google\Rpc\Code $code * @param String $message * @return Status */ public function createStatus($code, $message) { $status = new Status(); $status->setCode($code); $status->setMessage($message); return $status; } /** * @param $value \Google\Protobuf\Internal\Message; * @return Any */ public function createAny($value) { $any = new Any(); $any->setValue($value->serializeToString()); return $any; } public static function requiresGrpcExtension() { if (!extension_loaded('grpc')) { self::markTestSkipped('Must have the grpc extension installed to run this test.'); } if (defined('HHVM_VERSION')) { self::markTestSkipped('gRPC is not supported on HHVM.'); } } } tests/ApiCore/Tests/Unit/Transport/Grpc/ForwardingUnaryCallTest.php000064400000005066151742741630021447 0ustar00getMockBuilder(UnaryCall::class) ->disableOriginalConstructor() ->getMock(); $unaryCall->expects($this->once())->method('getMetadata'); $unaryCall->expects($this->once())->method('getTrailingMetadata'); $unaryCall->expects($this->once())->method('getPeer'); $unaryCall->expects($this->once())->method('cancel'); $unaryCall->expects($this->once())->method('wait'); $forwardingCall = new ForwardingUnaryCall($unaryCall); $forwardingCall->getMetadata(); $forwardingCall->getTrailingMetadata(); $forwardingCall->getPeer(); $forwardingCall->cancel(); $forwardingCall->wait(); } } tests/ApiCore/Tests/Unit/Transport/GrpcFallbackTransportTest.php000064400000017303151742741630021064 0ustar00call = new Call( 'Testing123', MockResponse::class, new MockRequest() ); } private function getTransport(callable $httpHandler) { return new GrpcFallbackTransport( 'www.example.com', $httpHandler ); } /** * @param $serviceAddress * @param $requestMessage * @dataProvider startUnaryCallDataProvider */ public function testStartUnaryCall($serviceAddress, $requestMessage) { $expectedRequest = new Request( 'POST', "https://$serviceAddress/\$rpc/Testing123", [ 'Content-Type' => 'application/x-protobuf', 'x-goog-api-client' => ['grpc-web'], ], $requestMessage->serializeToString() ); $expectedResponse = (new MockResponse()) ->setName('hello') ->setNumber(15); $httpHandler = function (RequestInterface $request, array $options = []) use ($expectedResponse, $expectedRequest) { $this->assertEquals($expectedRequest, $request); return Promise\promise_for( new Response( 200, [], $expectedResponse->serializeToString() ) ); }; $transport = new GrpcFallbackTransport( $serviceAddress, $httpHandler ); $call = new Call( 'Testing123', MockResponse::class, $requestMessage ); $response = $transport->startUnaryCall($call, [])->wait(); $this->assertEquals($expectedResponse->getName(), $response->getName()); $this->assertEquals($expectedResponse->getNumber(), $response->getNumber()); } public function startUnaryCallDataProvider() { return [ ["www.example.com", new MockRequest()], ["www.example.com:443", new MockRequest()], ["www.example.com:447", new MockRequest()], ]; } /** * @expectedException \Exception */ public function testStartUnaryCallThrowsException() { $httpHandler = function (RequestInterface $request, array $options = []) { return Promise\rejection_for(new \Exception()); }; $this->getTransport($httpHandler) ->startUnaryCall($this->call, []) ->wait(); } /** * @expectedException \Google\ApiCore\ApiException */ public function testStartUnaryCallThrowsRequestException() { $httpHandler = function (RequestInterface $request, array $options = []) { $status = new Status(); $status->setCode(Code::NOT_FOUND); $status->setMessage("Ruh-roh"); return Promise\rejection_for( RequestException::create( new Request('POST', 'http://www.example.com'), new Response( 404, [], $status->serializeToString() ) ) ); }; $this->getTransport($httpHandler) ->startUnaryCall($this->call, []) ->wait(); } /** * @dataProvider buildDataGrpcFallback */ public function testBuildGrpcFallback($serviceAddress, $config, $expectedTransport) { $actualTransport = GrpcFallbackTransport::build($serviceAddress, $config); $this->assertEquals($expectedTransport, $actualTransport); } public function buildDataGrpcFallback() { $uri = "address.com"; $serviceAddress = "$uri:443"; $httpHandler = [HttpHandlerFactory::build(), 'async']; return [ [ $serviceAddress, ['httpHandler' => $httpHandler], new GrpcFallbackTransport($serviceAddress, $httpHandler) ], [ $serviceAddress, [], new GrpcFallbackTransport($serviceAddress, $httpHandler), ], ]; } /** * @dataProvider buildInvalidData * @expectedException \Google\ApiCore\ValidationException * @param $serviceAddress * @param $args * @throws \Google\ApiCore\ValidationException */ public function testBuildInvalid($serviceAddress, $args) { GrpcFallbackTransport::build($serviceAddress, $args); } public function buildInvalidData() { return [ [ "addresswithtoo:many:segments", [], ], ]; } /** * @expectedException \Google\ApiCore\ApiException * @expectedExceptionMessage This is an HTML response<\/body><\/html> * @expectedExceptionCode 5 */ public function testNonBinaryProtobufResponseException() { $httpHandler = function (RequestInterface $request, array $options = []) { return Promise\rejection_for( RequestException::create( new Request('POST', 'http://www.example.com'), new Response( 404, [], "This is an HTML response" ) ) ); }; $this->getTransport($httpHandler) ->startUnaryCall($this->call, []) ->wait(); } } tests/ApiCore/Tests/Unit/Transport/GrpcTransportTest.php000064400000033740151742741630017447 0ustar00requiresGrpcExtension(); } private function callCredentialsCallback(MockGrpcTransport $transport) { $mockCall = new Call('method', '', null); $options = []; $response = $transport->startUnaryCall($mockCall, $options)->wait(); $args = $transport->getRequestArguments(); return call_user_func($args['options']['call_credentials_callback']); } public function testClientStreamingSuccessObject() { $response = new Status(); $response->setCode(Code::OK); $response->setMessage('response'); $status = new stdClass; $status->code = Code::OK; $clientStreamingCall = $this->getMockBuilder(ClientStreamingCall::class) ->disableOriginalConstructor() ->getMock(); $clientStreamingCall->method('write'); $clientStreamingCall->method('wait') ->will($this->returnValue([$response, $status])); $transport = new MockGrpcTransport($clientStreamingCall); $stream = $transport->startClientStreamingCall( new Call('method', null), [] ); /* @var $stream \Google\ApiCore\ClientStream */ $actualResponse = $stream->writeAllAndReadResponse([]); $this->assertEquals($response, $actualResponse); } /** * @expectedException \Google\ApiCore\ApiException * @expectedExceptionMessage client streaming failure */ public function testClientStreamingFailure() { $request = "request"; $response = "response"; $status = new stdClass; $status->code = Code::INTERNAL; $status->details = 'client streaming failure'; $clientStreamingCall = $this->getMockBuilder(ClientStreamingCall::class) ->disableOriginalConstructor() ->getMock(); $clientStreamingCall->method('wait') ->will($this->returnValue([$response, $status])); $transport = new MockGrpcTransport($clientStreamingCall); $stream = $transport->startClientStreamingCall( new Call('takeAction', null), [] ); $stream->readResponse(); } public function testServerStreamingSuccess() { $response = "response"; $status = new stdClass; $status->code = Code::OK; $message = $this->createMockRequest(); $serverStreamingCall = $this->getMockBuilder(\Grpc\ServerStreamingCall::class) ->disableOriginalConstructor() ->getMock(); $serverStreamingCall->method('responses') ->will($this->returnValue([$response])); $serverStreamingCall->method('getStatus') ->will($this->returnValue($status)); $transport = new MockGrpcTransport($serverStreamingCall); /* @var $stream \Google\ApiCore\ServerStream */ $stream = $transport->startServerStreamingCall( new Call('takeAction', null, $message), [] ); $actualResponsesArray = []; foreach ($stream->readAll() as $actualResponse) { $actualResponsesArray[] = $actualResponse; } $this->assertEquals([$response], $actualResponsesArray); } public function testServerStreamingSuccessResources() { $responses = ['resource1', 'resource2']; $repeatedField = new RepeatedField(GPBType::STRING); foreach ($responses as $response) { $repeatedField[] = $response; } $response = $this->createMockResponse('nextPageToken', $repeatedField); $status = new stdClass; $status->code = Code::OK; $message = $this->createMockRequest(); $call = $this->getMockBuilder(\Grpc\ServerStreamingCall::class) ->disableOriginalConstructor() ->getMock(); $call->method('responses') ->will($this->returnValue([$response])); $call->method('getStatus') ->will($this->returnValue($status)); $transport = new MockGrpcTransport($call); $call = new Call('takeAction', null, $message, ['resourcesGetMethod' => 'getResourcesList'] ); $options = []; /* @var $stream \Google\ApiCore\ServerStream */ $stream = $transport->startServerStreamingCall( $call, $options ); $actualResponsesArray = []; foreach ($stream->readAll() as $actualResponse) { $actualResponsesArray[] = $actualResponse; } $this->assertEquals($responses, $actualResponsesArray); } /** * @expectedException \Google\ApiCore\ApiException * @expectedExceptionMessage server streaming failure */ public function testServerStreamingFailure() { $status = new stdClass; $status->code = Code::INTERNAL; $status->details = 'server streaming failure'; $message = $this->createMockRequest(); $serverStreamingCall = $this->getMockBuilder(\Grpc\ServerStreamingCall::class) ->disableOriginalConstructor() ->getMock(); $serverStreamingCall->method('responses') ->will($this->returnValue(['response1'])); $serverStreamingCall->method('getStatus') ->will($this->returnValue($status)); $transport = new MockGrpcTransport($serverStreamingCall); /* @var $stream \Google\ApiCore\ServerStream */ $stream = $transport->startServerStreamingCall( new Call('takeAction', null, $message), [] ); foreach ($stream->readAll() as $actualResponse) { // for loop to trigger generator and API exception } } public function testBidiStreamingSuccessSimple() { $response = "response"; $status = new stdClass; $status->code = Code::OK; $bidiStreamingCall = $this->getMockBuilder(\Grpc\BidiStreamingCall::class) ->disableOriginalConstructor() ->getMock(); $bidiStreamingCall->method('read') ->will($this->onConsecutiveCalls($response, null)); $bidiStreamingCall->method('getStatus') ->will($this->returnValue($status)); $transport = new MockGrpcTransport($bidiStreamingCall); /* @var $stream \Google\ApiCore\BidiStream */ $stream = $transport->startBidiStreamingCall( new Call('takeAction', null), [] ); $actualResponsesArray = []; foreach ($stream->closeWriteAndReadAll() as $actualResponse) { $actualResponsesArray[] = $actualResponse; } $this->assertEquals([$response], $actualResponsesArray); } public function testBidiStreamingSuccessObject() { $response = new Status(); $response->setCode(Code::OK); $response->setMessage('response'); $status = new stdClass; $status->code = Code::OK; $bidiStreamingCall = $this->getMockBuilder(\Grpc\BidiStreamingCall::class) ->disableOriginalConstructor() ->getMock(); $bidiStreamingCall->method('read') ->will($this->onConsecutiveCalls($response, null)); $bidiStreamingCall->method('getStatus') ->will($this->returnValue($status)); $transport = new MockGrpcTransport($bidiStreamingCall); /* @var $stream \Google\ApiCore\BidiStream */ $stream = $transport->startBidiStreamingCall( new Call('takeAction', null), [] ); $actualResponsesArray = []; foreach ($stream->closeWriteAndReadAll() as $actualResponse) { $actualResponsesArray[] = $actualResponse; } $this->assertEquals([$response], $actualResponsesArray); } public function testBidiStreamingSuccessResources() { $responses = ['resource1', 'resource2']; $repeatedField = new RepeatedField(GPBType::STRING); foreach ($responses as $response) { $repeatedField[] = $response; } $response = $this->createMockResponse('nextPageToken', $repeatedField); $status = new stdClass; $status->code = Code::OK; $bidiStreamingCall = $this->getMockBuilder(\Grpc\BidiStreamingCall::class) ->disableOriginalConstructor() ->getMock(); $bidiStreamingCall->method('read') ->will($this->onConsecutiveCalls($response, null)); $bidiStreamingCall->method('getStatus') ->will($this->returnValue($status)); $transport = new MockGrpcTransport($bidiStreamingCall); $call = new Call( 'takeAction', null, null, ['resourcesGetMethod' => 'getResourcesList'] ); /* @var $stream \Google\ApiCore\BidiStream */ $stream = $transport->startBidiStreamingCall( $call, [] ); $actualResponsesArray = []; foreach ($stream->closeWriteAndReadAll() as $actualResponse) { $actualResponsesArray[] = $actualResponse; } $this->assertEquals($responses, $actualResponsesArray); } /** * @expectedException \Google\ApiCore\ApiException * @expectedExceptionMessage bidi failure */ public function testBidiStreamingFailure() { $response = "response"; $status = new stdClass; $status->code = Code::INTERNAL; $status->details = 'bidi failure'; $bidiStreamingCall = $this->getMockBuilder(\Grpc\BidiStreamingCall::class) ->disableOriginalConstructor() ->getMock(); $bidiStreamingCall->method('read') ->will($this->onConsecutiveCalls($response, null)); $bidiStreamingCall->method('getStatus') ->will($this->returnValue($status)); $transport = new MockGrpcTransport($bidiStreamingCall); /* @var $stream \Google\ApiCore\BidiStream */ $stream = $transport->startBidiStreamingCall( new Call('takeAction', null), [] ); foreach ($stream->closeWriteAndReadAll() as $actualResponse) { // for loop to trigger generator and API exception } } /** * @dataProvider buildDataGrpc */ public function testBuildGrpc($serviceAddress, $config, $expectedTransportProvider) { $expectedTransport = $expectedTransportProvider(); $actualTransport = GrpcTransport::build($serviceAddress, $config); $this->assertEquals($expectedTransport, $actualTransport); } public function buildDataGrpc() { $uri = "address.com"; $serviceAddress = "$uri:447"; $serviceAddressDefaultPort = "$uri:443"; return [ [ $serviceAddress, [], function () use ($serviceAddress) { return new GrpcTransport( $serviceAddress, [ 'credentials' => null, ], null ); }, ], [ $uri, [], function () use ($serviceAddressDefaultPort) { return new GrpcTransport( $serviceAddressDefaultPort, [ 'credentials' => null, ], null ); }, ], ]; } /** * @dataProvider buildInvalidData * @expectedException \Google\ApiCore\ValidationException */ public function testBuildInvalid($serviceAddress, $args) { GrpcTransport::build($serviceAddress, $args); } public function buildInvalidData() { return [ [ "addresswithtoo:many:segments", [], ], [ 'serviceaddress.com', [ 'channel' => 'not a channel', ] ] ]; } } tests/ApiCore/Tests/Unit/Transport/RestTransportTest.php000064400000020004151742741630017456 0ustar00call = new Call( 'Testing123', MockResponse::class, new MockRequest() ); } private function getTransport(callable $httpHandler, $serviceAddress = 'http://www.example.com') { $request = new Request('POST', $serviceAddress); $requestBuilder = $this->getMockBuilder(RequestBuilder::class) ->disableOriginalConstructor() ->getMock(); $requestBuilder->method('build') ->willReturn($request); $credentialsLoader = $this->getMockBuilder(FetchAuthTokenInterface::class) ->disableOriginalConstructor() ->getMock(); $credentialsLoader->method('fetchAuthToken') ->willReturn(['access_token' => 'abc']); return new RestTransport( $requestBuilder, $httpHandler ); } /** * @param $serviceAddress * @dataProvider startUnaryCallDataProvider */ public function testStartUnaryCall($serviceAddress) { $expectedRequest = new Request( 'POST', "$serviceAddress", [], "" ); $body = ['name' => 'hello', 'number' => 15]; $httpHandler = function (RequestInterface $request, array $options = []) use ($body, $expectedRequest) { $this->assertEquals($expectedRequest, $request); return Promise\promise_for( new Response( 200, [], json_encode($body) ) ); }; $response = $this->getTransport($httpHandler, $serviceAddress) ->startUnaryCall($this->call, []) ->wait(); $this->assertEquals($body['name'], $response->getName()); $this->assertEquals($body['number'], $response->getNumber()); } public function startUnaryCallDataProvider() { return [ ["www.example.com"], ["www.example.com:443"], ["www.example.com:447"], ]; } /** * @expectedException \Exception */ public function testStartUnaryCallThrowsException() { $httpHandler = function (RequestInterface $request, array $options = []) { return Promise\rejection_for(new \Exception()); }; $this->getTransport($httpHandler) ->startUnaryCall($this->call, []) ->wait(); } /** * @expectedException \Google\ApiCore\ApiException */ public function testStartUnaryCallThrowsRequestException() { $httpHandler = function (RequestInterface $request, array $options = []) { return Promise\rejection_for( RequestException::create( new Request('POST', 'http://www.example.com'), new Response( 404, [], json_encode([ 'error' => [ 'status' => 'NOT_FOUND', 'message' => 'Ruh-roh.' ] ]) ) ) ); }; $this->getTransport($httpHandler) ->startUnaryCall($this->call, []) ->wait(); } /** * @dataProvider buildDataRest */ public function testBuildRest($serviceAddress, $restConfigPath, $config, $expectedTransport) { $actualTransport = RestTransport::build($serviceAddress, $restConfigPath, $config); $this->assertEquals($expectedTransport, $actualTransport); } public function buildDataRest() { $uri = "address.com"; $serviceAddress = "$uri:443"; $restConfigPath = __DIR__ . '/../testdata/test_service_rest_client_config.php'; $requestBuilder = new RequestBuilder($serviceAddress, $restConfigPath); $httpHandler = [HttpHandlerFactory::build(), 'async']; return [ [ $serviceAddress, $restConfigPath, ['httpHandler' => $httpHandler], new RestTransport($requestBuilder, $httpHandler) ], [ $serviceAddress, $restConfigPath, [], new RestTransport($requestBuilder, $httpHandler), ], ]; } /** * @dataProvider buildInvalidData * @expectedException \Google\ApiCore\ValidationException */ public function testBuildInvalid($serviceAddress, $restConfigPath, $args) { RestTransport::build($serviceAddress, $restConfigPath, $args); } public function buildInvalidData() { $restConfigPath = __DIR__ . '/../testdata/test_service_rest_client_config.php'; return [ [ "addresswithtoo:many:segments", $restConfigPath, [], ], [ "address.com", "badpath", [], ], ]; } /** * @expectedException \Google\ApiCore\ApiException * @expectedExceptionMessage This is an HTML response<\/body><\/html> * @expectedExceptionCode 5 */ public function testNonJsonResponseException() { $httpHandler = function (RequestInterface $request, array $options = []) { return Promise\rejection_for( RequestException::create( new Request('POST', 'http://www.example.com'), new Response( 404, [], "This is an HTML response" ) ) ); }; $this->getTransport($httpHandler) ->startUnaryCall($this->call, []) ->wait(); } } tests/ApiCore/Tests/Unit/UriTraitTest.php000064400000004604151742741630014403 0ustar00implementation = $this->getObjectForTrait(UriTrait::class); } /** * @dataProvider queryProvider */ public function testBuildsUriWithQuery($expectedQuery, $query) { $baseUri = 'http://www.example.com'; $uri = $this->implementation->buildUriWithQuery($baseUri, $query); $this->assertEquals($baseUri . $expectedQuery, (string) $uri); } public function queryProvider() { return [ ['?narf=yes', ['narf' => 'yes']], ['?narf=true', ['narf' => true]], ['?narf=false', ['narf' => false]], ['?narf=0', ['narf' => '0']] ]; } } tests/ApiCore/Tests/Unit/ValidationTraitTest.php000064400000004100151742741630015725 0ustar00stub = new ValidationTraitStub; } /** * @expectedException \Google\ApiCore\ValidationException * @expectedExceptionMessage Missing required argument */ public function testValidateMissingRequiredKey() { $input = [ 'foo' => 1, 'bar' => 2 ]; $this->stub->validate($input, ['bar', 'baz']); } public function testValidateValidArray() { $input = [ 'foo' => 1, 'bar' => 2 ]; $arr = $this->stub->validate($input, ['foo', 'bar']); $this->assertEquals($input, $arr); } /** * @expectedException \Google\ApiCore\ValidationException * @expectedExceptionMessage Missing required argument */ public function testValidateNotNullWithNullRequiredKey() { $input = [ 'foo' => 1, 'bar' => null ]; $this->stub->validateNotNull($input, ['foo', 'bar']); } public function testValidateValidArrayWithNotNull() { $input = [ 'foo' => 1, 'bar' => 2 ]; $arr = $this->stub->validateNotNull($input, ['foo', 'bar']); $this->assertEquals($input, $arr); } } class ValidationTraitStub { use ValidationTrait; } tests/ApiCore/Tests/Unit/VersionTest.php000064400000003541151742741630014264 0ustar00assertStringMatchesFormat("%d.%d.%d", $actualVersion); } } tests/ApiCore/Tests/Unit/testdata/VERSION000064400000000011151742741630014134 0ustar001.2.3-devtests/ApiCore/Tests/Unit/testdata/json-key-file.json000064400000000240151742741630016437 0ustar00{ "type": "authorized_user", "client_id": "example@example.com", "client_secret": "example", "refresh_token": "abc", "project_id": "example_project" }tests/ApiCore/Tests/Unit/testdata/src/GapicClientStub.php000064400000003706151742741630017422 0ustar00 [ 'test.interface.v1.api' => [ 'PageStreamingMethod' => [ 'pageStreaming' => [ 'requestPageTokenGetMethod' => 'getPageToken', 'requestPageTokenSetMethod' => 'setPageToken', 'requestPageSizeGetMethod' => 'getPageSize', 'requestPageSizeSetMethod' => 'setPageSize', 'responsePageTokenGetMethod' => 'getNextPageToken', ], ], ], ], ]; tests/ApiCore/Tests/Unit/testdata/test_service_grpc_config.json000064400000000415151742741630021026 0ustar00{ "channelPool": { "maxSize": 10, "maxConcurrentStreamsLowWatermark": 1 }, "method": [ { "name": [ "/google.test.v1.Test/TestMethod" ], "affinity": { "command": "BIND", "affinityKey": "key" } } ] }tests/ApiCore/Tests/Unit/testdata/test_service_invalid_client_config.json000064400000001574151742741630023066 0ustar00{ "interfaces": { "test.interface.v1.api": { "retry_codes": { "idempotent": [ "DEADLINE_EXCEEDED", "UNAVAILABLE" ], "non_idempotent": ["INTERNAL"] }, "retry_params": { "default": { "initial_retry_delay_millis": 100, "retry_delay_multiplier": 1.2, "initial_rpc_timeout_millis": 300, "rpc_timeout_multiplier": 1.3, "max_rpc_timeout_millis": 3000, "total_timeout_millis": 30000 } }, "methods": { "SimpleMethod": { "timeout_millis": 40000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "PageStreamingMethod": { "timeout_millis": 40000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" } } } } }tests/ApiCore/Tests/Unit/testdata/test_service_rest_client_config.php000064400000010624151742741630022227 0ustar00 [ 'test.interface.v1.api' => [ 'MethodWithUrlPlaceholder' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=message/**}', 'placeholders' => [ 'name' => [ 'getters' => [ 'getName' ] ], ], ], 'MethodWithBody' => [ 'method' => 'post', 'uriTemplate' => '/v1/{name=message/**}', 'body' => '*', 'placeholders' => [ 'name' => [ 'getters' => [ 'getName' ] ], ], ], 'MethodWithNestedMessageAsBody' => [ 'method' => 'post', 'uriTemplate' => '/v1/{name=message/**}', 'body' => 'nested_message', 'placeholders' => [ 'name' => [ 'getters' => [ 'getName' ] ], ], ], 'MethodWithNestedUrlPlaceholder' => [ 'method' => 'get', 'uriTemplate' => '/v1/{nested_message=nested/**}', 'body' => '*', 'placeholders' => [ 'nested_message' => [ 'getters' => [ 'getNestedMessage', 'getName' ] ] ], ], 'MethodWithColonInUrl' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=message/*}:action', 'placeholders' => [ 'name' => [ 'getters' => [ 'getName', ], ] ], ], 'MethodWithMultipleWildcardsAndColonInUrl' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=message/*}/number/{number=*}:action', 'placeholders' => [ 'name' => [ 'getters' => [ 'getName', ] ], 'number' => [ 'getters' => [ 'getNumber', ] ] ], ], 'MethodWithSimplePlaceholder' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name}', 'placeholders' => [ 'name' => [ 'getters' => [ 'getName', ], ] ] ], 'MethodWithAdditionalBindings' => [ 'method' => 'post', 'uriTemplate' => '/v1/{name=message/**}/additional/bindings', 'body' => '*', 'additionalBindings' => [ [ 'method' => 'post', 'uriTemplate' => '/v2/{nested_message=nested/**}/additional/bindings', 'body' => '*' ], [ 'method' => 'post', 'uriTemplate' => '/v1/{name=different/format/**}/additional/bindings', 'body' => '*' ], ], 'placeholders' => [ 'name' => [ 'getters' => [ 'getName' ] ], 'nested_message' => [ 'getters' => [ 'getNestedMessage', 'getName' ] ] ], ], 'MethodWithSpecialJsonMapping' => [ 'method' => 'get', 'uriTemplate' => '/v1/special/mapping', 'placeholders' => [] ], 'MethodWithoutPlaceholders' => [ 'method' => 'get', 'uriTemplate' => '/v1/fixedurl', ], ], ], ]; tests/bootstrap.php000064400000004271151742741630010452 0ustar00register(new MessageAwareArrayComparator()); \SebastianBergmann\Comparator\Factory::getInstance()->register(new ProtobufMessageComparator()); \SebastianBergmann\Comparator\Factory::getInstance()->register(new ProtobufGPBEmptyComparator());