.gitignore 0000644 00000000232 15174272507 0006543 0 ustar 00 .DS_Store
phpunit.xml
composer.phar
composer.lock
composer-test.lock
vendor/
build/artifacts/
artifacts/
.idea
.metadata
coverage.xml
src/Jison/Parser.js
.travis.yml 0000644 00000000443 15174272507 0006670 0 ustar 00 language: php
php:
- '5.5.38'
- '5.6.25'
sudo: required
dist: trusty
install:
- pecl install grpc
- composer install
script:
- vendor/bin/phpunit --coverage-clover=coverage.xml
- vendor/bin/phpcs -l --standard=PSR2 src/
after_success:
- bash <(curl -s https://codecov.io/bash)
CONTRIBUTING.md 0000644 00000002654 15174272507 0007016 0 ustar 00 Want 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).
LICENSE 0000644 00000002700 15174272507 0005562 0 ustar 00 Copyright 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.md 0000644 00000003332 15174272507 0006036 0 ustar 00 Google API Extensions for PHP
=================================
[]
(https://travis-ci.org/googleapis/gax-php)
[]
(https://codecov.io/github/googleapis/gax-php)
- [Documentation] (http://googleapis.github.io/gax-php/phpdoc)
Google API Extensions 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 src/ and is contained in the `Google\GAX` namespace.
License
-------
BSD - See [LICENSE][] for more information.
[LICENSE]: https://github.com/googleapis/gax-php/blob/master/LICENSE
composer.json 0000644 00000001201 15174272507 0007272 0 ustar 00 {
"name": "google/gax",
"type": "library",
"description": "Google API Extensions for PHP",
"keywords": ["google"],
"homepage": "https://github.com/googleapis/gax-php",
"license": "BSD-3-Clause",
"require": {
"php": ">=5.5",
"google/auth": "^0.11",
"grpc/grpc": "v1.0.*"
},
"require-dev": {
"phpunit/phpunit": "4.8.*",
"squizlabs/php_codesniffer": "2.*",
"phpdocumentor/phpdocumentor": "*"
},
"autoload": {
"psr-4": {
"Google\\GAX\\":"src/"
},
"classmap": ["src/generated", "src/generated/well-known-types"]
}
}
phpunit.xml.dist 0000644 00000000633 15174272507 0007733 0 ustar 00
tests
src
src/generated
src/AgentHeaderDescriptor.php 0000644 00000007601 15174272507 0012270 0 ustar 00 clientName = $headerInfo['clientName'];
$this->clientVersion = $headerInfo['clientVersion'];
$this->codeGenName = $headerInfo['codeGenName'];
$this->codeGenVersion = $headerInfo['codeGenVersion'];
$this->gaxVersion = $headerInfo['gaxVersion'];
$this->phpVersion = $headerInfo['phpVersion'];
}
/**
* Returns an associative array that contains GAPIC header metadata.
*/
public function getHeader()
{
return [self::AGENT_HEADER_KEY => ["$this->clientName/$this->clientVersion ".
"$this->codeGenName/$this->codeGenVersion gax/$this->gaxVersion ".
"php/$this->phpVersion"]];
}
/**
* Returns the version string for GAX.
*/
public static function getGaxVersion()
{
return self::GAX_VERSION;
}
private static function validate($descriptor)
{
$requiredFields = ['clientName', 'clientVersion', 'codeGenName',
'codeGenVersion', 'gaxVersion', 'phpVersion'];
foreach ($requiredFields as $field) {
if (empty($descriptor[$field])) {
throw new InvalidArgumentException(
"$field is required for AgentHeaderDescriptor"
);
}
}
}
}
src/ApiCallable.php 0000644 00000021102 15174272507 0010203 0 ustar 00 getBackoffSettings();
// Initialize retry parameters
$delayMult = $backoffSettings->getRetryDelayMultiplier();
$maxDelayMillis = $backoffSettings->getMaxRetryDelayMillis();
$timeoutMult = $backoffSettings->getRpcTimeoutMultiplier();
$maxTimeoutMillis = $backoffSettings->getMaxRpcTimeoutMillis();
$totalTimeoutMillis = $backoffSettings->getTotalTimeoutMillis();
$delayMillis = $backoffSettings->getInitialRetryDelayMillis();
$timeoutMillis = $backoffSettings->getInitialRpcTimeoutMillis();
$currentTimeMillis = $timeFuncMillis();
$deadlineMillis = $currentTimeMillis + $totalTimeoutMillis;
while ($currentTimeMillis < $deadlineMillis) {
$nextApiCall = self::setTimeout($apiCall, $timeoutMillis);
try {
return call_user_func_array($nextApiCall, func_get_args());
} catch (ApiException $e) {
if (!in_array($e->getCode(), $retrySettings->getRetryableCodes())) {
throw $e;
}
} catch (Exception $e) {
throw $e;
}
// Don't sleep if the failure was a timeout
if ($e->getCode() != Grpc\STATUS_DEADLINE_EXCEEDED) {
usleep($delayMillis * 1000);
}
$currentTimeMillis = $timeFuncMillis();
$delayMillis = min($delayMillis * $delayMult, $maxDelayMillis);
$timeoutMillis = min(
$timeoutMillis * $timeoutMult,
$maxTimeoutMillis,
$deadlineMillis - $currentTimeMillis
);
}
throw new ApiException("Retry total timeout exceeded.", Grpc\STATUS_DEADLINE_EXCEEDED);
};
return $inner;
}
private static function setPageStreaming($callable, $pageStreamingDescriptor)
{
$inner = function () use ($callable, $pageStreamingDescriptor) {
return new PagedListResponse(func_get_args(), $callable, $pageStreamingDescriptor);
};
return $inner;
}
private static function setLongRunnning($callable, $longRunningDescriptor)
{
$inner = function () use ($callable, $longRunningDescriptor) {
$response = call_user_func_array($callable, func_get_args());
$name = $response->getName();
$client = $longRunningDescriptor['operationsClient'];
$options = $longRunningDescriptor + [
'lastProtoResponse' => $response,
];
return new OperationResponse($name, $client, $options);
};
return $inner;
}
private static function setCustomHeader($callable, $headerDescriptor)
{
$inner = function () use ($callable, $headerDescriptor) {
$params = func_get_args();
if (count($params) != self::GRPC_CALLABLE_PARAM_COUNT ||
!is_array($params[self::GRPC_CALLABLE_METADATA_INDEX])) {
throw new InvalidArgumentException('Metadata argument is not found.');
} else {
$metadata = $params[self::GRPC_CALLABLE_METADATA_INDEX];
$headers = $headerDescriptor->getHeader();
$params[self::GRPC_CALLABLE_METADATA_INDEX] = array_merge($headers, $metadata);
return call_user_func_array($callable, $params);
}
};
return $inner;
}
/**
* @param \Grpc\BaseStub $stub the gRPC stub to make calls through.
* @param string $methodName the method name on the stub to call.
* @param \Google\GAX\CallSettings $settings the call settings to use for this call.
* @param array $options {
* Optional.
* @type \Google\GAX\PageStreamingDescriptor $pageStreamingDescriptor
* the descriptor used for page-streaming.
* @type \Google\GAX\AgentHeaderDescriptor $headerDescriptor
* the descriptor used for creating GAPIC header.
* }
*
* @return callable
*/
public static function createApiCall($stub, $methodName, CallSettings $settings, $options = [])
{
$apiCall = function () use ($stub, $methodName) {
list($response, $status) =
call_user_func_array(array($stub, $methodName), func_get_args())->wait();
if ($status->code == Grpc\STATUS_OK) {
return $response;
} else {
throw new ApiException($status->details, $status->code);
}
};
$retrySettings = $settings->getRetrySettings();
if (!is_null($retrySettings) && !is_null($retrySettings->getRetryableCodes())) {
$timeFuncMillis = null;
if (array_key_exists('timeFuncMillis', $options)) {
$timeFuncMillis = $options['timeFuncMillis'];
}
$apiCall = self::setRetry($apiCall, $settings->getRetrySettings(), $timeFuncMillis);
} elseif ($settings->getTimeoutMillis() > 0) {
$apiCall = self::setTimeout($apiCall, $settings->getTimeoutMillis());
}
if (array_key_exists('pageStreamingDescriptor', $options)) {
$apiCall = self::setPageStreaming($apiCall, $options['pageStreamingDescriptor']);
}
if (array_key_exists('longRunningDescriptor', $options)) {
$apiCall = self::setLongRunnning($apiCall, $options['longRunningDescriptor']);
}
if (array_key_exists('headerDescriptor', $options)) {
$apiCall = self::setCustomHeader($apiCall, $options['headerDescriptor']);
}
return $apiCall;
}
}
src/ApiException.php 0000644 00000003644 15174272507 0010455 0 ustar 00 code}]: {$this->message}\n";
}
}
src/BackoffSettings.php 0000644 00000015717 15174272507 0011145 0 ustar 00 $value) {
$wordsKey = str_replace('_', ' ', $key);
$camelCaseKey = str_replace(' ', '', ucwords($wordsKey));
$camelCaseSettings[lcfirst($camelCaseKey)] = $value;
}
return new BackoffSettings($camelCaseSettings);
}
/**
* Constructs an instance.
*
* @param array $settings {
* Required. Settings for configuring the backoff settings
*
* @type integer $initialRetryDelayMillis The initial delay of retry in milliseconds.
* @type integer $retryDelayMultiplier The exponential multiplier of retry delay.
* @type integer $maxRetryDelayMillis The max delay of retry in milliseconds.
* @type integer $initialRpcTimeoutMillis The initial timeout of rpc call in milliseconds.
* @type integer $rpcTimeoutMultiplier The exponential multiplier of rpc timeout.
* @type integer $maxRpcTimeoutMillis The max timout of rpc call in milliseconds.
* @type integer $totalTimeoutMillis The max accumulative timeout in total.
* }
*/
public function __construct($settings)
{
self::validate($settings);
$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'];
}
public function getInitialRetryDelayMillis()
{
return $this->initialRetryDelayMillis;
}
public function getRetryDelayMultiplier()
{
return $this->retryDelayMultiplier;
}
public function getMaxRetryDelayMillis()
{
return $this->maxRetryDelayMillis;
}
public function getInitialRpcTimeoutMillis()
{
return $this->initialRpcTimeoutMillis;
}
public function getRpcTimeoutMultiplier()
{
return $this->rpcTimeoutMultiplier;
}
public function getMaxRpcTimeoutMillis()
{
return $this->maxRpcTimeoutMillis;
}
public function getTotalTimeoutMillis()
{
return $this->totalTimeoutMillis;
}
private static function validate($settings)
{
$requiredFields = ['initialRetryDelayMillis',
'retryDelayMultiplier', 'maxRetryDelayMillis', 'initialRpcTimeoutMillis',
'rpcTimeoutMultiplier', 'maxRpcTimeoutMillis', 'totalTimeoutMillis'];
foreach ($requiredFields as $field) {
if (empty($settings[$field])) {
throw new InvalidArgumentException("$field is required for BackoffSettings");
}
}
}
}
src/CallSettings.php 0000644 00000017277 15174272507 0010470 0 ustar 00 $methodConfig) {
$phpMethodKey = lcfirst($methodName);
$retrySettings = null;
if (self::inheritRetrySettings($retryingOverrides, $phpMethodKey)) {
$retrySettings =
self::constructRetry(
$methodConfig,
$statusCodes,
$serviceConfig['retry_codes'],
$serviceConfig['retry_params']
);
} else {
$retrySettings = $retryingOverrides[$phpMethodKey];
}
$callSettings[$phpMethodKey] = new CallSettings(
['timeoutMillis' => $timeoutMillis,
'retrySettings' => $retrySettings]
);
}
return $callSettings;
}
private static function inheritRetrySettings($retryingOverrides, $phpMethodKey)
{
if (empty($retryingOverrides)) {
return true;
}
if (!array_key_exists($phpMethodKey, $retryingOverrides)) {
return true;
}
$retrySettings = $retryingOverrides[$phpMethodKey];
if (is_null($retrySettings)) {
// Retry has been turned off explicitly.
return false;
}
return $retrySettings->shouldInherit();
}
private static function constructRetry(
$methodConfig,
$statusCodes,
$retryCodes,
$retryParams
) {
$codes = [];
if (!empty($retryCodes)) {
foreach ($retryCodes as $retryCodesName => $retryCodeList) {
if ($retryCodesName === $methodConfig['retry_codes_name'] &&
!empty($retryCodeList)) {
foreach ($retryCodeList as $retryCodeName) {
if (!array_key_exists($retryCodeName, $statusCodes)) {
throw new InvalidArgumentException("Invalid status code: $retryCodeName");
}
array_push($codes, $statusCodes[$retryCodeName]);
}
break;
}
}
}
$backoffSettings = null;
if (!empty($methodConfig['retry_params_name'])) {
foreach ($retryParams as $retryParamsName => $retryParamValues) {
if ($retryParamsName === $methodConfig['retry_params_name']) {
$backoffSettings = BackoffSettings::fromSnakeCase($retryParamValues);
}
}
}
if (!empty($codes) && !empty($backoffSettings)) {
return new RetrySettings($codes, $backoffSettings);
} else {
return null;
}
}
/**
* Construct an instance.
*
* @param array $options {
* Optional.
* @type Google\GAX\RetrySettings $retrySettings
* Retry settings to use for this method. If present, then
* $timeout is ignored.
* @type integer $timeoutMillis
* Timeout to use for the call. Only used if $retrySettings
* is not set.
* }
*/
public function __construct($settings = [])
{
$this->timeoutMillis = self::INHERIT_TIMEOUT;
$this->retrySettings = RetrySettings::inherit();
if (array_key_exists('timeoutMillis', $settings)) {
$this->timeoutMillis = $settings['timeoutMillis'];
}
if (array_key_exists('retrySettings', $settings)) {
$this->retrySettings = $settings['retrySettings'];
}
}
public function getTimeoutMillis()
{
return $this->timeoutMillis;
}
public function getRetrySettings()
{
return $this->retrySettings;
}
/**
* Returns a new CallSettings merged from this and another CallSettings object.
*
* @param CallSettings $otherSettings
* A CallSettings whose values override those in this object. If
* null, then a copy of this object is returned.
*/
public function merge(CallSettings $otherSettings = null)
{
if (is_null($otherSettings)) {
return new CallSettings([
'timeoutMillis' => $this->timeoutMillis,
'retrySettings' => $this->retrySettings]);
} else {
$timeoutMillis = $this->timeoutMillis;
if ($otherSettings->getTimeoutMillis() != self::INHERIT_TIMEOUT) {
$timeoutMillis = $otherSettings->getTimeoutMillis();
}
$retrySettings = $this->retrySettings;
if (is_null($otherSettings->getRetrySettings())
|| !$otherSettings->getRetrySettings()->shouldInherit()) {
$retrySettings = $otherSettings->getRetrySettings();
}
return new CallSettings([
'timeoutMillis' => $timeoutMillis,
'retrySettings' => $retrySettings]);
}
}
}
src/FixedSizeCollection.php 0000644 00000013345 15174272507 0011772 0 ustar 00 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.
*/
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.
*/
public function hasNextCollection()
{
return $this->getLastPage()->hasNextPage();
}
/**
* Returns a page token that can be passed into the API list
* method to retrieve additional elements.
*/
public function getNextPageToken()
{
return $this->getLastPage()->getNextPageToken();
}
/**
* Retrieves the next FixedSizeCollection using one or more API calls.
*/
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.
*/
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.
*/
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 = array_pop((array_slice($pageList, -1)));
return $lastPage;
}
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/GrpcConstants.php 0000644 00000006410 15174272507 0010647 0 ustar 00 Grpc\STATUS_ABORTED,
'ALREADY_EXISTS' => Grpc\STATUS_ALREADY_EXISTS,
'CANCELLED' => Grpc\STATUS_CANCELLED,
'DATA_LOSS' => Grpc\STATUS_DATA_LOSS,
'DEADLINE_EXCEEDED' => Grpc\STATUS_DEADLINE_EXCEEDED,
'FAILED_PRECONDITION' => Grpc\STATUS_FAILED_PRECONDITION,
'INTERNAL' => Grpc\STATUS_INTERNAL,
'INVALID_ARGUMENT' => Grpc\STATUS_INVALID_ARGUMENT,
'NOT_FOUND' => Grpc\STATUS_NOT_FOUND,
'OK' => Grpc\STATUS_OK,
'OUT_OF_RANGE' => Grpc\STATUS_OUT_OF_RANGE,
'PERMISSION_DENIED' => Grpc\STATUS_PERMISSION_DENIED,
'RESOURCE_EXHAUSTED' => Grpc\STATUS_RESOURCE_EXHAUSTED,
'UNAUTHENTICATED' => Grpc\STATUS_UNAUTHENTICATED,
'UNAVAILABLE' => Grpc\STATUS_UNAVAILABLE,
'UNIMPLEMENTED' => Grpc\STATUS_UNIMPLEMENTED,
'UNKNOWN' => Grpc\STATUS_UNKNOWN
];
}
/**
* Provides an array that maps from status code name to an object
* representing that status code.
*/
public static function getStatusCodeNames()
{
if (!self::$statusCodeNames) {
self::initStatusCodeNames();
}
return self::$statusCodeNames;
}
}
src/GrpcCredentialsHelper.php 0000644 00000013545 15174272507 0012277 0 ustar 00 null,
'enableCaching' => true,
];
$opts = array_merge($defaultOptions, $optionalArgs);
$cachingOptions = array_diff_key($opts, $defaultOptions);
$this->scopes = $scopes;
if (isset($opts['credentialsLoader'])) {
$credentialsLoader = $opts['credentialsLoader'];
} else {
$credentialsLoader = $this->getADCCredentials($scopes);
}
if ($opts['enableCaching']) {
$credentialsLoader = new FetchAuthTokenCache(
$credentialsLoader,
$cachingOptions,
new MemoryCacheItemPool()
);
}
$this->credentialsLoader = $credentialsLoader;
}
/**
* Creates the callback function to be passed to gRPC for providing the credentials
* for a call.
*/
public function createCallCredentialsCallback()
{
$credentialsLoader = $this->credentialsLoader;
$callback = function () use ($credentialsLoader) {
$token = $credentialsLoader->fetchAuthToken();
return ['authorization' => array('Bearer ' . $token['access_token'])];
};
return $callback;
}
// TODO(garrettjones):
// add:
// 1. (when supported in gRPC) channel
/**
* Creates a gRPC client stub.
*
* @param callable $generatedCreateStub
* Function callback which must accept two arguments ($hostname, $opts)
* and return an instance of the stub of the specific API to call.
* Generally, this should just call the stub's constructor and return
* the instance.
* @param string $serviceAddress The domain name of the API remote host.
* @param mixed $port The port on which to connect to the remote host.
* @param array $options {
* Optional. Options for configuring the gRPC stub.
*
* @type \Grpc\ChannelCredentials $sslCreds
* A `ChannelCredentials` for use with an SSL-enabled channel.
* Default: a credentials object returned from
* \Grpc\ChannelCredentials::createSsl()
* }
*/
public function createStub($generatedCreateStub, $serviceAddress, $port, $options = [])
{
$stubOpts = [];
if (empty($options['sslCreds'])) {
$stubOpts['credentials'] = $this->createSslChannelCredentials();
} else {
$stubOpts['credentials'] = $options['sslCreds'];
}
$fullAddress = "$serviceAddress:$port";
$stubOpts['grpc.ssl_target_name_override'] = $fullAddress;
return $generatedCreateStub($fullAddress, $stubOpts);
}
/**
* Gets credentials from ADC. This exists to allow overriding in unit tests.
*/
protected function getADCCredentials($scopes)
{
return ApplicationDefaultCredentials::getCredentials($scopes);
}
/**
* Construct ssl channel credentials. This exists to allow overriding in unit tests.
*/
protected function createSslChannelCredentials()
{
return ChannelCredentials::createSsl();
}
}
src/Jison/Parser.jison 0000644 00000010662 15174272507 0010734 0 ustar 00 /*
* Copyright 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.
*/
/* description: Parses a path template string and returns an array of
* Segment objects.
*/
/* options */
//option namespace:Google\GAX\Jison
/* lexical grammar */
%lex
%%
\s+ /* skip whitespace */
"/" return 'FORWARD_SLASH'
"{" return 'LEFT_BRACE'
"}" return 'RIGHT_BRACE'
"=" return 'EQUALS'
"**" return 'PATH_WILDCARD'
"*" return 'WILDCARD'
[^*=}{}\/]+ return 'LITERAL'
<> /* skip EOF */
/lex
%token 'FORWARD_SLASH'
%token 'LEFT_BRACE'
%token 'RIGHT_BRACE'
%token 'EQUALS'
%token 'LITERAL'
%token 'PATH_WILDCARD'
%token 'WILDCARD'
%% /* language grammar */
/* This file is used by a php port of Jison (https://github.com/zaach/jison). */
template
: FORWARD_SLASH bound_segments
{//php return $2->text;
}
| bound_segments
{//php return $1->text;
}
;
bound_segments
: bound_segment FORWARD_SLASH bound_segments
{/*php
$t1 = $1->text;
$t3 = $3->text;
$$ = array_merge($t1, $t3);
*/}
| bound_segment
{//php $$ = $1->text;
}
;
unbound_segments
: unbound_terminal FORWARD_SLASH unbound_segments
{/*php
$t1 = $1->text;
$t3 = $3->text;
$$ = array_merge($t1, $t3);
*/}
| unbound_terminal
{//php $$ = $1->text;
}
;
bound_segment
: bound_terminal
{//php $$ = $1->text;
}
| variable
{//php $$ = $1->text;
}
;
unbound_terminal
: WILDCARD
{/*php
$t1 = $1->text;
Segment::incrementSegmentCount();
$$ = [new Segment(Segment::TERMINAL, $t1)];
*/}
| PATH_WILDCARD
{/*php
$t1 = $1->text;
Segment::incrementSegmentCount();
$$ = [new Segment(Segment::TERMINAL, $t1)];
*/}
| LITERAL
{/*php
$t1 = $1->text;
Segment::incrementSegmentCount();
$$ = [new Segment(Segment::TERMINAL, $t1)];
*/}
;
bound_terminal
: unbound_terminal
{/*php
$t1 = $1->text;
if (in_array($t1[0]['literal'], ['*', '**'])) {
$$ = [
new Segment(Segment::BINDING,
sprintf('$%d', Segment::getBindingCount())),
$t1[0],
new Segment(Segment::END_BINDING, '')
];
Segment::incrementBindingCount();
} else {
$$ = $t1;
}
*/}
;
variable
: LEFT_BRACE LITERAL EQUALS unbound_segments RIGHT_BRACE
{/*php
$t2 = $2->text;
$t4 = $4->text;
$tmp = [new Segment(Segment::BINDING, $t2)];
$tmp = array_merge($tmp, $t4);
array_push($tmp, new Segment(Segment::END_BINDING, ''));
$$ = $tmp;
*/}
| LEFT_BRACE LITERAL RIGHT_BRACE
{/*php
$t2 = $2->text;
$$ = [
new Segment(Segment::BINDING, $t2),
new Segment(Segment::TERMINAL, '*'),
new Segment(Segment::END_BINDING, '')
];
Segment::incrementSegmentCount();
*/}
;
src/Jison/Parser.php 0000644 00000072551 15174272507 0010406 0 ustar 00 symbols[0] = $symbol0;
$this->symbols["accept"] = $symbol0;
$this->symbols[1] = $symbol1;
$this->symbols["end"] = $symbol1;
$this->symbols[2] = $symbol2;
$this->symbols["error"] = $symbol2;
$this->symbols[3] = $symbol3;
$this->symbols["template"] = $symbol3;
$this->symbols[4] = $symbol4;
$this->symbols["FORWARD_SLASH"] = $symbol4;
$this->symbols[5] = $symbol5;
$this->symbols["bound_segments"] = $symbol5;
$this->symbols[6] = $symbol6;
$this->symbols["bound_segment"] = $symbol6;
$this->symbols[7] = $symbol7;
$this->symbols["unbound_segments"] = $symbol7;
$this->symbols[8] = $symbol8;
$this->symbols["unbound_terminal"] = $symbol8;
$this->symbols[9] = $symbol9;
$this->symbols["bound_terminal"] = $symbol9;
$this->symbols[10] = $symbol10;
$this->symbols["variable"] = $symbol10;
$this->symbols[11] = $symbol11;
$this->symbols["WILDCARD"] = $symbol11;
$this->symbols[12] = $symbol12;
$this->symbols["PATH_WILDCARD"] = $symbol12;
$this->symbols[13] = $symbol13;
$this->symbols["LITERAL"] = $symbol13;
$this->symbols[14] = $symbol14;
$this->symbols["LEFT_BRACE"] = $symbol14;
$this->symbols[15] = $symbol15;
$this->symbols["EQUALS"] = $symbol15;
$this->symbols[16] = $symbol16;
$this->symbols["RIGHT_BRACE"] = $symbol16;
$this->terminals = array(
2=>&$symbol2,
4=>&$symbol4,
11=>&$symbol11,
12=>&$symbol12,
13=>&$symbol13,
14=>&$symbol14,
15=>&$symbol15,
16=>&$symbol16
);
$table0 = new ParserState(0);
$table1 = new ParserState(1);
$table2 = new ParserState(2);
$table3 = new ParserState(3);
$table4 = new ParserState(4);
$table5 = new ParserState(5);
$table6 = new ParserState(6);
$table7 = new ParserState(7);
$table8 = new ParserState(8);
$table9 = new ParserState(9);
$table10 = new ParserState(10);
$table11 = new ParserState(11);
$table12 = new ParserState(12);
$table13 = new ParserState(13);
$table14 = new ParserState(14);
$table15 = new ParserState(15);
$table16 = new ParserState(16);
$table17 = new ParserState(17);
$table18 = new ParserState(18);
$table19 = new ParserState(19);
$table20 = new ParserState(20);
$table21 = new ParserState(21);
$table22 = new ParserState(22);
$tableDefinition0 = array(
3=>new ParserAction($this->none, $table1),
4=>new ParserAction($this->shift, $table2),
5=>new ParserAction($this->none, $table3),
6=>new ParserAction($this->none, $table4),
8=>new ParserAction($this->none, $table7),
9=>new ParserAction($this->none, $table5),
10=>new ParserAction($this->none, $table6),
11=>new ParserAction($this->shift, $table9),
12=>new ParserAction($this->shift, $table10),
13=>new ParserAction($this->shift, $table11),
14=>new ParserAction($this->shift, $table8)
);
$tableDefinition1 = array(
1=>new ParserAction($this->accept)
);
$tableDefinition2 = array(
5=>new ParserAction($this->none, $table12),
6=>new ParserAction($this->none, $table4),
8=>new ParserAction($this->none, $table7),
9=>new ParserAction($this->none, $table5),
10=>new ParserAction($this->none, $table6),
11=>new ParserAction($this->shift, $table9),
12=>new ParserAction($this->shift, $table10),
13=>new ParserAction($this->shift, $table11),
14=>new ParserAction($this->shift, $table8)
);
$tableDefinition3 = array(
1=>new ParserAction($this->reduce, $table2)
);
$tableDefinition4 = array(
1=>new ParserAction($this->reduce, $table4),
4=>new ParserAction($this->shift, $table13)
);
$tableDefinition5 = array(
1=>new ParserAction($this->reduce, $table7),
4=>new ParserAction($this->reduce, $table7)
);
$tableDefinition6 = array(
1=>new ParserAction($this->reduce, $table8),
4=>new ParserAction($this->reduce, $table8)
);
$tableDefinition7 = array(
1=>new ParserAction($this->reduce, $table12),
4=>new ParserAction($this->reduce, $table12)
);
$tableDefinition8 = array(
13=>new ParserAction($this->shift, $table14)
);
$tableDefinition9 = array(
1=>new ParserAction($this->reduce, $table9),
4=>new ParserAction($this->reduce, $table9),
16=>new ParserAction($this->reduce, $table9)
);
$tableDefinition10 = array(
1=>new ParserAction($this->reduce, $table10),
4=>new ParserAction($this->reduce, $table10),
16=>new ParserAction($this->reduce, $table10)
);
$tableDefinition11 = array(
1=>new ParserAction($this->reduce, $table11),
4=>new ParserAction($this->reduce, $table11),
16=>new ParserAction($this->reduce, $table11)
);
$tableDefinition12 = array(
1=>new ParserAction($this->reduce, $table1)
);
$tableDefinition13 = array(
5=>new ParserAction($this->none, $table15),
6=>new ParserAction($this->none, $table4),
8=>new ParserAction($this->none, $table7),
9=>new ParserAction($this->none, $table5),
10=>new ParserAction($this->none, $table6),
11=>new ParserAction($this->shift, $table9),
12=>new ParserAction($this->shift, $table10),
13=>new ParserAction($this->shift, $table11),
14=>new ParserAction($this->shift, $table8)
);
$tableDefinition14 = array(
15=>new ParserAction($this->shift, $table16),
16=>new ParserAction($this->shift, $table17)
);
$tableDefinition15 = array(
1=>new ParserAction($this->reduce, $table3)
);
$tableDefinition16 = array(
7=>new ParserAction($this->none, $table18),
8=>new ParserAction($this->none, $table19),
11=>new ParserAction($this->shift, $table9),
12=>new ParserAction($this->shift, $table10),
13=>new ParserAction($this->shift, $table11)
);
$tableDefinition17 = array(
1=>new ParserAction($this->reduce, $table14),
4=>new ParserAction($this->reduce, $table14)
);
$tableDefinition18 = array(
16=>new ParserAction($this->shift, $table20)
);
$tableDefinition19 = array(
4=>new ParserAction($this->shift, $table21),
16=>new ParserAction($this->reduce, $table6)
);
$tableDefinition20 = array(
1=>new ParserAction($this->reduce, $table13),
4=>new ParserAction($this->reduce, $table13)
);
$tableDefinition21 = array(
7=>new ParserAction($this->none, $table22),
8=>new ParserAction($this->none, $table19),
11=>new ParserAction($this->shift, $table9),
12=>new ParserAction($this->shift, $table10),
13=>new ParserAction($this->shift, $table11)
);
$tableDefinition22 = array(
16=>new ParserAction($this->reduce, $table5)
);
$table0->setActions($tableDefinition0);
$table1->setActions($tableDefinition1);
$table2->setActions($tableDefinition2);
$table3->setActions($tableDefinition3);
$table4->setActions($tableDefinition4);
$table5->setActions($tableDefinition5);
$table6->setActions($tableDefinition6);
$table7->setActions($tableDefinition7);
$table8->setActions($tableDefinition8);
$table9->setActions($tableDefinition9);
$table10->setActions($tableDefinition10);
$table11->setActions($tableDefinition11);
$table12->setActions($tableDefinition12);
$table13->setActions($tableDefinition13);
$table14->setActions($tableDefinition14);
$table15->setActions($tableDefinition15);
$table16->setActions($tableDefinition16);
$table17->setActions($tableDefinition17);
$table18->setActions($tableDefinition18);
$table19->setActions($tableDefinition19);
$table20->setActions($tableDefinition20);
$table21->setActions($tableDefinition21);
$table22->setActions($tableDefinition22);
$this->table = array(
0=>$table0,
1=>$table1,
2=>$table2,
3=>$table3,
4=>$table4,
5=>$table5,
6=>$table6,
7=>$table7,
8=>$table8,
9=>$table9,
10=>$table10,
11=>$table11,
12=>$table12,
13=>$table13,
14=>$table14,
15=>$table15,
16=>$table16,
17=>$table17,
18=>$table18,
19=>$table19,
20=>$table20,
21=>$table21,
22=>$table22
);
$this->defaultActions = array(
3=>new ParserAction($this->reduce, $table2),
12=>new ParserAction($this->reduce, $table1),
15=>new ParserAction($this->reduce, $table3),
22=>new ParserAction($this->reduce, $table5)
);
$this->productions = array(
0=>new ParserProduction($symbol0),
1=>new ParserProduction($symbol3,2),
2=>new ParserProduction($symbol3,1),
3=>new ParserProduction($symbol5,3),
4=>new ParserProduction($symbol5,1),
5=>new ParserProduction($symbol7,3),
6=>new ParserProduction($symbol7,1),
7=>new ParserProduction($symbol6,1),
8=>new ParserProduction($symbol6,1),
9=>new ParserProduction($symbol8,1),
10=>new ParserProduction($symbol8,1),
11=>new ParserProduction($symbol8,1),
12=>new ParserProduction($symbol9,1),
13=>new ParserProduction($symbol10,5),
14=>new ParserProduction($symbol10,3)
);
//Setup Lexer
$this->rules = array(
0=>"/^(?:\s+)/",
1=>"/^(?:\/)/",
2=>"/^(?:\{)/",
3=>"/^(?:\})/",
4=>"/^(?:=)/",
5=>"/^(?:\*\*)/",
6=>"/^(?:\*)/",
7=>"/^(?:[^*=}{}\/]+)/",
8=>"/^(?:$)/"
);
$this->conditions = array(
"INITIAL"=>new LexerConditions(array( 0,1,2,3,4,5,6,7,8), true)
);
}
function parserPerformAction(&$thisS, &$yy, $yystate, &$s, $o)
{
/* this == yyval */
switch ($yystate) {
case 1: case 2:
return $s[$o]->text;
break;
case 3: case 5:
$t1 = $s[$o-2]->text;
$t3 = $s[$o]->text;
$thisS = array_merge($t1, $t3);
break;
case 4: case 6: case 7: case 8:
$thisS = $s[$o]->text;
break;
case 9: case 10: case 11:
$t1 = $s[$o]->text;
Segment::incrementSegmentCount();
$thisS = [new Segment(Segment::TERMINAL, $t1)];
break;
case 12:
$t1 = $s[$o]->text;
if (in_array($t1[0]['literal'], ['*', '**'])) {
$thisS = [
new Segment(Segment::BINDING,
sprintf('$%d', Segment::getBindingCount())),
$t1[0],
new Segment(Segment::END_BINDING, '')
];
Segment::incrementBindingCount();
} else {
$thisS = $t1;
}
break;
case 13:
$t2 = $s[$o-3]->text;
$t4 = $s[$o-1]->text;
$tmp = [new Segment(Segment::BINDING, $t2)];
$tmp = array_merge($tmp, $t4);
array_push($tmp, new Segment(Segment::END_BINDING, ''));
$thisS = $tmp;
break;
case 14:
$t2 = $s[$o-1]->text;
$thisS = [
new Segment(Segment::BINDING, $t2),
new Segment(Segment::TERMINAL, '*'),
new Segment(Segment::END_BINDING, '')
];
Segment::incrementSegmentCount();
break;
}
}
function parserLex()
{
$token = $this->lexerLex(); // $end = 1
if (isset($token)) {
return $token;
}
return $this->symbols["end"];
}
function parseError($str = "", ParserError $hash = null)
{
throw new Exception($str);
}
function lexerError($str = "", LexerError $hash = null)
{
throw new Exception($str);
}
function parse($input)
{
if (empty($this->table)) {
throw new Exception("Empty Table");
}
$this->eof = new ParserSymbol("Eof", 1);
$firstAction = new ParserAction(0, $this->table[0]);
$firstCachedAction = new ParserCachedAction($firstAction);
$stack = array($firstCachedAction);
$stackCount = 1;
$vstack = array(null);
$vstackCount = 1;
$yy = null;
$_yy = null;
$recovering = 0;
$symbol = null;
$action = null;
$errStr = "";
$preErrorSymbol = null;
$state = null;
$this->setInput($input);
while (true) {
// retrieve state number from top of stack
$state = $stack[$stackCount - 1]->action->state;
// use default actions if available
if ($state != null && isset($this->defaultActions[$state->index])) {
$action = $this->defaultActions[$state->index];
} else {
if (empty($symbol) == true) {
$symbol = $this->parserLex();
}
// read action for current state and first input
if (isset($state) && isset($state->actions[$symbol->index])) {
//$action = $this->table[$state][$symbol];
$action = $state->actions[$symbol->index];
} else {
$action = null;
}
}
if ($action == null) {
if ($recovering == 0) {
// Report error
$expected = array();
foreach($this->table[$state->index]->actions as $p => $item) {
if (!empty($this->terminals[$p]) && $p > 2) {
$expected[] = $this->terminals[$p]->name;
}
}
$errStr = "Parse error on line " . ($this->yy->lineNo + 1) . ":\n" . $this->showPosition() . "\nExpecting " . implode(", ", $expected) . ", got '" . (isset($this->terminals[$symbol->index]) ? $this->terminals[$symbol->index]->name : 'NOTHING') . "'";
$this->parseError($errStr, new ParserError($this->match, $state, $symbol, $this->yy->lineNo, $this->yy->loc, $expected));
}
}
if ($state === null || $action === null) {
break;
}
switch ($action->action) {
case 1:
// shift
//$this->shiftCount++;
$stack[] = new ParserCachedAction($action, $symbol);
$stackCount++;
$vstack[] = clone($this->yy);
$vstackCount++;
$symbol = "";
if ($preErrorSymbol == null) { // normal execution/no error
$yy = clone($this->yy);
if ($recovering > 0) $recovering--;
} else { // error just occurred, resume old look ahead f/ before error
$symbol = $preErrorSymbol;
$preErrorSymbol = null;
}
break;
case 2:
// reduce
$len = $this->productions[$action->state->index]->len;
// perform semantic action
$_yy = $vstack[$vstackCount - $len];// default to $S = $1
// default location, uses first token for firsts, last for lasts
if (isset($this->ranges)) {
//TODO: add ranges
}
$r = $this->parserPerformAction($_yy->text, $yy, $action->state->index, $vstack, $vstackCount - 1);
if (isset($r)) {
return $r;
}
// pop off stack
while ($len > 0) {
$len--;
array_pop($stack);
$stackCount--;
array_pop($vstack);
$vstackCount--;
}
if (is_null($_yy))
{
$vstack[] = new ParserValue();
}
else
{
$vstack[] = $_yy;
}
$vstackCount++;
$nextSymbol = $this->productions[$action->state->index]->symbol;
// goto new state = table[STATE][NONTERMINAL]
$nextState = $stack[$stackCount - 1]->action->state;
$nextAction = $nextState->actions[$nextSymbol->index];
$stack[] = new ParserCachedAction($nextAction, $nextSymbol);
$stackCount++;
break;
case 3:
// accept
return true;
}
}
return true;
}
/* Jison generated lexer */
public $eof;
public $yy = null;
public $match = "";
public $matched = "";
public $conditionStack = array();
public $conditionStackCount = 0;
public $rules = array();
public $conditions = array();
public $done = false;
public $less;
public $more;
public $input;
public $offset;
public $ranges;
public $flex = false;
function setInput($input)
{
$this->input = $input;
$this->more = $this->less = $this->done = false;
$this->yy = new ParserValue();
$this->conditionStack = array('INITIAL');
$this->conditionStackCount = 1;
if (isset($this->ranges)) {
$loc = $this->yy->loc = new ParserLocation();
$loc->Range(new ParserRange(0, 0));
} else {
$this->yy->loc = new ParserLocation();
}
$this->offset = 0;
}
function input()
{
$ch = $this->input[0];
$this->yy->text .= $ch;
$this->yy->leng++;
$this->offset++;
$this->match .= $ch;
$this->matched .= $ch;
$lines = preg_match("/(?:\r\n?|\n).*/", $ch);
if (count($lines) > 0) {
$this->yy->lineNo++;
$this->yy->lastLine++;
} else {
$this->yy->loc->lastColumn++;
}
if (isset($this->ranges)) {
$this->yy->loc->range->y++;
}
$this->input = array_slice($this->input, 1);
return $ch;
}
function unput($ch)
{
$len = strlen($ch);
$lines = explode("/(?:\r\n?|\n)/", $ch);
$linesCount = count($lines);
$this->input = $ch . $this->input;
$this->yy->text = substr($this->yy->text, 0, $len - 1);
//$this->yylen -= $len;
$this->offset -= $len;
$oldLines = explode("/(?:\r\n?|\n)/", $this->match);
$oldLinesCount = count($oldLines);
$this->match = substr($this->match, 0, strlen($this->match) - 1);
$this->matched = substr($this->matched, 0, strlen($this->matched) - 1);
if (($linesCount - 1) > 0) $this->yy->lineNo -= $linesCount - 1;
$r = $this->yy->loc->range;
$oldLinesLength = (isset($oldLines[$oldLinesCount - $linesCount]) ? strlen($oldLines[$oldLinesCount - $linesCount]) : 0);
$this->yy->loc = new ParserLocation(
$this->yy->loc->firstLine,
$this->yy->lineNo,
$this->yy->loc->firstColumn,
$this->yy->loc->firstLine,
(empty($lines) ?
($linesCount == $oldLinesCount ? $this->yy->loc->firstColumn : 0) + $oldLinesLength :
$this->yy->loc->firstColumn - $len)
);
if (isset($this->ranges)) {
$this->yy->loc->range = array($r[0], $r[0] + $this->yy->leng - $len);
}
}
function more()
{
$this->more = true;
}
function pastInput()
{
$past = substr($this->matched, 0, strlen($this->matched) - strlen($this->match));
return (strlen($past) > 20 ? '...' : '') . preg_replace("/\n/", "", substr($past, -20));
}
function upcomingInput()
{
$next = $this->match;
if (strlen($next) < 20) {
$next .= substr($this->input, 0, 20 - strlen($next));
}
return preg_replace("/\n/", "", substr($next, 0, 20) . (strlen($next) > 20 ? '...' : ''));
}
function showPosition()
{
$pre = $this->pastInput();
$c = '';
for($i = 0, $preLength = strlen($pre); $i < $preLength; $i++) {
$c .= '-';
}
return $pre . $this->upcomingInput() . "\n" . $c . "^";
}
function next()
{
if ($this->done == true) {
return $this->eof;
}
if (empty($this->input)) {
$this->done = true;
}
if ($this->more == false) {
$this->yy->text = '';
$this->match = '';
}
$rules = $this->currentRules();
for ($i = 0, $j = count($rules); $i < $j; $i++) {
preg_match($this->rules[$rules[$i]], $this->input, $tempMatch);
if ($tempMatch && (empty($match) || count($tempMatch[0]) > count($match[0]))) {
$match = $tempMatch;
$index = $i;
if (isset($this->flex) && $this->flex == false) {
break;
}
}
}
if ( $match ) {
$matchCount = strlen($match[0]);
$lineCount = preg_match("/(?:\r\n?|\n).*/", $match[0], $lines);
$line = ($lines ? $lines[$lineCount - 1] : false);
$this->yy->lineNo += $lineCount;
$this->yy->loc = new ParserLocation(
$this->yy->loc->lastLine,
$this->yy->lineNo + 1,
$this->yy->loc->lastColumn,
($line ?
count($line) - preg_match("/\r?\n?/", $line, $na) :
$this->yy->loc->lastColumn + $matchCount
)
);
$this->yy->text .= $match[0];
$this->match .= $match[0];
$this->matches = $match;
$this->matched .= $match[0];
$this->yy->leng = strlen($this->yy->text);
if (isset($this->ranges)) {
$this->yy->loc->range = new ParserRange($this->offset, $this->offset += $this->yy->leng);
}
$this->more = false;
$this->input = substr($this->input, $matchCount, strlen($this->input));
$ruleIndex = $rules[$index];
$nextCondition = $this->conditionStack[$this->conditionStackCount - 1];
$token = $this->lexerPerformAction($ruleIndex, $nextCondition);
if ($this->done == true && empty($this->input) == false) {
$this->done = false;
}
if (empty($token) == false) {
return $this->symbols[
$token
];
} else {
return null;
}
}
if (empty($this->input)) {
return $this->eof;
} else {
$this->lexerError("Lexical error on line " . ($this->yy->lineNo + 1) . ". Unrecognized text.\n" . $this->showPosition(), new LexerError("", -1, $this->yy->lineNo));
return null;
}
}
function lexerLex()
{
$r = $this->next();
while (is_null($r) && !$this->done) {
$r = $this->next();
}
return $r;
}
function begin($condition)
{
$this->conditionStackCount++;
$this->conditionStack[] = $condition;
}
function popState()
{
$this->conditionStackCount--;
return array_pop($this->conditionStack);
}
function currentRules()
{
$peek = $this->conditionStack[$this->conditionStackCount - 1];
return $this->conditions[$peek]->rules;
}
function LexerPerformAction($avoidingNameCollisions, $YY_START = null)
{
;
switch($avoidingNameCollisions) {
case 0:/* skip whitespace */
break;
case 1:return 4;
break;
case 2:return 14;
break;
case 3:return 16;
break;
case 4:return 15;
break;
case 5:return 12;
break;
case 6:return 11;
break;
case 7:return 13;
break;
case 8:/* skip EOF */
break;
}
}
}
class ParserLocation
{
public $firstLine = 1;
public $lastLine = 0;
public $firstColumn = 1;
public $lastColumn = 0;
public $range;
public function __construct($firstLine = 1, $lastLine = 0, $firstColumn = 1, $lastColumn = 0)
{
$this->firstLine = $firstLine;
$this->lastLine = $lastLine;
$this->firstColumn = $firstColumn;
$this->lastColumn = $lastColumn;
}
public function Range($range)
{
$this->range = $range;
}
public function __clone()
{
return new ParserLocation($this->firstLine, $this->lastLine, $this->firstColumn, $this->lastColumn);
}
}
class ParserValue
{
public $leng = 0;
public $loc;
public $lineNo = 0;
public $text;
function __clone() {
$clone = new ParserValue();
$clone->leng = $this->leng;
if (isset($this->loc)) {
$clone->loc = clone $this->loc;
}
$clone->lineNo = $this->lineNo;
$clone->text = $this->text;
return $clone;
}
}
class LexerConditions
{
public $rules;
public $inclusive;
function __construct($rules, $inclusive)
{
$this->rules = $rules;
$this->inclusive = $inclusive;
}
}
class ParserProduction
{
public $len = 0;
public $symbol;
public function __construct($symbol, $len = 0)
{
$this->symbol = $symbol;
$this->len = $len;
}
}
class ParserCachedAction
{
public $action;
public $symbol;
function __construct($action, $symbol = null)
{
$this->action = $action;
$this->symbol = $symbol;
}
}
class ParserAction
{
public $action;
public $state;
public $symbol;
function __construct($action, &$state = null, &$symbol = null)
{
$this->action = $action;
$this->state = $state;
$this->symbol = $symbol;
}
}
class ParserSymbol
{
public $name;
public $index = -1;
public $symbols = array();
public $symbolsByName = array();
function __construct($name, $index)
{
$this->name = $name;
$this->index = $index;
}
public function addAction($a)
{
$this->symbols[$a->index] = $this->symbolsByName[$a->name] = $a;
}
}
class ParserError
{
public $text;
public $state;
public $symbol;
public $lineNo;
public $loc;
public $expected;
function __construct($text, $state, $symbol, $lineNo, $loc, $expected)
{
$this->text = $text;
$this->state = $state;
$this->symbol = $symbol;
$this->lineNo = $lineNo;
$this->loc = $loc;
$this->expected = $expected;
}
}
class LexerError
{
public $text;
public $token;
public $lineNo;
public function __construct($text, $token, $lineNo)
{
$this->text = $text;
$this->token = $token;
$this->lineNo = $lineNo;
}
}
class ParserState
{
public $index;
public $actions = array();
function __construct($index)
{
$this->index = $index;
}
public function setActions(&$actions)
{
$this->actions = $actions;
}
}
class ParserRange
{
public $x;
public $y;
function __construct($x, $y)
{
$this->x = $x;
$this->y = $y;
}
}
src/Jison/Segment.php 0000644 00000005261 15174272507 0010546 0 ustar 00 kind = $kind;
$this->literal = $literal;
$this['kind'] = $kind;
$this['literal'] = $literal;
}
public static function getBindingCount()
{
return self::$bindingCount;
}
public static function incrementBindingCount()
{
self::$bindingCount++;
}
public static function resetBindingCount()
{
self::$bindingCount = 0;
}
public static function getSegmentCount()
{
return self::$segmentCount;
}
public static function incrementSegmentCount()
{
self::$segmentCount++;
}
public static function resetSegmentCount()
{
self::$segmentCount = 0;
}
}
src/LongRunning/OperationsClient.php 0000644 00000046264 15174272507 0013614 0 ustar 00 getOperation($name);
* } finally {
* if (isset($operationsClient)) {
* $operationsClient->close();
* }
* }
* ```
*
* Many parameters require resource names to be formatted in a particular way. To assist
* with these names, this class includes a format method for each type of name, and additionally
* a parse method to extract the individual identifiers contained within names that are
* returned.
*/
class OperationsClient
{
/**
* The default port of the service.
*/
const DEFAULT_SERVICE_PORT = 443;
/**
* The default timeout for non-retrying methods.
*/
const DEFAULT_TIMEOUT_MILLIS = 30000;
const _CODEGEN_NAME = 'gapic';
const _CODEGEN_VERSION = '0.1.0';
private $grpcCredentialsHelper;
private $operationsStub;
private $scopes;
private $defaultCallSettings;
private $descriptors;
private static function getPageStreamingDescriptors()
{
$listOperationsPageStreamingDescriptor =
new PageStreamingDescriptor([
'requestPageTokenField' => 'page_token',
'requestPageSizeField' => 'page_size',
'responsePageTokenField' => 'next_page_token',
'resourceField' => 'operations',
]);
$pageStreamingDescriptors = [
'listOperations' => $listOperationsPageStreamingDescriptor,
];
return $pageStreamingDescriptors;
}
// TODO(garrettjones): add channel (when supported in gRPC)
/**
* 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 domain name of the API remote host.
* @type mixed $port The port on which to connect to the remote host. Default 443.
* @type \Grpc\ChannelCredentials $sslCreds
* A `ChannelCredentials` for use with an SSL-enabled channel.
* Default: a credentials object returned from
* \Grpc\ChannelCredentials::createSsl()
* @type array $scopes Required. A string array of scopes to use when acquiring credentials.
* @type array $retryingOverride
* An associative array of string => RetryOptions, where the keys
* are method names (e.g. 'createFoo'), that overrides default retrying
* settings. A value of null indicates that the method in question should
* not retry.
* @type int $timeoutMillis The timeout in milliseconds to use for calls
* that don't use retries. For calls that use retries,
* set the timeout in RetryOptions.
* Default: 30000 (30 seconds)
* @type string $appName The codename of the calling service. Default 'gax'.
* @type string $appVersion The version of the calling service.
* Default: the current version of GAX.
* @type \Google\Auth\CredentialsLoader $credentialsLoader
* A CredentialsLoader object created using the
* Google\Auth library.
* }
*/
public function __construct($options = [])
{
if (!array_key_exists('serviceAddress', $options)) {
throw new ValidationException("The 'serviceAddress' option must be provided.");
}
if (!array_key_exists('scopes', $options)) {
throw new ValidationException("The 'scopes' option must be provided.");
}
$defaultOptions = [
'port' => self::DEFAULT_SERVICE_PORT,
'retryingOverride' => null,
'timeoutMillis' => self::DEFAULT_TIMEOUT_MILLIS,
'appName' => 'gax',
'appVersion' => AgentHeaderDescriptor::getGaxVersion(),
];
$options = array_merge($defaultOptions, $options);
$headerDescriptor = new AgentHeaderDescriptor([
'clientName' => $options['appName'],
'clientVersion' => $options['appVersion'],
'codeGenName' => self::_CODEGEN_NAME,
'codeGenVersion' => self::_CODEGEN_VERSION,
'gaxVersion' => AgentHeaderDescriptor::getGaxVersion(),
'phpVersion' => phpversion(),
]);
$defaultDescriptors = ['headerDescriptor' => $headerDescriptor];
$this->descriptors = [
'getOperation' => $defaultDescriptors,
'listOperations' => $defaultDescriptors,
'cancelOperation' => $defaultDescriptors,
'deleteOperation' => $defaultDescriptors,
];
$pageStreamingDescriptors = self::getPageStreamingDescriptors();
foreach ($pageStreamingDescriptors as $method => $pageStreamingDescriptor) {
$this->descriptors[$method]['pageStreamingDescriptor'] = $pageStreamingDescriptor;
}
$clientConfigJsonString = file_get_contents(__DIR__.'/resources/operations_client_config.json');
$clientConfig = json_decode($clientConfigJsonString, true);
$this->defaultCallSettings =
CallSettings::load(
'google.longrunning.Operations',
$clientConfig,
$options['retryingOverride'],
GrpcConstants::getStatusCodeNames(),
$options['timeoutMillis']
);
$this->scopes = $options['scopes'];
$createStubOptions = [];
if (array_key_exists('sslCreds', $options)) {
$createStubOptions['sslCreds'] = $options['sslCreds'];
}
$grpcCredentialsHelperOptions = array_diff_key($options, $defaultOptions);
$this->grpcCredentialsHelper = new GrpcCredentialsHelper($this->scopes, $grpcCredentialsHelperOptions);
$createOperationsStubFunction = function ($hostname, $opts) {
return new OperationsGrpcClient($hostname, $opts);
};
if (array_key_exists('createOperationsStubFunction', $options)) {
$createOperationsStubFunction = $options['createOperationsStubFunction'];
}
$this->operationsStub = $this->grpcCredentialsHelper->createStub(
$createOperationsStubFunction,
$options['serviceAddress'],
$options['port'],
$createStubOptions
);
}
/**
* 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:
* ```
* try {
* $operationsClient = new OperationsClient();
* $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 \Google\GAX\RetrySettings $retrySettings
* Retry settings to use for this call. If present, then
* $timeoutMillis is ignored.
* @type int $timeoutMillis
* Timeout to use for this call. Only used if $retrySettings
* is not set.
* }
*
* @return \google\longrunning\Operation
*
* @throws \Google\GAX\ApiException if the remote call fails
*/
public function getOperation($name, $optionalArgs = [])
{
$request = new GetOperationRequest();
$request->setName($name);
$mergedSettings = $this->defaultCallSettings['getOperation']->merge(
new CallSettings($optionalArgs)
);
$callable = ApiCallable::createApiCall(
$this->operationsStub,
'GetOperation',
$mergedSettings,
$this->descriptors['getOperation']
);
return $callable(
$request,
[],
['call_credentials_callback' => $this->createCredentialsCallback()]);
}
/**
* 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:
* ```
* try {
* $operationsClient = new OperationsClient();
* $name = "";
* $filter = "";
* foreach ($operationsClient->listOperations($name, $filter) as $element) {
* // doThingsWith(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 \Google\GAX\RetrySettings $retrySettings
* Retry settings to use for this call. If present, then
* $timeoutMillis is ignored.
* @type int $timeoutMillis
* Timeout to use for this call. Only used if $retrySettings
* is not set.
* }
*
* @return \Google\GAX\PagedListResponse
*
* @throws \Google\GAX\ApiException if the remote call fails
*/
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']);
}
$mergedSettings = $this->defaultCallSettings['listOperations']->merge(
new CallSettings($optionalArgs)
);
$callable = ApiCallable::createApiCall(
$this->operationsStub,
'ListOperations',
$mergedSettings,
$this->descriptors['listOperations']
);
return $callable(
$request,
[],
['call_credentials_callback' => $this->createCredentialsCallback()]);
}
/**
* 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:
* ```
* try {
* $operationsClient = new OperationsClient();
* $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 \Google\GAX\RetrySettings $retrySettings
* Retry settings to use for this call. If present, then
* $timeoutMillis is ignored.
* @type int $timeoutMillis
* Timeout to use for this call. Only used if $retrySettings
* is not set.
* }
*
* @throws \Google\GAX\ApiException if the remote call fails
*/
public function cancelOperation($name, $optionalArgs = [])
{
$request = new CancelOperationRequest();
$request->setName($name);
$mergedSettings = $this->defaultCallSettings['cancelOperation']->merge(
new CallSettings($optionalArgs)
);
$callable = ApiCallable::createApiCall(
$this->operationsStub,
'CancelOperation',
$mergedSettings,
$this->descriptors['cancelOperation']
);
return $callable(
$request,
[],
['call_credentials_callback' => $this->createCredentialsCallback()]);
}
/**
* 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:
* ```
* try {
* $operationsClient = new OperationsClient();
* $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 \Google\GAX\RetrySettings $retrySettings
* Retry settings to use for this call. If present, then
* $timeoutMillis is ignored.
* @type int $timeoutMillis
* Timeout to use for this call. Only used if $retrySettings
* is not set.
* }
*
* @throws \Google\GAX\ApiException if the remote call fails
*/
public function deleteOperation($name, $optionalArgs = [])
{
$request = new DeleteOperationRequest();
$request->setName($name);
$mergedSettings = $this->defaultCallSettings['deleteOperation']->merge(
new CallSettings($optionalArgs)
);
$callable = ApiCallable::createApiCall(
$this->operationsStub,
'DeleteOperation',
$mergedSettings,
$this->descriptors['deleteOperation']
);
return $callable(
$request,
[],
['call_credentials_callback' => $this->createCredentialsCallback()]);
}
/**
* Initiates an orderly shutdown in which preexisting calls continue but new
* calls are immediately cancelled.
*/
public function close()
{
$this->operationsStub->close();
}
private function createCredentialsCallback()
{
return $this->grpcCredentialsHelper->createCallCredentialsCallback();
}
}
src/LongRunning/resources/operations_client_config.json 0000644 00000002422 15174272507 0017560 0 ustar 00 {
"interfaces": {
"google.longrunning.Operations": {
"retry_codes": {
"retry_codes_def": {
"idempotent": [
"DEADLINE_EXCEEDED",
"UNAVAILABLE"
],
"non_idempotent": []
}
},
"retry_params": {
"default": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 20000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 20000,
"total_timeout_millis": 600000
}
},
"methods": {
"GetOperation": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"ListOperations": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"CancelOperation": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"DeleteOperation": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
}
}
}
}
}
src/OperationResponse.php 0000644 00000025242 15174272507 0011542 0 ustar 00 operationName = $operationName;
$this->operationsClient = $operationsClient;
if (isset($options['operationReturnType'])) {
$this->operationReturnType = $options['operationReturnType'];
}
if (isset($options['metadataReturnType'])) {
$this->metadataReturnType = $options['metadataReturnType'];
}
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['maxPollingDuration'] setting is not set (or set <= 0.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 float $pollingIntervalSeconds The polling interval to use, in seconds.
* Default: 1.0
* @type float $maxPollingDurationSeconds The maximum amount of time to continue polling.
* Default: 0.0 (no maximum)
* }
* @return bool Indicates if the operation completed.
* @throws ApiException If an API call fails.
*/
public function pollUntilComplete($options = [])
{
$defaultPollSettings = [
'pollingIntervalSeconds' => $this::DEFAULT_POLLING_INTERVAL,
'maxPollingDurationSeconds' => 0.0,
];
$pollSettings = array_merge($defaultPollSettings, $options);
$pollingIntervalMicros = $pollSettings['pollingIntervalSeconds'] * 1000000;
$maxPollingDuration = $pollSettings['maxPollingDurationSeconds'];
$hasMaxPollingDuration = $maxPollingDuration > 0.0;
$endTime = microtime(true) + $maxPollingDuration;
while (!$this->isDone() && (!$hasMaxPollingDuration || microtime(true) < $endTime)) {
usleep($pollingIntervalMicros);
$this->reload();
}
return $this->isDone();
}
/**
* 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() || !$this->lastProtoResponse->hasResponse()) {
return null;
}
$anyResponse = $this->lastProtoResponse->getResponse();
if (is_null($this->operationReturnType)) {
return $anyResponse;
}
$operationReturnType = $this->operationReturnType;
$response = new $operationReturnType();
$response->parse($anyResponse->getValue());
return $response;
}
/**
* If the operation failed, return the status. If operationFailed() is false, return null.
*
* @return \google\rpc\Status|null The status of the operation in case of failure, or null if
* operationFailed() is false.
*/
public function getError()
{
if (!$this->isDone() || !$this->lastProtoResponse->hasError()) {
return null;
}
return $this->lastProtoResponse->getError();
}
/**
* @return \google\longrunning\Operation|null The last Operation object received from the server.
*/
public function getLastProtoResponse()
{
return $this->lastProtoResponse;
}
/**
* @return \Google\GAX\LongRunning\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->parse($any->getValue());
return $metadata;
}
}
src/Page.php 0000644 00000013176 15174272507 0006742 0 ustar 00 parameters = $params;
$this->callable = $callable;
$this->pageStreamingDescriptor = $pageStreamingDescriptor;
$requestPageTokenField = $this->pageStreamingDescriptor->getRequestPageTokenField();
$this->pageToken = $params[0]->$requestPageTokenField;
// Make gRPC call eagerly
$this->response = call_user_func_array($this->callable, $this->parameters);
}
/**
* Returns true if there are more pages that can be retrieved from the
* API.
*/
public function hasNextPage()
{
return strcmp($this->getNextPageToken(), Page::FINAL_PAGE_TOKEN) != 0;
}
/**
* Returns the next page token from the response.
*/
public function getNextPageToken()
{
$responsePageTokenField = $this->pageStreamingDescriptor->getResponsePageTokenField();
return $this->getResponseObject()->$responsePageTokenField;
}
/**
* Retrieves the next Page object using the next page token.
*/
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();
$requestPageTokenField = $this->pageStreamingDescriptor->getRequestPageTokenField();
$newRequest->$requestPageTokenField = $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'
);
}
$requestPageSizeField = $this->pageStreamingDescriptor->getRequestPageSizeField();
$newRequest->$requestPageSizeField = $pageSize;
}
$nextParameters = [$newRequest, $this->parameters[1], $this->parameters[2]];
return new Page($nextParameters, $this->callable, $this->pageStreamingDescriptor);
}
/**
* Return the number of elements in the response.
*/
public function getPageElementCount()
{
$resourceField = $this->pageStreamingDescriptor->getResourceField();
return count($this->getResponseObject()->$resourceField);
}
/**
* Return an iterator over the elements in the response.
*/
public function getIterator()
{
$resourceField = $this->pageStreamingDescriptor->getResourceField();
foreach ($this->getResponseObject()->$resourceField 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.
*/
public function iteratePages()
{
$currentPage = $this;
yield $this;
while ($currentPage->hasNextPage()) {
$currentPage = $currentPage->getNextPage();
yield $currentPage;
}
}
/**
* Gets the request object used to generate the Page.
*/
public function getRequestObject()
{
return $this->parameters[0];
}
/**
* Gets the API response object.
*/
public function getResponseObject()
{
return $this->response;
}
}
src/PageStreamingDescriptor.php 0000644 00000007125 15174272507 0012650 0 ustar 00 requestPageTokenField = $descriptor['requestPageTokenField'];
if (isset($descriptor['requestPageSizeField'])) {
$this->requestPageSizeField = $descriptor['requestPageSizeField'];
} else {
$this->requestPageSizeField = null;
}
$this->responsePageTokenField = $descriptor['responsePageTokenField'];
$this->resourceField = $descriptor['resourceField'];
}
public function getRequestPageTokenField()
{
return $this->requestPageTokenField;
}
public function getRequestPageSizeField()
{
return $this->requestPageSizeField;
}
public function requestHasPageSizeField()
{
return isset($this->requestPageSizeField);
}
public function getResponsePageTokenField()
{
return $this->responsePageTokenField;
}
public function getResourceField()
{
return $this->resourceField;
}
private static function validate($descriptor)
{
$requiredFields = ['requestPageTokenField', 'responsePageTokenField', 'resourceField'];
foreach ($requiredFields as $field) {
if (empty($descriptor[$field])) {
throw new InvalidArgumentException(
"$field is required for PageStreamingDescriptor"
);
}
}
}
}
src/PagedListResponse.php 0000644 00000016344 15174272507 0011461 0 ustar 00 parameters = $params;
$this->callable = $callable;
$this->pageStreamingDescriptor = $pageStreamingDescriptor;
// Eagerly construct the first page
$this->getPage();
}
/**
* Returns an iterator over the full list of elements. Elements
* of the list are retrieved lazily using the underlying API.
*/
public function iterateAllElements()
{
foreach ($this->iteratePages() as $page) {
foreach ($page as $element) {
yield $element;
}
}
}
/**
* Return the current page of results. If the page has not
* previously been accessed, it will be retrieved with a call to
* the underlying API.
*/
public function getPage()
{
if (!isset($this->firstPage)) {
$this->firstPage = new Page(
$this->parameters,
$this->callable,
$this->pageStreamingDescriptor
);
}
return $this->firstPage;
}
/**
* Returns an iterator over pages of results. The pages are
* retrieved lazily from the underlying API.
*/
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.
*/
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."
);
}
// The first page has been eagerly constructed, so we do not need to
// update the page size parameter before calling getPage
$page = $this->getPage();
$request = $page->getRequestObject();
$pageSizeField = $this->pageStreamingDescriptor->getRequestPageSizeField();
if (!isset($request->$pageSizeField)) {
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."
);
}
$pageSize = $request->$pageSizeField;
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->getPage(), $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.
*/
public function iterateFixedSizeCollections($collectionSize)
{
return $this->expandToFixedSizeCollection($collectionSize)->iterateCollections();
}
}
src/Parser.php 0000644 00000006210 15174272507 0007311 0 ustar 00 parser = new BaseParser();
}
/**
* Returns an array of path template segments parsed from data.
*
* @param string $data A path template string
*
* @throws ValidationException when $data cannot be parsed
*
* @return array An array of Segment
*/
public function parse($data)
{
try {
Segment::resetSegmentCount();
Segment::resetBindingCount();
$segments = $this->parser->parse($data);
$this->segmentCount = Segment::getSegmentCount();
// Validation step: checks that there are no nested bindings.
$pathWildcard = false;
foreach ($segments as $segment) {
if ($segment->kind == Segment::TERMINAL &&
$segment->literal == '**') {
if ($pathWildcard) {
throw new ValidationException(
'validation error: path template cannot contain '.
'more than one path wildcard'
);
}
$pathWildcard = true;
}
}
return $segments;
} catch (Exception $e) {
throw new ValidationException('Exception in parser', 0, $e);
}
}
public function getSegmentCount()
{
return $this->segmentCount;
}
}
src/PathTemplate.php 0000644 00000014630 15174272507 0010452 0 ustar 00 segments = $parser->parse($data);
$this->segmentCount = $parser->getSegmentCount();
}
public function __toString()
{
return self::format($this->segments);
}
public function count()
{
return $this->segmentCount;
}
/**
* 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($bindings)
{
$out = [];
$binding = false;
foreach ($this->segments as $segment) {
if ($segment->kind == Segment::BINDING) {
if (!array_key_exists($segment->literal, $bindings)) {
throw new ValidationException(
sprintf(
'render error: value for key "%s" not '.
'provided',
$segment->literal
)
);
}
$out = array_merge(
$out,
(new self($bindings[$segment->literal]))->segments
);
$binding = true;
} elseif ($segment->kind == Segment::END_BINDING) {
$binding = false;
} else {
if ($binding) {
continue;
}
array_push($out, $segment);
}
}
$path = self::format($out);
$this->match($path);
return $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)
{
$segments = $this->segments;
$pathList = explode('/', $path);
$currentVar = null;
$bindings = [];
$segmentCount = $this->segmentCount;
$pathIndex = 0;
foreach ($segments as $segment) {
if ($pathIndex >= count($pathList)) {
break;
}
if ($segment->kind == Segment::TERMINAL) {
$pathItem = $pathList[$pathIndex];
if ($segment->literal == '*') {
$bindings[$currentVar] = $pathItem;
$pathIndex += 1;
} elseif ($segment->literal == '**') {
$length = count($pathList) - $segmentCount + 1;
$segmentCount += count($pathList) - $segmentCount;
$bindings[$currentVar] = implode(
'/',
array_slice($pathList, $pathIndex, $length)
);
$pathIndex += $length;
} elseif ($segment->literal != $pathItem) {
throw new ValidationException(
sprintf(
'mismatched literal: "%s" != "%s"',
$segment->literal,
$pathItem
)
);
} else {
$pathIndex += 1;
}
} elseif ($segment->kind == Segment::BINDING) {
$currentVar = $segment->literal;
}
}
if (($pathIndex != count($pathList)) || ($pathIndex != $segmentCount)) {
throw new ValidationException(
sprintf(
'match error: could not render a path template '.
'from %s',
$path
)
);
}
return $bindings;
}
private static function format($segments)
{
$template = '';
$slash = true;
foreach ($segments as $segment) {
if ($segment->kind == Segment::TERMINAL) {
if ($slash) {
$template .= '/';
}
$template .= $segment->literal;
}
$slash = true;
if ($segment->kind == Segment::BINDING) {
$template .= sprintf('/{%s=', $segment->literal);
$slash = false;
}
if ($segment->kind == Segment::END_BINDING) {
$template .= sprintf('%s}', $segment->literal);
}
}
// Remove leading '/'
return substr($template, 1);
}
}
src/RetrySettings.php 0000644 00000005600 15174272507 0010705 0 ustar 00 inherit = true;
return $retrySettings;
}
/**
* Construct an instance.
*/
public function __construct($retryableCodes, $backoffSettings)
{
$this->retryableCodes = $retryableCodes;
$this->backoffSettings = $backoffSettings;
$this->inherit = false;
}
public function getRetryableCodes()
{
return $this->retryableCodes;
}
public function getBackoffSettings()
{
return $this->backoffSettings;
}
public function shouldInherit()
{
return $this->inherit;
}
}
src/Testing/MockStubTrait.php 0000644 00000007446 15174272507 0012241 0 ustar 00 receivedFuncCalls[] = [$method, $argument::deserialize($argument->serialize())];
list($response, $status) = array_shift($this->responses);
return new MockUnaryCall($response, $deserialize, $status);
}
/**
* Add a response object, and an optional status, to the list of responses to be returned via
* _simpleRequest.
*/
public function addResponse($response, $status = null)
{
$this->responses[] = [$response->serialize(), $status];
}
/**
* Return a list of calls made to _simpleRequest, and clear $receivedFuncCalls.
*/
public function getReceivedCalls()
{
$receivedFuncCallsTemp = $this->receivedFuncCalls;
$this->receivedFuncCalls = [];
return $receivedFuncCallsTemp;
}
/**
* @return bool True if $receivedFuncCalls and $response are empty.
*/
public function isExhausted()
{
return count($this->receivedFuncCalls) === 0
&& count($this->responses) === 0;
}
}
src/Testing/MockUnaryCall.php 0000644 00000006063 15174272507 0012204 0 ustar 00 response = $response;
if (is_null($deserialize)) {
$deserialize = function($resp) {
return $resp;
};
}
$this->deserialize = $deserialize;
if (is_null($status)) {
$status = new Status();
$status->setCode(Code::OK);
}
$this->status = $status;
}
/**
* Immediately return the preset response object and status.
* @return array The response object and status.
*/
public function wait()
{
return [call_user_func($this->deserialize, $this->response), $this->status];
}
}
src/ValidationException.php 0000644 00000003170 15174272507 0012030 0 ustar 00 number = 72295728;
$f->name = "google\api\http";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\google\api\HttpRule';
return $f;
});
} src/generated/audit_log.php 0000644 00000053207 15174272507 0011772 0 ustar 00 number = 7;
$f->name = "service_name";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL STRING method_name = 8
$f = new \DrSlump\Protobuf\Field();
$f->number = 8;
$f->name = "method_name";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL STRING resource_name = 11
$f = new \DrSlump\Protobuf\Field();
$f->number = 11;
$f->name = "resource_name";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL INT64 num_response_items = 12
$f = new \DrSlump\Protobuf\Field();
$f->number = 12;
$f->name = "num_response_items";
$f->type = \DrSlump\Protobuf::TYPE_INT64;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL MESSAGE status = 2
$f = new \DrSlump\Protobuf\Field();
$f->number = 2;
$f->name = "status";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\google\rpc\Status';
$descriptor->addField($f);
// OPTIONAL MESSAGE authentication_info = 3
$f = new \DrSlump\Protobuf\Field();
$f->number = 3;
$f->name = "authentication_info";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\google\cloud\audit\AuthenticationInfo';
$descriptor->addField($f);
// REPEATED MESSAGE authorization_info = 9
$f = new \DrSlump\Protobuf\Field();
$f->number = 9;
$f->name = "authorization_info";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_REPEATED;
$f->reference = '\google\cloud\audit\AuthorizationInfo';
$descriptor->addField($f);
// OPTIONAL MESSAGE request_metadata = 4
$f = new \DrSlump\Protobuf\Field();
$f->number = 4;
$f->name = "request_metadata";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\google\cloud\audit\RequestMetadata';
$descriptor->addField($f);
// OPTIONAL MESSAGE request = 16
$f = new \DrSlump\Protobuf\Field();
$f->number = 16;
$f->name = "request";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\google\protobuf\Struct';
$descriptor->addField($f);
// OPTIONAL MESSAGE response = 17
$f = new \DrSlump\Protobuf\Field();
$f->number = 17;
$f->name = "response";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\google\protobuf\Struct';
$descriptor->addField($f);
// OPTIONAL MESSAGE service_data = 15
$f = new \DrSlump\Protobuf\Field();
$f->number = 15;
$f->name = "service_data";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\google\protobuf\Any';
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasServiceName(){
return $this->_has(7);
}
/**
* Clear value
*
* @return \google\cloud\audit\AuditLog
*/
public function clearServiceName(){
return $this->_clear(7);
}
/**
* Get value
*
* @return string
*/
public function getServiceName(){
return $this->_get(7);
}
/**
* Set value
*
* @param string $value
* @return \google\cloud\audit\AuditLog
*/
public function setServiceName( $value){
return $this->_set(7, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasMethodName(){
return $this->_has(8);
}
/**
* Clear value
*
* @return \google\cloud\audit\AuditLog
*/
public function clearMethodName(){
return $this->_clear(8);
}
/**
* Get value
*
* @return string
*/
public function getMethodName(){
return $this->_get(8);
}
/**
* Set value
*
* @param string $value
* @return \google\cloud\audit\AuditLog
*/
public function setMethodName( $value){
return $this->_set(8, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasResourceName(){
return $this->_has(11);
}
/**
* Clear value
*
* @return \google\cloud\audit\AuditLog
*/
public function clearResourceName(){
return $this->_clear(11);
}
/**
* Get value
*
* @return string
*/
public function getResourceName(){
return $this->_get(11);
}
/**
* Set value
*
* @param string $value
* @return \google\cloud\audit\AuditLog
*/
public function setResourceName( $value){
return $this->_set(11, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasNumResponseItems(){
return $this->_has(12);
}
/**
* Clear value
*
* @return \google\cloud\audit\AuditLog
*/
public function clearNumResponseItems(){
return $this->_clear(12);
}
/**
* Get value
*
* @return int
*/
public function getNumResponseItems(){
return $this->_get(12);
}
/**
* Set value
*
* @param int $value
* @return \google\cloud\audit\AuditLog
*/
public function setNumResponseItems( $value){
return $this->_set(12, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasStatus(){
return $this->_has(2);
}
/**
* Clear value
*
* @return \google\cloud\audit\AuditLog
*/
public function clearStatus(){
return $this->_clear(2);
}
/**
* Get value
*
* @return \google\rpc\Status
*/
public function getStatus(){
return $this->_get(2);
}
/**
* Set value
*
* @param \google\rpc\Status $value
* @return \google\cloud\audit\AuditLog
*/
public function setStatus(\google\rpc\Status $value){
return $this->_set(2, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasAuthenticationInfo(){
return $this->_has(3);
}
/**
* Clear value
*
* @return \google\cloud\audit\AuditLog
*/
public function clearAuthenticationInfo(){
return $this->_clear(3);
}
/**
* Get value
*
* @return \google\cloud\audit\AuthenticationInfo
*/
public function getAuthenticationInfo(){
return $this->_get(3);
}
/**
* Set value
*
* @param \google\cloud\audit\AuthenticationInfo $value
* @return \google\cloud\audit\AuditLog
*/
public function setAuthenticationInfo(\google\cloud\audit\AuthenticationInfo $value){
return $this->_set(3, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasAuthorizationInfo(){
return $this->_has(9);
}
/**
* Clear value
*
* @return \google\cloud\audit\AuditLog
*/
public function clearAuthorizationInfo(){
return $this->_clear(9);
}
/**
* Get value
*
* @param int $idx
* @return \google\cloud\audit\AuthorizationInfo
*/
public function getAuthorizationInfo($idx = NULL){
return $this->_get(9, $idx);
}
/**
* Set value
*
* @param \google\cloud\audit\AuthorizationInfo $value
* @return \google\cloud\audit\AuditLog
*/
public function setAuthorizationInfo(\google\cloud\audit\AuthorizationInfo $value, $idx = NULL){
return $this->_set(9, $value, $idx);
}
/**
* Get all elements of
*
* @return \google\cloud\audit\AuthorizationInfo[]
*/
public function getAuthorizationInfoList(){
return $this->_get(9);
}
/**
* Add a new element to
*
* @param \google\cloud\audit\AuthorizationInfo $value
* @return \google\cloud\audit\AuditLog
*/
public function addAuthorizationInfo(\google\cloud\audit\AuthorizationInfo $value){
return $this->_add(9, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasRequestMetadata(){
return $this->_has(4);
}
/**
* Clear value
*
* @return \google\cloud\audit\AuditLog
*/
public function clearRequestMetadata(){
return $this->_clear(4);
}
/**
* Get value
*
* @return \google\cloud\audit\RequestMetadata
*/
public function getRequestMetadata(){
return $this->_get(4);
}
/**
* Set value
*
* @param \google\cloud\audit\RequestMetadata $value
* @return \google\cloud\audit\AuditLog
*/
public function setRequestMetadata(\google\cloud\audit\RequestMetadata $value){
return $this->_set(4, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasRequest(){
return $this->_has(16);
}
/**
* Clear value
*
* @return \google\cloud\audit\AuditLog
*/
public function clearRequest(){
return $this->_clear(16);
}
/**
* Get value
*
* @return \google\protobuf\Struct
*/
public function getRequest(){
return $this->_get(16);
}
/**
* Set value
*
* @param \google\protobuf\Struct $value
* @return \google\cloud\audit\AuditLog
*/
public function setRequest(\google\protobuf\Struct $value){
return $this->_set(16, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasResponse(){
return $this->_has(17);
}
/**
* Clear value
*
* @return \google\cloud\audit\AuditLog
*/
public function clearResponse(){
return $this->_clear(17);
}
/**
* Get value
*
* @return \google\protobuf\Struct
*/
public function getResponse(){
return $this->_get(17);
}
/**
* Set value
*
* @param \google\protobuf\Struct $value
* @return \google\cloud\audit\AuditLog
*/
public function setResponse(\google\protobuf\Struct $value){
return $this->_set(17, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasServiceData(){
return $this->_has(15);
}
/**
* Clear value
*
* @return \google\cloud\audit\AuditLog
*/
public function clearServiceData(){
return $this->_clear(15);
}
/**
* Get value
*
* @return \google\protobuf\Any
*/
public function getServiceData(){
return $this->_get(15);
}
/**
* Set value
*
* @param \google\protobuf\Any $value
* @return \google\cloud\audit\AuditLog
*/
public function setServiceData(\google\protobuf\Any $value){
return $this->_set(15, $value);
}
}
}
namespace google\cloud\audit {
class AuthenticationInfo extends \DrSlump\Protobuf\Message {
/** @var string */
public $principal_email = null;
/** @var \Closure[] */
protected static $__extensions = array();
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.cloud.audit.AuthenticationInfo');
// OPTIONAL STRING principal_email = 1
$f = new \DrSlump\Protobuf\Field();
$f->number = 1;
$f->name = "principal_email";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasPrincipalEmail(){
return $this->_has(1);
}
/**
* Clear value
*
* @return \google\cloud\audit\AuthenticationInfo
*/
public function clearPrincipalEmail(){
return $this->_clear(1);
}
/**
* Get value
*
* @return string
*/
public function getPrincipalEmail(){
return $this->_get(1);
}
/**
* Set value
*
* @param string $value
* @return \google\cloud\audit\AuthenticationInfo
*/
public function setPrincipalEmail( $value){
return $this->_set(1, $value);
}
}
}
namespace google\cloud\audit {
class AuthorizationInfo extends \DrSlump\Protobuf\Message {
/** @var string */
public $resource = null;
/** @var string */
public $permission = null;
/** @var boolean */
public $granted = null;
/** @var \Closure[] */
protected static $__extensions = array();
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.cloud.audit.AuthorizationInfo');
// OPTIONAL STRING resource = 1
$f = new \DrSlump\Protobuf\Field();
$f->number = 1;
$f->name = "resource";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL STRING permission = 2
$f = new \DrSlump\Protobuf\Field();
$f->number = 2;
$f->name = "permission";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL BOOL granted = 3
$f = new \DrSlump\Protobuf\Field();
$f->number = 3;
$f->name = "granted";
$f->type = \DrSlump\Protobuf::TYPE_BOOL;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasResource(){
return $this->_has(1);
}
/**
* Clear value
*
* @return \google\cloud\audit\AuthorizationInfo
*/
public function clearResource(){
return $this->_clear(1);
}
/**
* Get value
*
* @return string
*/
public function getResource(){
return $this->_get(1);
}
/**
* Set value
*
* @param string $value
* @return \google\cloud\audit\AuthorizationInfo
*/
public function setResource( $value){
return $this->_set(1, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasPermission(){
return $this->_has(2);
}
/**
* Clear value
*
* @return \google\cloud\audit\AuthorizationInfo
*/
public function clearPermission(){
return $this->_clear(2);
}
/**
* Get value
*
* @return string
*/
public function getPermission(){
return $this->_get(2);
}
/**
* Set value
*
* @param string $value
* @return \google\cloud\audit\AuthorizationInfo
*/
public function setPermission( $value){
return $this->_set(2, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasGranted(){
return $this->_has(3);
}
/**
* Clear value
*
* @return \google\cloud\audit\AuthorizationInfo
*/
public function clearGranted(){
return $this->_clear(3);
}
/**
* Get value
*
* @return boolean
*/
public function getGranted(){
return $this->_get(3);
}
/**
* Set value
*
* @param boolean $value
* @return \google\cloud\audit\AuthorizationInfo
*/
public function setGranted( $value){
return $this->_set(3, $value);
}
}
}
namespace google\cloud\audit {
class RequestMetadata extends \DrSlump\Protobuf\Message {
/** @var string */
public $caller_ip = null;
/** @var string */
public $caller_supplied_user_agent = null;
/** @var \Closure[] */
protected static $__extensions = array();
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.cloud.audit.RequestMetadata');
// OPTIONAL STRING caller_ip = 1
$f = new \DrSlump\Protobuf\Field();
$f->number = 1;
$f->name = "caller_ip";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL STRING caller_supplied_user_agent = 2
$f = new \DrSlump\Protobuf\Field();
$f->number = 2;
$f->name = "caller_supplied_user_agent";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasCallerIp(){
return $this->_has(1);
}
/**
* Clear value
*
* @return \google\cloud\audit\RequestMetadata
*/
public function clearCallerIp(){
return $this->_clear(1);
}
/**
* Get value
*
* @return string
*/
public function getCallerIp(){
return $this->_get(1);
}
/**
* Set value
*
* @param string $value
* @return \google\cloud\audit\RequestMetadata
*/
public function setCallerIp( $value){
return $this->_set(1, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasCallerSuppliedUserAgent(){
return $this->_has(2);
}
/**
* Clear value
*
* @return \google\cloud\audit\RequestMetadata
*/
public function clearCallerSuppliedUserAgent(){
return $this->_clear(2);
}
/**
* Get value
*
* @return string
*/
public function getCallerSuppliedUserAgent(){
return $this->_get(2);
}
/**
* Set value
*
* @param string $value
* @return \google\cloud\audit\RequestMetadata
*/
public function setCallerSuppliedUserAgent( $value){
return $this->_set(2, $value);
}
}
}
src/generated/auth.php 0000644 00000041302 15174272507 0010755 0 ustar 00 number = 3;
$f->name = "rules";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_REPEATED;
$f->reference = '\google\api\AuthenticationRule';
$descriptor->addField($f);
// REPEATED MESSAGE providers = 4
$f = new \DrSlump\Protobuf\Field();
$f->number = 4;
$f->name = "providers";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_REPEATED;
$f->reference = '\google\api\AuthProvider';
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasRules(){
return $this->_has(3);
}
/**
* Clear value
*
* @return \google\api\Authentication
*/
public function clearRules(){
return $this->_clear(3);
}
/**
* Get value
*
* @param int $idx
* @return \google\api\AuthenticationRule
*/
public function getRules($idx = NULL){
return $this->_get(3, $idx);
}
/**
* Set value
*
* @param \google\api\AuthenticationRule $value
* @return \google\api\Authentication
*/
public function setRules(\google\api\AuthenticationRule $value, $idx = NULL){
return $this->_set(3, $value, $idx);
}
/**
* Get all elements of
*
* @return \google\api\AuthenticationRule[]
*/
public function getRulesList(){
return $this->_get(3);
}
/**
* Add a new element to
*
* @param \google\api\AuthenticationRule $value
* @return \google\api\Authentication
*/
public function addRules(\google\api\AuthenticationRule $value){
return $this->_add(3, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasProviders(){
return $this->_has(4);
}
/**
* Clear value
*
* @return \google\api\Authentication
*/
public function clearProviders(){
return $this->_clear(4);
}
/**
* Get value
*
* @param int $idx
* @return \google\api\AuthProvider
*/
public function getProviders($idx = NULL){
return $this->_get(4, $idx);
}
/**
* Set value
*
* @param \google\api\AuthProvider $value
* @return \google\api\Authentication
*/
public function setProviders(\google\api\AuthProvider $value, $idx = NULL){
return $this->_set(4, $value, $idx);
}
/**
* Get all elements of
*
* @return \google\api\AuthProvider[]
*/
public function getProvidersList(){
return $this->_get(4);
}
/**
* Add a new element to
*
* @param \google\api\AuthProvider $value
* @return \google\api\Authentication
*/
public function addProviders(\google\api\AuthProvider $value){
return $this->_add(4, $value);
}
}
}
namespace google\api {
class AuthenticationRule extends \DrSlump\Protobuf\Message {
/** @var string */
public $selector = null;
/** @var \google\api\OAuthRequirements */
public $oauth = null;
/** @var boolean */
public $allow_without_credential = null;
/** @var \google\api\AuthRequirement[] */
public $requirements = array();
/** @var \Closure[] */
protected static $__extensions = array();
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.api.AuthenticationRule');
// OPTIONAL STRING selector = 1
$f = new \DrSlump\Protobuf\Field();
$f->number = 1;
$f->name = "selector";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL MESSAGE oauth = 2
$f = new \DrSlump\Protobuf\Field();
$f->number = 2;
$f->name = "oauth";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\google\api\OAuthRequirements';
$descriptor->addField($f);
// OPTIONAL BOOL allow_without_credential = 5
$f = new \DrSlump\Protobuf\Field();
$f->number = 5;
$f->name = "allow_without_credential";
$f->type = \DrSlump\Protobuf::TYPE_BOOL;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// REPEATED MESSAGE requirements = 7
$f = new \DrSlump\Protobuf\Field();
$f->number = 7;
$f->name = "requirements";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_REPEATED;
$f->reference = '\google\api\AuthRequirement';
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasSelector(){
return $this->_has(1);
}
/**
* Clear value
*
* @return \google\api\AuthenticationRule
*/
public function clearSelector(){
return $this->_clear(1);
}
/**
* Get value
*
* @return string
*/
public function getSelector(){
return $this->_get(1);
}
/**
* Set value
*
* @param string $value
* @return \google\api\AuthenticationRule
*/
public function setSelector( $value){
return $this->_set(1, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasOauth(){
return $this->_has(2);
}
/**
* Clear value
*
* @return \google\api\AuthenticationRule
*/
public function clearOauth(){
return $this->_clear(2);
}
/**
* Get value
*
* @return \google\api\OAuthRequirements
*/
public function getOauth(){
return $this->_get(2);
}
/**
* Set value
*
* @param \google\api\OAuthRequirements $value
* @return \google\api\AuthenticationRule
*/
public function setOauth(\google\api\OAuthRequirements $value){
return $this->_set(2, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasAllowWithoutCredential(){
return $this->_has(5);
}
/**
* Clear value
*
* @return \google\api\AuthenticationRule
*/
public function clearAllowWithoutCredential(){
return $this->_clear(5);
}
/**
* Get value
*
* @return boolean
*/
public function getAllowWithoutCredential(){
return $this->_get(5);
}
/**
* Set value
*
* @param boolean $value
* @return \google\api\AuthenticationRule
*/
public function setAllowWithoutCredential( $value){
return $this->_set(5, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasRequirements(){
return $this->_has(7);
}
/**
* Clear value
*
* @return \google\api\AuthenticationRule
*/
public function clearRequirements(){
return $this->_clear(7);
}
/**
* Get value
*
* @param int $idx
* @return \google\api\AuthRequirement
*/
public function getRequirements($idx = NULL){
return $this->_get(7, $idx);
}
/**
* Set value
*
* @param \google\api\AuthRequirement $value
* @return \google\api\AuthenticationRule
*/
public function setRequirements(\google\api\AuthRequirement $value, $idx = NULL){
return $this->_set(7, $value, $idx);
}
/**
* Get all elements of
*
* @return \google\api\AuthRequirement[]
*/
public function getRequirementsList(){
return $this->_get(7);
}
/**
* Add a new element to
*
* @param \google\api\AuthRequirement $value
* @return \google\api\AuthenticationRule
*/
public function addRequirements(\google\api\AuthRequirement $value){
return $this->_add(7, $value);
}
}
}
namespace google\api {
class AuthProvider extends \DrSlump\Protobuf\Message {
/** @var string */
public $id = null;
/** @var string */
public $issuer = null;
/** @var string */
public $jwks_uri = null;
/** @var \Closure[] */
protected static $__extensions = array();
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.api.AuthProvider');
// OPTIONAL STRING id = 1
$f = new \DrSlump\Protobuf\Field();
$f->number = 1;
$f->name = "id";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL STRING issuer = 2
$f = new \DrSlump\Protobuf\Field();
$f->number = 2;
$f->name = "issuer";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL STRING jwks_uri = 3
$f = new \DrSlump\Protobuf\Field();
$f->number = 3;
$f->name = "jwks_uri";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasId(){
return $this->_has(1);
}
/**
* Clear value
*
* @return \google\api\AuthProvider
*/
public function clearId(){
return $this->_clear(1);
}
/**
* Get value
*
* @return string
*/
public function getId(){
return $this->_get(1);
}
/**
* Set value
*
* @param string $value
* @return \google\api\AuthProvider
*/
public function setId( $value){
return $this->_set(1, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasIssuer(){
return $this->_has(2);
}
/**
* Clear value
*
* @return \google\api\AuthProvider
*/
public function clearIssuer(){
return $this->_clear(2);
}
/**
* Get value
*
* @return string
*/
public function getIssuer(){
return $this->_get(2);
}
/**
* Set value
*
* @param string $value
* @return \google\api\AuthProvider
*/
public function setIssuer( $value){
return $this->_set(2, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasJwksUri(){
return $this->_has(3);
}
/**
* Clear value
*
* @return \google\api\AuthProvider
*/
public function clearJwksUri(){
return $this->_clear(3);
}
/**
* Get value
*
* @return string
*/
public function getJwksUri(){
return $this->_get(3);
}
/**
* Set value
*
* @param string $value
* @return \google\api\AuthProvider
*/
public function setJwksUri( $value){
return $this->_set(3, $value);
}
}
}
namespace google\api {
class OAuthRequirements extends \DrSlump\Protobuf\Message {
/** @var string */
public $canonical_scopes = null;
/** @var \Closure[] */
protected static $__extensions = array();
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.api.OAuthRequirements');
// OPTIONAL STRING canonical_scopes = 1
$f = new \DrSlump\Protobuf\Field();
$f->number = 1;
$f->name = "canonical_scopes";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasCanonicalScopes(){
return $this->_has(1);
}
/**
* Clear value
*
* @return \google\api\OAuthRequirements
*/
public function clearCanonicalScopes(){
return $this->_clear(1);
}
/**
* Get value
*
* @return string
*/
public function getCanonicalScopes(){
return $this->_get(1);
}
/**
* Set value
*
* @param string $value
* @return \google\api\OAuthRequirements
*/
public function setCanonicalScopes( $value){
return $this->_set(1, $value);
}
}
}
namespace google\api {
class AuthRequirement extends \DrSlump\Protobuf\Message {
/** @var string */
public $provider_id = null;
/** @var string */
public $audiences = null;
/** @var \Closure[] */
protected static $__extensions = array();
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.api.AuthRequirement');
// OPTIONAL STRING provider_id = 1
$f = new \DrSlump\Protobuf\Field();
$f->number = 1;
$f->name = "provider_id";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL STRING audiences = 2
$f = new \DrSlump\Protobuf\Field();
$f->number = 2;
$f->name = "audiences";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasProviderId(){
return $this->_has(1);
}
/**
* Clear value
*
* @return \google\api\AuthRequirement
*/
public function clearProviderId(){
return $this->_clear(1);
}
/**
* Get value
*
* @return string
*/
public function getProviderId(){
return $this->_get(1);
}
/**
* Set value
*
* @param string $value
* @return \google\api\AuthRequirement
*/
public function setProviderId( $value){
return $this->_set(1, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasAudiences(){
return $this->_has(2);
}
/**
* Clear value
*
* @return \google\api\AuthRequirement
*/
public function clearAudiences(){
return $this->_clear(2);
}
/**
* Get value
*
* @return string
*/
public function getAudiences(){
return $this->_get(2);
}
/**
* Set value
*
* @param string $value
* @return \google\api\AuthRequirement
*/
public function setAudiences( $value){
return $this->_set(2, $value);
}
}
}
src/generated/backend.php 0000644 00000013021 15174272507 0011400 0 ustar 00 number = 1;
$f->name = "rules";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_REPEATED;
$f->reference = '\google\api\BackendRule';
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasRules(){
return $this->_has(1);
}
/**
* Clear value
*
* @return \google\api\Backend
*/
public function clearRules(){
return $this->_clear(1);
}
/**
* Get value
*
* @param int $idx
* @return \google\api\BackendRule
*/
public function getRules($idx = NULL){
return $this->_get(1, $idx);
}
/**
* Set value
*
* @param \google\api\BackendRule $value
* @return \google\api\Backend
*/
public function setRules(\google\api\BackendRule $value, $idx = NULL){
return $this->_set(1, $value, $idx);
}
/**
* Get all elements of
*
* @return \google\api\BackendRule[]
*/
public function getRulesList(){
return $this->_get(1);
}
/**
* Add a new element to
*
* @param \google\api\BackendRule $value
* @return \google\api\Backend
*/
public function addRules(\google\api\BackendRule $value){
return $this->_add(1, $value);
}
}
}
namespace google\api {
class BackendRule extends \DrSlump\Protobuf\Message {
/** @var string */
public $selector = null;
/** @var string */
public $address = null;
/** @var float */
public $deadline = null;
/** @var \Closure[] */
protected static $__extensions = array();
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.api.BackendRule');
// OPTIONAL STRING selector = 1
$f = new \DrSlump\Protobuf\Field();
$f->number = 1;
$f->name = "selector";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL STRING address = 2
$f = new \DrSlump\Protobuf\Field();
$f->number = 2;
$f->name = "address";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL DOUBLE deadline = 3
$f = new \DrSlump\Protobuf\Field();
$f->number = 3;
$f->name = "deadline";
$f->type = \DrSlump\Protobuf::TYPE_DOUBLE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasSelector(){
return $this->_has(1);
}
/**
* Clear value
*
* @return \google\api\BackendRule
*/
public function clearSelector(){
return $this->_clear(1);
}
/**
* Get value
*
* @return string
*/
public function getSelector(){
return $this->_get(1);
}
/**
* Set value
*
* @param string $value
* @return \google\api\BackendRule
*/
public function setSelector( $value){
return $this->_set(1, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasAddress(){
return $this->_has(2);
}
/**
* Clear value
*
* @return \google\api\BackendRule
*/
public function clearAddress(){
return $this->_clear(2);
}
/**
* Get value
*
* @return string
*/
public function getAddress(){
return $this->_get(2);
}
/**
* Set value
*
* @param string $value
* @return \google\api\BackendRule
*/
public function setAddress( $value){
return $this->_set(2, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasDeadline(){
return $this->_has(3);
}
/**
* Clear value
*
* @return \google\api\BackendRule
*/
public function clearDeadline(){
return $this->_clear(3);
}
/**
* Get value
*
* @return float
*/
public function getDeadline(){
return $this->_get(3);
}
/**
* Set value
*
* @param float $value
* @return \google\api\BackendRule
*/
public function setDeadline( $value){
return $this->_set(3, $value);
}
}
}
src/generated/billing.php 0000644 00000015114 15174272507 0011436 0 ustar 00 number = 1;
$f->name = "metrics";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_REPEATED;
$descriptor->addField($f);
// REPEATED MESSAGE rules = 5
$f = new \DrSlump\Protobuf\Field();
$f->number = 5;
$f->name = "rules";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_REPEATED;
$f->reference = '\google\api\BillingStatusRule';
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasMetrics(){
return $this->_has(1);
}
/**
* Clear value
*
* @return \google\api\Billing
*/
public function clearMetrics(){
return $this->_clear(1);
}
/**
* Get value
*
* @param int $idx
* @return string
*/
public function getMetrics($idx = NULL){
return $this->_get(1, $idx);
}
/**
* Set value
*
* @param string $value
* @return \google\api\Billing
*/
public function setMetrics( $value, $idx = NULL){
return $this->_set(1, $value, $idx);
}
/**
* Get all elements of
*
* @return string[]
*/
public function getMetricsList(){
return $this->_get(1);
}
/**
* Add a new element to
*
* @param string $value
* @return \google\api\Billing
*/
public function addMetrics( $value){
return $this->_add(1, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasRules(){
return $this->_has(5);
}
/**
* Clear value
*
* @return \google\api\Billing
*/
public function clearRules(){
return $this->_clear(5);
}
/**
* Get value
*
* @param int $idx
* @return \google\api\BillingStatusRule
*/
public function getRules($idx = NULL){
return $this->_get(5, $idx);
}
/**
* Set value
*
* @param \google\api\BillingStatusRule $value
* @return \google\api\Billing
*/
public function setRules(\google\api\BillingStatusRule $value, $idx = NULL){
return $this->_set(5, $value, $idx);
}
/**
* Get all elements of
*
* @return \google\api\BillingStatusRule[]
*/
public function getRulesList(){
return $this->_get(5);
}
/**
* Add a new element to
*
* @param \google\api\BillingStatusRule $value
* @return \google\api\Billing
*/
public function addRules(\google\api\BillingStatusRule $value){
return $this->_add(5, $value);
}
}
}
namespace google\api {
class BillingStatusRule extends \DrSlump\Protobuf\Message {
/** @var string */
public $selector = null;
/** @var string[] */
public $allowed_statuses = array();
/** @var \Closure[] */
protected static $__extensions = array();
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.api.BillingStatusRule');
// OPTIONAL STRING selector = 1
$f = new \DrSlump\Protobuf\Field();
$f->number = 1;
$f->name = "selector";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// REPEATED STRING allowed_statuses = 2
$f = new \DrSlump\Protobuf\Field();
$f->number = 2;
$f->name = "allowed_statuses";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_REPEATED;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasSelector(){
return $this->_has(1);
}
/**
* Clear value
*
* @return \google\api\BillingStatusRule
*/
public function clearSelector(){
return $this->_clear(1);
}
/**
* Get value
*
* @return string
*/
public function getSelector(){
return $this->_get(1);
}
/**
* Set value
*
* @param string $value
* @return \google\api\BillingStatusRule
*/
public function setSelector( $value){
return $this->_set(1, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasAllowedStatuses(){
return $this->_has(2);
}
/**
* Clear value
*
* @return \google\api\BillingStatusRule
*/
public function clearAllowedStatuses(){
return $this->_clear(2);
}
/**
* Get value
*
* @param int $idx
* @return string
*/
public function getAllowedStatuses($idx = NULL){
return $this->_get(2, $idx);
}
/**
* Set value
*
* @param string $value
* @return \google\api\BillingStatusRule
*/
public function setAllowedStatuses( $value, $idx = NULL){
return $this->_set(2, $value, $idx);
}
/**
* Get all elements of
*
* @return string[]
*/
public function getAllowedStatusesList(){
return $this->_get(2);
}
/**
* Add a new element to
*
* @param string $value
* @return \google\api\BillingStatusRule
*/
public function addAllowedStatuses( $value){
return $this->_add(2, $value);
}
}
}
src/generated/code.php 0000644 00000001261 15174272507 0010726 0 ustar 00 number = 1;
$f->name = "red";
$f->type = \DrSlump\Protobuf::TYPE_FLOAT;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL FLOAT green = 2
$f = new \DrSlump\Protobuf\Field();
$f->number = 2;
$f->name = "green";
$f->type = \DrSlump\Protobuf::TYPE_FLOAT;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL FLOAT blue = 3
$f = new \DrSlump\Protobuf\Field();
$f->number = 3;
$f->name = "blue";
$f->type = \DrSlump\Protobuf::TYPE_FLOAT;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL MESSAGE alpha = 4
$f = new \DrSlump\Protobuf\Field();
$f->number = 4;
$f->name = "alpha";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\google\protobuf\FloatValue';
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasRed(){
return $this->_has(1);
}
/**
* Clear value
*
* @return \google\type\Color
*/
public function clearRed(){
return $this->_clear(1);
}
/**
* Get value
*
* @return float
*/
public function getRed(){
return $this->_get(1);
}
/**
* Set value
*
* @param float $value
* @return \google\type\Color
*/
public function setRed( $value){
return $this->_set(1, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasGreen(){
return $this->_has(2);
}
/**
* Clear value
*
* @return \google\type\Color
*/
public function clearGreen(){
return $this->_clear(2);
}
/**
* Get value
*
* @return float
*/
public function getGreen(){
return $this->_get(2);
}
/**
* Set value
*
* @param float $value
* @return \google\type\Color
*/
public function setGreen( $value){
return $this->_set(2, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasBlue(){
return $this->_has(3);
}
/**
* Clear value
*
* @return \google\type\Color
*/
public function clearBlue(){
return $this->_clear(3);
}
/**
* Get value
*
* @return float
*/
public function getBlue(){
return $this->_get(3);
}
/**
* Set value
*
* @param float $value
* @return \google\type\Color
*/
public function setBlue( $value){
return $this->_set(3, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasAlpha(){
return $this->_has(4);
}
/**
* Clear value
*
* @return \google\type\Color
*/
public function clearAlpha(){
return $this->_clear(4);
}
/**
* Get value
*
* @return \google\protobuf\FloatValue
*/
public function getAlpha(){
return $this->_get(4);
}
/**
* Set value
*
* @param \google\protobuf\FloatValue $value
* @return \google\type\Color
*/
public function setAlpha(\google\protobuf\FloatValue $value){
return $this->_set(4, $value);
}
}
}
src/generated/config_change.php 0000644 00000017634 15174272507 0012601 0 ustar 00 number = 1;
$f->name = "element";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL STRING old_value = 2
$f = new \DrSlump\Protobuf\Field();
$f->number = 2;
$f->name = "old_value";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL STRING new_value = 3
$f = new \DrSlump\Protobuf\Field();
$f->number = 3;
$f->name = "new_value";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL ENUM change_type = 4
$f = new \DrSlump\Protobuf\Field();
$f->number = 4;
$f->name = "change_type";
$f->type = \DrSlump\Protobuf::TYPE_ENUM;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\google\api\ChangeType';
$descriptor->addField($f);
// REPEATED MESSAGE advices = 5
$f = new \DrSlump\Protobuf\Field();
$f->number = 5;
$f->name = "advices";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_REPEATED;
$f->reference = '\google\api\Advice';
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasElement(){
return $this->_has(1);
}
/**
* Clear value
*
* @return \google\api\ConfigChange
*/
public function clearElement(){
return $this->_clear(1);
}
/**
* Get value
*
* @return string
*/
public function getElement(){
return $this->_get(1);
}
/**
* Set value
*
* @param string $value
* @return \google\api\ConfigChange
*/
public function setElement( $value){
return $this->_set(1, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasOldValue(){
return $this->_has(2);
}
/**
* Clear value
*
* @return \google\api\ConfigChange
*/
public function clearOldValue(){
return $this->_clear(2);
}
/**
* Get value
*
* @return string
*/
public function getOldValue(){
return $this->_get(2);
}
/**
* Set value
*
* @param string $value
* @return \google\api\ConfigChange
*/
public function setOldValue( $value){
return $this->_set(2, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasNewValue(){
return $this->_has(3);
}
/**
* Clear value
*
* @return \google\api\ConfigChange
*/
public function clearNewValue(){
return $this->_clear(3);
}
/**
* Get value
*
* @return string
*/
public function getNewValue(){
return $this->_get(3);
}
/**
* Set value
*
* @param string $value
* @return \google\api\ConfigChange
*/
public function setNewValue( $value){
return $this->_set(3, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasChangeType(){
return $this->_has(4);
}
/**
* Clear value
*
* @return \google\api\ConfigChange
*/
public function clearChangeType(){
return $this->_clear(4);
}
/**
* Get value
*
* @return int - \google\api\ChangeType
*/
public function getChangeType(){
return $this->_get(4);
}
/**
* Set value
*
* @param int - \google\api\ChangeType $value
* @return \google\api\ConfigChange
*/
public function setChangeType( $value){
return $this->_set(4, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasAdvices(){
return $this->_has(5);
}
/**
* Clear value
*
* @return \google\api\ConfigChange
*/
public function clearAdvices(){
return $this->_clear(5);
}
/**
* Get value
*
* @param int $idx
* @return \google\api\Advice
*/
public function getAdvices($idx = NULL){
return $this->_get(5, $idx);
}
/**
* Set value
*
* @param \google\api\Advice $value
* @return \google\api\ConfigChange
*/
public function setAdvices(\google\api\Advice $value, $idx = NULL){
return $this->_set(5, $value, $idx);
}
/**
* Get all elements of
*
* @return \google\api\Advice[]
*/
public function getAdvicesList(){
return $this->_get(5);
}
/**
* Add a new element to
*
* @param \google\api\Advice $value
* @return \google\api\ConfigChange
*/
public function addAdvices(\google\api\Advice $value){
return $this->_add(5, $value);
}
}
}
namespace google\api {
class Advice extends \DrSlump\Protobuf\Message {
/** @var string */
public $description = null;
/** @var \Closure[] */
protected static $__extensions = array();
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.api.Advice');
// OPTIONAL STRING description = 2
$f = new \DrSlump\Protobuf\Field();
$f->number = 2;
$f->name = "description";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasDescription(){
return $this->_has(2);
}
/**
* Clear value
*
* @return \google\api\Advice
*/
public function clearDescription(){
return $this->_clear(2);
}
/**
* Get value
*
* @return string
*/
public function getDescription(){
return $this->_get(2);
}
/**
* Set value
*
* @param string $value
* @return \google\api\Advice
*/
public function setDescription( $value){
return $this->_set(2, $value);
}
}
}
src/generated/consumer.php 0000644 00000013635 15174272507 0011657 0 ustar 00 number = 1;
$f->name = "properties";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_REPEATED;
$f->reference = '\google\api\Property';
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasProperties(){
return $this->_has(1);
}
/**
* Clear value
*
* @return \google\api\ProjectProperties
*/
public function clearProperties(){
return $this->_clear(1);
}
/**
* Get value
*
* @param int $idx
* @return \google\api\Property
*/
public function getProperties($idx = NULL){
return $this->_get(1, $idx);
}
/**
* Set value
*
* @param \google\api\Property $value
* @return \google\api\ProjectProperties
*/
public function setProperties(\google\api\Property $value, $idx = NULL){
return $this->_set(1, $value, $idx);
}
/**
* Get all elements of
*
* @return \google\api\Property[]
*/
public function getPropertiesList(){
return $this->_get(1);
}
/**
* Add a new element to
*
* @param \google\api\Property $value
* @return \google\api\ProjectProperties
*/
public function addProperties(\google\api\Property $value){
return $this->_add(1, $value);
}
}
}
namespace google\api\Property {
class PropertyType extends \DrSlump\Protobuf\Enum {
const UNSPECIFIED = 0;
const INT64 = 1;
const BOOL = 2;
const STRING = 3;
const DOUBLE = 4;
}
}
namespace google\api {
class Property extends \DrSlump\Protobuf\Message {
/** @var string */
public $name = null;
/** @var int - \google\api\Property\PropertyType */
public $type = null;
/** @var string */
public $description = null;
/** @var \Closure[] */
protected static $__extensions = array();
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.api.Property');
// OPTIONAL STRING name = 1
$f = new \DrSlump\Protobuf\Field();
$f->number = 1;
$f->name = "name";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL ENUM type = 2
$f = new \DrSlump\Protobuf\Field();
$f->number = 2;
$f->name = "type";
$f->type = \DrSlump\Protobuf::TYPE_ENUM;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\google\api\Property\PropertyType';
$descriptor->addField($f);
// OPTIONAL STRING description = 3
$f = new \DrSlump\Protobuf\Field();
$f->number = 3;
$f->name = "description";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasName(){
return $this->_has(1);
}
/**
* Clear value
*
* @return \google\api\Property
*/
public function clearName(){
return $this->_clear(1);
}
/**
* Get value
*
* @return string
*/
public function getName(){
return $this->_get(1);
}
/**
* Set value
*
* @param string $value
* @return \google\api\Property
*/
public function setName( $value){
return $this->_set(1, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasType(){
return $this->_has(2);
}
/**
* Clear value
*
* @return \google\api\Property
*/
public function clearType(){
return $this->_clear(2);
}
/**
* Get value
*
* @return int - \google\api\Property\PropertyType
*/
public function getType(){
return $this->_get(2);
}
/**
* Set value
*
* @param int - \google\api\Property\PropertyType $value
* @return \google\api\Property
*/
public function setType( $value){
return $this->_set(2, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasDescription(){
return $this->_has(3);
}
/**
* Clear value
*
* @return \google\api\Property
*/
public function clearDescription(){
return $this->_clear(3);
}
/**
* Get value
*
* @return string
*/
public function getDescription(){
return $this->_get(3);
}
/**
* Set value
*
* @param string $value
* @return \google\api\Property
*/
public function setDescription( $value){
return $this->_set(3, $value);
}
}
}
src/generated/context.php 0000644 00000014652 15174272507 0011510 0 ustar 00 number = 1;
$f->name = "rules";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_REPEATED;
$f->reference = '\google\api\ContextRule';
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasRules(){
return $this->_has(1);
}
/**
* Clear value
*
* @return \google\api\Context
*/
public function clearRules(){
return $this->_clear(1);
}
/**
* Get value
*
* @param int $idx
* @return \google\api\ContextRule
*/
public function getRules($idx = NULL){
return $this->_get(1, $idx);
}
/**
* Set value
*
* @param \google\api\ContextRule $value
* @return \google\api\Context
*/
public function setRules(\google\api\ContextRule $value, $idx = NULL){
return $this->_set(1, $value, $idx);
}
/**
* Get all elements of
*
* @return \google\api\ContextRule[]
*/
public function getRulesList(){
return $this->_get(1);
}
/**
* Add a new element to
*
* @param \google\api\ContextRule $value
* @return \google\api\Context
*/
public function addRules(\google\api\ContextRule $value){
return $this->_add(1, $value);
}
}
}
namespace google\api {
class ContextRule extends \DrSlump\Protobuf\Message {
/** @var string */
public $selector = null;
/** @var string[] */
public $requested = array();
/** @var string[] */
public $provided = array();
/** @var \Closure[] */
protected static $__extensions = array();
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'google.api.ContextRule');
// OPTIONAL STRING selector = 1
$f = new \DrSlump\Protobuf\Field();
$f->number = 1;
$f->name = "selector";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// REPEATED STRING requested = 2
$f = new \DrSlump\Protobuf\Field();
$f->number = 2;
$f->name = "requested";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_REPEATED;
$descriptor->addField($f);
// REPEATED STRING provided = 3
$f = new \DrSlump\Protobuf\Field();
$f->number = 3;
$f->name = "provided";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_REPEATED;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasSelector(){
return $this->_has(1);
}
/**
* Clear value
*
* @return \google\api\ContextRule
*/
public function clearSelector(){
return $this->_clear(1);
}
/**
* Get value
*
* @return string
*/
public function getSelector(){
return $this->_get(1);
}
/**
* Set value
*
* @param string $value
* @return \google\api\ContextRule
*/
public function setSelector( $value){
return $this->_set(1, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasRequested(){
return $this->_has(2);
}
/**
* Clear value
*
* @return \google\api\ContextRule
*/
public function clearRequested(){
return $this->_clear(2);
}
/**
* Get value
*
* @param int $idx
* @return string
*/
public function getRequested($idx = NULL){
return $this->_get(2, $idx);
}
/**
* Set value
*
* @param string $value
* @return \google\api\ContextRule
*/
public function setRequested( $value, $idx = NULL){
return $this->_set(2, $value, $idx);
}
/**
* Get all elements of
*
* @return string[]
*/
public function getRequestedList(){
return $this->_get(2);
}
/**
* Add a new element to
*
* @param string $value
* @return \google\api\ContextRule
*/
public function addRequested( $value){
return $this->_add(2, $value);
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasProvided(){
return $this->_has(3);
}
/**
* Clear value
*
* @return \google\api\ContextRule
*/
public function clearProvided(){
return $this->_clear(3);
}
/**
* Get value
*
* @param int $idx
* @return string
*/
public function getProvided($idx = NULL){
return $this->_get(3, $idx);
}
/**
* Set value
*
* @param string $value
* @return \google\api\ContextRule
*/
public function setProvided( $value, $idx = NULL){
return $this->_set(3, $value, $idx);
}
/**
* Get all elements of
*
* @return string[]
*/
public function getProvidedList(){
return $this->_get(3);
}
/**
* Add a new element to
*
* @param string $value
* @return \google\api\ContextRule
*/
public function addProvided( $value){
return $this->_add(3, $value);
}
}
}
src/generated/control.php 0000644 00000003106 15174272507 0011474 0 ustar 00 number = 1;
$f->name = "environment";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasEnvironment(){
return $this->_has(1);
}
/**
* Clear value
*
* @return \google\api\Control
*/
public function clearEnvironment(){
return $this->_clear(1);
}
/**
* Get value
*
* @return string
*/
public function getEnvironment(){
return $this->_get(1);
}
/**
* Set value
*
* @param string $value
* @return \google\api\Control
*/
public function setEnvironment( $value){
return $this->_set(1, $value);
}
}
}
src/generated/date.php 0000644 00000006546 15174272507 0010744 0 ustar 00 number = 1;
$f->name = "year";
$f->type = \DrSlump\Protobuf::TYPE_INT32;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL INT32 month = 2
$f = new \DrSlump\Protobuf\Field();
$f->number = 2;
$f->name = "month";
$f->type = \DrSlump\Protobuf::TYPE_INT32;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL INT32 day = 3
$f = new \DrSlump\Protobuf\Field();
$f->number = 3;
$f->name = "day";
$f->type = \DrSlump\Protobuf::TYPE_INT32;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if has a value
*
* @return boolean
*/
public function hasYear(){
return $this->_has(1);
}
/**
* Clear value
*
* @return \google\type\Date
*/
public function clearYear(){
return $this->_clear(1);
}
/**
* Get value
*
* @return int
*/
public function getYear(){
return $this->_get(1);
}
/**
* Set