From c2f402820b12f37f64f1fa409e8dad38af573707 Mon Sep 17 00:00:00 2001 From: David Supplee Date: Mon, 23 Jul 2018 15:36:00 -0400 Subject: [PATCH] Update Bigtable branch with latest from master (#1190) * Add isRacy() to SafeSearch (#1166) The SafeSearch class included `is` functions for each SafeSearch feature (adult, spoof, medical, violence), but was missing Racy. This Pull Request adds `isRacy()` to the SafeSearch class. * Exclude component vendor folder from snippet coverage (#1168) cc @tmatsuo * Allow context to handle Throwable interface (#1164) * Add getServiceAccount to the BigQueryClient (#1167) * Add getServiceAccount to the BigQueryClient See: https://cloud.google.com/bigquery/docs/reference/rest/v2/projects/getServiceAccount * Added $options to getServiceAccount and fixed the indent * Use single quote * Add snippet test * Comment update, use self instead of $this * Comment update * Prepare v0.71.0 (#1169) * Prepare v0.71.0 * patch release for Logging * Correct version for Logging * [Kms] Regenerate with the new gapic config (#1165) * Update for the new gapic configuration * Docs update for the new and nicer namespace * Removed the files with the old namespace * Use the new namespace in the code sample Add back the deprecated files * Changed the wording for the deprecation warning * Fix firestore queries (#1161) * Bump gax to 0.35 (#1170) * Add an interactive release builder. (#1160) * Add an interactive release builder. * Create build directory if it doesn't exist * Add getServiceAccount method to StorageClient (#1173) * Re-generate library using Tasks/synth.py (#1174) * Re-generate library using Tasks/synth.py * Use new namespace in user visible area, tweak the deprecation wording * Add support for Numeric type (#1172) * Add support for Numeric type * Added a cast in Numeric's constructor, added system tests * Allow '123.' and '.123', update tests * [Breaking Change] Add support for Document Snapshots in Firestore Query Cursors (#1162) cc @schmidt-sebastian Extracted from #923 and updated to address pull request comments. Breaking change is the standardization in Query of using `InvalidArgumentException`, replacing various throws of `BadMethodCallException`. Closes #851. * Fix Storage Requesterpays system tests (#1180) The requester pays system tests have been broken for some time. This change fixes them. * Bandaid for protobuf 4761 (#1176) * Temporary workaround for protobuf extension issue https://github.com/google/protobuf/issues/4761 * Bump gax to 0.36 * Configure comparators for the unit test * Revert back to normal TestCase * Install protobuf extension in the PHP 7.2 test runner * Revert to TestCase * Prepare v0.72.0 (#1181) * Added a document for the time filter on BigQueryClient->jobs() (#1183) * Narrowed the time filter in the system test (#1185) * Re-generate library using BigQueryDataTransfer/synth.py (#1184) * Re-generate library using BigQueryDataTransfer/synth.py * Tweak the wording on the deprecation warning Also use the new namespace in the sample code * pin auth version until we have a way to silence warnings (#1189) --- .travis.yml | 1 + BigQuery/VERSION | 2 +- BigQuery/src/BigQueryClient.php | 48 +- .../src/Connection/ConnectionInterface.php | 6 + BigQuery/src/Connection/Rest.php | 9 + BigQuery/src/Numeric.php | 102 +++ BigQuery/src/ValueMapper.php | 3 + BigQuery/tests/Snippet/BigQueryClientTest.php | 28 + BigQuery/tests/Snippet/NumericTest.php | 37 + .../tests/System/LoadDataAndQueryTest.php | 12 +- BigQuery/tests/System/ManageJobsTest.php | 27 + BigQuery/tests/System/data/table-schema.json | 2 +- BigQuery/tests/Unit/BigQueryClientTest.php | 51 ++ BigQuery/tests/Unit/Connection/RestTest.php | 3 +- BigQuery/tests/Unit/NumericTest.php | 92 +++ BigQuery/tests/Unit/ValueMapperTest.php | 11 +- BigQueryDataTransfer/VERSION | 2 +- BigQueryDataTransfer/composer.json | 2 +- .../src/V1/CheckValidCredsRequest.php | 15 +- .../src/V1/CheckValidCredsResponse.php | 14 +- .../src/V1/CreateTransferConfigRequest.php | 35 +- BigQueryDataTransfer/src/V1/DataSource.php | 65 +- .../src/V1/DataSource/AuthorizationType.php | 38 + .../src/V1/DataSource/DataRefreshType.php | 40 + .../src/V1/DataSourceParameter.php | 44 +- .../src/V1/DataSourceParameter/Type.php | 61 ++ .../src/V1/DataSourceParameter_Type.php | 54 +- .../src/V1/DataSource_AuthorizationType.php | 31 +- .../src/V1/DataSource_DataRefreshType.php | 33 +- .../src/V1/DeleteTransferConfigRequest.php | 15 +- .../src/V1/DeleteTransferRunRequest.php | 15 +- .../Gapic/DataTransferServiceGapicClient.php | 94 ++- .../src/V1/GetDataSourceRequest.php | 15 +- .../src/V1/GetTransferConfigRequest.php | 15 +- .../src/V1/GetTransferRunRequest.php | 15 +- .../src/V1/ListDataSourcesRequest.php | 23 +- .../src/V1/ListDataSourcesResponse.php | 19 +- .../src/V1/ListTransferConfigsRequest.php | 25 +- .../src/V1/ListTransferConfigsResponse.php | 19 +- .../src/V1/ListTransferLogsRequest.php | 28 +- .../src/V1/ListTransferLogsResponse.php | 19 +- .../src/V1/ListTransferRunsRequest.php | 28 +- .../V1/ListTransferRunsRequest/RunAttempt.php | 30 + .../V1/ListTransferRunsRequest_RunAttempt.php | 23 +- .../src/V1/ListTransferRunsResponse.php | 19 +- .../src/V1/ScheduleTransferRunsRequest.php | 21 +- .../src/V1/ScheduleTransferRunsResponse.php | 14 +- .../src/V1/TransferConfig.php | 64 +- .../src/V1/TransferMessage.php | 18 +- .../V1/TransferMessage/MessageSeverity.php | 42 + .../V1/TransferMessage_MessageSeverity.php | 35 +- BigQueryDataTransfer/src/V1/TransferRun.php | 52 +- BigQueryDataTransfer/src/V1/TransferState.php | 2 +- BigQueryDataTransfer/src/V1/TransferType.php | 2 +- .../src/V1/UpdateTransferConfigRequest.php | 32 +- BigQueryDataTransfer/synth.py | 11 + Bigtable/VERSION | 2 +- Bigtable/composer.json | 2 +- Container/VERSION | 2 +- Container/composer.json | 2 +- Core/VERSION | 2 +- Core/composer.json | 2 +- Core/src/Testing/FileListFilterIterator.php | 2 +- .../src/Testing}/RegexFileFilter.php | 2 +- Core/src/Testing/TestHelpers.php | 7 +- Core/unit-bootstrap.php | 7 + Dataproc/VERSION | 2 +- Dataproc/composer.json | 2 +- Debugger/VERSION | 2 +- Debugger/composer.json | 2 +- Debugger/src/DebuggerClient.php | 2 +- Dialogflow/VERSION | 2 +- Dialogflow/composer.json | 2 +- Dlp/VERSION | 2 +- Dlp/composer.json | 2 +- ErrorReporting/VERSION | 2 +- ErrorReporting/composer.json | 2 +- Firestore/VERSION | 2 +- Firestore/composer.json | 2 +- Firestore/src/DocumentSnapshot.php | 5 +- Firestore/src/FieldValue.php | 15 + Firestore/src/FirestoreClient.php | 2 +- Firestore/src/Query.php | 293 +++++-- Firestore/src/ValueMapper.php | 2 +- Firestore/tests/Snippet/QueryTest.php | 59 +- Firestore/tests/System/QueryTest.php | 27 + Firestore/tests/Unit/QueryTest.php | 224 +++++- Iot/VERSION | 2 +- Iot/composer.json | 2 +- Kms/README.md | 4 +- Kms/VERSION | 2 +- Kms/composer.json | 2 +- Kms/src/V1/CreateCryptoKeyRequest.php | 20 +- Kms/src/V1/CreateCryptoKeyVersionRequest.php | 17 +- Kms/src/V1/CreateKeyRingRequest.php | 20 +- Kms/src/V1/CryptoKey.php | 41 +- Kms/src/V1/CryptoKey/CryptoKeyPurpose.php | 34 + Kms/src/V1/CryptoKeyVersion.php | 27 +- .../CryptoKeyVersionState.php | 54 ++ ...CryptoKeyVersion_CryptoKeyVersionState.php | 47 +- Kms/src/V1/CryptoKey_CryptoKeyPurpose.php | 27 +- Kms/src/V1/DecryptRequest.php | 21 +- Kms/src/V1/DecryptResponse.php | 14 +- Kms/src/V1/DestroyCryptoKeyVersionRequest.php | 14 +- Kms/src/V1/EncryptRequest.php | 23 +- Kms/src/V1/EncryptResponse.php | 16 +- .../Gapic/KeyManagementServiceGapicClient.php | 136 +++- Kms/src/V1/GetCryptoKeyRequest.php | 14 +- Kms/src/V1/GetCryptoKeyVersionRequest.php | 14 +- Kms/src/V1/GetKeyRingRequest.php | 14 +- Kms/src/V1/KeyRing.php | 17 +- Kms/src/V1/ListCryptoKeyVersionsRequest.php | 24 +- Kms/src/V1/ListCryptoKeyVersionsResponse.php | 21 +- Kms/src/V1/ListCryptoKeysRequest.php | 23 +- Kms/src/V1/ListCryptoKeysResponse.php | 19 +- Kms/src/V1/ListKeyRingsRequest.php | 23 +- Kms/src/V1/ListKeyRingsResponse.php | 19 +- Kms/src/V1/README.md | 4 +- Kms/src/V1/RestoreCryptoKeyVersionRequest.php | 14 +- .../UpdateCryptoKeyPrimaryVersionRequest.php | 16 +- Kms/src/V1/UpdateCryptoKeyRequest.php | 16 +- Kms/src/V1/UpdateCryptoKeyVersionRequest.php | 16 +- Kms/synth.py | 12 + Language/VERSION | 2 +- Language/composer.json | 2 +- Language/src/LanguageClient.php | 2 +- Logging/VERSION | 2 +- Logging/composer.json | 2 +- Logging/src/LoggingClient.php | 2 +- Logging/src/PsrLogger.php | 7 +- Logging/tests/Unit/PsrLoggerTest.php | 57 +- Monitoring/VERSION | 2 +- Monitoring/composer.json | 2 +- OsLogin/VERSION | 2 +- OsLogin/composer.json | 2 +- PubSub/VERSION | 2 +- PubSub/composer.json | 2 +- PubSub/src/PubSubClient.php | 2 +- README.md | 4 +- Redis/VERSION | 2 +- Redis/composer.json | 2 +- Spanner/VERSION | 2 +- Spanner/composer.json | 2 +- Spanner/src/SpannerClient.php | 2 +- Speech/VERSION | 2 +- Speech/composer.json | 2 +- Speech/src/SpeechClient.php | 2 +- Storage/VERSION | 2 +- .../src/Connection/ConnectionInterface.php | 5 + Storage/src/Connection/Rest.php | 8 + Storage/src/StorageClient.php | 24 +- Storage/tests/Snippet/StorageClientTest.php | 21 +- Storage/tests/System/KmsTest.php | 25 +- Storage/tests/System/RequesterPaysTest.php | 294 ++++--- Storage/tests/Unit/Connection/RestTest.php | 1 + Storage/tests/Unit/StorageClientTest.php | 18 + Tasks/VERSION | 2 +- Tasks/composer.json | 2 +- Tasks/metadata/V2Beta2/Cloudtasks.php | 307 ++++--- Tasks/src/V2beta2/AcknowledgeTaskRequest.php | 23 +- Tasks/src/V2beta2/AppEngineHttpRequest.php | 108 ++- Tasks/src/V2beta2/AppEngineHttpTarget.php | 20 +- Tasks/src/V2beta2/AppEngineRouting.php | 128 ++- Tasks/src/V2beta2/AttemptStatus.php | 25 +- Tasks/src/V2beta2/CancelLeaseRequest.php | 46 +- Tasks/src/V2beta2/CloudTasksGrpcClient.php | 30 +- Tasks/src/V2beta2/CreateQueueRequest.php | 23 +- Tasks/src/V2beta2/CreateTaskRequest.php | 70 +- Tasks/src/V2beta2/DeleteQueueRequest.php | 16 +- Tasks/src/V2beta2/DeleteTaskRequest.php | 16 +- .../V2beta2/Gapic/CloudTasksGapicClient.php | 78 +- Tasks/src/V2beta2/GetQueueRequest.php | 16 +- Tasks/src/V2beta2/GetTaskRequest.php | 39 +- Tasks/src/V2beta2/HttpMethod.php | 12 +- Tasks/src/V2beta2/LeaseTasksRequest.php | 81 +- Tasks/src/V2beta2/LeaseTasksResponse.php | 14 +- Tasks/src/V2beta2/ListQueuesRequest.php | 46 +- Tasks/src/V2beta2/ListQueuesResponse.php | 21 +- Tasks/src/V2beta2/ListTasksRequest.php | 95 ++- Tasks/src/V2beta2/ListTasksResponse.php | 20 +- Tasks/src/V2beta2/PauseQueueRequest.php | 16 +- Tasks/src/V2beta2/PullMessage.php | 35 +- Tasks/src/V2beta2/PullTarget.php | 12 +- Tasks/src/V2beta2/PurgeQueueRequest.php | 16 +- Tasks/src/V2beta2/Queue.php | 96 ++- Tasks/src/V2beta2/Queue/State.php | 62 ++ Tasks/src/V2beta2/Queue_State.php | 55 +- Tasks/src/V2beta2/RateLimits.php | 128 ++- Tasks/src/V2beta2/RenewLeaseRequest.php | 51 +- Tasks/src/V2beta2/ResumeQueueRequest.php | 16 +- Tasks/src/V2beta2/RetryConfig.php | 151 +++- Tasks/src/V2beta2/RunTaskRequest.php | 39 +- Tasks/src/V2beta2/Task.php | 61 +- Tasks/src/V2beta2/Task/View.php | 51 ++ Tasks/src/V2beta2/TaskStatus.php | 54 +- Tasks/src/V2beta2/Task_View.php | 44 +- Tasks/src/V2beta2/UpdateQueueRequest.php | 22 +- Tasks/synth.py | 12 + TextToSpeech/VERSION | 1 + TextToSpeech/composer.json | 2 +- Trace/VERSION | 2 +- Trace/composer.json | 2 +- Trace/src/TraceClient.php | 2 +- VideoIntelligence/VERSION | 2 +- VideoIntelligence/composer.json | 2 +- Vision/VERSION | 2 +- Vision/composer.json | 2 +- Vision/src/Annotation/SafeSearch.php | 39 +- Vision/src/VisionClient.php | 2 +- .../Snippet/Annotation/SafeSearchTest.php | 19 + Vision/tests/System/AnnotationsTest.php | 2 + .../tests/Unit/Annotation/SafeSearchTest.php | 8 +- .../V1/ImageAnnotatorClientExtensionTest.php | 14 +- composer.json | 59 +- dev/google-cloud | 4 +- dev/sh/bump-gax.sh | 14 + dev/src/AddComponent/Command/AddComponent.php | 2 +- dev/src/AddComponent/Composer.php | 1 + dev/src/AddComponent/Info.php | 1 + dev/src/AddComponent/Manifest.php | 1 + dev/src/AddComponent/Readmes.php | 1 + dev/src/AddComponent/TableOfContents.php | 1 + dev/src/ComponentVersionTrait.php | 114 +++ dev/src/DocGenerator/Command/Docs.php | 1 - dev/src/GetComponentsTrait.php | 10 +- dev/src/{AddComponent => }/QuestionTrait.php | 18 +- dev/src/Release/{Command => }/Release.php | 74 +- dev/src/ReleaseBuilder/ReleaseBuilder.php | 759 ++++++++++++++++++ .../templates/release-notes.md.txt | 3 + docs/manifest.json | 40 + src/ServiceBuilder.php | 2 +- src/Version.php | 2 +- 232 files changed, 5540 insertions(+), 1370 deletions(-) create mode 100644 BigQuery/src/Numeric.php create mode 100644 BigQuery/tests/Snippet/NumericTest.php create mode 100644 BigQuery/tests/Unit/NumericTest.php create mode 100644 BigQueryDataTransfer/src/V1/DataSource/AuthorizationType.php create mode 100644 BigQueryDataTransfer/src/V1/DataSource/DataRefreshType.php create mode 100644 BigQueryDataTransfer/src/V1/DataSourceParameter/Type.php create mode 100644 BigQueryDataTransfer/src/V1/ListTransferRunsRequest/RunAttempt.php create mode 100644 BigQueryDataTransfer/src/V1/TransferMessage/MessageSeverity.php rename {dev/src/DocGenerator => Core/src/Testing}/RegexFileFilter.php (94%) create mode 100644 Kms/src/V1/CryptoKey/CryptoKeyPurpose.php create mode 100644 Kms/src/V1/CryptoKeyVersion/CryptoKeyVersionState.php create mode 100644 Tasks/src/V2beta2/Queue/State.php create mode 100644 Tasks/src/V2beta2/Task/View.php create mode 100644 TextToSpeech/VERSION create mode 100755 dev/sh/bump-gax.sh create mode 100644 dev/src/ComponentVersionTrait.php rename dev/src/{AddComponent => }/QuestionTrait.php (87%) rename dev/src/Release/{Command => }/Release.php (67%) create mode 100644 dev/src/ReleaseBuilder/ReleaseBuilder.php create mode 100644 dev/src/ReleaseBuilder/templates/release-notes.md.txt diff --git a/.travis.yml b/.travis.yml index ab6607d78a0a..d1d709051129 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ jobs: - php: 7.2 install: - pecl install grpc || echo 'Failed to install grpc' + - pecl install protobuf || echo 'Failed to install protobuf' - pecl install stackdriver_debugger-alpha || echo 'Failed to install stackdriver_debugger' - composer self-update - travis_retry composer install diff --git a/BigQuery/VERSION b/BigQuery/VERSION index b966e81a45e8..e21e727f96fa 100644 --- a/BigQuery/VERSION +++ b/BigQuery/VERSION @@ -1 +1 @@ -1.2.4 \ No newline at end of file +1.4.0 \ No newline at end of file diff --git a/BigQuery/src/BigQueryClient.php b/BigQuery/src/BigQueryClient.php index f316c82c8433..231ce39593ed 100644 --- a/BigQuery/src/BigQueryClient.php +++ b/BigQuery/src/BigQueryClient.php @@ -49,7 +49,7 @@ class BigQueryClient use ClientTrait; use RetryDeciderTrait; - const VERSION = '1.2.4'; + const VERSION = '1.4.0'; const MAX_DELAY_MICROSECONDS = 32000000; @@ -442,6 +442,10 @@ public function job($id, array $options = []) * resume the loading of results from a specific point. * @type string $stateFilter Filter for job state. Maybe be either * `done`, `pending`, or `running`. + * @type int $maxCreationTime Milliseconds since the POSIX epoch. If set, only jobs created + * before or at this timestamp are returned. + * @type int $minCreationTime Milliseconds since the POSIX epoch. If set, only jobs created + * after or at this timestamp are returned. * } * @return ItemIterator */ @@ -682,4 +686,46 @@ public function timestamp(\DateTimeInterface $value) { return new Timestamp($value); } + + /** + * Create a Numeric object. + * + * Numeric represents a value with a data type of + * [Numeric](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#numeric-type). + * + * It supports a fixed 38 decimal digits of precision and 9 decimal digits of scale, and values + * are in the range of -99999999999999999999999999999.999999999 to + * 99999999999999999999999999999.999999999. + * + * Example: + * ``` + * $numeric = $bigQuery->numeric('99999999999999999999999999999999999999.999999999'); + * ``` + * + * @param string|int|float $value The Numeric value. + * @return Numeric + * @throws \InvalidArgumentException + */ + public function numeric($value) + { + return new Numeric($value); + } + + /** + * Get a service account for the KMS integration. + * + * Example: + * ``` + * $serviceAccount = $bigQuery->getServiceAccount(); + * ``` + * + * @param array $options [optional] Configuration options. + * + * @return string + */ + public function getServiceAccount(array $options = []) + { + $resp = $this->connection->getServiceAccount($options + ['projectId' => $this->projectId]); + return $resp['email']; + } } diff --git a/BigQuery/src/Connection/ConnectionInterface.php b/BigQuery/src/Connection/ConnectionInterface.php index 1350a66e2083..4ae4abbe300d 100644 --- a/BigQuery/src/Connection/ConnectionInterface.php +++ b/BigQuery/src/Connection/ConnectionInterface.php @@ -138,4 +138,10 @@ public function insertJob(array $args = []); * @return AbstractUploader */ public function insertJobUpload(array $args = []); + + /** + * @param array $args + * @return array + */ + public function getServiceAccount(array $args = []); } diff --git a/BigQuery/src/Connection/Rest.php b/BigQuery/src/Connection/Rest.php index c851e7553ecf..4ecfbc45ef81 100644 --- a/BigQuery/src/Connection/Rest.php +++ b/BigQuery/src/Connection/Rest.php @@ -237,6 +237,15 @@ public function insertJobUpload(array $args = []) ); } + /** + * @param array $args + * @return array + */ + public function getServiceAccount(array $args = []) + { + return $this->send('projects', 'getServiceAccount', $args); + } + /** * @param array $args * @return array diff --git a/BigQuery/src/Numeric.php b/BigQuery/src/Numeric.php new file mode 100644 index 000000000000..fb8caaf5b6c3 --- /dev/null +++ b/BigQuery/src/Numeric.php @@ -0,0 +1,102 @@ +numeric('99999999999999999999999999999999999999.999999999'); + * ``` + */ +class Numeric implements ValueInterface +{ + /** + * @var string + */ + private $value; + + /** + * @param string|int|float $value The NUMERIC value. + * @throws \InvalidArgumentException + */ + public function __construct($value) + { + $value = (string) $value; + // allow minus sign at the beginning + // 38 or less decimal digits (or none) + // optional period and 9 or less digits of scale + $pattern = '/^-?([0-9]{1,38})?(\.([0-9]{1,9})?)?$/'; + if (! preg_match($pattern, $value)) { + throw new \InvalidArgumentException( + 'Numeric type only allows fixed 38 decimal digits and 9 decimal digits of scale.' + ); + } + $this->value = $value; + } + + /** + * Get the underlying value. + * + * @return string + */ + public function get() + { + return $this->value; + } + + /** + * Get the type. + * + * @return string + */ + public function type() + { + return ValueMapper::TYPE_NUMERIC; + } + + /** + * Format the value as a string. + * + * @return string + */ + public function formatAsString() + { + return $this->value; + } + + /** + * Format the value as a string. + * + * @return string + */ + public function __toString() + { + return $this->value; + } +} diff --git a/BigQuery/src/ValueMapper.php b/BigQuery/src/ValueMapper.php index 8663cf47bcce..5d62a2c7a4da 100644 --- a/BigQuery/src/ValueMapper.php +++ b/BigQuery/src/ValueMapper.php @@ -34,6 +34,7 @@ class ValueMapper const TYPE_INTEGER = 'INTEGER'; const TYPE_FLOAT64 = 'FLOAT64'; const TYPE_FLOAT = 'FLOAT'; + const TYPE_NUMERIC = 'NUMERIC'; const TYPE_STRING = 'STRING'; const TYPE_BYTES = 'BYTES'; const TYPE_DATE = 'DATE'; @@ -95,6 +96,8 @@ public function fromBigQuery(array $value, array $schema) : (int) $value; case self::TYPE_FLOAT: return (float) $value; + case self::TYPE_NUMERIC: + return new Numeric($value); case self::TYPE_STRING: return (string) $value; case self::TYPE_BYTES: diff --git a/BigQuery/tests/Snippet/BigQueryClientTest.php b/BigQuery/tests/Snippet/BigQueryClientTest.php index 4df12305e52f..1796ce1293dc 100644 --- a/BigQuery/tests/Snippet/BigQueryClientTest.php +++ b/BigQuery/tests/Snippet/BigQueryClientTest.php @@ -20,6 +20,7 @@ use Google\Cloud\BigQuery\BigQueryClient; use Google\Cloud\BigQuery\Bytes; use Google\Cloud\BigQuery\Date; +use Google\Cloud\BigQuery\Numeric; use Google\Cloud\BigQuery\Time; use Google\Cloud\BigQuery\Timestamp; use Google\Cloud\BigQuery\Connection\ConnectionInterface; @@ -393,6 +394,16 @@ public function testInt64() $this->assertInstanceOf(Int64::class, $res->returnVal()); } + public function testNumeric() + { + $snippet = $this->snippetFromMethod(BigQueryClient::class, 'numeric'); + $snippet->addLocal('bigQuery', $this->client); + $this->client->___setProperty('connection', $this->connection->reveal()); + $res = $snippet->invoke('numeric'); + + $this->assertInstanceOf(Numeric::class, $res->returnVal()); + } + public function testTime() { $snippet = $this->snippetFromMethod(BigQueryClient::class, 'time'); @@ -412,6 +423,23 @@ public function testTimestamp() $this->assertInstanceOf(Timestamp::class, $res->returnVal()); } + + public function testGetServiceAccount() + { + $expectedEmail = uniqid() . '@bigquery-encryption.iam.gserviceaccount.com'; + $snippet = $this->snippetFromMethod(BigQueryClient::class, 'getServiceAccount'); + $snippet->addLocal('bigQuery', $this->client); + $this->connection->getServiceAccount(['projectId' => self::PROJECT_ID]) + ->willReturn([ + "kind" => "bigquery#getServiceAccountResponse", + "email" => $expectedEmail + ]) + ->shouldBeCalledTimes(1); + $this->client->___setProperty('connection', $this->connection->reveal()); + $res = $snippet->invoke('serviceAccount'); + + $this->assertEquals($expectedEmail, $res->returnVal()); + } } class BigQueryTestClient extends BigQueryClient diff --git a/BigQuery/tests/Snippet/NumericTest.php b/BigQuery/tests/Snippet/NumericTest.php new file mode 100644 index 000000000000..7f0096f6c2be --- /dev/null +++ b/BigQuery/tests/Snippet/NumericTest.php @@ -0,0 +1,37 @@ +snippetFromClass(Numeric::class); + $res = $snippet->invoke('numeric'); + + $this->assertInstanceOf(Numeric::class, $res->returnVal()); + $this->assertEquals($expected, $res->returnVal()); + } +} diff --git a/BigQuery/tests/System/LoadDataAndQueryTest.php b/BigQuery/tests/System/LoadDataAndQueryTest.php index 8879e98bfab7..ad376ed73618 100644 --- a/BigQuery/tests/System/LoadDataAndQueryTest.php +++ b/BigQuery/tests/System/LoadDataAndQueryTest.php @@ -18,6 +18,7 @@ namespace Google\Cloud\BigQuery\Tests\System; use Google\Cloud\BigQuery\Bytes; +use Google\Cloud\BigQuery\Numeric; use Google\Cloud\BigQuery\Date; use Google\Cloud\Core\ExponentialBackoff; use Google\Cloud\BigQuery\Time; @@ -60,7 +61,7 @@ public function setUp() 'NextVacation' => self::$client->date(new \DateTime('2020-10-11')), 'FavoriteTime' => new \DateTime('1920-01-01 15:15:12') ], - 'FavoriteNumbers' => [10, 11] + 'FavoriteNumbers' => [new Numeric('.123'), new Numeric('123.')] ]; } @@ -133,8 +134,8 @@ public function testRunQuery($useLegacySql) $expectedRow = $this->row; $expectedBytes = $expectedRow['Spells'][0]['Icon']; $actualBytes = $actualRow['Spells'][0]['Icon']; - unset($expectedRow['ImportantDates']); unset($expectedRow['FavoriteNumbers']); + unset($expectedRow['ImportantDates']); unset($expectedRow['Spells'][0]['Icon']); unset($actualRow['Spells'][0]['Icon']); @@ -216,9 +217,11 @@ public function testRunQueryWithNamedParameters() . '@datetime as datetime,' . '@date as date,' . '@time as time,' - . '@bytes as bytes'; + . '@bytes as bytes, ' + . '@numeric as numeric'; $bytes = self::$client->bytes('123'); + $numeric = self::$client->numeric('9.999999999'); $params = [ 'structType' => [ 'hello' => 'world' @@ -241,7 +244,8 @@ public function testRunQueryWithNamedParameters() 'datetime' => new \DateTime('2003-02-05 11:15:02.421827Z'), 'date' => self::$client->date(new \DateTime('2003-12-12')), 'time' => self::$client->time(new \DateTime('11:15:02')), - 'bytes' => $bytes + 'bytes' => $bytes, + 'numeric' => $numeric ]; $query = self::$client->query($queryString) ->parameters($params); diff --git a/BigQuery/tests/System/ManageJobsTest.php b/BigQuery/tests/System/ManageJobsTest.php index a41e5e87aeb2..3c9dacecd724 100644 --- a/BigQuery/tests/System/ManageJobsTest.php +++ b/BigQuery/tests/System/ManageJobsTest.php @@ -47,6 +47,33 @@ public function testListJobs() return $job; } + public function testListJobsWithTimeFilter() + { + $query = self::$client->query(sprintf( + 'SELECT * FROM [%s.%s]', + self::$dataset->id(), + self::$table->id() + )); + $job = self::$client->startQuery($query); + $info = $job->info(); + $jobId = $job->id(); + $creationTime = $info['statistics']['creationTime']; + $jobs = self::$client->jobs([ + 'maxCreationTime' => $creationTime + 1, + 'minCreationTime' => $creationTime - 1, + ]); + $job = null; + + // break early to prevent subsequent requests + foreach ($jobs as $j) { + $job = $j; + break; + } + + $this->assertInstanceOf(Job::class, $job); + $this->assertEquals($jobId, $job->id()); + } + /** * @depends testListJobs */ diff --git a/BigQuery/tests/System/data/table-schema.json b/BigQuery/tests/System/data/table-schema.json index 9a676d1a19ae..256e85bd9f32 100644 --- a/BigQuery/tests/System/data/table-schema.json +++ b/BigQuery/tests/System/data/table-schema.json @@ -88,6 +88,6 @@ { "mode": "REPEATED", "name": "FavoriteNumbers", - "type": "INTEGER" + "type": "NUMERIC" } ] diff --git a/BigQuery/tests/Unit/BigQueryClientTest.php b/BigQuery/tests/Unit/BigQueryClientTest.php index 9d1e57ff2ec5..dca5f11f1e63 100644 --- a/BigQuery/tests/Unit/BigQueryClientTest.php +++ b/BigQuery/tests/Unit/BigQueryClientTest.php @@ -23,6 +23,7 @@ use Google\Cloud\BigQuery\Dataset; use Google\Cloud\BigQuery\Date; use Google\Cloud\BigQuery\Job; +use Google\Cloud\BigQuery\Numeric; use Google\Cloud\BigQuery\QueryJobConfiguration; use Google\Cloud\BigQuery\QueryResults; use Google\Cloud\BigQuery\Time; @@ -256,6 +257,31 @@ public function testGetsJobsWithToken() $this->assertEquals(self::JOB_ID, $job[1]->id()); } + public function testGetsJobsWithTimeFilter() + { + $client = $this->getClient(); + $now = round(microtime(true) * 1000); + $max = $now + 1000; + $min = $now - 1000; + $token = 'token'; + $this->connection->listJobs([ + 'projectId' => self::PROJECT_ID, + 'maxCreationTime' => $max, + 'minCreationTime' => $min + ])->willReturn([ + 'jobs' => [ + ['jobReference' => ['jobId' => self::JOB_ID]] + ] + ])->shouldBeCalledTimes(1); + $client->___setProperty('connection', $this->connection->reveal()); + $job = iterator_to_array($client->jobs([ + 'minCreationTime' => $min, + 'maxCreationTime' => $max, + ])); + + $this->assertEquals(self::JOB_ID, $job[0]->id()); + } + public function testGetsDataset() { $client = $this->getClient(); @@ -375,6 +401,13 @@ public function testGetsBytes() $this->assertInstanceOf(Bytes::class, $bytes); } + public function testGetsNumeric() + { + $numeric = $this->getClient()->numeric('9'); + + $this->assertInstanceOf(Numeric::class, $numeric); + } + public function testGetsDate() { $date = $this->getClient()->date(new \DateTime()); @@ -430,4 +463,22 @@ public function testExplicitLocationPropagatesToJob() )->identity()['location'] ); } + + public function testGetServiceAccount() + { + $expectedEmail = uniqid() . '@bigquery-encryption.iam.gserviceaccount.com'; + $client = $this->getClient(); + $this->connection->getServiceAccount([ + 'projectId' => self::PROJECT_ID, + ]) + ->willReturn([ + "kind" => "bigquery#getServiceAccountResponse", + "email" => $expectedEmail + ]) + ->shouldBeCalledTimes(1); + $client->___setProperty('connection', $this->connection->reveal()); + $serviceAccount = $client->getServiceAccount(); + + $this->assertEquals($expectedEmail, $serviceAccount); + } } diff --git a/BigQuery/tests/Unit/Connection/RestTest.php b/BigQuery/tests/Unit/Connection/RestTest.php index 9cd73eb11d37..9759839b7acc 100644 --- a/BigQuery/tests/Unit/Connection/RestTest.php +++ b/BigQuery/tests/Unit/Connection/RestTest.php @@ -91,7 +91,8 @@ public function methodProvider() ['getJob'], ['listJobs'], ['cancelJob'], - ['insertJob'] + ['insertJob'], + ['getServiceAccount'], ]; } diff --git a/BigQuery/tests/Unit/NumericTest.php b/BigQuery/tests/Unit/NumericTest.php new file mode 100644 index 000000000000..8b4b4904bd4d --- /dev/null +++ b/BigQuery/tests/Unit/NumericTest.php @@ -0,0 +1,92 @@ +assertInstanceOf(Numeric::class, $numeric); + $this->assertEquals((string) $value, $numeric->get()); + } + + public function validValueProvider() + { + return + [ + ['0'], + ['99'], + ['99.9'], + ['99999999999999999999999999999999999999.999999999'], + ['-99999999999999999999999999999999999999.999999999'], + ['0.999999999'], + [99], // int + [99.9], // float + ['123.'], + ['.123'] + ]; + } + + public function testGetsType() + { + $numeric = new Numeric('9'); + + $this->assertEquals('NUMERIC', $numeric->type()); + } + + public function testToString() + { + $expected = '99999999999999999999999999999999999999.999999999'; + $numeric = new Numeric($expected); + + $this->assertEquals($expected, (string) $numeric); + $this->assertEquals($expected, $numeric->formatAsString()); + } +} diff --git a/BigQuery/tests/Unit/ValueMapperTest.php b/BigQuery/tests/Unit/ValueMapperTest.php index 0a7c73d5badb..7a6ef4156476 100644 --- a/BigQuery/tests/Unit/ValueMapperTest.php +++ b/BigQuery/tests/Unit/ValueMapperTest.php @@ -19,6 +19,7 @@ use Google\Cloud\BigQuery\Bytes; use Google\Cloud\BigQuery\Date; +use Google\Cloud\BigQuery\Numeric; use Google\Cloud\BigQuery\Time; use Google\Cloud\BigQuery\Timestamp; use Google\Cloud\BigQuery\ValueMapper; @@ -114,6 +115,11 @@ public function bigQueryValueProvider() ['type' => 'FLOAT'], 12.3 ], + [ + ['v' => '99999999999999999999999999999999999999.999999999'], + ['type' => 'NUMERIC'], + new Numeric('99999999999999999999999999999999999999.999999999') + ], [ ['v' => 'Hello'], ['type' => 'STRING'], @@ -233,6 +239,7 @@ public function toBigQueryValueProvider() $dt = new \DateTime(); $date = new Date($dt); $int64 = new Int64('123'); + $numeric = new Numeric('99999999999999999999999999999999999999.999999999'); return [ [$dt, $dt->format('Y-m-d\TH:i:s.u')], @@ -241,7 +248,9 @@ public function toBigQueryValueProvider() ['date' => $date], ['date' => (string) $date] ], - [1, 1] + [1, 1], + [$int64, '123'], + [$numeric, $numeric->formatAsString()], ]; } diff --git a/BigQueryDataTransfer/VERSION b/BigQueryDataTransfer/VERSION index 7ceb04048e8a..b1d7abc0dbab 100644 --- a/BigQueryDataTransfer/VERSION +++ b/BigQueryDataTransfer/VERSION @@ -1 +1 @@ -0.6.1 \ No newline at end of file +0.6.2 \ No newline at end of file diff --git a/BigQueryDataTransfer/composer.json b/BigQueryDataTransfer/composer.json index 2b5695a32e5c..8114dd19fb17 100644 --- a/BigQueryDataTransfer/composer.json +++ b/BigQueryDataTransfer/composer.json @@ -18,7 +18,7 @@ } }, "require": { - "google/gax": "^0.34" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/BigQueryDataTransfer/src/V1/CheckValidCredsRequest.php b/BigQueryDataTransfer/src/V1/CheckValidCredsRequest.php index 8e346e55acf8..012147cb0546 100644 --- a/BigQueryDataTransfer/src/V1/CheckValidCredsRequest.php +++ b/BigQueryDataTransfer/src/V1/CheckValidCredsRequest.php @@ -28,9 +28,20 @@ class CheckValidCredsRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The data source in the form: + * `projects/{project_id}/dataSources/{data_source_id}` + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/CheckValidCredsResponse.php b/BigQueryDataTransfer/src/V1/CheckValidCredsResponse.php index f0296466887d..ce8aa6652294 100644 --- a/BigQueryDataTransfer/src/V1/CheckValidCredsResponse.php +++ b/BigQueryDataTransfer/src/V1/CheckValidCredsResponse.php @@ -22,9 +22,19 @@ class CheckValidCredsResponse extends \Google\Protobuf\Internal\Message */ private $has_valid_creds = false; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $has_valid_creds + * If set to `true`, the credentials exist and are valid. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/CreateTransferConfigRequest.php b/BigQueryDataTransfer/src/V1/CreateTransferConfigRequest.php index fb64421d1442..f814a539e009 100644 --- a/BigQueryDataTransfer/src/V1/CreateTransferConfigRequest.php +++ b/BigQueryDataTransfer/src/V1/CreateTransferConfigRequest.php @@ -56,9 +56,40 @@ class CreateTransferConfigRequest extends \Google\Protobuf\Internal\Message */ private $authorization_code = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * The BigQuery project id where the transfer configuration should be created. + * Must be in the format /projects/{project_id}/locations/{location_id} + * If specified location and location of the destination bigquery dataset + * do not match - the request will fail. + * @type \Google\Cloud\BigQuery\DataTransfer\V1\TransferConfig $transfer_config + * Data transfer configuration to create. + * @type string $authorization_code + * Optional OAuth2 authorization code to use with this transfer configuration. + * This is required if new credentials are needed, as indicated by + * `CheckValidCreds`. + * In order to obtain authorization_code, please make a + * request to + * https://www.gstatic.com/bigquerydatatransfer/oauthz/auth?client_id=&scope=&redirect_uri= + * * client_id should be OAuth client_id of BigQuery DTS API for the given + * data source returned by ListDataSources method. + * * data_source_scopes are the scopes returned by ListDataSources method. + * * redirect_uri is an optional parameter. If not specified, then + * authorization code is posted to the opener of authorization flow window. + * Otherwise it will be sent to the redirect uri. A special value of + * urn:ietf:wg:oauth:2.0:oob means that authorization code should be + * returned in the title bar of the browser, with the page text prompting + * the user to copy the code and paste it in the application. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/DataSource.php b/BigQueryDataTransfer/src/V1/DataSource.php index 274317f2f9ea..490dd47a4d11 100644 --- a/BigQueryDataTransfer/src/V1/DataSource.php +++ b/BigQueryDataTransfer/src/V1/DataSource.php @@ -142,9 +142,70 @@ class DataSource extends \Google\Protobuf\Internal\Message */ private $minimum_schedule_interval = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. Data source resource name. + * @type string $data_source_id + * Data source id. + * @type string $display_name + * User friendly data source name. + * @type string $description + * User friendly data source description string. + * @type string $client_id + * Data source client id which should be used to receive refresh token. + * When not supplied, no offline credentials are populated for data transfer. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $scopes + * Api auth scopes for which refresh token needs to be obtained. Only valid + * when `client_id` is specified. Ignored otherwise. These are scopes needed + * by a data source to prepare data and ingest them into BigQuery, + * e.g., https://www.googleapis.com/auth/bigquery + * @type int $transfer_type + * Deprecated. This field has no effect. + * @type bool $supports_multiple_transfers + * Indicates whether the data source supports multiple transfers + * to different BigQuery targets. + * @type int $update_deadline_seconds + * The number of seconds to wait for an update from the data source + * before BigQuery marks the transfer as failed. + * @type string $default_schedule + * Default data transfer schedule. + * Examples of valid schedules include: + * `1st,3rd monday of month 15:30`, + * `every wed,fri of jan,jun 13:15`, and + * `first sunday of quarter 00:00`. + * @type bool $supports_custom_schedule + * Specifies whether the data source supports a user defined schedule, or + * operates on the default schedule. + * When set to `true`, user can override default schedule. + * @type \Google\Cloud\BigQuery\DataTransfer\V1\DataSourceParameter[]|\Google\Protobuf\Internal\RepeatedField $parameters + * Data source parameters. + * @type string $help_url + * Url for the help document for this data source. + * @type int $authorization_type + * Indicates the type of authorization. + * @type int $data_refresh_type + * Specifies whether the data source supports automatic data refresh for the + * past few days, and how it's supported. + * For some data sources, data might not be complete until a few days later, + * so it's useful to refresh data automatically. + * @type int $default_data_refresh_window_days + * Default data refresh window on days. + * Only meaningful when `data_refresh_type` = `SLIDING_WINDOW`. + * @type bool $manual_runs_disabled + * Disables backfilling and manual run scheduling + * for the data source. + * @type \Google\Protobuf\Duration $minimum_schedule_interval + * The minimum interval for scheduler to schedule runs. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/DataSource/AuthorizationType.php b/BigQueryDataTransfer/src/V1/DataSource/AuthorizationType.php new file mode 100644 index 000000000000..9e942ce9643b --- /dev/null +++ b/BigQueryDataTransfer/src/V1/DataSource/AuthorizationType.php @@ -0,0 +1,38 @@ +google.cloud.bigquery.datatransfer.v1.DataSource.AuthorizationType + */ +class AuthorizationType +{ + /** + * Type unspecified. + * + * Generated from protobuf enum AUTHORIZATION_TYPE_UNSPECIFIED = 0; + */ + const AUTHORIZATION_TYPE_UNSPECIFIED = 0; + /** + * Use OAuth 2 authorization codes that can be exchanged + * for a refresh token on the backend. + * + * Generated from protobuf enum AUTHORIZATION_CODE = 1; + */ + const AUTHORIZATION_CODE = 1; + /** + * Return an authorization code for a given Google+ page that can then be + * exchanged for a refresh token on the backend. + * + * Generated from protobuf enum GOOGLE_PLUS_AUTHORIZATION_CODE = 2; + */ + const GOOGLE_PLUS_AUTHORIZATION_CODE = 2; +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AuthorizationType::class, \Google\Cloud\BigQuery\DataTransfer\V1\DataSource_AuthorizationType::class); + diff --git a/BigQueryDataTransfer/src/V1/DataSource/DataRefreshType.php b/BigQueryDataTransfer/src/V1/DataSource/DataRefreshType.php new file mode 100644 index 000000000000..ba8ec07d03d7 --- /dev/null +++ b/BigQueryDataTransfer/src/V1/DataSource/DataRefreshType.php @@ -0,0 +1,40 @@ +google.cloud.bigquery.datatransfer.v1.DataSource.DataRefreshType + */ +class DataRefreshType +{ + /** + * The data source won't support data auto refresh, which is default value. + * + * Generated from protobuf enum DATA_REFRESH_TYPE_UNSPECIFIED = 0; + */ + const DATA_REFRESH_TYPE_UNSPECIFIED = 0; + /** + * The data source supports data auto refresh, and runs will be scheduled + * for the past few days. Does not allow custom values to be set for each + * transfer config. + * + * Generated from protobuf enum SLIDING_WINDOW = 1; + */ + const SLIDING_WINDOW = 1; + /** + * The data source supports data auto refresh, and runs will be scheduled + * for the past few days. Allows custom values to be set for each transfer + * config. + * + * Generated from protobuf enum CUSTOM_SLIDING_WINDOW = 2; + */ + const CUSTOM_SLIDING_WINDOW = 2; +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DataRefreshType::class, \Google\Cloud\BigQuery\DataTransfer\V1\DataSource_DataRefreshType::class); + diff --git a/BigQueryDataTransfer/src/V1/DataSourceParameter.php b/BigQueryDataTransfer/src/V1/DataSourceParameter.php index 76f9fb3dd5e4..b65bb86ae9e0 100644 --- a/BigQueryDataTransfer/src/V1/DataSourceParameter.php +++ b/BigQueryDataTransfer/src/V1/DataSourceParameter.php @@ -113,9 +113,49 @@ class DataSourceParameter extends \Google\Protobuf\Internal\Message */ private $recurse = false; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $param_id + * Parameter identifier. + * @type string $display_name + * Parameter display name in the user interface. + * @type string $description + * Parameter description. + * @type int $type + * Parameter type. + * @type bool $required + * Is parameter required. + * @type bool $repeated + * Can parameter have multiple values. + * @type string $validation_regex + * Regular expression which can be used for parameter validation. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $allowed_values + * All possible values for the parameter. + * @type \Google\Protobuf\DoubleValue $min_value + * For integer and double values specifies minimum allowed value. + * @type \Google\Protobuf\DoubleValue $max_value + * For integer and double values specifies maxminum allowed value. + * @type \Google\Cloud\BigQuery\DataTransfer\V1\DataSourceParameter[]|\Google\Protobuf\Internal\RepeatedField $fields + * When parameter is a record, describes child fields. + * @type string $validation_description + * Description of the requirements for this field, in case the user input does + * not fulfill the regex pattern or min/max values. + * @type string $validation_help_url + * URL to a help document to further explain the naming requirements. + * @type bool $immutable + * Cannot be changed after initial creation. + * @type bool $recurse + * If set to true, schema should be taken from the parent with the same + * parameter_id. Only applicable when parameter type is RECORD. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/DataSourceParameter/Type.php b/BigQueryDataTransfer/src/V1/DataSourceParameter/Type.php new file mode 100644 index 000000000000..7e600dc4ac9b --- /dev/null +++ b/BigQueryDataTransfer/src/V1/DataSourceParameter/Type.php @@ -0,0 +1,61 @@ +google.cloud.bigquery.datatransfer.v1.DataSourceParameter.Type + */ +class Type +{ + /** + * Type unspecified. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * String parameter. + * + * Generated from protobuf enum STRING = 1; + */ + const STRING = 1; + /** + * Integer parameter (64-bits). + * Will be serialized to json as string. + * + * Generated from protobuf enum INTEGER = 2; + */ + const INTEGER = 2; + /** + * Double precision floating point parameter. + * + * Generated from protobuf enum DOUBLE = 3; + */ + const DOUBLE = 3; + /** + * Boolean parameter. + * + * Generated from protobuf enum BOOLEAN = 4; + */ + const BOOLEAN = 4; + /** + * Record parameter. + * + * Generated from protobuf enum RECORD = 5; + */ + const RECORD = 5; + /** + * Page ID for a Google+ Page. + * + * Generated from protobuf enum PLUS_PAGE = 6; + */ + const PLUS_PAGE = 6; +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\BigQuery\DataTransfer\V1\DataSourceParameter_Type::class); + diff --git a/BigQueryDataTransfer/src/V1/DataSourceParameter_Type.php b/BigQueryDataTransfer/src/V1/DataSourceParameter_Type.php index 6a2036ac3cf4..56ed9fb8d743 100644 --- a/BigQueryDataTransfer/src/V1/DataSourceParameter_Type.php +++ b/BigQueryDataTransfer/src/V1/DataSourceParameter_Type.php @@ -4,55 +4,13 @@ namespace Google\Cloud\BigQuery\DataTransfer\V1; -/** - * Parameter type. - * - * Protobuf enum Google\Cloud\Bigquery\Datatransfer\V1\DataSourceParameter\Type - */ -class DataSourceParameter_Type -{ +if (false) { /** - * Type unspecified. - * - * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + * This class is deprecated. Use Google\Cloud\BigQuery\DataTransfer\V1\DataSourceParameter\Type instead. + * @deprecated */ - const TYPE_UNSPECIFIED = 0; - /** - * String parameter. - * - * Generated from protobuf enum STRING = 1; - */ - const STRING = 1; - /** - * Integer parameter (64-bits). - * Will be serialized to json as string. - * - * Generated from protobuf enum INTEGER = 2; - */ - const INTEGER = 2; - /** - * Double precision floating point parameter. - * - * Generated from protobuf enum DOUBLE = 3; - */ - const DOUBLE = 3; - /** - * Boolean parameter. - * - * Generated from protobuf enum BOOLEAN = 4; - */ - const BOOLEAN = 4; - /** - * Record parameter. - * - * Generated from protobuf enum RECORD = 5; - */ - const RECORD = 5; - /** - * Page ID for a Google+ Page. - * - * Generated from protobuf enum PLUS_PAGE = 6; - */ - const PLUS_PAGE = 6; + class DataSourceParameter_Type {} } +class_exists(DataSourceParameter\Type::class); +@trigger_error('Google\Cloud\BigQuery\DataTransfer\V1\DataSourceParameter_Type is deprecated and will be removed in a future release. Use Google\Cloud\BigQuery\DataTransfer\V1\DataSourceParameter\Type instead', E_USER_DEPRECATED); diff --git a/BigQueryDataTransfer/src/V1/DataSource_AuthorizationType.php b/BigQueryDataTransfer/src/V1/DataSource_AuthorizationType.php index 5dabae97fc02..3b7be216e44d 100644 --- a/BigQueryDataTransfer/src/V1/DataSource_AuthorizationType.php +++ b/BigQueryDataTransfer/src/V1/DataSource_AuthorizationType.php @@ -4,32 +4,13 @@ namespace Google\Cloud\BigQuery\DataTransfer\V1; -/** - * The type of authorization needed for this data source. - * - * Protobuf enum Google\Cloud\Bigquery\Datatransfer\V1\DataSource\AuthorizationType - */ -class DataSource_AuthorizationType -{ +if (false) { /** - * Type unspecified. - * - * Generated from protobuf enum AUTHORIZATION_TYPE_UNSPECIFIED = 0; + * This class is deprecated. Use Google\Cloud\BigQuery\DataTransfer\V1\DataSource\AuthorizationType instead. + * @deprecated */ - const AUTHORIZATION_TYPE_UNSPECIFIED = 0; - /** - * Use OAuth 2 authorization codes that can be exchanged - * for a refresh token on the backend. - * - * Generated from protobuf enum AUTHORIZATION_CODE = 1; - */ - const AUTHORIZATION_CODE = 1; - /** - * Return an authorization code for a given Google+ page that can then be - * exchanged for a refresh token on the backend. - * - * Generated from protobuf enum GOOGLE_PLUS_AUTHORIZATION_CODE = 2; - */ - const GOOGLE_PLUS_AUTHORIZATION_CODE = 2; + class DataSource_AuthorizationType {} } +class_exists(DataSource\AuthorizationType::class); +@trigger_error('Google\Cloud\BigQuery\DataTransfer\V1\DataSource_AuthorizationType is deprecated and will be removed in a future release. Use Google\Cloud\BigQuery\DataTransfer\V1\DataSource\AuthorizationType instead', E_USER_DEPRECATED); diff --git a/BigQueryDataTransfer/src/V1/DataSource_DataRefreshType.php b/BigQueryDataTransfer/src/V1/DataSource_DataRefreshType.php index 782d0407c0a8..79d4090040f9 100644 --- a/BigQueryDataTransfer/src/V1/DataSource_DataRefreshType.php +++ b/BigQueryDataTransfer/src/V1/DataSource_DataRefreshType.php @@ -4,34 +4,13 @@ namespace Google\Cloud\BigQuery\DataTransfer\V1; -/** - * Represents how the data source supports data auto refresh. - * - * Protobuf enum Google\Cloud\Bigquery\Datatransfer\V1\DataSource\DataRefreshType - */ -class DataSource_DataRefreshType -{ +if (false) { /** - * The data source won't support data auto refresh, which is default value. - * - * Generated from protobuf enum DATA_REFRESH_TYPE_UNSPECIFIED = 0; + * This class is deprecated. Use Google\Cloud\BigQuery\DataTransfer\V1\DataSource\DataRefreshType instead. + * @deprecated */ - const DATA_REFRESH_TYPE_UNSPECIFIED = 0; - /** - * The data source supports data auto refresh, and runs will be scheduled - * for the past few days. Does not allow custom values to be set for each - * transfer config. - * - * Generated from protobuf enum SLIDING_WINDOW = 1; - */ - const SLIDING_WINDOW = 1; - /** - * The data source supports data auto refresh, and runs will be scheduled - * for the past few days. Allows custom values to be set for each transfer - * config. - * - * Generated from protobuf enum CUSTOM_SLIDING_WINDOW = 2; - */ - const CUSTOM_SLIDING_WINDOW = 2; + class DataSource_DataRefreshType {} } +class_exists(DataSource\DataRefreshType::class); +@trigger_error('Google\Cloud\BigQuery\DataTransfer\V1\DataSource_DataRefreshType is deprecated and will be removed in a future release. Use Google\Cloud\BigQuery\DataTransfer\V1\DataSource\DataRefreshType instead', E_USER_DEPRECATED); diff --git a/BigQueryDataTransfer/src/V1/DeleteTransferConfigRequest.php b/BigQueryDataTransfer/src/V1/DeleteTransferConfigRequest.php index 770682874a3b..c53ffb96ae90 100644 --- a/BigQueryDataTransfer/src/V1/DeleteTransferConfigRequest.php +++ b/BigQueryDataTransfer/src/V1/DeleteTransferConfigRequest.php @@ -24,9 +24,20 @@ class DeleteTransferConfigRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The field will contain name of the resource requested, for example: + * `projects/{project_id}/transferConfigs/{config_id}` + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/DeleteTransferRunRequest.php b/BigQueryDataTransfer/src/V1/DeleteTransferRunRequest.php index 9bd253a8c831..415e3fe215bc 100644 --- a/BigQueryDataTransfer/src/V1/DeleteTransferRunRequest.php +++ b/BigQueryDataTransfer/src/V1/DeleteTransferRunRequest.php @@ -23,9 +23,20 @@ class DeleteTransferRunRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The field will contain name of the resource requested, for example: + * `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}` + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/Gapic/DataTransferServiceGapicClient.php b/BigQueryDataTransfer/src/V1/Gapic/DataTransferServiceGapicClient.php index 7c83cfb7d83f..2e58f1eeb36b 100644 --- a/BigQueryDataTransfer/src/V1/Gapic/DataTransferServiceGapicClient.php +++ b/BigQueryDataTransfer/src/V1/Gapic/DataTransferServiceGapicClient.php @@ -31,6 +31,7 @@ use Google\ApiCore\FetchAuthTokenInterface; use Google\ApiCore\GapicClientTrait; use Google\ApiCore\PathTemplate; +use Google\ApiCore\RequestParamsHeaderDescriptor; use Google\ApiCore\RetrySettings; use Google\ApiCore\Transport\TransportInterface; use Google\ApiCore\ValidationException; @@ -401,6 +402,13 @@ public function getDataSource($name, array $optionalArgs = []) $request = new GetDataSourceRequest(); $request->setName($name); + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'GetDataSource', DataSource::class, @@ -473,6 +481,13 @@ public function listDataSources($parent, array $optionalArgs = []) $request->setPageSize($optionalArgs['pageSize']); } + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( 'ListDataSources', $optionalArgs, @@ -542,6 +557,13 @@ public function createTransferConfig($parent, $transferConfig, array $optionalAr $request->setAuthorizationCode($optionalArgs['authorizationCode']); } + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'CreateTransferConfig', TransferConfig::class, @@ -609,6 +631,13 @@ public function updateTransferConfig($transferConfig, $updateMask, array $option $request->setAuthorizationCode($optionalArgs['authorizationCode']); } + $requestParams = new RequestParamsHeaderDescriptor([ + 'transfer_config.name' => $request->getTransferConfig()->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'UpdateTransferConfig', TransferConfig::class, @@ -652,6 +681,13 @@ public function deleteTransferConfig($name, array $optionalArgs = []) $request = new DeleteTransferConfigRequest(); $request->setName($name); + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'DeleteTransferConfig', GPBEmpty::class, @@ -696,6 +732,13 @@ public function getTransferConfig($name, array $optionalArgs = []) $request = new GetTransferConfigRequest(); $request->setName($name); + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'GetTransferConfig', TransferConfig::class, @@ -772,6 +815,13 @@ public function listTransferConfigs($parent, array $optionalArgs = []) $request->setPageSize($optionalArgs['pageSize']); } + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( 'ListTransferConfigs', $optionalArgs, @@ -827,6 +877,13 @@ public function scheduleTransferRuns($parent, $startTime, $endTime, array $optio $request->setStartTime($startTime); $request->setEndTime($endTime); + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'ScheduleTransferRuns', ScheduleTransferRunsResponse::class, @@ -871,6 +928,13 @@ public function getTransferRun($name, array $optionalArgs = []) $request = new GetTransferRunRequest(); $request->setName($name); + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'GetTransferRun', TransferRun::class, @@ -913,6 +977,13 @@ public function deleteTransferRun($name, array $optionalArgs = []) $request = new DeleteTransferRunRequest(); $request->setName($name); + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'DeleteTransferRun', GPBEmpty::class, @@ -967,7 +1038,7 @@ public function deleteTransferRun($name, array $optionalArgs = []) * there are additional values to be retrieved. * @type int $runAttempt * Indicates how run attempts are to be pulled. - * For allowed values, use constants defined on {@see \Google\Cloud\BigQuery\DataTransfer\V1\ListTransferRunsRequest_RunAttempt} + * For allowed values, use constants defined on {@see \Google\Cloud\BigQuery\DataTransfer\V1\ListTransferRunsRequest\RunAttempt} * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a * {@see Google\ApiCore\RetrySettings} object, or an associative array @@ -997,6 +1068,13 @@ public function listTransferRuns($parent, array $optionalArgs = []) $request->setRunAttempt($optionalArgs['runAttempt']); } + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( 'ListTransferRuns', $optionalArgs, @@ -1075,6 +1153,13 @@ public function listTransferLogs($parent, array $optionalArgs = []) $request->setMessageTypes($optionalArgs['messageTypes']); } + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( 'ListTransferLogs', $optionalArgs, @@ -1124,6 +1209,13 @@ public function checkValidCreds($name, array $optionalArgs = []) $request = new CheckValidCredsRequest(); $request->setName($name); + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'CheckValidCreds', CheckValidCredsResponse::class, diff --git a/BigQueryDataTransfer/src/V1/GetDataSourceRequest.php b/BigQueryDataTransfer/src/V1/GetDataSourceRequest.php index 27d0778c5a84..9ebd7fc7b9d4 100644 --- a/BigQueryDataTransfer/src/V1/GetDataSourceRequest.php +++ b/BigQueryDataTransfer/src/V1/GetDataSourceRequest.php @@ -23,9 +23,20 @@ class GetDataSourceRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The field will contain name of the resource requested, for example: + * `projects/{project_id}/dataSources/{data_source_id}` + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/GetTransferConfigRequest.php b/BigQueryDataTransfer/src/V1/GetTransferConfigRequest.php index f69df12e8daf..186abd026c40 100644 --- a/BigQueryDataTransfer/src/V1/GetTransferConfigRequest.php +++ b/BigQueryDataTransfer/src/V1/GetTransferConfigRequest.php @@ -23,9 +23,20 @@ class GetTransferConfigRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The field will contain name of the resource requested, for example: + * `projects/{project_id}/transferConfigs/{config_id}` + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/GetTransferRunRequest.php b/BigQueryDataTransfer/src/V1/GetTransferRunRequest.php index d8402c56334b..505c13d96d46 100644 --- a/BigQueryDataTransfer/src/V1/GetTransferRunRequest.php +++ b/BigQueryDataTransfer/src/V1/GetTransferRunRequest.php @@ -23,9 +23,20 @@ class GetTransferRunRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The field will contain name of the resource requested, for example: + * `projects/{project_id}/transferConfigs/{config_id}/runs/{run_id}` + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/ListDataSourcesRequest.php b/BigQueryDataTransfer/src/V1/ListDataSourcesRequest.php index 32e89691dcb9..12343591cd36 100644 --- a/BigQueryDataTransfer/src/V1/ListDataSourcesRequest.php +++ b/BigQueryDataTransfer/src/V1/ListDataSourcesRequest.php @@ -39,9 +39,28 @@ class ListDataSourcesRequest extends \Google\Protobuf\Internal\Message */ private $page_size = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * The BigQuery project id for which data sources should be returned. + * Must be in the form: `projects/{project_id}` + * @type string $page_token + * Pagination token, which can be used to request a specific page + * of `ListDataSourcesRequest` list results. For multiple-page + * results, `ListDataSourcesResponse` outputs + * a `next_page` token, which can be used as the + * `page_token` value to request the next page of list results. + * @type int $page_size + * Page size. The default page size is the maximum value of 1000 results. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/ListDataSourcesResponse.php b/BigQueryDataTransfer/src/V1/ListDataSourcesResponse.php index eec14b1d1e6c..6fd1e63aa00a 100644 --- a/BigQueryDataTransfer/src/V1/ListDataSourcesResponse.php +++ b/BigQueryDataTransfer/src/V1/ListDataSourcesResponse.php @@ -31,9 +31,24 @@ class ListDataSourcesResponse extends \Google\Protobuf\Internal\Message */ private $next_page_token = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\BigQuery\DataTransfer\V1\DataSource[]|\Google\Protobuf\Internal\RepeatedField $data_sources + * List of supported data sources and their transfer settings. + * @type string $next_page_token + * Output only. The next-pagination token. For multiple-page list results, + * this token can be used as the + * `ListDataSourcesRequest.page_token` + * to request the next page of list results. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/ListTransferConfigsRequest.php b/BigQueryDataTransfer/src/V1/ListTransferConfigsRequest.php index 7346d4b2d821..5dbb9f300ae5 100644 --- a/BigQueryDataTransfer/src/V1/ListTransferConfigsRequest.php +++ b/BigQueryDataTransfer/src/V1/ListTransferConfigsRequest.php @@ -45,9 +45,30 @@ class ListTransferConfigsRequest extends \Google\Protobuf\Internal\Message */ private $page_size = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * The BigQuery project id for which data sources + * should be returned: `projects/{project_id}`. + * @type string[]|\Google\Protobuf\Internal\RepeatedField $data_source_ids + * When specified, only configurations of requested data sources are returned. + * @type string $page_token + * Pagination token, which can be used to request a specific page + * of `ListTransfersRequest` list results. For multiple-page + * results, `ListTransfersResponse` outputs + * a `next_page` token, which can be used as the + * `page_token` value to request the next page of list results. + * @type int $page_size + * Page size. The default page size is the maximum value of 1000 results. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/ListTransferConfigsResponse.php b/BigQueryDataTransfer/src/V1/ListTransferConfigsResponse.php index 2af6660af8be..0edef4cc025b 100644 --- a/BigQueryDataTransfer/src/V1/ListTransferConfigsResponse.php +++ b/BigQueryDataTransfer/src/V1/ListTransferConfigsResponse.php @@ -31,9 +31,24 @@ class ListTransferConfigsResponse extends \Google\Protobuf\Internal\Message */ private $next_page_token = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\BigQuery\DataTransfer\V1\TransferConfig[]|\Google\Protobuf\Internal\RepeatedField $transfer_configs + * Output only. The stored pipeline transfer configurations. + * @type string $next_page_token + * Output only. The next-pagination token. For multiple-page list results, + * this token can be used as the + * `ListTransferConfigsRequest.page_token` + * to request the next page of list results. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/ListTransferLogsRequest.php b/BigQueryDataTransfer/src/V1/ListTransferLogsRequest.php index 5fe15b6477a7..9abb2b768f8c 100644 --- a/BigQueryDataTransfer/src/V1/ListTransferLogsRequest.php +++ b/BigQueryDataTransfer/src/V1/ListTransferLogsRequest.php @@ -46,9 +46,31 @@ class ListTransferLogsRequest extends \Google\Protobuf\Internal\Message */ private $message_types; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Transfer run name in the form: + * `projects/{project_id}/transferConfigs/{config_Id}/runs/{run_id}`. + * @type string $page_token + * Pagination token, which can be used to request a specific page + * of `ListTransferLogsRequest` list results. For multiple-page + * results, `ListTransferLogsResponse` outputs + * a `next_page` token, which can be used as the + * `page_token` value to request the next page of list results. + * @type int $page_size + * Page size. The default page size is the maximum value of 1000 results. + * @type int[]|\Google\Protobuf\Internal\RepeatedField $message_types + * Message types to return. If not populated - INFO, WARNING and ERROR + * messages are returned. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** @@ -161,7 +183,7 @@ public function getMessageTypes() */ public function setMessageTypes($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\BigQuery\DataTransfer\V1\TransferMessage_MessageSeverity::class); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\BigQuery\DataTransfer\V1\TransferMessage\MessageSeverity::class); $this->message_types = $arr; return $this; diff --git a/BigQueryDataTransfer/src/V1/ListTransferLogsResponse.php b/BigQueryDataTransfer/src/V1/ListTransferLogsResponse.php index 155f5772c74e..199b1382aab2 100644 --- a/BigQueryDataTransfer/src/V1/ListTransferLogsResponse.php +++ b/BigQueryDataTransfer/src/V1/ListTransferLogsResponse.php @@ -31,9 +31,24 @@ class ListTransferLogsResponse extends \Google\Protobuf\Internal\Message */ private $next_page_token = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\BigQuery\DataTransfer\V1\TransferMessage[]|\Google\Protobuf\Internal\RepeatedField $transfer_messages + * Output only. The stored pipeline transfer messages. + * @type string $next_page_token + * Output only. The next-pagination token. For multiple-page list results, + * this token can be used as the + * `GetTransferRunLogRequest.page_token` + * to request the next page of list results. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/ListTransferRunsRequest.php b/BigQueryDataTransfer/src/V1/ListTransferRunsRequest.php index 195aaacdb1c6..5602b6257845 100644 --- a/BigQueryDataTransfer/src/V1/ListTransferRunsRequest.php +++ b/BigQueryDataTransfer/src/V1/ListTransferRunsRequest.php @@ -54,9 +54,33 @@ class ListTransferRunsRequest extends \Google\Protobuf\Internal\Message */ private $run_attempt = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Name of transfer configuration for which transfer runs should be retrieved. + * Format of transfer configuration resource name is: + * `projects/{project_id}/transferConfigs/{config_id}`. + * @type int[]|\Google\Protobuf\Internal\RepeatedField $states + * When specified, only transfer runs with requested states are returned. + * @type string $page_token + * Pagination token, which can be used to request a specific page + * of `ListTransferRunsRequest` list results. For multiple-page + * results, `ListTransferRunsResponse` outputs + * a `next_page` token, which can be used as the + * `page_token` value to request the next page of list results. + * @type int $page_size + * Page size. The default page size is the maximum value of 1000 results. + * @type int $run_attempt + * Indicates how run attempts are to be pulled. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/ListTransferRunsRequest/RunAttempt.php b/BigQueryDataTransfer/src/V1/ListTransferRunsRequest/RunAttempt.php new file mode 100644 index 000000000000..6e87f25fff2f --- /dev/null +++ b/BigQueryDataTransfer/src/V1/ListTransferRunsRequest/RunAttempt.php @@ -0,0 +1,30 @@ +google.cloud.bigquery.datatransfer.v1.ListTransferRunsRequest.RunAttempt + */ +class RunAttempt +{ + /** + * All runs should be returned. + * + * Generated from protobuf enum RUN_ATTEMPT_UNSPECIFIED = 0; + */ + const RUN_ATTEMPT_UNSPECIFIED = 0; + /** + * Only latest run per day should be returned. + * + * Generated from protobuf enum LATEST = 1; + */ + const LATEST = 1; +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RunAttempt::class, \Google\Cloud\BigQuery\DataTransfer\V1\ListTransferRunsRequest_RunAttempt::class); + diff --git a/BigQueryDataTransfer/src/V1/ListTransferRunsRequest_RunAttempt.php b/BigQueryDataTransfer/src/V1/ListTransferRunsRequest_RunAttempt.php index aa24f9928e31..3ce62c88a7c2 100644 --- a/BigQueryDataTransfer/src/V1/ListTransferRunsRequest_RunAttempt.php +++ b/BigQueryDataTransfer/src/V1/ListTransferRunsRequest_RunAttempt.php @@ -4,24 +4,13 @@ namespace Google\Cloud\BigQuery\DataTransfer\V1; -/** - * Represents which runs should be pulled. - * - * Protobuf enum Google\Cloud\Bigquery\Datatransfer\V1\ListTransferRunsRequest\RunAttempt - */ -class ListTransferRunsRequest_RunAttempt -{ +if (false) { /** - * All runs should be returned. - * - * Generated from protobuf enum RUN_ATTEMPT_UNSPECIFIED = 0; + * This class is deprecated. Use Google\Cloud\BigQuery\DataTransfer\V1\ListTransferRunsRequest\RunAttempt instead. + * @deprecated */ - const RUN_ATTEMPT_UNSPECIFIED = 0; - /** - * Only latest run per day should be returned. - * - * Generated from protobuf enum LATEST = 1; - */ - const LATEST = 1; + class ListTransferRunsRequest_RunAttempt {} } +class_exists(ListTransferRunsRequest\RunAttempt::class); +@trigger_error('Google\Cloud\BigQuery\DataTransfer\V1\ListTransferRunsRequest_RunAttempt is deprecated and will be removed in a future release. Use Google\Cloud\BigQuery\DataTransfer\V1\ListTransferRunsRequest\RunAttempt instead', E_USER_DEPRECATED); diff --git a/BigQueryDataTransfer/src/V1/ListTransferRunsResponse.php b/BigQueryDataTransfer/src/V1/ListTransferRunsResponse.php index d8814d324ad8..17ed0156fe51 100644 --- a/BigQueryDataTransfer/src/V1/ListTransferRunsResponse.php +++ b/BigQueryDataTransfer/src/V1/ListTransferRunsResponse.php @@ -31,9 +31,24 @@ class ListTransferRunsResponse extends \Google\Protobuf\Internal\Message */ private $next_page_token = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\BigQuery\DataTransfer\V1\TransferRun[]|\Google\Protobuf\Internal\RepeatedField $transfer_runs + * Output only. The stored pipeline transfer runs. + * @type string $next_page_token + * Output only. The next-pagination token. For multiple-page list results, + * this token can be used as the + * `ListTransferRunsRequest.page_token` + * to request the next page of list results. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/ScheduleTransferRunsRequest.php b/BigQueryDataTransfer/src/V1/ScheduleTransferRunsRequest.php index aeccdfe4f006..755e4c16f371 100644 --- a/BigQueryDataTransfer/src/V1/ScheduleTransferRunsRequest.php +++ b/BigQueryDataTransfer/src/V1/ScheduleTransferRunsRequest.php @@ -37,9 +37,26 @@ class ScheduleTransferRunsRequest extends \Google\Protobuf\Internal\Message */ private $end_time = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Transfer configuration name in the form: + * `projects/{project_id}/transferConfigs/{config_id}`. + * @type \Google\Protobuf\Timestamp $start_time + * Start time of the range of transfer runs. For example, + * `"2017-05-25T00:00:00+00:00"`. + * @type \Google\Protobuf\Timestamp $end_time + * End time of the range of transfer runs. For example, + * `"2017-05-30T00:00:00+00:00"`. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/ScheduleTransferRunsResponse.php b/BigQueryDataTransfer/src/V1/ScheduleTransferRunsResponse.php index 7a51cffa28e3..8a9e734dde59 100644 --- a/BigQueryDataTransfer/src/V1/ScheduleTransferRunsResponse.php +++ b/BigQueryDataTransfer/src/V1/ScheduleTransferRunsResponse.php @@ -22,9 +22,19 @@ class ScheduleTransferRunsResponse extends \Google\Protobuf\Internal\Message */ private $runs; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\BigQuery\DataTransfer\V1\TransferRun[]|\Google\Protobuf\Internal\RepeatedField $runs + * The transfer runs that were scheduled. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/TransferConfig.php b/BigQueryDataTransfer/src/V1/TransferConfig.php index c07f805e7f2d..32b9d677ff70 100644 --- a/BigQueryDataTransfer/src/V1/TransferConfig.php +++ b/BigQueryDataTransfer/src/V1/TransferConfig.php @@ -125,9 +125,69 @@ class TransferConfig extends \Google\Protobuf\Internal\Message */ private $dataset_region = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the transfer config. + * Transfer config names have the form + * `projects/{project_id}/transferConfigs/{config_id}`. + * Where `config_id` is usually a uuid, even though it is not + * guaranteed or required. The name is ignored when creating a transfer + * config. + * @type string $destination_dataset_id + * The BigQuery target dataset id. + * @type string $display_name + * User specified display name for the data transfer. + * @type string $data_source_id + * Data source id. Cannot be changed once data transfer is created. + * @type \Google\Protobuf\Struct $params + * Data transfer specific parameters. + * @type string $schedule + * Data transfer schedule. + * If the data source does not support a custom schedule, this should be + * empty. If it is empty, the default value for the data source will be + * used. + * The specified times are in UTC. + * Examples of valid format: + * `1st,3rd monday of month 15:30`, + * `every wed,fri of jan,jun 13:15`, and + * `first sunday of quarter 00:00`. + * See more explanation about the format here: + * https://cloud.google.com/appengine/docs/flexible/python/scheduling-jobs-with-cron-yaml#the_schedule_format + * NOTE: the granularity should be at least 8 hours, or less frequent. + * @type int $data_refresh_window_days + * The number of days to look back to automatically refresh the data. + * For example, if `data_refresh_window_days = 10`, then every day + * BigQuery reingests data for [today-10, today-1], rather than ingesting data + * for just [today-1]. + * Only valid if the data source supports the feature. Set the value to 0 + * to use the default value. + * @type bool $disabled + * Is this config disabled. When set to true, no runs are scheduled + * for a given transfer. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Data transfer modification time. Ignored by server on input. + * @type \Google\Protobuf\Timestamp $next_run_time + * Output only. Next time when data transfer will run. + * @type int $state + * Output only. State of the most recently updated transfer run. + * @type int|string $user_id + * Output only. Unique ID of the user on whose behalf transfer is done. + * Applicable only to data sources that do not support service accounts. + * When set to 0, the data source service account credentials are used. + * May be negative. Note, that this identifier is not stable. + * It may change over time even for the same user. + * @type string $dataset_region + * Output only. Region in which BigQuery dataset is located. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Transfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/TransferMessage.php b/BigQueryDataTransfer/src/V1/TransferMessage.php index 70b56d423a2d..516448b4fc6c 100644 --- a/BigQueryDataTransfer/src/V1/TransferMessage.php +++ b/BigQueryDataTransfer/src/V1/TransferMessage.php @@ -34,9 +34,23 @@ class TransferMessage extends \Google\Protobuf\Internal\Message */ private $message_text = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $message_time + * Time when message was logged. + * @type int $severity + * Message severity. + * @type string $message_text + * Message text. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Transfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/TransferMessage/MessageSeverity.php b/BigQueryDataTransfer/src/V1/TransferMessage/MessageSeverity.php new file mode 100644 index 000000000000..029672e5ef83 --- /dev/null +++ b/BigQueryDataTransfer/src/V1/TransferMessage/MessageSeverity.php @@ -0,0 +1,42 @@ +google.cloud.bigquery.datatransfer.v1.TransferMessage.MessageSeverity + */ +class MessageSeverity +{ + /** + * No severity specified. + * + * Generated from protobuf enum MESSAGE_SEVERITY_UNSPECIFIED = 0; + */ + const MESSAGE_SEVERITY_UNSPECIFIED = 0; + /** + * Informational message. + * + * Generated from protobuf enum INFO = 1; + */ + const INFO = 1; + /** + * Warning message. + * + * Generated from protobuf enum WARNING = 2; + */ + const WARNING = 2; + /** + * Error message. + * + * Generated from protobuf enum ERROR = 3; + */ + const ERROR = 3; +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MessageSeverity::class, \Google\Cloud\BigQuery\DataTransfer\V1\TransferMessage_MessageSeverity::class); + diff --git a/BigQueryDataTransfer/src/V1/TransferMessage_MessageSeverity.php b/BigQueryDataTransfer/src/V1/TransferMessage_MessageSeverity.php index f23801b8108f..944bc4022d14 100644 --- a/BigQueryDataTransfer/src/V1/TransferMessage_MessageSeverity.php +++ b/BigQueryDataTransfer/src/V1/TransferMessage_MessageSeverity.php @@ -4,36 +4,13 @@ namespace Google\Cloud\BigQuery\DataTransfer\V1; -/** - * Represents data transfer user facing message severity. - * - * Protobuf enum Google\Cloud\Bigquery\Datatransfer\V1\TransferMessage\MessageSeverity - */ -class TransferMessage_MessageSeverity -{ +if (false) { /** - * No severity specified. - * - * Generated from protobuf enum MESSAGE_SEVERITY_UNSPECIFIED = 0; + * This class is deprecated. Use Google\Cloud\BigQuery\DataTransfer\V1\TransferMessage\MessageSeverity instead. + * @deprecated */ - const MESSAGE_SEVERITY_UNSPECIFIED = 0; - /** - * Informational message. - * - * Generated from protobuf enum INFO = 1; - */ - const INFO = 1; - /** - * Warning message. - * - * Generated from protobuf enum WARNING = 2; - */ - const WARNING = 2; - /** - * Error message. - * - * Generated from protobuf enum ERROR = 3; - */ - const ERROR = 3; + class TransferMessage_MessageSeverity {} } +class_exists(TransferMessage\MessageSeverity::class); +@trigger_error('Google\Cloud\BigQuery\DataTransfer\V1\TransferMessage_MessageSeverity is deprecated and will be removed in a future release. Use Google\Cloud\BigQuery\DataTransfer\V1\TransferMessage\MessageSeverity instead', E_USER_DEPRECATED); diff --git a/BigQueryDataTransfer/src/V1/TransferRun.php b/BigQueryDataTransfer/src/V1/TransferRun.php index d2e1f75de10e..c24d15bbcd54 100644 --- a/BigQueryDataTransfer/src/V1/TransferRun.php +++ b/BigQueryDataTransfer/src/V1/TransferRun.php @@ -108,9 +108,57 @@ class TransferRun extends \Google\Protobuf\Internal\Message */ private $schedule = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the transfer run. + * Transfer run names have the form + * `projects/{project_id}/locations/{location}/transferConfigs/{config_id}/runs/{run_id}`. + * The name is ignored when creating a transfer run. + * @type \Google\Protobuf\Timestamp $schedule_time + * Minimum time after which a transfer run can be started. + * @type \Google\Protobuf\Timestamp $run_time + * For batch transfer runs, specifies the date and time that + * data should be ingested. + * @type \Google\Rpc\Status $error_status + * Status of the transfer run. + * @type \Google\Protobuf\Timestamp $start_time + * Output only. Time when transfer run was started. + * Parameter ignored by server for input requests. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. Time when transfer run ended. + * Parameter ignored by server for input requests. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Last time the data transfer run state was updated. + * @type \Google\Protobuf\Struct $params + * Output only. Data transfer specific parameters. + * @type string $destination_dataset_id + * Output only. The BigQuery target dataset id. + * @type string $data_source_id + * Output only. Data source id. + * @type int $state + * Data transfer run state. Ignored for input requests. + * @type int|string $user_id + * Output only. Unique ID of the user on whose behalf transfer is done. + * Applicable only to data sources that do not support service accounts. + * When set to 0, the data source service account credentials are used. + * May be negative. Note, that this identifier is not stable. + * It may change over time even for the same user. + * @type string $schedule + * Output only. Describes the schedule of this transfer run if it was + * created as part of a regular schedule. For batch transfer runs that are + * scheduled manually, this is empty. + * NOTE: the system might choose to delay the schedule depending on the + * current load, so `schedule_time` doesn't always matches this. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Transfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/src/V1/TransferState.php b/BigQueryDataTransfer/src/V1/TransferState.php index d5de969bc119..9a5274e87e5a 100644 --- a/BigQueryDataTransfer/src/V1/TransferState.php +++ b/BigQueryDataTransfer/src/V1/TransferState.php @@ -7,7 +7,7 @@ /** * Represents data transfer run state. * - * Protobuf enum Google\Cloud\Bigquery\Datatransfer\V1\TransferState + * Protobuf type google.cloud.bigquery.datatransfer.v1.TransferState */ class TransferState { diff --git a/BigQueryDataTransfer/src/V1/TransferType.php b/BigQueryDataTransfer/src/V1/TransferType.php index 1f9f15a64ccb..ddef4570b1e1 100644 --- a/BigQueryDataTransfer/src/V1/TransferType.php +++ b/BigQueryDataTransfer/src/V1/TransferType.php @@ -7,7 +7,7 @@ /** * DEPRECATED. Represents data transfer type. * - * Protobuf enum Google\Cloud\Bigquery\Datatransfer\V1\TransferType + * Protobuf type google.cloud.bigquery.datatransfer.v1.TransferType */ class TransferType { diff --git a/BigQueryDataTransfer/src/V1/UpdateTransferConfigRequest.php b/BigQueryDataTransfer/src/V1/UpdateTransferConfigRequest.php index cea93374fbb6..29b4b2182399 100644 --- a/BigQueryDataTransfer/src/V1/UpdateTransferConfigRequest.php +++ b/BigQueryDataTransfer/src/V1/UpdateTransferConfigRequest.php @@ -49,9 +49,37 @@ class UpdateTransferConfigRequest extends \Google\Protobuf\Internal\Message */ private $update_mask = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\BigQuery\DataTransfer\V1\TransferConfig $transfer_config + * Data transfer configuration to create. + * @type string $authorization_code + * Optional OAuth2 authorization code to use with this transfer configuration. + * If it is provided, the transfer configuration will be associated with the + * authorizing user. + * In order to obtain authorization_code, please make a + * request to + * https://www.gstatic.com/bigquerydatatransfer/oauthz/auth?client_id=&scope=&redirect_uri= + * * client_id should be OAuth client_id of BigQuery DTS API for the given + * data source returned by ListDataSources method. + * * data_source_scopes are the scopes returned by ListDataSources method. + * * redirect_uri is an optional parameter. If not specified, then + * authorization code is posted to the opener of authorization flow window. + * Otherwise it will be sent to the redirect uri. A special value of + * urn:ietf:wg:oauth:2.0:oob means that authorization code should be + * returned in the title bar of the browser, with the page text prompting + * the user to copy the code and paste it in the application. + * @type \Google\Protobuf\FieldMask $update_mask + * Required list of fields to be updated in this request. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Bigquery\Datatransfer\V1\Datatransfer::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/BigQueryDataTransfer/synth.py b/BigQueryDataTransfer/synth.py index f04c56b75200..9a0060cdef99 100644 --- a/BigQueryDataTransfer/synth.py +++ b/BigQueryDataTransfer/synth.py @@ -52,3 +52,14 @@ 'tests/**/V1/*Test.php', r'Copyright \d{4}', 'Copyright 2018') + +# Change the wording for the deprecation warning. +s.replace( + 'src/*/*_*.php', + r'will be removed in the next major release', + 'will be removed in a future release') + +s.replace( + 'src/V1/Gapic/DataTransferServiceGapicClient.php', + r'ListTransferRunsRequest_RunAttempt', + 'ListTransferRunsRequest\RunAttempt') diff --git a/Bigtable/VERSION b/Bigtable/VERSION index 5d4294b9120c..c52db9804044 100644 --- a/Bigtable/VERSION +++ b/Bigtable/VERSION @@ -1 +1 @@ -0.5.1 \ No newline at end of file +0.5.3 \ No newline at end of file diff --git a/Bigtable/composer.json b/Bigtable/composer.json index 795377a4e84e..5330572cdd42 100644 --- a/Bigtable/composer.json +++ b/Bigtable/composer.json @@ -4,7 +4,7 @@ "license": "Apache-2.0", "minimum-stability": "stable", "require": { - "google/gax": "^0.34" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Container/VERSION b/Container/VERSION index 5d4294b9120c..2411653a5008 100644 --- a/Container/VERSION +++ b/Container/VERSION @@ -1 +1 @@ -0.5.1 \ No newline at end of file +0.5.2 \ No newline at end of file diff --git a/Container/composer.json b/Container/composer.json index 092ae85ca782..e29848c390d9 100644 --- a/Container/composer.json +++ b/Container/composer.json @@ -18,7 +18,7 @@ } }, "require": { - "google/gax": "^0.34" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Core/VERSION b/Core/VERSION index 6597009a0673..87967a790d61 100644 --- a/Core/VERSION +++ b/Core/VERSION @@ -1 +1 @@ -1.20.7 \ No newline at end of file +1.21.1 \ No newline at end of file diff --git a/Core/composer.json b/Core/composer.json index d27009023c71..859525b732d7 100644 --- a/Core/composer.json +++ b/Core/composer.json @@ -17,7 +17,7 @@ "squizlabs/php_codesniffer": "2.*", "phpdocumentor/reflection": "^3.0", "erusev/parsedown": "^1.6", - "google/gax": "^0.33", + "google/gax": "^0.36", "opis/closure": "^3" }, "suggest": { diff --git a/Core/src/Testing/FileListFilterIterator.php b/Core/src/Testing/FileListFilterIterator.php index 4176847f86a0..920e8566ecd1 100644 --- a/Core/src/Testing/FileListFilterIterator.php +++ b/Core/src/Testing/FileListFilterIterator.php @@ -77,7 +77,7 @@ public function accept() if ($exclude instanceof RegexFileFilter) { $pattern = $exclude->regex; - if (preg_match('/'. $pattern .'/', $path) === 1) { + if (preg_match($pattern, $path) === 1) { return false; } diff --git a/dev/src/DocGenerator/RegexFileFilter.php b/Core/src/Testing/RegexFileFilter.php similarity index 94% rename from dev/src/DocGenerator/RegexFileFilter.php rename to Core/src/Testing/RegexFileFilter.php index 5f8037e31aa8..30707ca574f2 100644 --- a/dev/src/DocGenerator/RegexFileFilter.php +++ b/Core/src/Testing/RegexFileFilter.php @@ -15,7 +15,7 @@ * limitations under the License. */ -namespace Google\Cloud\Dev\DocGenerator; +namespace Google\Cloud\Core\Testing; /** * A regex exclude path diff --git a/Core/src/Testing/TestHelpers.php b/Core/src/Testing/TestHelpers.php index ae136b55c852..2becfebb442d 100644 --- a/Core/src/Testing/TestHelpers.php +++ b/Core/src/Testing/TestHelpers.php @@ -18,6 +18,7 @@ namespace Google\Cloud\Core\Testing; +use Google\Cloud\Core\Testing\RegexFileFilter; use Google\Cloud\Core\Testing\Snippet\Container; use Google\Cloud\Core\Testing\Snippet\Coverage\Coverage; use Google\Cloud\Core\Testing\Snippet\Coverage\ExcludeFilter; @@ -109,7 +110,11 @@ public static function snippetBootstrap() putenv('GOOGLE_APPLICATION_CREDENTIALS='. \Google\Cloud\Core\Testing\Snippet\Fixtures::KEYFILE_STUB_FIXTURE()); $parser = new Parser; - $scanner = new Scanner($parser, self::projectRoot(), ['/vendor/', '/dev/']); + $scanner = new Scanner($parser, self::projectRoot(), [ + '/vendor/', + '/dev/', + new RegexFileFilter('/\w{0,}\/vendor\//') + ]); $coverage = new Coverage($scanner); $coverage->buildListToCover(); diff --git a/Core/unit-bootstrap.php b/Core/unit-bootstrap.php index f11c03886df4..4fc30215b3d5 100644 --- a/Core/unit-bootstrap.php +++ b/Core/unit-bootstrap.php @@ -1,3 +1,10 @@ register(new MessageAwareArrayComparator()); +\SebastianBergmann\Comparator\Factory::getInstance()->register(new ProtobufMessageComparator()); +\SebastianBergmann\Comparator\Factory::getInstance()->register(new ProtobufGPBEmptyComparator()); diff --git a/Dataproc/VERSION b/Dataproc/VERSION index 5d4294b9120c..c52db9804044 100644 --- a/Dataproc/VERSION +++ b/Dataproc/VERSION @@ -1 +1 @@ -0.5.1 \ No newline at end of file +0.5.3 \ No newline at end of file diff --git a/Dataproc/composer.json b/Dataproc/composer.json index 69829e208a77..53f5f9561ff6 100644 --- a/Dataproc/composer.json +++ b/Dataproc/composer.json @@ -18,7 +18,7 @@ } }, "require": { - "google/gax": "^0.34" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Debugger/VERSION b/Debugger/VERSION index aac2dacab4fe..e96a87111cbb 100644 --- a/Debugger/VERSION +++ b/Debugger/VERSION @@ -1 +1 @@ -0.12.1 \ No newline at end of file +0.12.2 \ No newline at end of file diff --git a/Debugger/composer.json b/Debugger/composer.json index e11566b38519..f919a801fff7 100644 --- a/Debugger/composer.json +++ b/Debugger/composer.json @@ -6,7 +6,7 @@ "require": { "google/cloud-core": "^1.4", "google/cloud-logging": "^1.4", - "google/gax": "^0.34", + "google/gax": "^0.36", "psr/log": "^1.0" }, "require-dev": { diff --git a/Debugger/src/DebuggerClient.php b/Debugger/src/DebuggerClient.php index 37fe09ed78c2..99128437faf6 100644 --- a/Debugger/src/DebuggerClient.php +++ b/Debugger/src/DebuggerClient.php @@ -39,7 +39,7 @@ class DebuggerClient { use ClientTrait; - const VERSION = '0.12.1'; + const VERSION = '0.12.2'; const FULL_CONTROL_SCOPE = 'https://www.googleapis.com/auth/cloud-platform'; const READ_ONLY_SCOPE = 'https://www.googleapis.com/auth/debugger.readonly'; diff --git a/Dialogflow/VERSION b/Dialogflow/VERSION index a2268e2de445..9fc80f937fab 100644 --- a/Dialogflow/VERSION +++ b/Dialogflow/VERSION @@ -1 +1 @@ -0.3.1 \ No newline at end of file +0.3.2 \ No newline at end of file diff --git a/Dialogflow/composer.json b/Dialogflow/composer.json index 090463ca0885..74cf812167c6 100644 --- a/Dialogflow/composer.json +++ b/Dialogflow/composer.json @@ -18,7 +18,7 @@ } }, "require": { - "google/gax": "^0.34" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Dlp/VERSION b/Dlp/VERSION index 142464bf22b4..a8839f70de05 100644 --- a/Dlp/VERSION +++ b/Dlp/VERSION @@ -1 +1 @@ -0.11.0 \ No newline at end of file +0.11.2 \ No newline at end of file diff --git a/Dlp/composer.json b/Dlp/composer.json index 9e8634021f4f..ce194391cee2 100644 --- a/Dlp/composer.json +++ b/Dlp/composer.json @@ -4,7 +4,7 @@ "license": "Apache-2.0", "minimum-stability": "stable", "require": { - "google/gax": "^0.34" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/ErrorReporting/VERSION b/ErrorReporting/VERSION index 027934ea1a1a..a8839f70de05 100644 --- a/ErrorReporting/VERSION +++ b/ErrorReporting/VERSION @@ -1 +1 @@ -0.11.1 \ No newline at end of file +0.11.2 \ No newline at end of file diff --git a/ErrorReporting/composer.json b/ErrorReporting/composer.json index d24f9b3ea9e0..fbe68ade5641 100644 --- a/ErrorReporting/composer.json +++ b/ErrorReporting/composer.json @@ -5,7 +5,7 @@ "minimum-stability": "stable", "require": { "google/cloud-logging": "^1.5.0", - "google/gax": "^0.34" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Firestore/VERSION b/Firestore/VERSION index a8839f70de05..d33c3a2128bc 100644 --- a/Firestore/VERSION +++ b/Firestore/VERSION @@ -1 +1 @@ -0.11.2 \ No newline at end of file +0.12.0 \ No newline at end of file diff --git a/Firestore/composer.json b/Firestore/composer.json index 35d697e5fa17..18afd79602e7 100644 --- a/Firestore/composer.json +++ b/Firestore/composer.json @@ -6,7 +6,7 @@ "require": { "ext-grpc": "*", "google/cloud-core": "^1.14", - "google/gax": "^0.34", + "google/gax": "^0.36", "ramsey/uuid": "~3" }, "require-dev": { diff --git a/Firestore/src/DocumentSnapshot.php b/Firestore/src/DocumentSnapshot.php index db1c56cefb6b..efcb165ccbd5 100644 --- a/Firestore/src/DocumentSnapshot.php +++ b/Firestore/src/DocumentSnapshot.php @@ -294,7 +294,10 @@ public function get($fieldPath) break; } else { if (!isset($fields[$part])) { - throw new \InvalidArgumentException('field path does not exist.'); + throw new \InvalidArgumentException(sprintf( + 'Field path `%s` does not exist.', + $fieldPath + )); } $fields = $fields[$part]; diff --git a/Firestore/src/FieldValue.php b/Firestore/src/FieldValue.php index 51bc6e8bd18e..fe83d4233a02 100644 --- a/Firestore/src/FieldValue.php +++ b/Firestore/src/FieldValue.php @@ -84,4 +84,19 @@ public static function serverTimestamp() { return '___google-cloud-php__serverTimestamp___'; } + + /** + * Check if the given value is a sentinel. + * + * @param string $value + * @return bool + * @access private + */ + public static function isSentinelValue($value) + { + return in_array($value, [ + self::deleteField(), + self::serverTimestamp() + ]); + } } diff --git a/Firestore/src/FirestoreClient.php b/Firestore/src/FirestoreClient.php index 679add71f252..c2f3b324a8fc 100644 --- a/Firestore/src/FirestoreClient.php +++ b/Firestore/src/FirestoreClient.php @@ -55,7 +55,7 @@ class FirestoreClient use SnapshotTrait; use ValidateTrait; - const VERSION = '0.11.2'; + const VERSION = '0.12.0'; const DEFAULT_DATABASE = '(default)'; diff --git a/Firestore/src/Query.php b/Firestore/src/Query.php index 9cb1f1f305ff..12db6740edc5 100644 --- a/Firestore/src/Query.php +++ b/Firestore/src/Query.php @@ -21,6 +21,7 @@ use Google\Cloud\Core\ExponentialBackoff; use Google\Cloud\Firestore\Connection\ConnectionInterface; use Google\Cloud\Firestore\DocumentSnapshot; +use Google\Cloud\Firestore\FieldValue; use Google\Cloud\Firestore\SnapshotTrait; use Google\Cloud\Firestore\V1beta1\StructuredQuery_CompositeFilter_Operator; use Google\Cloud\Firestore\V1beta1\StructuredQuery_Direction; @@ -126,7 +127,10 @@ public function __construct( $this->connection = $connection; $this->valueMapper = $valueMapper; $this->parent = $parent; - $this->query = $query; + $this->query = $query + [ + 'orderBy' => [], + 'offset' => 0 + ]; if (!isset($this->query['from'])) { throw new \InvalidArgumentException( @@ -156,14 +160,18 @@ public function __construct( */ public function documents(array $options = []) { - $maxRetries = $this->pluck('maxRetries', $options, false) ?: FirestoreClient::MAX_RETRIES; + $maxRetries = $this->pluck('maxRetries', $options, false); + $maxRetries = $maxRetries === null + ? FirestoreClient::MAX_RETRIES + : $maxRetries; $rows = (new ExponentialBackoff($maxRetries))->execute(function () use ($options) { - $generator = $this->connection->runQuery([ + $query = $this->finalQueryPrepare($this->query); + $generator = $this->connection->runQuery($this->arrayFilterRemoveNull([ 'parent' => $this->parent, - 'structuredQuery' => $this->query, + 'structuredQuery' => $query, 'retries' => 0 - ] + $options); + ]) + $options); // cache collection references $collections = []; @@ -212,6 +220,8 @@ public function documents(array $options = []) * list of field paths to return, or use an empty list to only return the * references of matching documents. * + * Subsequent calls to this method will override previous values. + * * Example: * ``` * $query = $query->select(['firstName']); @@ -241,7 +251,7 @@ public function select(array $fieldPaths) 'select' => [ 'fields' => $fields ] - ]); + ], true); } /** @@ -265,6 +275,13 @@ public function select(array $fieldPaths) */ public function where($fieldPath, $operator, $value) { + if (FieldValue::isSentinelValue($value)) { + throw new \InvalidArgumentException(sprintf( + 'Value cannot be a `%s` value.', + FieldValue::class + )); + } + $escapedFieldPath = $this->valueMapper->escapeFieldPath($fieldPath); $operator = array_key_exists($operator, $this->shortOperators) @@ -333,7 +350,7 @@ public function where($fieldPath, $operator, $value) * @param string $direction The direction to order in. **Defaults to** `ASC`. * @return Query A new instance of Query with the given changes applied. * @throws \InvalidArgumentException If an invalid direction is given. - * @throws \BadMethodCallException If orderBy is called after `startAt()`, + * @throws \InvalidArgumentException If orderBy is called after `startAt()`, * `startAfter()`, `endBefore()` or `endAt`(). */ public function orderBy($fieldPath, $direction = self::DIR_ASCENDING) @@ -350,7 +367,7 @@ public function orderBy($fieldPath, $direction = self::DIR_ASCENDING) } if ($this->queryHas('startAt') || $this->queryHas('endAt')) { - throw new \BadMethodCallException( + throw new \InvalidArgumentException( 'Cannot specify an orderBy constraint after calling any of ' . '`startAt()`, `startAfter()`, `endBefore()` or `endAt`().' ); @@ -428,14 +445,14 @@ public function offset($number) * $users18YearsOrOlder = $query->documents(); * ``` * - * @param array $fieldValues A list of values defining the query starting point. + * @param mixed[]|DocumentSnapshot $fieldValues A list of values, or an + * instance of {@see Google\Cloud\Firestore\DocumentSnapshot} + * defining the query starting point. * @return Query A new instance of Query with the given changes applied. */ - public function startAt(array $fieldValues) + public function startAt($fieldValues) { - return $this->newQuery([ - 'startAt' => $this->buildPosition($fieldValues, true) - ], true); + return $this->buildPosition('startAt', $fieldValues, true); } /** @@ -456,14 +473,14 @@ public function startAt(array $fieldValues) * $users18YearsOrOlder = $query->documents(); * ``` * - * @param array $fieldValues A list of values defining the query starting point. + * @param mixed[]|DocumentSnapshot $fieldValues A list of values, or an + * instance of {@see Google\Cloud\Firestore\DocumentSnapshot} + * defining the query starting point. * @return Query A new instance of Query with the given changes applied. */ - public function startAfter(array $fieldValues) + public function startAfter($fieldValues) { - return $this->newQuery([ - 'startAt' => $this->buildPosition($fieldValues, false) - ], true); + return $this->buildPosition('startAt', $fieldValues, false); } /** @@ -484,14 +501,14 @@ public function startAfter(array $fieldValues) * $usersYoungerThan18 = $query->documents(); * ``` * - * @param array $fieldValues A list of values defining the query end point. + * @param mixed[]|DocumentSnapshot $fieldValues A list of values, or an + * instance of {@see Google\Cloud\Firestore\DocumentSnapshot} + * defining the query end point. * @return Query A new instance of Query with the given changes applied. */ - public function endBefore(array $fieldValues) + public function endBefore($fieldValues) { - return $this->newQuery([ - 'endAt' => $this->buildPosition($fieldValues, true) - ], true); + return $this->buildPosition('endAt', $fieldValues, true); } /** @@ -512,93 +529,238 @@ public function endBefore(array $fieldValues) * $usersYoungerThan18 = $query->documents(); * ``` * - * @param array $fieldValues A list of values defining the query end point. + * @param mixed[]|DocumentSnapshot $fieldValues A list of values, or an + * instance of {@see Google\Cloud\Firestore\DocumentSnapshot} + * defining the query end point. * @return Query A new instance of Query with the given changes applied. */ - public function endAt(array $fieldValues) + public function endAt($fieldValues) { - return $this->newQuery([ - 'endAt' => $this->buildPosition($fieldValues, false) - ], true); + return $this->buildPosition('endAt', $fieldValues, false); + } + + /** + * Check if a given constraint type has been specified on the query. + * + * @param string $key The constraint name. + * @return bool + * @access private + */ + public function queryHas($key) + { + return isset($this->query[$key]); + } + + /** + * Get the constraint data from the current query. + * + * @param string $key The constraint name + * @return mixed + * @access private + */ + public function queryKey($key) + { + return $this->queryHas($key) + ? $this->query[$key] + : null; } /** * Builds a Firestore query position. * - * @param array $fieldValues The set of field values to use as the query boundary. + * @param string $key The query key. + * @param mixed[]|DocumentSnapshot $fieldValues An array of values, or an + * instance of {@see Google\Cloud\Firestore\DocumentSnapshot} + * to use as the query boundary. * @param bool $before Whether the query boundary lies just before or after * the provided data. * @return array */ - private function buildPosition(array $fieldValues, $before) + private function buildPosition($key, $fieldValues, $before) { - if (!$this->queryHas('orderBy') || count($fieldValues) > count($this->query['orderBy'])) { - throw new \BadMethodCallException( + $orderBy = $this->queryKey('orderBy') ?: []; + if ($fieldValues instanceof DocumentSnapshot) { + list($fieldValues, $orderBy) = $this->snapshotPosition($fieldValues, $orderBy); + } else { + if (!is_array($fieldValues)) { + throw new \InvalidArgumentException(sprintf( + 'Field values must be an array or an instance of `%s`.', + DocumentSnapshot::class + )); + } + + foreach ($fieldValues as $value) { + if ($value instanceof DocumentSnapshot) { + throw new \InvalidArgumentException(sprintf( + 'Instances of `%` are not allowed in an array of field values. ' . + 'Provide it as the method argument instead.', + DocumentSnapshot::class + )); + } + if (FieldValue::isSentinelValue($value)) { + throw new \InvalidArgumentException(sprintf( + 'Value cannot be a `%s` value.', + FieldValue::class + )); + } + } + } + + if (count($fieldValues) > count($orderBy)) { + throw new \InvalidArgumentException( 'Too many cursor values specified. The specified values must ' . 'match the `orderBy` constraints of the query.' ); } - $order = $this->query['orderBy']; foreach ($fieldValues as $i => &$value) { - if ($order[$i]['field']['fieldPath'] === self::DOCUMENT_ID) { + if ($orderBy[$i]['field']['fieldPath'] === self::DOCUMENT_ID) { $collection = $this->childPath( $this->parent, $this->query['from'][0]['collectionId'] ); if (is_string($value)) { - $c = new CollectionReference( + $parent = new CollectionReference( $this->connection, $this->valueMapper, $collection ); + $name = $this->childPath($collection, $value); $value = new DocumentReference( $this->connection, $this->valueMapper, - $c, - $this->childPath($collection, $value) + $parent, + $name ); - } elseif ($value instanceof DocumentReference) { - $name = $value->name(); + } else { + if ($value instanceof DocumentReference) { + $name = $value->name(); + $parent = $value->parent()->name(); + } else { + throw new \InvalidArgumentException( + 'The corresponding value for DOCUMENT_ID must be a ' . + 'string or a DocumentReference.' + ); + } + if (!$this->isPrefixOf($collection, $name)) { - throw new \BadMethodCallException(sprintf( + throw new \InvalidArgumentException(sprintf( '%s is not a part of the query result set and ' . 'cannot be used as a query boundary', $name )); } - } else { - throw new \BadMethodCallException( - 'The corresponding value for DOCUMENT_ID must be a ' . - 'string or a DocumentReference.' - ); + + if ($parent !== $collection) { + throw new \InvalidArgumentException( + 'Only direct children may be used as query boundaries.' + ); + } } + } + } - if ($value->parent()->name() !== $collection) { - throw new \BadMethodCallException( - 'Only direct children may be used as query boundaries.' - ); + return $this->newQuery([ + $key => [ + 'before' => $before, + 'values' => $this->valueMapper->encodeValues($fieldValues) + ], + 'orderBy' => $orderBy + ], true); + } + + /** + * Build cursors for document snapshots. + * + * @param DocumentSnapshot $snapshot The document snapshot + * @param array $orderBy A list of orderBy clauses. + * @return array A list, where position 0 is fieldValues and position 1 is orderBy. + */ + private function snapshotPosition(DocumentSnapshot $snapshot, array $orderBy) + { + $appendName = true; + foreach ($orderBy as $order) { + if ($order['field']['fieldPath'] === self::DOCUMENT_ID) { + $appendName = false; + break; + } + } + + if ($appendName) { + // If there is inequality filter (anything other than equals), + // append orderBy(the last inequality filter’s path, ascending). + if (!$orderBy && $this->queryHas('where')) { + $filters = $this->query['where']['compositeFilter']['filters']; + $inequality = array_filter($filters, function ($filter) { + $type = array_keys($filter)[0]; + return $filter[$type]['op'] !== self::OP_EQUAL; + }); + + if ($inequality) { + $filter = end($inequality); + $type = array_keys($filter)[0]; + $orderBy[] = [ + 'field' => [ + 'fieldPath' => $filter[$type]['field']['fieldPath'], + ], + 'direction' => self::DIR_ASCENDING + ]; } } + + // If the query has existing orderBy constraints + if ($orderBy) { + // Append orderBy(__name__, direction of last orderBy clause) + $lastOrderDirection = end($orderBy)['direction']; + $orderBy[] = [ + 'field' => [ + 'fieldPath' => self::DOCUMENT_ID + ], + 'direction' => $lastOrderDirection + ]; + } else { + // no existing orderBy constraints + // Otherwise append orderBy(__name__, ‘asc’) + $orderBy[] = [ + 'field' => [ + 'fieldPath' => self::DOCUMENT_ID + ], + 'direction' => self::DIR_ASCENDING + ]; + } } + $fieldValues = $this->snapshotCursorValues($snapshot, $orderBy); + return [ - 'before' => $before, - 'values' => $this->valueMapper->encodeValues($fieldValues) + $fieldValues, + $orderBy ]; } /** - * Check if a given constraint type has been specified on the query. + * Determine field values for Document Snapshot cursors. * - * @param string $key The constraint name. - * @return bool + * @param DocumentSnapshot $snapshot + * @param array $orderBy + * @return $fieldValues */ - private function queryHas($key) + private function snapshotCursorValues(DocumentSnapshot $snapshot, array $orderBy) { - return isset($this->query[$key]); + $fieldValues = []; + foreach ($orderBy as $order) { + $path = $order['field']['fieldPath']; + if ($path === self::DOCUMENT_ID) { + continue; + } + + $fieldValues[] = $snapshot->get($path); + } + + $fieldValues[] = $snapshot->reference(); + return $fieldValues; } /** @@ -629,4 +791,23 @@ private function newQuery(array $additionalConfig, $overrideTopLevelKeys = false $query ); } + + /** + * Clean up the query array before sending. + * + * Some optimizations cannot be performed ahead of time and must be done + * at execution. + * + * @param array $query The incoming query + * @return array The final query data + */ + private function finalQueryPrepare(array $query) + { + if (isset($query['where']['compositeFilter']) && count($query['where']['compositeFilter']['filters']) === 1) { + $filter = $query['where']['compositeFilter']['filters'][0]; + $query['where'] = $filter; + } + + return $query; + } } diff --git a/Firestore/src/ValueMapper.php b/Firestore/src/ValueMapper.php index 21b7a2c2d8f8..68aa95d41371 100644 --- a/Firestore/src/ValueMapper.php +++ b/Firestore/src/ValueMapper.php @@ -429,7 +429,7 @@ private function encodeObjectValue($value) return ['geoPointValue' => $value->point()]; } - if ($value instanceof DocumentReference) { + if ($value instanceof DocumentReference || $value instanceof DocumentSnapshot) { return ['referenceValue' => $value->name()]; } diff --git a/Firestore/tests/Snippet/QueryTest.php b/Firestore/tests/Snippet/QueryTest.php index 66f46ffbb6cb..8e77a56794d9 100644 --- a/Firestore/tests/Snippet/QueryTest.php +++ b/Firestore/tests/Snippet/QueryTest.php @@ -17,15 +17,16 @@ namespace Google\Cloud\Firestore\Tests\Snippet; -use Prophecy\Argument; -use Google\Cloud\Firestore\Query; +use Google\Cloud\Core\Testing\ArrayHasSameValuesToken; use Google\Cloud\Core\Testing\GrpcTestTrait; -use Google\Cloud\Firestore\ValueMapper; -use Google\Cloud\Firestore\QuerySnapshot; use Google\Cloud\Core\Testing\Snippet\Parser\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\Firestore\Connection\ConnectionInterface; +use Google\Cloud\Firestore\Query; +use Google\Cloud\Firestore\QuerySnapshot; use Google\Cloud\Firestore\V1beta1\StructuredQuery_CompositeFilter_Operator; +use Google\Cloud\Firestore\ValueMapper; +use Prophecy\Argument; /** * @group firestore @@ -86,20 +87,13 @@ public function testWhere() { $snippet = $this->snippetFromMethod(Query::class, 'where'); $this->runAndAssert($snippet, 'where', [ - 'compositeFilter' => [ - 'op' => StructuredQuery_CompositeFilter_Operator::PBAND, - 'filters' => [ - [ - 'fieldFilter' => [ - 'field' => [ - 'fieldPath' => 'firstName' - ], - 'op' => Query::OP_EQUAL, - 'value' => [ - 'stringValue' => 'John' - ] - ] - ] + 'fieldFilter' => [ + 'field' => [ + 'fieldPath' => 'firstName' + ], + 'op' => Query::OP_EQUAL, + 'value' => [ + 'stringValue' => 'John' ] ] ]); @@ -109,18 +103,11 @@ public function testWhereNaN() { $snippet = $this->snippetFromMethod(Query::class, 'where', 1); $this->runAndAssert($snippet, 'where', [ - 'compositeFilter' => [ - 'op' => StructuredQuery_CompositeFilter_Operator::PBAND, - 'filters' => [ - [ - 'unaryFilter' => [ - 'field' => [ - 'fieldPath' => 'coolnessPercentage' - ], - 'op' => Query::OP_NAN, - ] - ] - ] + 'unaryFilter' => [ + 'field' => [ + 'fieldPath' => 'coolnessPercentage' + ], + 'op' => Query::OP_NAN, ] ]); } @@ -196,18 +183,22 @@ private function runAndAssert(Snippet $snippet, $key, $argument) private function runAndAssertArray(Snippet $snippet, array $query) { - $this->connection->runQuery([ + $this->connection->runQuery(new ArrayHasSameValuesToken([ 'parent' => self::NAME, 'retries' => 0, 'structuredQuery' => array_filter([ 'from' => self::NAME, - ]) + $query - ])->shouldBeCalled()->willReturn(new \ArrayIterator([[]])); + ]) + $query + [ + 'offset' => 0, + 'orderBy' => [] + ] + ]))->shouldBeCalled()->willReturn(new \ArrayIterator([[]])); $this->query->___setProperty('connection', $this->connection->reveal()); $snippet->addLocal('query', $this->query); + $res = $snippet->invoke('query'); - $res->returnVal()->documents(['retries' => 0]); + $res->returnVal()->documents(['maxRetries' => 0]); $this->assertInstanceOf(Query::class, $res->returnVal()); } } diff --git a/Firestore/tests/System/QueryTest.php b/Firestore/tests/System/QueryTest.php index d223848b4ebd..2c783d49826b 100644 --- a/Firestore/tests/System/QueryTest.php +++ b/Firestore/tests/System/QueryTest.php @@ -17,6 +17,8 @@ namespace Google\Cloud\Firestore\Tests\System; +use Google\Cloud\Firestore\CollectionReference; + /** * @group firestore * @group firestore-query @@ -90,6 +92,31 @@ public function testWhereNan() $this->assertEquals($res->name(), $doc->name()); } + public function testSnapshotCursors() + { + $collection = self::$client->collection(uniqid(self::COLLECTION_NAME)); + self::$localDeletionQueue->add($collection); + + $refs = []; + for ($i = 0; $i <= 3; $i++) { + $doc = $collection->document($i); + $doc->create(['i' => $i]); + $refs[] = $doc; + } + + $q = $collection->startAt($refs[0]->snapshot()); + $this->assertCount(count($refs), iterator_to_array($q->documents())); + + $q = $collection->startAfter($refs[0]->snapshot()); + $this->assertCount(count($refs)-1, iterator_to_array($q->documents())); + + $q = $collection->endBefore(end($refs)->snapshot()); + $this->assertCount(count($refs)-1, iterator_to_array($q->documents())); + + $q = $collection->endAt(end($refs)->snapshot()); + $this->assertCount(count($refs), iterator_to_array($q->documents())); + } + private function insertDoc(array $fields) { $doc = $this->query->add($fields); diff --git a/Firestore/tests/Unit/QueryTest.php b/Firestore/tests/Unit/QueryTest.php index 95afb8cc73c3..62d4064483ce 100644 --- a/Firestore/tests/Unit/QueryTest.php +++ b/Firestore/tests/Unit/QueryTest.php @@ -17,6 +17,7 @@ namespace Google\Cloud\Firestore\Tests\Unit; +use Google\Cloud\Core\Testing\ArrayHasSameValuesToken; use Google\Cloud\Core\Timestamp; use Google\Cloud\Firestore\CollectionReference; use Google\Cloud\Firestore\Connection\ConnectionInterface; @@ -95,7 +96,7 @@ public function testDocuments() $this->query->___setProperty('connection', $this->connection->reveal()); - $res = $this->query->documents(); + $res = $this->query->documents(['maxRetries' => 0]); $this->assertContainsOnlyInstancesOf(DocumentSnapshot::class, $res); $this->assertCount(1, $res->rows()); @@ -145,7 +146,6 @@ public function testSelect() $this->runAndAssert(function (Query $q) use ($paths) { $res = $q->select($paths); - $res = $res->select(['users.dan']); return $res; }, [ @@ -156,6 +156,29 @@ public function testSelect() 'fields' => [ [ 'fieldPath' => 'users.john' ], [ 'fieldPath' => 'users.dave' ], + ] + ] + ] + ]); + } + + public function testSelectOverride() + { + $paths = [ + 'users.john', + 'users.dave' + ]; + + $this->runAndAssert(function (Query $q) use ($paths) { + $res = $q->select($paths); + $res = $res->select(['users.dan']); + return $res; + }, [ + 'parent' => self::PARENT, + 'structuredQuery' => [ + 'from' => $this->queryFrom(), + 'select' => [ + 'fields' => [ [ 'fieldPath' => 'users.dan' ], ] ] @@ -322,7 +345,7 @@ public function testOrderBy() } /** - * @expectedException BadMethodCallException + * @expectedException InvalidArgumentException * @dataProvider cursors */ public function testOrderByAfterCursor($cursor) @@ -590,8 +613,176 @@ public function testBuildPositionWithDocumentReference() ]); } + public function testPositionWithDocumentSnapshot() + { + $c = $this->prophesize(CollectionReference::class); + $c->name()->willReturn(self::PARENT .'/'. $this->queryFrom()[0]['collectionId']); + + $ref = $this->prophesize(DocumentReference::class); + $ref->name()->willReturn(self::PARENT .'/'. $this->queryFrom()[0]['collectionId'] .'/john'); + $ref->parent()->willReturn($c->reveal()); + + $snapshot = $this->prophesize(DocumentSnapshot::class); + $snapshot->name()->willReturn(self::PARENT .'/'. $this->queryFrom()[0]['collectionId'] .'/john'); + $snapshot->reference()->willReturn($ref->reveal()); + + $this->runAndAssert(function (Query $q) use ($snapshot) { + return $this->query->startAt($snapshot->reveal()); + }, [ + 'parent' => self::PARENT, + 'structuredQuery' => [ + 'from' => $this->queryFrom(), + 'orderBy' => [ + [ + 'field' => [ + 'fieldPath' => Query::DOCUMENT_ID + ], + 'direction' => Query::DIR_ASCENDING + ] + ], + 'startAt' => [ + 'before' => true, + 'values' => [ + [ + 'referenceValue' => self::PARENT .'/'. $this->queryFrom()[0]['collectionId'] .'/john' + ] + ] + ] + ] + ]); + } + /** - * @expectedException BadMethodCallException + * @expectedException InvalidArgumentException + */ + public function testSnapshotInFieldValue() + { + $snapshot = $this->prophesize(DocumentSnapshot::class); + $this->query->startAt([$snapshot->reveal()]); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testInvalidFieldValues() + { + $this->query->startAt('foo'); + } + + public function testPositionSnapshotOrderBy() + { + $c = $this->prophesize(CollectionReference::class); + $c->name()->willReturn(self::PARENT .'/'. $this->queryFrom()[0]['collectionId']); + + $ref = $this->prophesize(DocumentReference::class); + $ref->name()->willReturn(self::PARENT .'/'. $this->queryFrom()[0]['collectionId'] .'/john'); + $ref->parent()->willReturn($c->reveal()); + + $snapshot = $this->prophesize(DocumentSnapshot::class); + $snapshot->name()->willReturn(self::PARENT .'/'. $this->queryFrom()[0]['collectionId'] .'/john'); + $snapshot->reference()->willReturn($ref->reveal()); + $snapshot->get('a')->willReturn('b'); + $snapshot->get('c')->willReturn('d'); + + $this->runAndAssert(function (Query $q) use ($snapshot) { + $query = $this->query->orderBy('a')->orderBy('c'); + return $query->startAt($snapshot->reveal()); + }, [ + 'parent' => self::PARENT, + 'structuredQuery' => [ + 'from' => $this->queryFrom(), + 'orderBy' => [ + [ + 'field' => [ + 'fieldPath' => 'a' + ], + 'direction' => Query::DIR_ASCENDING + ], [ + 'field' => [ + 'fieldPath' => 'c' + ], + 'direction' => Query::DIR_ASCENDING + ], [ + 'field' => [ + 'fieldPath' => Query::DOCUMENT_ID + ], + 'direction' => Query::DIR_ASCENDING + ] + ], + 'startAt' => [ + 'before' => true, + 'values' => [ + ['stringValue' => 'b'], + ['stringValue' => 'd'], + [ + 'referenceValue' => self::PARENT .'/'. $this->queryFrom()[0]['collectionId'] .'/john' + ] + ] + ] + ] + ]); + } + + public function testPositionInequalityFilter() + { + $c = $this->prophesize(CollectionReference::class); + $c->name()->willReturn(self::PARENT .'/'. $this->queryFrom()[0]['collectionId']); + + $ref = $this->prophesize(DocumentReference::class); + $ref->name()->willReturn(self::PARENT .'/'. $this->queryFrom()[0]['collectionId'] .'/john'); + $ref->parent()->willReturn($c->reveal()); + + $snapshot = $this->prophesize(DocumentSnapshot::class); + $snapshot->name()->willReturn(self::PARENT .'/'. $this->queryFrom()[0]['collectionId'] .'/john'); + $snapshot->reference()->willReturn($ref->reveal()); + $snapshot->get('foo')->willReturn('bar'); + + $this->runAndAssert(function (Query $q) use ($snapshot) { + $query = $this->query->where('foo', '>', 'bar'); + return $query->startAt($snapshot->reveal()); + }, [ + 'parent' => self::PARENT, + 'structuredQuery' => [ + 'from' => $this->queryFrom(), + 'orderBy' => [ + [ + 'field' => [ + 'fieldPath' => 'foo' + ], + 'direction' => Query::DIR_ASCENDING + ], [ + 'field' => [ + 'fieldPath' => Query::DOCUMENT_ID + ], + 'direction' => Query::DIR_ASCENDING + ] + ], + 'startAt' => [ + 'before' => true, + 'values' => [ + [ + 'stringValue' => 'bar' + ], [ + 'referenceValue' => self::PARENT .'/'. $this->queryFrom()[0]['collectionId'] .'/john' + ] + ] + ], + "where" => [ + "fieldFilter" => [ + "field" => [ + "fieldPath" => "foo" + ], + "op" => 3, + "value" => [ + "stringValue" => "bar" + ] + ] + ] + ]]); + } + + /** + * @expectedException InvalidArgumentException */ public function testBuildPositionTooManyCursorValues() { @@ -599,17 +790,22 @@ public function testBuildPositionTooManyCursorValues() } /** - * @expectedException BadMethodCallException + * @expectedException InvalidArgumentException */ public function testBuildPositionOutOfBounds() { $ref = $this->prophesize(DocumentReference::class); $ref->name()->willReturn(self::PARENT .'/whatev/john'); + + $col = $this->prophesize(CollectionReference::class); + $col->name()->willReturn(self::PARENT .'/whatev/john'); + $ref->parent()->willReturn($col->reveal()); + $this->query->orderBy(Query::DOCUMENT_ID)->startAt([$ref->reveal()]); } /** - * @expectedException BadMethodCallException + * @expectedException InvalidArgumentException */ public function testBuildPositionInvalidCursorType() { @@ -617,7 +813,7 @@ public function testBuildPositionInvalidCursorType() } /** - * @expectedException BadMethodCallException + * @expectedException InvalidArgumentException */ public function testBuildPositionNestedChild() { @@ -634,8 +830,16 @@ public function testBuildPositionNestedChild() private function runAndAssert(callable $filters, $assertion) { if (is_array($assertion)) { - $this->connection->runQuery($assertion + ['retries' => 0]) - ->shouldBeCalledTimes(1)->willReturn(new \ArrayIterator([ + if (isset($assertion['structuredQuery'])) { + $assertion['structuredQuery'] = array_merge([ + 'orderBy' => [], + 'offset' => 0 + ], $assertion['structuredQuery']); + } + + $this->connection->runQuery( + new ArrayHasSameValuesToken($assertion + ['retries' => 0]) + )->shouldBeCalledTimes(1)->willReturn(new \ArrayIterator([ [] ])); } elseif (is_callable($assertion)) { @@ -650,7 +854,7 @@ private function runAndAssert(callable $filters, $assertion) $this->assertInstanceOf(Query::class, $query); $this->assertNotEquals($immutable, $query); - $query->documents(['maxRetries' => 0]); + iterator_to_array($query->documents(['maxRetries' => 0])); } private function queryFrom() diff --git a/Iot/VERSION b/Iot/VERSION index a2268e2de445..9fc80f937fab 100644 --- a/Iot/VERSION +++ b/Iot/VERSION @@ -1 +1 @@ -0.3.1 \ No newline at end of file +0.3.2 \ No newline at end of file diff --git a/Iot/composer.json b/Iot/composer.json index 25cc17aa9cd1..9ec22e3425fb 100644 --- a/Iot/composer.json +++ b/Iot/composer.json @@ -18,7 +18,7 @@ } }, "require": { - "google/gax": "^0.34" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Kms/README.md b/Kms/README.md index bec197abd2ee..2cb04df2dd85 100644 --- a/Kms/README.md +++ b/Kms/README.md @@ -41,7 +41,7 @@ require __DIR__ . '/vendor/autoload.php'; use Google\ApiCore\ApiException; use Google\Cloud\Kms\V1\CryptoKey; -use Google\Cloud\Kms\V1\CryptoKey_CryptoKeyPurpose; +use Google\Cloud\Kms\V1\CryptoKey\CryptoKeyPurpose; use Google\Cloud\Kms\V1\KeyManagementServiceClient; use Google\Cloud\Kms\V1\KeyRing; @@ -74,7 +74,7 @@ try { } catch (ApiException $e) { if ($e->getStatus() === 'NOT_FOUND') { $cryptoKey = new CryptoKey(); - $cryptoKey->setPurpose(CryptoKey_CryptoKeyPurpose::ENCRYPT_DECRYPT); + $cryptoKey->setPurpose(CryptoKeyPurpose::ENCRYPT_DECRYPT); $cryptoKey = $client->createCryptoKey($keyRingName, $keyId, $cryptoKey); } } diff --git a/Kms/VERSION b/Kms/VERSION index 6c6aa7cb0918..341cf11faf9a 100644 --- a/Kms/VERSION +++ b/Kms/VERSION @@ -1 +1 @@ -0.1.0 \ No newline at end of file +0.2.0 \ No newline at end of file diff --git a/Kms/composer.json b/Kms/composer.json index d7c348433406..c2c6fe0a0a2b 100644 --- a/Kms/composer.json +++ b/Kms/composer.json @@ -23,7 +23,7 @@ } }, "require": { - "google/gax": "^0.34.0" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Kms/src/V1/CreateCryptoKeyRequest.php b/Kms/src/V1/CreateCryptoKeyRequest.php index 57c5b58f04a4..dba0e4f5b360 100644 --- a/Kms/src/V1/CreateCryptoKeyRequest.php +++ b/Kms/src/V1/CreateCryptoKeyRequest.php @@ -36,9 +36,25 @@ class CreateCryptoKeyRequest extends \Google\Protobuf\Internal\Message */ private $crypto_key = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the + * [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + * @type string $crypto_key_id + * Required. It must be unique within a KeyRing and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + * @type \Google\Cloud\Kms\V1\CryptoKey $crypto_key + * A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/CreateCryptoKeyVersionRequest.php b/Kms/src/V1/CreateCryptoKeyVersionRequest.php index f356a10e92ea..65c9f949bf40 100644 --- a/Kms/src/V1/CreateCryptoKeyVersionRequest.php +++ b/Kms/src/V1/CreateCryptoKeyVersionRequest.php @@ -29,9 +29,22 @@ class CreateCryptoKeyVersionRequest extends \Google\Protobuf\Internal\Message */ private $crypto_key_version = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with + * the [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. + * @type \Google\Cloud\Kms\V1\CryptoKeyVersion $crypto_key_version + * A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/CreateKeyRingRequest.php b/Kms/src/V1/CreateKeyRingRequest.php index 5bfcef876e66..d839035cf3ff 100644 --- a/Kms/src/V1/CreateKeyRingRequest.php +++ b/Kms/src/V1/CreateKeyRingRequest.php @@ -36,9 +36,25 @@ class CreateKeyRingRequest extends \Google\Protobuf\Internal\Message */ private $key_ring = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the location associated with the + * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`. + * @type string $key_ring_id + * Required. It must be unique within a location and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + * @type \Google\Cloud\Kms\V1\KeyRing $key_ring + * A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/CryptoKey.php b/Kms/src/V1/CryptoKey.php index 5104214bcf2e..54fbcffd5522 100644 --- a/Kms/src/V1/CryptoKey.php +++ b/Kms/src/V1/CryptoKey.php @@ -69,9 +69,46 @@ class CryptoKey extends \Google\Protobuf\Internal\Message private $labels; protected $rotation_schedule; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name for this [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format + * `projects/*/locations/*/keyRings/*/cryptoKeys/*`. + * @type \Google\Cloud\Kms\V1\CryptoKeyVersion $primary + * Output only. A copy of the "primary" [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used + * by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this [CryptoKey][google.cloud.kms.v1.CryptoKey] is given + * in [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name]. + * The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be updated via + * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]. + * @type int $purpose + * The immutable purpose of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. Currently, the only acceptable + * purpose is [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time at which this [CryptoKey][google.cloud.kms.v1.CryptoKey] was created. + * @type \Google\Protobuf\Timestamp $next_rotation_time + * At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], the Key Management Service will automatically: + * 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. + * 2. Mark the new version as primary. + * Key rotations performed manually via + * [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] and + * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion] + * do not affect [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]. + * @type \Google\Protobuf\Duration $rotation_period + * [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] will be advanced by this period when the service + * automatically rotates a key. Must be at least one day. + * If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is set, [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] must also be set. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels with user-defined metadata. For more information, see + * [Labeling Keys](/kms/docs/labeling-keys). + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Resources::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/CryptoKey/CryptoKeyPurpose.php b/Kms/src/V1/CryptoKey/CryptoKeyPurpose.php new file mode 100644 index 000000000000..8ce5171b69a4 --- /dev/null +++ b/Kms/src/V1/CryptoKey/CryptoKeyPurpose.php @@ -0,0 +1,34 @@ +google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose + */ +class CryptoKeyPurpose +{ + /** + * Not specified. + * + * Generated from protobuf enum CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0; + */ + const CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0; + /** + * [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with + * [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and + * [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. + * + * Generated from protobuf enum ENCRYPT_DECRYPT = 1; + */ + const ENCRYPT_DECRYPT = 1; +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CryptoKeyPurpose::class, \Google\Cloud\Kms\V1\CryptoKey_CryptoKeyPurpose::class); + diff --git a/Kms/src/V1/CryptoKeyVersion.php b/Kms/src/V1/CryptoKeyVersion.php index 9af4c4a0feda..e7f2e5be02f9 100644 --- a/Kms/src/V1/CryptoKeyVersion.php +++ b/Kms/src/V1/CryptoKeyVersion.php @@ -59,9 +59,32 @@ class CryptoKeyVersion extends \Google\Protobuf\Internal\Message */ private $destroy_event_time = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name for this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format + * `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`. + * @type int $state + * The current state of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created. + * @type \Google\Protobuf\Timestamp $destroy_time + * Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is scheduled + * for destruction. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is + * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]. + * @type \Google\Protobuf\Timestamp $destroy_event_time + * Output only. The time this CryptoKeyVersion's key material was + * destroyed. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is + * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Resources::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/CryptoKeyVersion/CryptoKeyVersionState.php b/Kms/src/V1/CryptoKeyVersion/CryptoKeyVersionState.php new file mode 100644 index 000000000000..f572885cf2ab --- /dev/null +++ b/Kms/src/V1/CryptoKeyVersion/CryptoKeyVersionState.php @@ -0,0 +1,54 @@ +google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState + */ +class CryptoKeyVersionState +{ + /** + * Not specified. + * + * Generated from protobuf enum CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0; + */ + const CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0; + /** + * This version may be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and + * [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt] requests. + * + * Generated from protobuf enum ENABLED = 1; + */ + const ENABLED = 1; + /** + * This version may not be used, but the key material is still available, + * and the version can be placed back into the [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] state. + * + * Generated from protobuf enum DISABLED = 2; + */ + const DISABLED = 2; + /** + * This version is destroyed, and the key material is no longer stored. + * A version may not leave this state once entered. + * + * Generated from protobuf enum DESTROYED = 3; + */ + const DESTROYED = 3; + /** + * This version is scheduled for destruction, and will be destroyed soon. + * Call + * [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] + * to put it back into the [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] state. + * + * Generated from protobuf enum DESTROY_SCHEDULED = 4; + */ + const DESTROY_SCHEDULED = 4; +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CryptoKeyVersionState::class, \Google\Cloud\Kms\V1\CryptoKeyVersion_CryptoKeyVersionState::class); + diff --git a/Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php b/Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php index 762544b828e4..1cd489fcf69a 100644 --- a/Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php +++ b/Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php @@ -4,48 +4,13 @@ namespace Google\Cloud\Kms\V1; -/** - * The state of a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating if it can be used. - * - * Protobuf enum Google\Cloud\Kms\V1\CryptoKeyVersion\CryptoKeyVersionState - */ -class CryptoKeyVersion_CryptoKeyVersionState -{ +if (false) { /** - * Not specified. - * - * Generated from protobuf enum CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0; + * This class is deprecated. Use Google\Cloud\Kms\V1\CryptoKeyVersion\CryptoKeyVersionState instead. + * @deprecated */ - const CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0; - /** - * This version may be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and - * [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt] requests. - * - * Generated from protobuf enum ENABLED = 1; - */ - const ENABLED = 1; - /** - * This version may not be used, but the key material is still available, - * and the version can be placed back into the [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] state. - * - * Generated from protobuf enum DISABLED = 2; - */ - const DISABLED = 2; - /** - * This version is destroyed, and the key material is no longer stored. - * A version may not leave this state once entered. - * - * Generated from protobuf enum DESTROYED = 3; - */ - const DESTROYED = 3; - /** - * This version is scheduled for destruction, and will be destroyed soon. - * Call - * [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] - * to put it back into the [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] state. - * - * Generated from protobuf enum DESTROY_SCHEDULED = 4; - */ - const DESTROY_SCHEDULED = 4; + class CryptoKeyVersion_CryptoKeyVersionState {} } +class_exists(CryptoKeyVersion\CryptoKeyVersionState::class); +@trigger_error('Google\Cloud\Kms\V1\CryptoKeyVersion_CryptoKeyVersionState is deprecated and will be removed in a future release. Use Google\Cloud\Kms\V1\CryptoKeyVersion\CryptoKeyVersionState instead', E_USER_DEPRECATED); diff --git a/Kms/src/V1/CryptoKey_CryptoKeyPurpose.php b/Kms/src/V1/CryptoKey_CryptoKeyPurpose.php index 40bfd2567a41..7c6f9388bd95 100644 --- a/Kms/src/V1/CryptoKey_CryptoKeyPurpose.php +++ b/Kms/src/V1/CryptoKey_CryptoKeyPurpose.php @@ -4,28 +4,13 @@ namespace Google\Cloud\Kms\V1; -/** - * [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose] describes the capabilities of a [CryptoKey][google.cloud.kms.v1.CryptoKey]. Two - * keys with the same purpose may use different underlying algorithms, but - * must support the same set of operations. - * - * Protobuf enum Google\Cloud\Kms\V1\CryptoKey\CryptoKeyPurpose - */ -class CryptoKey_CryptoKeyPurpose -{ +if (false) { /** - * Not specified. - * - * Generated from protobuf enum CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0; + * This class is deprecated. Use Google\Cloud\Kms\V1\CryptoKey\CryptoKeyPurpose instead. + * @deprecated */ - const CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0; - /** - * [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with - * [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and - * [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. - * - * Generated from protobuf enum ENCRYPT_DECRYPT = 1; - */ - const ENCRYPT_DECRYPT = 1; + class CryptoKey_CryptoKeyPurpose {} } +class_exists(CryptoKey\CryptoKeyPurpose::class); +@trigger_error('Google\Cloud\Kms\V1\CryptoKey_CryptoKeyPurpose is deprecated and will be removed in a future release. Use Google\Cloud\Kms\V1\CryptoKey\CryptoKeyPurpose instead', E_USER_DEPRECATED); diff --git a/Kms/src/V1/DecryptRequest.php b/Kms/src/V1/DecryptRequest.php index 917f2e2e5f78..d3caf54f7139 100644 --- a/Kms/src/V1/DecryptRequest.php +++ b/Kms/src/V1/DecryptRequest.php @@ -37,9 +37,26 @@ class DecryptRequest extends \Google\Protobuf\Internal\Message */ private $additional_authenticated_data = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. + * The server will choose the appropriate version. + * @type string $ciphertext + * Required. The encrypted data originally returned in + * [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]. + * @type string $additional_authenticated_data + * Optional data that must match the data originally supplied in + * [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/DecryptResponse.php b/Kms/src/V1/DecryptResponse.php index 86e69c7a7fc3..edf43b0a3ddf 100644 --- a/Kms/src/V1/DecryptResponse.php +++ b/Kms/src/V1/DecryptResponse.php @@ -22,9 +22,19 @@ class DecryptResponse extends \Google\Protobuf\Internal\Message */ private $plaintext = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $plaintext + * The decrypted data originally supplied in [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/DestroyCryptoKeyVersionRequest.php b/Kms/src/V1/DestroyCryptoKeyVersionRequest.php index 6f3605f37794..7a651102b01b 100644 --- a/Kms/src/V1/DestroyCryptoKeyVersionRequest.php +++ b/Kms/src/V1/DestroyCryptoKeyVersionRequest.php @@ -22,9 +22,19 @@ class DestroyCryptoKeyVersionRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/EncryptRequest.php b/Kms/src/V1/EncryptRequest.php index ef98e7a893ff..418dda7e5a05 100644 --- a/Kms/src/V1/EncryptRequest.php +++ b/Kms/src/V1/EncryptRequest.php @@ -39,9 +39,28 @@ class EncryptRequest extends \Google\Protobuf\Internal\Message */ private $additional_authenticated_data = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + * to use for encryption. + * If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its + * [primary version][google.cloud.kms.v1.CryptoKey.primary]. + * @type string $plaintext + * Required. The data to encrypt. Must be no larger than 64KiB. + * @type string $additional_authenticated_data + * Optional data that, if specified, must also be provided during decryption + * through [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]. Must be no + * larger than 64KiB. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/EncryptResponse.php b/Kms/src/V1/EncryptResponse.php index 1d2ff07b1b40..1f32fae72eb7 100644 --- a/Kms/src/V1/EncryptResponse.php +++ b/Kms/src/V1/EncryptResponse.php @@ -28,9 +28,21 @@ class EncryptResponse extends \Google\Protobuf\Internal\Message */ private $ciphertext = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in encryption. + * @type string $ciphertext + * The encrypted data. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php b/Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php index 8bf154babec2..3bffba8a6fef 100644 --- a/Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php +++ b/Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php @@ -32,6 +32,7 @@ use Google\ApiCore\FetchAuthTokenInterface; use Google\ApiCore\GapicClientTrait; use Google\ApiCore\PathTemplate; +use Google\ApiCore\RequestParamsHeaderDescriptor; use Google\ApiCore\RetrySettings; use Google\ApiCore\Transport\TransportInterface; use Google\ApiCore\ValidationException; @@ -495,6 +496,13 @@ public function listKeyRings($parent, array $optionalArgs = []) $request->setPageToken($optionalArgs['pageToken']); } + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( 'ListKeyRings', $optionalArgs, @@ -566,6 +574,13 @@ public function listCryptoKeys($parent, array $optionalArgs = []) $request->setPageToken($optionalArgs['pageToken']); } + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( 'ListCryptoKeys', $optionalArgs, @@ -637,6 +652,13 @@ public function listCryptoKeyVersions($parent, array $optionalArgs = []) $request->setPageToken($optionalArgs['pageToken']); } + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( 'ListCryptoKeyVersions', $optionalArgs, @@ -680,6 +702,13 @@ public function getKeyRing($name, array $optionalArgs = []) $request = new GetKeyRingRequest(); $request->setName($name); + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'GetKeyRing', KeyRing::class, @@ -724,6 +753,13 @@ public function getCryptoKey($name, array $optionalArgs = []) $request = new GetCryptoKeyRequest(); $request->setName($name); + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'GetCryptoKey', CryptoKey::class, @@ -767,6 +803,13 @@ public function getCryptoKeyVersion($name, array $optionalArgs = []) $request = new GetCryptoKeyVersionRequest(); $request->setName($name); + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'GetCryptoKeyVersion', CryptoKeyVersion::class, @@ -818,6 +861,13 @@ public function createKeyRing($parent, $keyRingId, $keyRing, array $optionalArgs $request->setKeyRingId($keyRingId); $request->setKeyRing($keyRing); + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'CreateKeyRing', KeyRing::class, @@ -837,7 +887,7 @@ public function createKeyRing($parent, $keyRingId, $keyRing, array $optionalArgs * try { * $formattedParent = $keyManagementServiceClient->keyRingName('[PROJECT]', '[LOCATION]', '[KEY_RING]'); * $cryptoKeyId = 'my-app-key'; - * $purpose = CryptoKey_CryptoKeyPurpose::ENCRYPT_DECRYPT; + * $purpose = CryptoKeyPurpose::ENCRYPT_DECRYPT; * $seconds = 2147483647; * $nextRotationTime = new Timestamp(); * $nextRotationTime->setSeconds($seconds); @@ -881,6 +931,13 @@ public function createCryptoKey($parent, $cryptoKeyId, $cryptoKey, array $option $request->setCryptoKeyId($cryptoKeyId); $request->setCryptoKey($cryptoKey); + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'CreateCryptoKey', CryptoKey::class, @@ -932,6 +989,13 @@ public function createCryptoKeyVersion($parent, $cryptoKeyVersion, array $option $request->setParent($parent); $request->setCryptoKeyVersion($cryptoKeyVersion); + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'CreateCryptoKeyVersion', CryptoKeyVersion::class, @@ -978,6 +1042,13 @@ public function updateCryptoKey($cryptoKey, $updateMask, array $optionalArgs = [ $request->setCryptoKey($cryptoKey); $request->setUpdateMask($updateMask); + $requestParams = new RequestParamsHeaderDescriptor([ + 'crypto_key.name' => $request->getCryptoKey()->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'UpdateCryptoKey', CryptoKey::class, @@ -1030,6 +1101,13 @@ public function updateCryptoKeyVersion($cryptoKeyVersion, $updateMask, array $op $request->setCryptoKeyVersion($cryptoKeyVersion); $request->setUpdateMask($updateMask); + $requestParams = new RequestParamsHeaderDescriptor([ + 'crypto_key_version.name' => $request->getCryptoKeyVersion()->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'UpdateCryptoKeyVersion', CryptoKeyVersion::class, @@ -1087,6 +1165,13 @@ public function encrypt($name, $plaintext, array $optionalArgs = []) $request->setAdditionalAuthenticatedData($optionalArgs['additionalAuthenticatedData']); } + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'Encrypt', EncryptResponse::class, @@ -1141,6 +1226,13 @@ public function decrypt($name, $ciphertext, array $optionalArgs = []) $request->setAdditionalAuthenticatedData($optionalArgs['additionalAuthenticatedData']); } + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'Decrypt', DecryptResponse::class, @@ -1187,6 +1279,13 @@ public function updateCryptoKeyPrimaryVersion($name, $cryptoKeyVersionId, array $request->setName($name); $request->setCryptoKeyVersionId($cryptoKeyVersionId); + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'UpdateCryptoKeyPrimaryVersion', CryptoKey::class, @@ -1241,6 +1340,13 @@ public function destroyCryptoKeyVersion($name, array $optionalArgs = []) $request = new DestroyCryptoKeyVersionRequest(); $request->setName($name); + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'DestroyCryptoKeyVersion', CryptoKeyVersion::class, @@ -1290,6 +1396,13 @@ public function restoreCryptoKeyVersion($name, array $optionalArgs = []) $request = new RestoreCryptoKeyVersionRequest(); $request->setName($name); + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'RestoreCryptoKeyVersion', CryptoKeyVersion::class, @@ -1342,6 +1455,13 @@ public function setIamPolicy($resource, $policy, array $optionalArgs = []) $request->setResource($resource); $request->setPolicy($policy); + $requestParams = new RequestParamsHeaderDescriptor([ + 'resource' => $request->getResource(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'SetIamPolicy', Policy::class, @@ -1391,6 +1511,13 @@ public function getIamPolicy($resource, array $optionalArgs = []) $request = new GetIamPolicyRequest(); $request->setResource($resource); + $requestParams = new RequestParamsHeaderDescriptor([ + 'resource' => $request->getResource(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'GetIamPolicy', Policy::class, @@ -1446,6 +1573,13 @@ public function testIamPermissions($resource, $permissions, array $optionalArgs $request->setResource($resource); $request->setPermissions($permissions); + $requestParams = new RequestParamsHeaderDescriptor([ + 'resource' => $request->getResource(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'TestIamPermissions', TestIamPermissionsResponse::class, diff --git a/Kms/src/V1/GetCryptoKeyRequest.php b/Kms/src/V1/GetCryptoKeyRequest.php index f0fcf26ff4d1..34f76b73eb9e 100644 --- a/Kms/src/V1/GetCryptoKeyRequest.php +++ b/Kms/src/V1/GetCryptoKeyRequest.php @@ -22,9 +22,19 @@ class GetCryptoKeyRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/GetCryptoKeyVersionRequest.php b/Kms/src/V1/GetCryptoKeyVersionRequest.php index 3a2aa7f71fc3..76c7d48fcf72 100644 --- a/Kms/src/V1/GetCryptoKeyVersionRequest.php +++ b/Kms/src/V1/GetCryptoKeyVersionRequest.php @@ -22,9 +22,19 @@ class GetCryptoKeyVersionRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/GetKeyRingRequest.php b/Kms/src/V1/GetKeyRingRequest.php index b1e5c3aa8fcb..7374fee9a4c1 100644 --- a/Kms/src/V1/GetKeyRingRequest.php +++ b/Kms/src/V1/GetKeyRingRequest.php @@ -22,9 +22,19 @@ class GetKeyRingRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/KeyRing.php b/Kms/src/V1/KeyRing.php index 2d43d5990fca..a9619f7f0c01 100644 --- a/Kms/src/V1/KeyRing.php +++ b/Kms/src/V1/KeyRing.php @@ -29,9 +29,22 @@ class KeyRing extends \Google\Protobuf\Internal\Message */ private $create_time = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name for the [KeyRing][google.cloud.kms.v1.KeyRing] in the format + * `projects/*/locations/*/keyRings/*`. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] was created. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Resources::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/ListCryptoKeyVersionsRequest.php b/Kms/src/V1/ListCryptoKeyVersionsRequest.php index e49c1f37e030..e85246fb7a4b 100644 --- a/Kms/src/V1/ListCryptoKeyVersionsRequest.php +++ b/Kms/src/V1/ListCryptoKeyVersionsRequest.php @@ -40,9 +40,29 @@ class ListCryptoKeyVersionsRequest extends \Google\Protobuf\Internal\Message */ private $page_token = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format + * `projects/*/locations/*/keyRings/*/cryptoKeys/*`. + * @type int $page_size + * Optional limit on the number of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to + * include in the response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can + * subsequently be obtained by including the + * [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token] in a subsequent request. + * If unspecified, the server will pick an appropriate default. + * @type string $page_token + * Optional pagination token, returned earlier via + * [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/ListCryptoKeyVersionsResponse.php b/Kms/src/V1/ListCryptoKeyVersionsResponse.php index a0f7e5a7f80f..5ecefbcbde61 100644 --- a/Kms/src/V1/ListCryptoKeyVersionsResponse.php +++ b/Kms/src/V1/ListCryptoKeyVersionsResponse.php @@ -37,9 +37,26 @@ class ListCryptoKeyVersionsResponse extends \Google\Protobuf\Internal\Message */ private $total_size = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Kms\V1\CryptoKeyVersion[]|\Google\Protobuf\Internal\RepeatedField $crypto_key_versions + * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. + * @type string $next_page_token + * A token to retrieve next page of results. Pass this value in + * [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token] to retrieve the next page of + * results. + * @type int $total_size + * The total number of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the + * query. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/ListCryptoKeysRequest.php b/Kms/src/V1/ListCryptoKeysRequest.php index 5113689092ba..11da90ea1f52 100644 --- a/Kms/src/V1/ListCryptoKeysRequest.php +++ b/Kms/src/V1/ListCryptoKeysRequest.php @@ -39,9 +39,28 @@ class ListCryptoKeysRequest extends \Google\Protobuf\Internal\Message */ private $page_token = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format + * `projects/*/locations/*/keyRings/*`. + * @type int $page_size + * Optional limit on the number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the + * response. Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be obtained by + * including the [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token] in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @type string $page_token + * Optional pagination token, returned earlier via + * [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/ListCryptoKeysResponse.php b/Kms/src/V1/ListCryptoKeysResponse.php index 2ebab46334c0..4fe6b561323c 100644 --- a/Kms/src/V1/ListCryptoKeysResponse.php +++ b/Kms/src/V1/ListCryptoKeysResponse.php @@ -35,9 +35,24 @@ class ListCryptoKeysResponse extends \Google\Protobuf\Internal\Message */ private $total_size = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Kms\V1\CryptoKey[]|\Google\Protobuf\Internal\RepeatedField $crypto_keys + * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + * @type string $next_page_token + * A token to retrieve next page of results. Pass this value in + * [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token] to retrieve the next page of results. + * @type int $total_size + * The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that matched the query. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/ListKeyRingsRequest.php b/Kms/src/V1/ListKeyRingsRequest.php index 24fc95d30219..956e2dc0c13e 100644 --- a/Kms/src/V1/ListKeyRingsRequest.php +++ b/Kms/src/V1/ListKeyRingsRequest.php @@ -39,9 +39,28 @@ class ListKeyRingsRequest extends \Google\Protobuf\Internal\Message */ private $page_token = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the location associated with the + * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`. + * @type int $page_size + * Optional limit on the number of [KeyRings][google.cloud.kms.v1.KeyRing] to include in the + * response. Further [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by + * including the [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token] in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @type string $page_token + * Optional pagination token, returned earlier via + * [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/ListKeyRingsResponse.php b/Kms/src/V1/ListKeyRingsResponse.php index 1cf9add01122..fc052f41ba63 100644 --- a/Kms/src/V1/ListKeyRingsResponse.php +++ b/Kms/src/V1/ListKeyRingsResponse.php @@ -35,9 +35,24 @@ class ListKeyRingsResponse extends \Google\Protobuf\Internal\Message */ private $total_size = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Kms\V1\KeyRing[]|\Google\Protobuf\Internal\RepeatedField $key_rings + * The list of [KeyRings][google.cloud.kms.v1.KeyRing]. + * @type string $next_page_token + * A token to retrieve next page of results. Pass this value in + * [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token] to retrieve the next page of results. + * @type int $total_size + * The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched the query. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/README.md b/Kms/src/V1/README.md index 17d08bfb3032..97dc2073162d 100644 --- a/Kms/src/V1/README.md +++ b/Kms/src/V1/README.md @@ -7,7 +7,7 @@ require __DIR__ . '/vendor/autoload.php'; use Google\ApiCore\ApiException; use Google\Cloud\Kms\V1\CryptoKey; -use Google\Cloud\Kms\V1\CryptoKey_CryptoKeyPurpose; +use Google\Cloud\Kms\V1\CryptoKey\CryptoKeyPurpose; use Google\Cloud\Kms\V1\KeyManagementServiceClient; use Google\Cloud\Kms\V1\KeyRing; @@ -40,7 +40,7 @@ try { } catch (ApiException $e) { if ($e->getStatus() === 'NOT_FOUND') { $cryptoKey = new CryptoKey(); - $cryptoKey->setPurpose(CryptoKey_CryptoKeyPurpose::ENCRYPT_DECRYPT); + $cryptoKey->setPurpose(CryptoKeyPurpose::ENCRYPT_DECRYPT); $cryptoKey = $client->createCryptoKey($keyRingName, $keyId, $cryptoKey); } } diff --git a/Kms/src/V1/RestoreCryptoKeyVersionRequest.php b/Kms/src/V1/RestoreCryptoKeyVersionRequest.php index 19addd9a95f5..0f52336c85ae 100644 --- a/Kms/src/V1/RestoreCryptoKeyVersionRequest.php +++ b/Kms/src/V1/RestoreCryptoKeyVersionRequest.php @@ -22,9 +22,19 @@ class RestoreCryptoKeyVersionRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/UpdateCryptoKeyPrimaryVersionRequest.php b/Kms/src/V1/UpdateCryptoKeyPrimaryVersionRequest.php index 573dbed536df..b21c2727f4ec 100644 --- a/Kms/src/V1/UpdateCryptoKeyPrimaryVersionRequest.php +++ b/Kms/src/V1/UpdateCryptoKeyPrimaryVersionRequest.php @@ -28,9 +28,21 @@ class UpdateCryptoKeyPrimaryVersionRequest extends \Google\Protobuf\Internal\Mes */ private $crypto_key_version_id = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update. + * @type string $crypto_key_version_id + * The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/UpdateCryptoKeyRequest.php b/Kms/src/V1/UpdateCryptoKeyRequest.php index fe6ca2a2bd03..2fd1140d14b2 100644 --- a/Kms/src/V1/UpdateCryptoKeyRequest.php +++ b/Kms/src/V1/UpdateCryptoKeyRequest.php @@ -28,9 +28,21 @@ class UpdateCryptoKeyRequest extends \Google\Protobuf\Internal\Message */ private $update_mask = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Kms\V1\CryptoKey $crypto_key + * [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values. + * @type \Google\Protobuf\FieldMask $update_mask + * Required list of fields to be updated in this request. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/UpdateCryptoKeyVersionRequest.php b/Kms/src/V1/UpdateCryptoKeyVersionRequest.php index 6f5fc3d80c53..df0b11cae709 100644 --- a/Kms/src/V1/UpdateCryptoKeyVersionRequest.php +++ b/Kms/src/V1/UpdateCryptoKeyVersionRequest.php @@ -28,9 +28,21 @@ class UpdateCryptoKeyVersionRequest extends \Google\Protobuf\Internal\Message */ private $update_mask = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Kms\V1\CryptoKeyVersion $crypto_key_version + * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values. + * @type \Google\Protobuf\FieldMask $update_mask + * Required list of fields to be updated in this request. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/synth.py b/Kms/synth.py index 6a5331b498ad..6e5b024ffb97 100644 --- a/Kms/synth.py +++ b/Kms/synth.py @@ -43,3 +43,15 @@ 'tests/**/V1/*Test.php', r'Copyright \d{4}', r'Copyright 2018') + +# Use new namespace in the doc sample. See +# https://github.com/googleapis/gapic-generator/issues/2141 +s.replace( + 'src/V1/Gapic/KeyManagementServiceGapicClient.php', + r'CryptoKey_CryptoKeyPurpose', + 'CryptoKeyPurpose') +# Change the wording for the deprecation warning. +s.replace( + 'src/V1/CryptoKey*_*.php', + r'will be removed in the next major release', + 'will be removed in a future release') diff --git a/Language/VERSION b/Language/VERSION index 8076af51c002..a12760eb1717 100644 --- a/Language/VERSION +++ b/Language/VERSION @@ -1 +1 @@ -0.15.1 \ No newline at end of file +0.15.2 \ No newline at end of file diff --git a/Language/composer.json b/Language/composer.json index b86a704d7008..16e3942e521a 100644 --- a/Language/composer.json +++ b/Language/composer.json @@ -5,7 +5,7 @@ "minimum-stability": "stable", "require": { "google/cloud-core": "^1.14", - "google/gax": "^0.34" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Language/src/LanguageClient.php b/Language/src/LanguageClient.php index 745d27f51a9b..c514155efadb 100644 --- a/Language/src/LanguageClient.php +++ b/Language/src/LanguageClient.php @@ -44,7 +44,7 @@ class LanguageClient use ClientTrait; use RetryDeciderTrait; - const VERSION = '0.15.1'; + const VERSION = '0.15.2'; const FULL_CONTROL_SCOPE = 'https://www.googleapis.com/auth/cloud-platform'; diff --git a/Logging/VERSION b/Logging/VERSION index c56eaaaf456f..91b0acb51aab 100644 --- a/Logging/VERSION +++ b/Logging/VERSION @@ -1 +1 @@ -1.12.3 \ No newline at end of file +1.12.5 \ No newline at end of file diff --git a/Logging/composer.json b/Logging/composer.json index d2e0c511258a..15d623a5c001 100644 --- a/Logging/composer.json +++ b/Logging/composer.json @@ -5,7 +5,7 @@ "minimum-stability": "stable", "require": { "google/cloud-core": "^1.14", - "google/gax": "^0.34" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Logging/src/LoggingClient.php b/Logging/src/LoggingClient.php index 835dd34adc64..90f0f35188e8 100644 --- a/Logging/src/LoggingClient.php +++ b/Logging/src/LoggingClient.php @@ -70,7 +70,7 @@ class LoggingClient use ArrayTrait; use ClientTrait; - const VERSION = '1.12.3'; + const VERSION = '1.12.5'; const FULL_CONTROL_SCOPE = 'https://www.googleapis.com/auth/logging.admin'; const READ_ONLY_SCOPE = 'https://www.googleapis.com/auth/logging.read'; diff --git a/Logging/src/PsrLogger.php b/Logging/src/PsrLogger.php index 863dd2bd2fab..57fc758ba894 100644 --- a/Logging/src/PsrLogger.php +++ b/Logging/src/PsrLogger.php @@ -364,7 +364,8 @@ public function log($level, $message, array $context = []) $this->validateLogLevel($level); $options = []; - if (isset($context['exception']) && $context['exception'] instanceof \Exception) { + if (isset($context['exception']) + && ($context['exception'] instanceof \Exception || $context['exception'] instanceof \Throwable)) { $context['exception'] = (string) $context['exception']; } @@ -383,7 +384,7 @@ public function log($level, $message, array $context = []) // Adding labels for log request correlation. $labels = $this->getLabels(); - if (! empty($labels)) { + if (!empty($labels)) { $options['labels'] = (isset($options['labels']) ? $options['labels'] @@ -397,7 +398,7 @@ public function log($level, $message, array $context = []) } // Adding MonitoredResource $resource = $this->metadataProvider->monitoredResource(); - if (! empty($resource)) { + if (!empty($resource)) { $options['resource'] = (isset($options['resource']) ? $options['resource'] diff --git a/Logging/tests/Unit/PsrLoggerTest.php b/Logging/tests/Unit/PsrLoggerTest.php index db936e3a9144..96ce32db38b1 100644 --- a/Logging/tests/Unit/PsrLoggerTest.php +++ b/Logging/tests/Unit/PsrLoggerTest.php @@ -187,28 +187,16 @@ public function testLogThrowsExceptionWithInvalidLevel() public function testLogAppendsExceptionWhenPassedThroughAsContext() { - $exception = new \Exception('test'); - $this->connection->writeEntries([ - 'entries' => [ - [ - 'severity' => $this->severity, - 'jsonPayload' => [ - 'message' => $this->textPayload, - 'exception' => (string) $exception - ], - 'logName' => $this->formattedName, - 'resource' => $this->resource, - 'timestamp' => null - ] - ] - ]) - ->willReturn([]) - ->shouldBeCalledTimes(1); - $psrLogger = $this->getPsrLogger($this->connection); - $psrLogger->log($this->severity, $this->textPayload, [ - 'exception' => $exception, - 'stackdriverOptions' => ['timestamp' => null] - ]); + $this->expectLogWithExceptionInContext(new \Exception('test')); + } + + public function testLogAppendsThrowableWhenPassedThroughAsContext() + { + if (!is_subclass_of('Error', 'Throwable')) { + $this->markTestSkipped('This test requires PHP 7+'); + } + + $this->expectLogWithExceptionInContext(new \Error('test')); } public function testUsesCustomMessageKey() @@ -292,4 +280,29 @@ public function testSerializesCorrectly() $this->logName ); } + + private function expectLogWithExceptionInContext($throwable) + { + $this->connection->writeEntries([ + 'entries' => [ + [ + 'severity' => $this->severity, + 'jsonPayload' => [ + 'message' => $this->textPayload, + 'exception' => (string) $throwable + ], + 'logName' => $this->formattedName, + 'resource' => $this->resource, + 'timestamp' => null + ] + ] + ]) + ->willReturn([]) + ->shouldBeCalledTimes(1); + $psrLogger = $this->getPsrLogger($this->connection); + $psrLogger->log($this->severity, $this->textPayload, [ + 'exception' => $throwable, + 'stackdriverOptions' => ['timestamp' => null] + ]); + } } diff --git a/Monitoring/VERSION b/Monitoring/VERSION index 027934ea1a1a..a8839f70de05 100644 --- a/Monitoring/VERSION +++ b/Monitoring/VERSION @@ -1 +1 @@ -0.11.1 \ No newline at end of file +0.11.2 \ No newline at end of file diff --git a/Monitoring/composer.json b/Monitoring/composer.json index 453f0b18d1c1..2f2fc8089aa1 100644 --- a/Monitoring/composer.json +++ b/Monitoring/composer.json @@ -4,7 +4,7 @@ "license": "Apache-2.0", "minimum-stability": "stable", "require": { - "google/gax": "^0.34" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/OsLogin/VERSION b/OsLogin/VERSION index 09a3acfa138d..7ceb04048e8a 100644 --- a/OsLogin/VERSION +++ b/OsLogin/VERSION @@ -1 +1 @@ -0.6.0 \ No newline at end of file +0.6.1 \ No newline at end of file diff --git a/OsLogin/composer.json b/OsLogin/composer.json index 74bdff86c7b6..654716b5643b 100644 --- a/OsLogin/composer.json +++ b/OsLogin/composer.json @@ -18,7 +18,7 @@ } }, "require": { - "google/gax": "^0.34" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/PubSub/VERSION b/PubSub/VERSION index e21e727f96fa..13175fdc4371 100644 --- a/PubSub/VERSION +++ b/PubSub/VERSION @@ -1 +1 @@ -1.4.0 \ No newline at end of file +1.4.1 \ No newline at end of file diff --git a/PubSub/composer.json b/PubSub/composer.json index 18ce8b3fe040..c83b124cc60a 100644 --- a/PubSub/composer.json +++ b/PubSub/composer.json @@ -5,7 +5,7 @@ "minimum-stability": "stable", "require": { "google/cloud-core": "^1.14", - "google/gax": "^0.34" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/PubSub/src/PubSubClient.php b/PubSub/src/PubSubClient.php index ffca482bae6f..0fd21b28c292 100644 --- a/PubSub/src/PubSubClient.php +++ b/PubSub/src/PubSubClient.php @@ -85,7 +85,7 @@ class PubSubClient use IncomingMessageTrait; use ResourceNameTrait; - const VERSION = '1.4.0'; + const VERSION = '1.4.1'; const FULL_CONTROL_SCOPE = 'https://www.googleapis.com/auth/pubsub'; diff --git a/README.md b/README.md index 2b50064f7aab..4de6f954b4fa 100644 --- a/README.md +++ b/README.md @@ -584,7 +584,7 @@ require __DIR__ . '/vendor/autoload.php'; use Google\ApiCore\ApiException; use Google\Cloud\Kms\V1\CryptoKey; -use Google\Cloud\Kms\V1\CryptoKey_CryptoKeyPurpose; +use Google\Cloud\Kms\V1\CryptoKey\CryptoKeyPurpose; use Google\Cloud\Kms\V1\KeyManagementServiceClient; use Google\Cloud\Kms\V1\KeyRing; @@ -617,7 +617,7 @@ try { } catch (ApiException $e) { if ($e->getStatus() === 'NOT_FOUND') { $cryptoKey = new CryptoKey(); - $cryptoKey->setPurpose(CryptoKey_CryptoKeyPurpose::ENCRYPT_DECRYPT); + $cryptoKey->setPurpose(CryptoKeyPurpose::ENCRYPT_DECRYPT); $cryptoKey = $client->createCryptoKey($keyRingName, $keyId, $cryptoKey); } } diff --git a/Redis/VERSION b/Redis/VERSION index a2268e2de445..87a0871112f9 100644 --- a/Redis/VERSION +++ b/Redis/VERSION @@ -1 +1 @@ -0.3.1 \ No newline at end of file +0.3.3 \ No newline at end of file diff --git a/Redis/composer.json b/Redis/composer.json index 2222508ad34b..586b89035eb1 100644 --- a/Redis/composer.json +++ b/Redis/composer.json @@ -19,7 +19,7 @@ }, "require": { "ext-grpc": "*", - "google/gax": "^0.34" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Spanner/VERSION b/Spanner/VERSION index 2eda823ff528..308b6faa7585 100644 --- a/Spanner/VERSION +++ b/Spanner/VERSION @@ -1 +1 @@ -1.6.1 \ No newline at end of file +1.6.2 \ No newline at end of file diff --git a/Spanner/composer.json b/Spanner/composer.json index e713ba7602a9..05992e9f603d 100644 --- a/Spanner/composer.json +++ b/Spanner/composer.json @@ -6,7 +6,7 @@ "require": { "ext-grpc": "*", "google/cloud-core": "^1.14", - "google/gax": "^0.34" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Spanner/src/SpannerClient.php b/Spanner/src/SpannerClient.php index 6839512279b3..53d20e81f4cd 100644 --- a/Spanner/src/SpannerClient.php +++ b/Spanner/src/SpannerClient.php @@ -78,7 +78,7 @@ class SpannerClient use LROTrait; use ValidateTrait; - const VERSION = '1.6.1'; + const VERSION = '1.6.2'; const FULL_CONTROL_SCOPE = 'https://www.googleapis.com/auth/spanner.data'; const ADMIN_SCOPE = 'https://www.googleapis.com/auth/spanner.admin'; diff --git a/Speech/VERSION b/Speech/VERSION index 8076af51c002..a12760eb1717 100644 --- a/Speech/VERSION +++ b/Speech/VERSION @@ -1 +1 @@ -0.15.1 \ No newline at end of file +0.15.2 \ No newline at end of file diff --git a/Speech/composer.json b/Speech/composer.json index 3e8b2bf83a64..5ba07fae470e 100644 --- a/Speech/composer.json +++ b/Speech/composer.json @@ -5,7 +5,7 @@ "minimum-stability": "stable", "require": { "google/cloud-core": "^1.14", - "google/gax": "^0.34" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Speech/src/SpeechClient.php b/Speech/src/SpeechClient.php index 9c711e3476b0..07780d2fab3f 100644 --- a/Speech/src/SpeechClient.php +++ b/Speech/src/SpeechClient.php @@ -43,7 +43,7 @@ class SpeechClient { use ClientTrait; - const VERSION = '0.15.1'; + const VERSION = '0.15.2'; const SCOPE = 'https://www.googleapis.com/auth/cloud-platform'; diff --git a/Storage/VERSION b/Storage/VERSION index a73b43254444..ce6a70b9d84c 100644 --- a/Storage/VERSION +++ b/Storage/VERSION @@ -1 +1 @@ -1.5.2 \ No newline at end of file +1.6.0 \ No newline at end of file diff --git a/Storage/src/Connection/ConnectionInterface.php b/Storage/src/Connection/ConnectionInterface.php index 44ca1c159ec6..7db556680d79 100644 --- a/Storage/src/Connection/ConnectionInterface.php +++ b/Storage/src/Connection/ConnectionInterface.php @@ -152,4 +152,9 @@ public function insertNotification(array $args = []); * @param array $args */ public function listNotifications(array $args = []); + + /** + * @param array $args + */ + public function getServiceAccount(array $args = []); } diff --git a/Storage/src/Connection/Rest.php b/Storage/src/Connection/Rest.php index 19a65b756f73..4fa4bd824f44 100644 --- a/Storage/src/Connection/Rest.php +++ b/Storage/src/Connection/Rest.php @@ -386,4 +386,12 @@ public function listNotifications(array $args = []) { return $this->send('notifications', 'list', $args); } + + /** + * @param array $args + */ + public function getServiceAccount(array $args = []) + { + return $this->send('projects.resources.serviceAccount', 'get', $args); + } } diff --git a/Storage/src/StorageClient.php b/Storage/src/StorageClient.php index 4679e8cbde31..6f3baf7b7bcf 100644 --- a/Storage/src/StorageClient.php +++ b/Storage/src/StorageClient.php @@ -47,7 +47,7 @@ class StorageClient use ArrayTrait; use ClientTrait; - const VERSION = '1.5.2'; + const VERSION = '1.6.0'; const FULL_CONTROL_SCOPE = 'https://www.googleapis.com/auth/devstorage.full_control'; const READ_ONLY_SCOPE = 'https://www.googleapis.com/auth/devstorage.read_only'; @@ -379,4 +379,26 @@ public function timestamp(\DateTimeInterface $timestamp, $nanoSeconds = null) { return new Timestamp($timestamp, $nanoSeconds); } + + /** + * Get a service account email for the KMS integration. + * + * Example: + * ``` + * $serviceAccount = $storage->getServiceAccount(); + * ``` + * + * @param array $options [optional] { + * Configuration options. + * + * @type string $userProject If set, this is the ID of the project which + * will be billed for the request. + * } + * @return string + */ + public function getServiceAccount(array $options = []) + { + $resp = $this->connection->getServiceAccount($options + ['projectId' => $this->projectId]); + return $resp['email_address']; + } } diff --git a/Storage/tests/Snippet/StorageClientTest.php b/Storage/tests/Snippet/StorageClientTest.php index 9630b0e4bb50..4318ec01c75f 100644 --- a/Storage/tests/Snippet/StorageClientTest.php +++ b/Storage/tests/Snippet/StorageClientTest.php @@ -19,6 +19,7 @@ use Google\Cloud\Core\Iterator\ItemIterator; use Google\Cloud\Core\RequestWrapper; +use Google\Cloud\Core\Testing\TestHelpers; use Google\Cloud\Core\Timestamp; use Google\Cloud\Core\Upload\SignedUrlUploader; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; @@ -43,7 +44,9 @@ public function setUp() $this->connection = $this->prophesize(Rest::class); $this->connection->projectId() ->willReturn(self::PROJECT_ID); - $this->client = \Google\Cloud\Core\Testing\TestHelpers::stub(StorageClient::class); + $this->client = TestHelpers::stub(StorageClient::class, [ + ['projectId' => self::PROJECT_ID] + ]); $this->client->___setProperty('connection', $this->connection->reveal()); } @@ -161,4 +164,20 @@ public function testTimestamp() $res = $snippet->invoke('timestamp'); $this->assertInstanceOf(Timestamp::class, $res->returnVal()); } + + public function testGetServiceAccount() + { + $snippet = $this->snippetFromMethod(StorageClient::class, 'getServiceAccount'); + $snippet->addLocal('storage', $this->client); + $expectedServiceAccount = self::PROJECT_ID . '@gs-project-accounts.iam.gserviceaccount.com'; + $this->connection->getServiceAccount([ + 'projectId' => self::PROJECT_ID, + ])->willReturn([ + 'kind' => 'storage#serviceAccount', + 'email_address' => $expectedServiceAccount + ])->shouldBeCalledTimes(1); + + $res = $snippet->invoke('serviceAccount'); + $this->assertEquals($expectedServiceAccount, $res->returnVal()); + } } diff --git a/Storage/tests/System/KmsTest.php b/Storage/tests/System/KmsTest.php index b0b6e9b15ebc..56956af918d5 100644 --- a/Storage/tests/System/KmsTest.php +++ b/Storage/tests/System/KmsTest.php @@ -178,7 +178,7 @@ private static function getKeyNames($keyRingId, $cryptoKeyId1, $cryptoKeyId2) 'scopes' => ['https://www.googleapis.com/auth/cloud-platform'] ]); $projectId = self::getProjectId($keyFilePath); - $serviceAccount = self::getServiceAccount($wrapper, $projectId); + $serviceAccount = self::$client->getServiceAccount(); self::buildKeyRing($wrapper, $projectId, $keyRingId); $keyNames[] = self::getCryptoKeyName( $wrapper, @@ -295,27 +295,4 @@ private static function getCryptoKeyName( return $name; } - - /** - * @param RequestWrapper $wrapper - * @param string $projectId - * @return string - */ - private static function getServiceAccount(RequestWrapper $wrapper, $projectId) - { - $response = $wrapper->send( - new Request( - 'GET', - sprintf( - 'https://www.googleapis.com/storage/v1/projects/%s/serviceAccount', - $projectId - ) - ) - ); - - return json_decode( - (string) $response->getBody(), - true - )['email_address']; - } } diff --git a/Storage/tests/System/RequesterPaysTest.php b/Storage/tests/System/RequesterPaysTest.php index 748652aa3935..9211e7567b48 100644 --- a/Storage/tests/System/RequesterPaysTest.php +++ b/Storage/tests/System/RequesterPaysTest.php @@ -31,11 +31,14 @@ */ class RequesterPaysTest extends StorageTestCase { - private $keyFilePath; - private $requesterPaysClient; - private $requesterProject; - private $keyfileUser; - + private static $requesterKeyFile; + private static $requesterProject; + private static $requesterEmail; + private static $ownerKeyFile; + private static $ownerEmail; + private static $ownerProject; + + private static $requesterClient; private static $bucketName; private static $ownerBucketInstance; private static $object1; @@ -43,19 +46,36 @@ class RequesterPaysTest extends StorageTestCase private static $content; private static $topic; private static $notificationId; - private static $iamsetup = false; public static function setupBeforeClass() { parent::setupBeforeClass(); - $client = self::$client; + $requesterKeyFilePath = getenv('GOOGLE_CLOUD_PHP_TESTS_WHITELIST_KEY_PATH'); + $ownerKeyFilePath = getenv('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH'); + + self::$requesterKeyFile = json_decode(file_get_contents($requesterKeyFilePath), true); + self::$requesterEmail = self::$requesterKeyFile['client_email']; + self::$requesterProject = self::$requesterKeyFile['project_id']; + + self::$ownerKeyFile = json_decode(file_get_contents($ownerKeyFilePath), true); + self::$ownerEmail = self::$ownerKeyFile['client_email']; + self::$ownerProject = self::$ownerKeyFile['project_id']; self::$bucketName = uniqid(self::TESTING_PREFIX); + + $client = self::$client; + + // Owner bucket instance is a bucket class with requester pays turned on + // and authenticated with the credentials of the user owning the bucket. self::$ownerBucketInstance = self::createBucket($client, self::$bucketName, [ 'billing' => ['requesterPays' => true] ]); + self::$requesterClient = new StorageClient([ + 'keyFile' => self::$requesterKeyFile + ]); + self::$topic = self::$pubsubClient->createTopic(uniqid(self::TESTING_PREFIX)); self::$deletionQueue->add(self::$topic); @@ -67,52 +87,34 @@ public static function setupBeforeClass() self::$object2 = self::$ownerBucketInstance->upload(self::$content, [ 'name' => uniqid(self::TESTING_PREFIX) ]); - } - - public function setUp() - { - $this->keyFilePath = getenv('GOOGLE_CLOUD_PHP_TESTS_WHITELIST_KEY_PATH'); - - $keyfile = json_decode(file_get_contents(getenv('GOOGLE_CLOUD_PHP_TESTS_WHITELIST_KEY_PATH')), true); - $this->keyfileUser = $keyfile['client_email']; - - $this->requesterPaysClient = new StorageClient([ - 'keyFile' => $keyfile - ]); - $parentKeyfile = json_decode(file_get_contents(getenv('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH')), true); - $keyfile = json_decode(file_get_contents($this->keyFilePath), true); - $this->requesterProject = $keyfile['project_id']; - - if (!self::$iamsetup) { - // set bucket policy - $p = self::$ownerBucketInstance->iam()->policy(); - $p['bindings'][] = [ - 'role' => 'roles/storage.admin', - 'members' => [ - 'serviceAccount:' . $keyfile['client_email'] - ] - ]; - $p['bindings'][] = [ - 'role' => 'roles/storage.objectAdmin', - 'members' => [ - 'serviceAccount:' . $keyfile['client_email'] - ] - ]; - self::$ownerBucketInstance->iam()->setPolicy($p); - - // set topic policy - $p = self::$topic->iam()->policy(); - $p['bindings'][] = [ - 'role' => 'roles/pubsub.publisher', - 'members' => [ - 'serviceAccount:'. $parentKeyfile['project_id'] .'@gs-project-accounts.iam.gserviceaccount.com' - ] - ]; - self::$topic->iam()->setPolicy($p); - - self::$iamsetup = true; - } + // set bucket policy + $p = self::$ownerBucketInstance->iam()->policy(); + $p['bindings'][] = [ + 'role' => 'roles/storage.admin', + 'members' => [ + 'serviceAccount:' . self::$requesterEmail, + 'serviceAccount:'. self::$ownerEmail + ] + ]; + $p['bindings'][] = [ + 'role' => 'roles/storage.objectAdmin', + 'members' => [ + 'serviceAccount:' . self::$requesterEmail, + 'serviceAccount:'. self::$ownerEmail + ] + ]; + self::$ownerBucketInstance->iam()->setPolicy($p); + + // set topic policy + $p = self::$topic->iam()->policy(); + $p['bindings'][] = [ + 'role' => 'roles/pubsub.publisher', + 'members' => [ + 'serviceAccount:'. self::$ownerProject .'@gs-project-accounts.iam.gserviceaccount.com', + ] + ]; + self::$topic->iam()->setPolicy($p); } public function testBucketSettings() @@ -154,7 +156,7 @@ public function testBucketSettings() */ public function testRequesterPaysMethodsWithoutUserProject(callable $call) { - $bucket = $this->requesterPaysClient->bucket(self::$bucketName); + $bucket = self::$requesterClient->bucket(self::$bucketName); $object = $bucket->object(self::$object1->name()); $call($bucket, $object); @@ -163,12 +165,12 @@ public function testRequesterPaysMethodsWithoutUserProject(callable $call) /** * @dataProvider requesterPaysMethods */ - public function testRequesterPaysWithUserProject(callable $call) + public function testRequesterPaysMethodsWithUserProject(callable $call) { - $bucket = $this->requesterPaysClient->bucket(self::$bucketName, $this->requesterProject); + $bucket = self::$requesterClient->bucket(self::$bucketName, true); $object = $bucket->object(self::$object1->name()); - $this->assertEquals($this->requesterProject, $object->identity()['userProject']); + $this->assertEquals(self::$requesterProject, $object->identity()['userProject']); $call($bucket, $object); } @@ -178,164 +180,179 @@ public function requesterPaysMethods() $this->setup(); return [ - [ + 'add-acl' => [ function (Bucket $bucket) { $acl = $bucket->acl(); - $acl->add('user-'. $this->keyfileUser, Acl::ROLE_READER); + $acl->add('user-'. self::$requesterEmail, Acl::ROLE_READER); } - ], [ + ], + 'get-acl' => [ function (Bucket $bucket) { $acl = $bucket->acl(); - $item = $acl->get(['entity' => 'user-'. $this->keyfileUser]); + $item = $acl->get(['entity' => 'user-'. self::$requesterEmail]); } - ], [ + ], + 'update-acl' => [ function (Bucket $bucket) { $acl = $bucket->acl(); - $acl->update('user-'. $this->keyfileUser, Acl::ROLE_OWNER); + $acl->update('user-'. self::$requesterEmail, Acl::ROLE_OWNER); } - ], [ + ], + 'delete-acl' => [ function (Bucket $bucket) { $acl = $bucket->acl(); - $acl->delete('user-'. $this->keyfileUser); + $acl->delete('user-'. self::$requesterEmail); } - ], [ + ], + 'add-default-acl' => [ function (Bucket $bucket) { $acl = $bucket->defaultAcl(); - $acl->add('user-'. $this->keyfileUser, Acl::ROLE_READER); + $acl->add('user-'. self::$requesterEmail, Acl::ROLE_READER); } - ], [ + ], + 'get-default-acl' => [ function (Bucket $bucket) { $acl = $bucket->defaultAcl(); - $item = $acl->get(['entity' => 'user-'. $this->keyfileUser]); + $item = $acl->get(['entity' => 'user-'. self::$requesterEmail]); } - ], [ + ], + 'update-default-acl' => [ function (Bucket $bucket) { $acl = $bucket->defaultAcl(); - $acl->update('user-'. $this->keyfileUser, Acl::ROLE_OWNER); + $acl->update('user-'. self::$requesterEmail, Acl::ROLE_OWNER); } - ], [ + ], + 'delete-default-acl' => [ function (Bucket $bucket) { $acl = $bucket->defaultAcl(); - $acl->delete('user-'. $this->keyfileUser); + $acl->delete('user-'. self::$requesterEmail); } - ], [ + ], + 'bucket-exists' => [ function (Bucket $bucket) { $bucket->exists(); }, - ], [ + ], + 'bucket-upload' => [ function (Bucket $bucket) { $bucket->upload(self::$content, [ 'name' => uniqid(self::TESTING_PREFIX) ]); }, - ], [ - function (Bucket $bucket) { - $bucket->getResumableUploader(self::$content, [ - 'name' => uniqid(self::TESTING_PREFIX) - ])->upload(); - }, - ], [ - function (Bucket $bucket) { - $bucket->getStreamableUploader(self::$content, [ - 'name' => uniqid(self::TESTING_PREFIX) - ])->upload(); - }, - ], [ + ], + 'bucket-objects' => [ function (Bucket $bucket) { iterator_to_array($bucket->objects()); }, - ], [ + ], + 'bucket-update' => [ function (Bucket $bucket) { $bucket->update([]); }, - ], [ + ], + 'bucket-compose' => [ function (Bucket $bucket) { $bucket->compose([self::$object1, self::$object2], uniqid(self::TESTING_PREFIX), [ 'metadata' => ['contentType' => 'text/plain'] ]); }, - ], [ + ], + 'bucket-reload' => [ function (Bucket $bucket) { $bucket->reload(); } - ], [ + ], + 'notification-create' => [ function (Bucket $bucket) { self::$notificationId = $bucket->createNotification(self::$topic)->info()['id']; } - ], [ + ], + 'notification-get' => [ function (Bucket $bucket) { $bucket->notifications()->current(); } - ], [ + ], + 'notification-reload' => [ function (Bucket $bucket) { $bucket->notification(self::$notificationId)->reload(); } - ], [ + ], + 'object-acl-add' => [ function (Bucket $bucket, StorageObject $object) { $acl = $object->acl(); - $acl->add('user-'. $this->keyfileUser, Acl::ROLE_READER); + $acl->add('user-'. self::$requesterEmail, Acl::ROLE_READER); } - ], [ + ], + 'object-acl-get' => [ function (Bucket $bucket, StorageObject $object) { $acl = $object->acl(); - $item = $acl->get(['entity' => 'user-'. $this->keyfileUser]); + $item = $acl->get(['entity' => 'user-'. self::$requesterEmail]); } - ], [ + ], + 'object-acl-update' => [ function (Bucket $bucket, StorageObject $object) { $acl = $object->acl(); - $acl->update('user-'. $this->keyfileUser, Acl::ROLE_OWNER); + $acl->update('user-'. self::$requesterEmail, Acl::ROLE_OWNER); } - ], [ + ], + 'object-acl-delete' => [ function (Bucket $bucket, StorageObject $object) { $acl = $object->acl(); - $acl->delete('user-'. $this->keyfileUser); + $acl->delete('user-'. self::$requesterEmail); } - ], [ + ], + 'object-exists' => [ function (Bucket $bucket, StorageObject $object) { $object->exists(); } - ], [ + ], + 'object-update' => [ function (Bucket $bucket, StorageObject $object) { $object->update([]); } - ], [ + ], + 'object-copy' => [ function (Bucket $bucket, StorageObject $object) { $object->copy($bucket); } - ], [ + ], + 'object-rewrite' => [ function (Bucket $bucket, StorageObject $object) { $object->rewrite($bucket); } - ], [ + ], + 'object-download-string' => [ function (Bucket $bucket, StorageObject $object) { $object->downloadAsString(); } - ], [ + ], + 'object-download-file' => [ function (Bucket $bucket, StorageObject $object) { $object->downloadToFile('php://temp'); } - ], [ + ], + 'object-download-stream' => [ function (Bucket $bucket, StorageObject $object) { $object->downloadAsStream(); } - ], [ + ], + 'object-reload' => [ function (Bucket $bucket, StorageObject $object) { $object->reload(); } - ], [ + ], + 'bucket-iam-get' => [ function (Bucket $bucket, StorageObject $object) { $bucket->iam()->policy(); } - ], [ + ], + 'bucket-iam-set' => [ function (Bucket $bucket, StorageObject $object) { $p = $bucket->iam()->policy(); $bucket->iam()->setPolicy($p); } - ], [ - function (Bucket $bucket, StorageObject $object) { - $bucket->iam()->testPermissions(['storage.objects.create', 'storage.objects.delete']); - } - ], [ + ], + 'bucket-iam-reload' => [ function (Bucket $bucket, StorageObject $object) { $bucket->iam()->reload(); } @@ -343,14 +360,53 @@ function (Bucket $bucket, StorageObject $object) { ]; } + /** + * @dataProvider uploadMethods + * @expectedException Google\Cloud\Core\Exception\GoogleException + */ + public function testUploadMethodsWithoutUserProject(callable $call) + { + $bucket = self::$requesterClient->bucket(self::$bucketName); + $call($bucket); + } + + /** + * @dataProvider uploadMethods + */ + public function testUploadMethodsWithUserProject(callable $call) + { + $bucket = self::$requesterClient->bucket(self::$bucketName, true); + $call($bucket); + } + + public function uploadMethods() + { + return [ + 'resumable-upload' => [ + function (Bucket $bucket) { + $bucket->getResumableUploader(self::$content, [ + 'name' => uniqid(self::TESTING_PREFIX) + ])->upload(); + }, + ], + 'streamable-upload' => [ + function (Bucket $bucket) { + $bucket->getStreamableUploader(self::$content, [ + 'name' => uniqid(self::TESTING_PREFIX) + ])->upload(); + }, + ], + ]; + } + public function testDeleteNotification() { - $bucket = $this->requesterPaysClient->bucket(self::$bucketName, $this->requesterProject); + $bucket = self::$requesterClient->bucket(self::$bucketName, self::$requesterProject); $bucket->notification(self::$notificationId)->delete(); // test that the userProject is right through the object (since no access on bucket). $object = $bucket->object(self::$object1->name()); - $this->assertEquals($this->requesterProject, $object->identity()['userProject']); + $this->assertEquals(self::$requesterProject, $object->identity()['userProject']); } /** @@ -358,7 +414,7 @@ public function testDeleteNotification() */ public function testDeleteNotificationFails() { - $bucket = $this->requesterPaysClient->bucket(self::$bucketName); + $bucket = self::$requesterClient->bucket(self::$bucketName); $bucket->notification(self::$notificationId)->delete(); } } diff --git a/Storage/tests/Unit/Connection/RestTest.php b/Storage/tests/Unit/Connection/RestTest.php index ea586ced4687..4894c98b31b1 100644 --- a/Storage/tests/Unit/Connection/RestTest.php +++ b/Storage/tests/Unit/Connection/RestTest.php @@ -106,6 +106,7 @@ public function methodProvider() ['deleteNotification'], ['insertNotification'], ['listNotifications'], + ['getServiceAccount'] ]; } diff --git a/Storage/tests/Unit/StorageClientTest.php b/Storage/tests/Unit/StorageClientTest.php index 6ff471f476f6..1cec11431d9c 100644 --- a/Storage/tests/Unit/StorageClientTest.php +++ b/Storage/tests/Unit/StorageClientTest.php @@ -156,6 +156,24 @@ public function testTimestamp() $this->assertInstanceOf(Timestamp::class, $ts); $this->assertEquals($ts->get(), $dt); } + + public function testGetServiceAccount() + { + $expectedServiceAccount = self::PROJECT . '@gs-project-accounts.iam.gserviceaccount.com'; + $this->connection->getServiceAccount([ + 'projectId' => self::PROJECT, + 'userProject' => self::PROJECT + ])->willReturn([ + 'kind' => 'storage#serviceAccount', + 'email_address' => $expectedServiceAccount + ])->shouldBeCalledTimes(1); + $this->client->___setProperty('connection', $this->connection->reveal()); + + $this->assertEquals( + $this->client->getServiceAccount(['userProject' => self::PROJECT]), + $expectedServiceAccount + ); + } } class StorageClientStub extends StorageClient diff --git a/Tasks/VERSION b/Tasks/VERSION index 6c6aa7cb0918..341cf11faf9a 100644 --- a/Tasks/VERSION +++ b/Tasks/VERSION @@ -1 +1 @@ -0.1.0 \ No newline at end of file +0.2.0 \ No newline at end of file diff --git a/Tasks/composer.json b/Tasks/composer.json index 4a0cb373b443..408478faab23 100644 --- a/Tasks/composer.json +++ b/Tasks/composer.json @@ -23,7 +23,7 @@ } }, "require": { - "google/gax": "^0.34.0" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Tasks/metadata/V2Beta2/Cloudtasks.php b/Tasks/metadata/V2Beta2/Cloudtasks.php index cc107a92ec83..87d4d0dee113 100644 --- a/Tasks/metadata/V2Beta2/Cloudtasks.php +++ b/Tasks/metadata/V2Beta2/Cloudtasks.php @@ -25,7 +25,7 @@ public static function initOnce() { \GPBMetadata\Google\Protobuf\Timestamp::initOnce(); \GPBMetadata\Google\Rpc\Code::initOnce(); $pool->internalAddGeneratedFile(hex2bin( - "0aca2c0a2b676f6f676c652f636c6f75642f7461736b732f763262657461" . + "0ab82c0a2b676f6f676c652f636c6f75642f7461736b732f763262657461" . "322f636c6f75647461736b732e70726f746f121a676f6f676c652e636c6f" . "75642e7461736b732e763262657461321a26676f6f676c652f636c6f7564" . "2f7461736b732f763262657461322f71756575652e70726f746f1a25676f" . @@ -56,166 +56,165 @@ public static function initOnce() { "726765517565756552657175657374120c0a046e616d6518012001280922" . "210a115061757365517565756552657175657374120c0a046e616d651801" . "2001280922220a12526573756d65517565756552657175657374120c0a04" . - "6e616d651801200128092299010a104c6973745461736b73526571756573" . + "6e616d651801200128092287010a104c6973745461736b73526571756573" . "74120e0a06706172656e74180120012809123c0a0d726573706f6e73655f" . "7669657718022001280e32252e676f6f676c652e636c6f75642e7461736b" . - "732e763262657461322e5461736b2e5669657712100a086f726465725f62" . - "7918032001280912110a09706167655f73697a6518042001280512120a0a" . - "706167655f746f6b656e180520012809225d0a114c6973745461736b7352" . - "6573706f6e7365122f0a057461736b7318012003280b32202e676f6f676c" . - "652e636c6f75642e7461736b732e763262657461322e5461736b12170a0f" . - "6e6578745f706167655f746f6b656e180220012809225c0a0e4765745461" . - "736b52657175657374120c0a046e616d65180120012809123c0a0d726573" . - "706f6e73655f7669657718022001280e32252e676f6f676c652e636c6f75" . - "642e7461736b732e763262657461322e5461736b2e566965772291010a11" . - "4372656174655461736b52657175657374120e0a06706172656e74180120" . - "012809122e0a047461736b18022001280b32202e676f6f676c652e636c6f" . - "75642e7461736b732e763262657461322e5461736b123c0a0d726573706f" . - "6e73655f7669657718032001280e32252e676f6f676c652e636c6f75642e" . - "7461736b732e763262657461322e5461736b2e5669657722210a1144656c" . - "6574655461736b52657175657374120c0a046e616d6518012001280922b7" . - "010a114c656173655461736b7352657175657374120e0a06706172656e74" . - "18012001280912110a096d61785f7461736b7318022001280512310a0e6c" . + "732e763262657461322e5461736b2e5669657712110a09706167655f7369" . + "7a6518042001280512120a0a706167655f746f6b656e180520012809225d" . + "0a114c6973745461736b73526573706f6e7365122f0a057461736b731801" . + "2003280b32202e676f6f676c652e636c6f75642e7461736b732e76326265" . + "7461322e5461736b12170a0f6e6578745f706167655f746f6b656e180220" . + "012809225c0a0e4765745461736b52657175657374120c0a046e616d6518" . + "0120012809123c0a0d726573706f6e73655f7669657718022001280e3225" . + "2e676f6f676c652e636c6f75642e7461736b732e763262657461322e5461" . + "736b2e566965772291010a114372656174655461736b5265717565737412" . + "0e0a06706172656e74180120012809122e0a047461736b18022001280b32" . + "202e676f6f676c652e636c6f75642e7461736b732e763262657461322e54" . + "61736b123c0a0d726573706f6e73655f7669657718032001280e32252e67" . + "6f6f676c652e636c6f75642e7461736b732e763262657461322e5461736b" . + "2e5669657722210a1144656c6574655461736b52657175657374120c0a04" . + "6e616d6518012001280922b7010a114c656173655461736b735265717565" . + "7374120e0a06706172656e7418012001280912110a096d61785f7461736b" . + "7318022001280512310a0e6c656173655f6475726174696f6e1803200128" . + "0b32192e676f6f676c652e70726f746f6275662e4475726174696f6e123c" . + "0a0d726573706f6e73655f7669657718042001280e32252e676f6f676c65" . + "2e636c6f75642e7461736b732e763262657461322e5461736b2e56696577" . + "120e0a0666696c74657218052001280922450a124c656173655461736b73" . + "526573706f6e7365122f0a057461736b7318012003280b32202e676f6f67" . + "6c652e636c6f75642e7461736b732e763262657461322e5461736b22590a" . + "1641636b6e6f776c656467655461736b52657175657374120c0a046e616d" . + "6518012001280912310a0d7363686564756c655f74696d6518022001280b" . + "321a2e676f6f676c652e70726f746f6275662e54696d657374616d7022c5" . + "010a1152656e65774c6561736552657175657374120c0a046e616d651801" . + "2001280912310a0d7363686564756c655f74696d6518022001280b321a2e" . + "676f6f676c652e70726f746f6275662e54696d657374616d7012310a0e6c" . "656173655f6475726174696f6e18032001280b32192e676f6f676c652e70" . "726f746f6275662e4475726174696f6e123c0a0d726573706f6e73655f76" . "69657718042001280e32252e676f6f676c652e636c6f75642e7461736b73" . - "2e763262657461322e5461736b2e56696577120e0a0666696c7465721805" . - "2001280922450a124c656173655461736b73526573706f6e7365122f0a05" . - "7461736b7318012003280b32202e676f6f676c652e636c6f75642e746173" . - "6b732e763262657461322e5461736b22590a1641636b6e6f776c65646765" . - "5461736b52657175657374120c0a046e616d6518012001280912310a0d73" . + "2e763262657461322e5461736b2e566965772293010a1243616e63656c4c" . + "6561736552657175657374120c0a046e616d6518012001280912310a0d73" . "63686564756c655f74696d6518022001280b321a2e676f6f676c652e7072" . - "6f746f6275662e54696d657374616d7022c5010a1152656e65774c656173" . - "6552657175657374120c0a046e616d6518012001280912310a0d73636865" . - "64756c655f74696d6518022001280b321a2e676f6f676c652e70726f746f" . - "6275662e54696d657374616d7012310a0e6c656173655f6475726174696f" . - "6e18032001280b32192e676f6f676c652e70726f746f6275662e44757261" . - "74696f6e123c0a0d726573706f6e73655f7669657718042001280e32252e" . - "676f6f676c652e636c6f75642e7461736b732e763262657461322e546173" . - "6b2e566965772293010a1243616e63656c4c656173655265717565737412" . - "0c0a046e616d6518012001280912310a0d7363686564756c655f74696d65" . - "18022001280b321a2e676f6f676c652e70726f746f6275662e54696d6573" . - "74616d70123c0a0d726573706f6e73655f7669657718032001280e32252e" . - "676f6f676c652e636c6f75642e7461736b732e763262657461322e546173" . - "6b2e56696577225c0a0e52756e5461736b52657175657374120c0a046e61" . - "6d65180120012809123c0a0d726573706f6e73655f766965771802200128" . - "0e32252e676f6f676c652e636c6f75642e7461736b732e76326265746132" . - "2e5461736b2e5669657732f0190a0a436c6f75645461736b7312a4010a0a" . - "4c697374517565756573122d2e676f6f676c652e636c6f75642e7461736b" . - "732e763262657461322e4c697374517565756573526571756573741a2e2e" . - "676f6f676c652e636c6f75642e7461736b732e763262657461322e4c6973" . - "74517565756573526573706f6e7365223782d3e4930231122f2f76326265" . - "7461322f7b706172656e743d70726f6a656374732f2a2f6c6f636174696f" . - "6e732f2a7d2f7175657565731293010a084765745175657565122b2e676f" . - "6f676c652e636c6f75642e7461736b732e763262657461322e4765745175" . - "657565526571756573741a212e676f6f676c652e636c6f75642e7461736b" . - "732e763262657461322e5175657565223782d3e4930231122f2f76326265" . - "7461322f7b6e616d653d70726f6a656374732f2a2f6c6f636174696f6e73" . - "2f2a2f7175657565732f2a7d12a0010a0b4372656174655175657565122e" . - "2e676f6f676c652e636c6f75642e7461736b732e763262657461322e4372" . - "656174655175657565526571756573741a212e676f6f676c652e636c6f75" . - "642e7461736b732e763262657461322e5175657565223e82d3e493023822" . - "2f2f763262657461322f7b706172656e743d70726f6a656374732f2a2f6c" . - "6f636174696f6e732f2a7d2f7175657565733a05717565756512a6010a0b" . - "5570646174655175657565122e2e676f6f676c652e636c6f75642e746173" . - "6b732e763262657461322e5570646174655175657565526571756573741a" . - "212e676f6f676c652e636c6f75642e7461736b732e763262657461322e51" . - "75657565224482d3e493023e32352f763262657461322f7b71756575652e" . - "6e616d653d70726f6a656374732f2a2f6c6f636174696f6e732f2a2f7175" . - "657565732f2a7d3a057175657565128e010a0b44656c6574655175657565" . - "122e2e676f6f676c652e636c6f75642e7461736b732e763262657461322e" . - "44656c6574655175657565526571756573741a162e676f6f676c652e7072" . - "6f746f6275662e456d707479223782d3e49302312a2f2f76326265746132" . - "2f7b6e616d653d70726f6a656374732f2a2f6c6f636174696f6e732f2a2f" . - "7175657565732f2a7d12a0010a0a50757267655175657565122d2e676f6f" . - "676c652e636c6f75642e7461736b732e763262657461322e507572676551" . + "6f746f6275662e54696d657374616d70123c0a0d726573706f6e73655f76" . + "69657718032001280e32252e676f6f676c652e636c6f75642e7461736b73" . + "2e763262657461322e5461736b2e56696577225c0a0e52756e5461736b52" . + "657175657374120c0a046e616d65180120012809123c0a0d726573706f6e" . + "73655f7669657718022001280e32252e676f6f676c652e636c6f75642e74" . + "61736b732e763262657461322e5461736b2e5669657732f0190a0a436c6f" . + "75645461736b7312a4010a0a4c697374517565756573122d2e676f6f676c" . + "652e636c6f75642e7461736b732e763262657461322e4c69737451756575" . + "6573526571756573741a2e2e676f6f676c652e636c6f75642e7461736b73" . + "2e763262657461322e4c697374517565756573526573706f6e7365223782" . + "d3e4930231122f2f763262657461322f7b706172656e743d70726f6a6563" . + "74732f2a2f6c6f636174696f6e732f2a7d2f7175657565731293010a0847" . + "65745175657565122b2e676f6f676c652e636c6f75642e7461736b732e76" . + "3262657461322e4765745175657565526571756573741a212e676f6f676c" . + "652e636c6f75642e7461736b732e763262657461322e5175657565223782" . + "d3e4930231122f2f763262657461322f7b6e616d653d70726f6a65637473" . + "2f2a2f6c6f636174696f6e732f2a2f7175657565732f2a7d12a0010a0b43" . + "72656174655175657565122e2e676f6f676c652e636c6f75642e7461736b" . + "732e763262657461322e4372656174655175657565526571756573741a21" . + "2e676f6f676c652e636c6f75642e7461736b732e763262657461322e5175" . + "657565223e82d3e4930238222f2f763262657461322f7b706172656e743d" . + "70726f6a656374732f2a2f6c6f636174696f6e732f2a7d2f717565756573" . + "3a05717565756512a6010a0b5570646174655175657565122e2e676f6f67" . + "6c652e636c6f75642e7461736b732e763262657461322e55706461746551" . "75657565526571756573741a212e676f6f676c652e636c6f75642e746173" . - "6b732e763262657461322e5175657565224082d3e493023a22352f763262" . - "657461322f7b6e616d653d70726f6a656374732f2a2f6c6f636174696f6e" . - "732f2a2f7175657565732f2a7d3a70757267653a012a12a0010a0a506175" . - "73655175657565122d2e676f6f676c652e636c6f75642e7461736b732e76" . - "3262657461322e50617573655175657565526571756573741a212e676f6f" . - "676c652e636c6f75642e7461736b732e763262657461322e517565756522" . - "4082d3e493023a22352f763262657461322f7b6e616d653d70726f6a6563" . - "74732f2a2f6c6f636174696f6e732f2a2f7175657565732f2a7d3a706175" . - "73653a012a12a3010a0b526573756d655175657565122e2e676f6f676c65" . - "2e636c6f75642e7461736b732e763262657461322e526573756d65517565" . - "7565526571756573741a212e676f6f676c652e636c6f75642e7461736b73" . - "2e763262657461322e5175657565224182d3e493023b22362f7632626574" . - "61322f7b6e616d653d70726f6a656374732f2a2f6c6f636174696f6e732f" . - "2a2f7175657565732f2a7d3a726573756d653a012a1296010a0c47657449" . - "616d506f6c69637912222e676f6f676c652e69616d2e76312e4765744961" . - "6d506f6c696379526571756573741a152e676f6f676c652e69616d2e7631" . - "2e506f6c696379224b82d3e493024522402f763262657461322f7b726573" . - "6f757263653d70726f6a656374732f2a2f6c6f636174696f6e732f2a2f71" . - "75657565732f2a7d3a67657449616d506f6c6963793a012a1296010a0c53" . - "657449616d506f6c69637912222e676f6f676c652e69616d2e76312e5365" . - "7449616d506f6c696379526571756573741a152e676f6f676c652e69616d" . - "2e76312e506f6c696379224b82d3e493024522402f763262657461322f7b" . - "7265736f757263653d70726f6a656374732f2a2f6c6f636174696f6e732f" . - "2a2f7175657565732f2a7d3a73657449616d506f6c6963793a012a12bc01" . - "0a125465737449616d5065726d697373696f6e7312282e676f6f676c652e" . - "69616d2e76312e5465737449616d5065726d697373696f6e735265717565" . - "73741a292e676f6f676c652e69616d2e76312e5465737449616d5065726d" . - "697373696f6e73526573706f6e7365225182d3e493024b22462f76326265" . - "7461322f7b7265736f757263653d70726f6a656374732f2a2f6c6f636174" . - "696f6e732f2a2f7175657565732f2a7d3a7465737449616d5065726d6973" . - "73696f6e733a012a12a9010a094c6973745461736b73122c2e676f6f676c" . - "652e636c6f75642e7461736b732e763262657461322e4c6973745461736b" . - "73526571756573741a2d2e676f6f676c652e636c6f75642e7461736b732e" . - "763262657461322e4c6973745461736b73526573706f6e7365223f82d3e4" . - "93023912372f763262657461322f7b706172656e743d70726f6a65637473" . - "2f2a2f6c6f636174696f6e732f2a2f7175657565732f2a7d2f7461736b73" . - "1298010a074765745461736b122a2e676f6f676c652e636c6f75642e7461" . - "736b732e763262657461322e4765745461736b526571756573741a202e67" . - "6f6f676c652e636c6f75642e7461736b732e763262657461322e5461736b" . - "223f82d3e493023912372f763262657461322f7b6e616d653d70726f6a65" . - "6374732f2a2f6c6f636174696f6e732f2a2f7175657565732f2a2f746173" . - "6b732f2a7d12a1010a0a4372656174655461736b122d2e676f6f676c652e" . - "636c6f75642e7461736b732e763262657461322e4372656174655461736b" . - "526571756573741a202e676f6f676c652e636c6f75642e7461736b732e76" . - "3262657461322e5461736b224282d3e493023c22372f763262657461322f" . - "7b706172656e743d70726f6a656374732f2a2f6c6f636174696f6e732f2a" . - "2f7175657565732f2a7d2f7461736b733a012a1294010a0a44656c657465" . - "5461736b122d2e676f6f676c652e636c6f75642e7461736b732e76326265" . - "7461322e44656c6574655461736b526571756573741a162e676f6f676c65" . - "2e70726f746f6275662e456d707479223f82d3e49302392a372f76326265" . - "7461322f7b6e616d653d70726f6a656374732f2a2f6c6f636174696f6e73" . - "2f2a2f7175657565732f2a2f7461736b732f2a7d12b5010a0a4c65617365" . - "5461736b73122d2e676f6f676c652e636c6f75642e7461736b732e763262" . - "657461322e4c656173655461736b73526571756573741a2e2e676f6f676c" . - "652e636c6f75642e7461736b732e763262657461322e4c65617365546173" . - "6b73526573706f6e7365224882d3e4930242223d2f763262657461322f7b" . - "706172656e743d70726f6a656374732f2a2f6c6f636174696f6e732f2a2f" . - "7175657565732f2a7d2f7461736b733a6c656173653a012a12ad010a0f41" . - "636b6e6f776c656467655461736b12322e676f6f676c652e636c6f75642e" . - "7461736b732e763262657461322e41636b6e6f776c656467655461736b52" . - "6571756573741a162e676f6f676c652e70726f746f6275662e456d707479" . - "224e82d3e493024822432f763262657461322f7b6e616d653d70726f6a65" . - "6374732f2a2f6c6f636174696f6e732f2a2f7175657565732f2a2f746173" . - "6b732f2a7d3a61636b6e6f776c656467653a012a12ac010a0a52656e6577" . - "4c65617365122d2e676f6f676c652e636c6f75642e7461736b732e763262" . - "657461322e52656e65774c65617365526571756573741a202e676f6f676c" . - "652e636c6f75642e7461736b732e763262657461322e5461736b224d82d3" . - "e493024722422f763262657461322f7b6e616d653d70726f6a656374732f" . - "2a2f6c6f636174696f6e732f2a2f7175657565732f2a2f7461736b732f2a" . - "7d3a72656e65774c656173653a012a12af010a0b43616e63656c4c656173" . - "65122e2e676f6f676c652e636c6f75642e7461736b732e76326265746132" . - "2e43616e63656c4c65617365526571756573741a202e676f6f676c652e63" . - "6c6f75642e7461736b732e763262657461322e5461736b224e82d3e49302" . - "4822432f763262657461322f7b6e616d653d70726f6a656374732f2a2f6c" . - "6f636174696f6e732f2a2f7175657565732f2a2f7461736b732f2a7d3a63" . - "616e63656c4c656173653a012a129f010a0752756e5461736b122a2e676f" . - "6f676c652e636c6f75642e7461736b732e763262657461322e52756e5461" . - "736b526571756573741a202e676f6f676c652e636c6f75642e7461736b73" . - "2e763262657461322e5461736b224682d3e4930240223b2f763262657461" . - "322f7b6e616d653d70726f6a656374732f2a2f6c6f636174696f6e732f2a" . - "2f7175657565732f2a2f7461736b732f2a7d3a72756e3a012a427c0a1e63" . - "6f6d2e676f6f676c652e636c6f75642e7461736b732e7632626574613242" . - "0f436c6f75645461736b7350726f746f50015a3f676f6f676c652e676f6c" . - "616e672e6f72672f67656e70726f746f2f676f6f676c65617069732f636c" . - "6f75642f7461736b732f763262657461323b7461736b73a202055441534b" . - "53620670726f746f33" + "6b732e763262657461322e5175657565224482d3e493023e32352f763262" . + "657461322f7b71756575652e6e616d653d70726f6a656374732f2a2f6c6f" . + "636174696f6e732f2a2f7175657565732f2a7d3a057175657565128e010a" . + "0b44656c6574655175657565122e2e676f6f676c652e636c6f75642e7461" . + "736b732e763262657461322e44656c657465517565756552657175657374" . + "1a162e676f6f676c652e70726f746f6275662e456d707479223782d3e493" . + "02312a2f2f763262657461322f7b6e616d653d70726f6a656374732f2a2f" . + "6c6f636174696f6e732f2a2f7175657565732f2a7d12a0010a0a50757267" . + "655175657565122d2e676f6f676c652e636c6f75642e7461736b732e7632" . + "62657461322e50757267655175657565526571756573741a212e676f6f67" . + "6c652e636c6f75642e7461736b732e763262657461322e51756575652240" . + "82d3e493023a22352f763262657461322f7b6e616d653d70726f6a656374" . + "732f2a2f6c6f636174696f6e732f2a2f7175657565732f2a7d3a70757267" . + "653a012a12a0010a0a50617573655175657565122d2e676f6f676c652e63" . + "6c6f75642e7461736b732e763262657461322e5061757365517565756552" . + "6571756573741a212e676f6f676c652e636c6f75642e7461736b732e7632" . + "62657461322e5175657565224082d3e493023a22352f763262657461322f" . + "7b6e616d653d70726f6a656374732f2a2f6c6f636174696f6e732f2a2f71" . + "75657565732f2a7d3a70617573653a012a12a3010a0b526573756d655175" . + "657565122e2e676f6f676c652e636c6f75642e7461736b732e7632626574" . + "61322e526573756d655175657565526571756573741a212e676f6f676c65" . + "2e636c6f75642e7461736b732e763262657461322e5175657565224182d3" . + "e493023b22362f763262657461322f7b6e616d653d70726f6a656374732f" . + "2a2f6c6f636174696f6e732f2a2f7175657565732f2a7d3a726573756d65" . + "3a012a1296010a0c47657449616d506f6c69637912222e676f6f676c652e" . + "69616d2e76312e47657449616d506f6c696379526571756573741a152e67" . + "6f6f676c652e69616d2e76312e506f6c696379224b82d3e493024522402f" . + "763262657461322f7b7265736f757263653d70726f6a656374732f2a2f6c" . + "6f636174696f6e732f2a2f7175657565732f2a7d3a67657449616d506f6c" . + "6963793a012a1296010a0c53657449616d506f6c69637912222e676f6f67" . + "6c652e69616d2e76312e53657449616d506f6c696379526571756573741a" . + "152e676f6f676c652e69616d2e76312e506f6c696379224b82d3e4930245" . + "22402f763262657461322f7b7265736f757263653d70726f6a656374732f" . + "2a2f6c6f636174696f6e732f2a2f7175657565732f2a7d3a73657449616d" . + "506f6c6963793a012a12bc010a125465737449616d5065726d697373696f" . + "6e7312282e676f6f676c652e69616d2e76312e5465737449616d5065726d" . + "697373696f6e73526571756573741a292e676f6f676c652e69616d2e7631" . + "2e5465737449616d5065726d697373696f6e73526573706f6e7365225182" . + "d3e493024b22462f763262657461322f7b7265736f757263653d70726f6a" . + "656374732f2a2f6c6f636174696f6e732f2a2f7175657565732f2a7d3a74" . + "65737449616d5065726d697373696f6e733a012a12a9010a094c69737454" . + "61736b73122c2e676f6f676c652e636c6f75642e7461736b732e76326265" . + "7461322e4c6973745461736b73526571756573741a2d2e676f6f676c652e" . + "636c6f75642e7461736b732e763262657461322e4c6973745461736b7352" . + "6573706f6e7365223f82d3e493023912372f763262657461322f7b706172" . + "656e743d70726f6a656374732f2a2f6c6f636174696f6e732f2a2f717565" . + "7565732f2a7d2f7461736b731298010a074765745461736b122a2e676f6f" . + "676c652e636c6f75642e7461736b732e763262657461322e476574546173" . + "6b526571756573741a202e676f6f676c652e636c6f75642e7461736b732e" . + "763262657461322e5461736b223f82d3e493023912372f76326265746132" . + "2f7b6e616d653d70726f6a656374732f2a2f6c6f636174696f6e732f2a2f" . + "7175657565732f2a2f7461736b732f2a7d12a1010a0a4372656174655461" . + "736b122d2e676f6f676c652e636c6f75642e7461736b732e763262657461" . + "322e4372656174655461736b526571756573741a202e676f6f676c652e63" . + "6c6f75642e7461736b732e763262657461322e5461736b224282d3e49302" . + "3c22372f763262657461322f7b706172656e743d70726f6a656374732f2a" . + "2f6c6f636174696f6e732f2a2f7175657565732f2a7d2f7461736b733a01" . + "2a1294010a0a44656c6574655461736b122d2e676f6f676c652e636c6f75" . + "642e7461736b732e763262657461322e44656c6574655461736b52657175" . + "6573741a162e676f6f676c652e70726f746f6275662e456d707479223f82" . + "d3e49302392a372f763262657461322f7b6e616d653d70726f6a65637473" . + "2f2a2f6c6f636174696f6e732f2a2f7175657565732f2a2f7461736b732f" . + "2a7d12b5010a0a4c656173655461736b73122d2e676f6f676c652e636c6f" . + "75642e7461736b732e763262657461322e4c656173655461736b73526571" . + "756573741a2e2e676f6f676c652e636c6f75642e7461736b732e76326265" . + "7461322e4c656173655461736b73526573706f6e7365224882d3e4930242" . + "223d2f763262657461322f7b706172656e743d70726f6a656374732f2a2f" . + "6c6f636174696f6e732f2a2f7175657565732f2a7d2f7461736b733a6c65" . + "6173653a012a12ad010a0f41636b6e6f776c656467655461736b12322e67" . + "6f6f676c652e636c6f75642e7461736b732e763262657461322e41636b6e" . + "6f776c656467655461736b526571756573741a162e676f6f676c652e7072" . + "6f746f6275662e456d707479224e82d3e493024822432f76326265746132" . + "2f7b6e616d653d70726f6a656374732f2a2f6c6f636174696f6e732f2a2f" . + "7175657565732f2a2f7461736b732f2a7d3a61636b6e6f776c656467653a" . + "012a12ac010a0a52656e65774c65617365122d2e676f6f676c652e636c6f" . + "75642e7461736b732e763262657461322e52656e65774c65617365526571" . + "756573741a202e676f6f676c652e636c6f75642e7461736b732e76326265" . + "7461322e5461736b224d82d3e493024722422f763262657461322f7b6e61" . + "6d653d70726f6a656374732f2a2f6c6f636174696f6e732f2a2f71756575" . + "65732f2a2f7461736b732f2a7d3a72656e65774c656173653a012a12af01" . + "0a0b43616e63656c4c65617365122e2e676f6f676c652e636c6f75642e74" . + "61736b732e763262657461322e43616e63656c4c65617365526571756573" . + "741a202e676f6f676c652e636c6f75642e7461736b732e76326265746132" . + "2e5461736b224e82d3e493024822432f763262657461322f7b6e616d653d" . + "70726f6a656374732f2a2f6c6f636174696f6e732f2a2f7175657565732f" . + "2a2f7461736b732f2a7d3a63616e63656c4c656173653a012a129f010a07" . + "52756e5461736b122a2e676f6f676c652e636c6f75642e7461736b732e76" . + "3262657461322e52756e5461736b526571756573741a202e676f6f676c65" . + "2e636c6f75642e7461736b732e763262657461322e5461736b224682d3e4" . + "930240223b2f763262657461322f7b6e616d653d70726f6a656374732f2a" . + "2f6c6f636174696f6e732f2a2f7175657565732f2a2f7461736b732f2a7d" . + "3a72756e3a012a427c0a1e636f6d2e676f6f676c652e636c6f75642e7461" . + "736b732e76326265746132420f436c6f75645461736b7350726f746f5001" . + "5a3f676f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f67" . + "6f6f676c65617069732f636c6f75642f7461736b732f763262657461323b" . + "7461736b73a202055441534b53620670726f746f33" )); static::$is_initialized = true; diff --git a/Tasks/src/V2beta2/AcknowledgeTaskRequest.php b/Tasks/src/V2beta2/AcknowledgeTaskRequest.php index bfa0ca1f35af..d9fe5f3b28a7 100644 --- a/Tasks/src/V2beta2/AcknowledgeTaskRequest.php +++ b/Tasks/src/V2beta2/AcknowledgeTaskRequest.php @@ -36,9 +36,28 @@ class AcknowledgeTaskRequest extends \Google\Protobuf\Internal\Message */ private $schedule_time = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. + * The task name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + * @type \Google\Protobuf\Timestamp $schedule_time + * Required. + * The task's current schedule time, available in the + * [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] returned by + * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] response or + * [RenewLease][google.cloud.tasks.v2beta2.CloudTasks.RenewLease] response. This restriction is + * to ensure that your worker currently holds the lease. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Cloudtasks::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Tasks/src/V2beta2/AppEngineHttpRequest.php b/Tasks/src/V2beta2/AppEngineHttpRequest.php index c1e7ce7e59f5..9f02a42f8f5e 100644 --- a/Tasks/src/V2beta2/AppEngineHttpRequest.php +++ b/Tasks/src/V2beta2/AppEngineHttpRequest.php @@ -15,15 +15,15 @@ * This proto can only be used for tasks in a queue which has * [app_engine_http_target][google.cloud.tasks.v2beta2.Queue.app_engine_http_target] set. * Using [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] requires - * [`appengine.applications.get`](/appengine/docs/admin-api/access-control) + * [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control) * Google IAM permission for the project * and the following scope: * `https://www.googleapis.com/auth/cloud-platform` * The task will be delivered to the App Engine app which belongs to the same * project as the queue. For more information, see - * [How Requests are Routed](/appengine/docs/standard/python/how-requests-are-routed) + * [How Requests are Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) * and how routing is affected by - * [dispatch files](/appengine/docs/python/config/dispatchref). + * [dispatch files](https://cloud.google.com/appengine/docs/python/config/dispatchref). * The [AppEngineRouting][google.cloud.tasks.v2beta2.AppEngineRouting] used to construct the URL that the task is * delivered to can be set at the queue-level or task-level: * * If set, @@ -51,10 +51,10 @@ class AppEngineHttpRequest extends \Google\Protobuf\Internal\Message * The app's request handler for the task's target URL must be able to handle * HTTP requests with this http_method, otherwise the task attempt will fail * with error code 405 (Method Not Allowed). See - * [Writing a push task request handler](/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) + * [Writing a push task request handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) * and the documentation for the request handlers in the language your app is * written in e.g. - * [Python Request Handler](/appengine/docs/python/tools/webapp/requesthandlerclass). + * [Python Request Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). * * Generated from protobuf field .google.cloud.tasks.v2beta2.HttpMethod http_method = 1; */ @@ -83,7 +83,7 @@ class AppEngineHttpRequest extends \Google\Protobuf\Internal\Message * HTTP request headers. * This map contains the header field names and values. * Headers can be set when the - * [task is created](google.cloud.tasks.v2beta2.CloudTasks.CreateTask). + * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]. * Repeated headers are not supported but a header value can contain commas. * Cloud Tasks sets some headers to default values: * * `User-Agent`: By default, this header is @@ -96,7 +96,7 @@ class AppEngineHttpRequest extends \Google\Protobuf\Internal\Message * * `Content-Type`: By default, the `Content-Type` header is set to * `"application/octet-stream"`. The default can be overridden by explicitly * setting `Content-Type` to a particular media type when the - * [task is created](google.cloud.tasks.v2beta2.CloudTasks.CreateTask). + * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]. * For example, `Content-Type` can be set to `"application/json"`. * * `Content-Length`: This is computed by Cloud Tasks. This value is * output only. It cannot be changed. @@ -106,7 +106,7 @@ class AppEngineHttpRequest extends \Google\Protobuf\Internal\Message * * `X-AppEngine-*` * In addition, Cloud Tasks sets some headers when the task is dispatched, * such as headers containing information about the task; see - * [request headers](/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). + * [request headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). * These headers are set only when the task is dispatched, so they are not * visible when the task is returned in a Cloud Tasks response. * Although there is no specific limit for the maximum number of headers or @@ -127,9 +127,77 @@ class AppEngineHttpRequest extends \Google\Protobuf\Internal\Message */ private $payload = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $http_method + * The HTTP method to use for the request. The default is POST. + * The app's request handler for the task's target URL must be able to handle + * HTTP requests with this http_method, otherwise the task attempt will fail + * with error code 405 (Method Not Allowed). See + * [Writing a push task request handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) + * and the documentation for the request handlers in the language your app is + * written in e.g. + * [Python Request Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). + * @type \Google\Cloud\Tasks\V2beta2\AppEngineRouting $app_engine_routing + * Task-level setting for App Engine routing. + * If set, + * [app_engine_routing_override][google.cloud.tasks.v2beta2.AppEngineHttpTarget.app_engine_routing_override] + * is used for all tasks in the queue, no matter what the setting is for the + * [task-level app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing]. + * @type string $relative_url + * The relative URL. + * The relative URL must begin with "/" and must be a valid HTTP relative URL. + * It can contain a path and query string arguments. + * If the relative URL is empty, then the root path "/" will be used. + * No spaces are allowed, and the maximum length allowed is 2083 characters. + * @type array|\Google\Protobuf\Internal\MapField $headers + * HTTP request headers. + * This map contains the header field names and values. + * Headers can be set when the + * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]. + * Repeated headers are not supported but a header value can contain commas. + * Cloud Tasks sets some headers to default values: + * * `User-Agent`: By default, this header is + * `"AppEngine-Google; (+http://code.google.com/appengine)"`. + * This header can be modified, but Cloud Tasks will append + * `"AppEngine-Google; (+http://code.google.com/appengine)"` to the + * modified `User-Agent`. + * If the task has a [payload][google.cloud.tasks.v2beta2.AppEngineHttpRequest.payload], Cloud + * Tasks sets the following headers: + * * `Content-Type`: By default, the `Content-Type` header is set to + * `"application/octet-stream"`. The default can be overridden by explicitly + * setting `Content-Type` to a particular media type when the + * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]. + * For example, `Content-Type` can be set to `"application/json"`. + * * `Content-Length`: This is computed by Cloud Tasks. This value is + * output only. It cannot be changed. + * The headers below cannot be set or overridden: + * * `Host` + * * `X-Google-*` + * * `X-AppEngine-*` + * In addition, Cloud Tasks sets some headers when the task is dispatched, + * such as headers containing information about the task; see + * [request headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). + * These headers are set only when the task is dispatched, so they are not + * visible when the task is returned in a Cloud Tasks response. + * Although there is no specific limit for the maximum number of headers or + * the size, there is a limit on the maximum size of the [Task][google.cloud.tasks.v2beta2.Task]. For more + * information, see the [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask] documentation. + * @type string $payload + * Payload. + * The payload will be sent as the HTTP message body. A message + * body, and thus a payload, is allowed only if the HTTP method is + * POST or PUT. It is an error to set a data payload on a task with + * an incompatible [HttpMethod][google.cloud.tasks.v2beta2.HttpMethod]. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Target::initOnce(); - parent::__construct(); + parent::__construct($data); } /** @@ -137,10 +205,10 @@ public function __construct() { * The app's request handler for the task's target URL must be able to handle * HTTP requests with this http_method, otherwise the task attempt will fail * with error code 405 (Method Not Allowed). See - * [Writing a push task request handler](/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) + * [Writing a push task request handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) * and the documentation for the request handlers in the language your app is * written in e.g. - * [Python Request Handler](/appengine/docs/python/tools/webapp/requesthandlerclass). + * [Python Request Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). * * Generated from protobuf field .google.cloud.tasks.v2beta2.HttpMethod http_method = 1; * @return int @@ -155,10 +223,10 @@ public function getHttpMethod() * The app's request handler for the task's target URL must be able to handle * HTTP requests with this http_method, otherwise the task attempt will fail * with error code 405 (Method Not Allowed). See - * [Writing a push task request handler](/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) + * [Writing a push task request handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) * and the documentation for the request handlers in the language your app is * written in e.g. - * [Python Request Handler](/appengine/docs/python/tools/webapp/requesthandlerclass). + * [Python Request Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). * * Generated from protobuf field .google.cloud.tasks.v2beta2.HttpMethod http_method = 1; * @param int $var @@ -244,7 +312,7 @@ public function setRelativeUrl($var) * HTTP request headers. * This map contains the header field names and values. * Headers can be set when the - * [task is created](google.cloud.tasks.v2beta2.CloudTasks.CreateTask). + * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]. * Repeated headers are not supported but a header value can contain commas. * Cloud Tasks sets some headers to default values: * * `User-Agent`: By default, this header is @@ -257,7 +325,7 @@ public function setRelativeUrl($var) * * `Content-Type`: By default, the `Content-Type` header is set to * `"application/octet-stream"`. The default can be overridden by explicitly * setting `Content-Type` to a particular media type when the - * [task is created](google.cloud.tasks.v2beta2.CloudTasks.CreateTask). + * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]. * For example, `Content-Type` can be set to `"application/json"`. * * `Content-Length`: This is computed by Cloud Tasks. This value is * output only. It cannot be changed. @@ -267,7 +335,7 @@ public function setRelativeUrl($var) * * `X-AppEngine-*` * In addition, Cloud Tasks sets some headers when the task is dispatched, * such as headers containing information about the task; see - * [request headers](/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). + * [request headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). * These headers are set only when the task is dispatched, so they are not * visible when the task is returned in a Cloud Tasks response. * Although there is no specific limit for the maximum number of headers or @@ -286,7 +354,7 @@ public function getHeaders() * HTTP request headers. * This map contains the header field names and values. * Headers can be set when the - * [task is created](google.cloud.tasks.v2beta2.CloudTasks.CreateTask). + * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]. * Repeated headers are not supported but a header value can contain commas. * Cloud Tasks sets some headers to default values: * * `User-Agent`: By default, this header is @@ -299,7 +367,7 @@ public function getHeaders() * * `Content-Type`: By default, the `Content-Type` header is set to * `"application/octet-stream"`. The default can be overridden by explicitly * setting `Content-Type` to a particular media type when the - * [task is created](google.cloud.tasks.v2beta2.CloudTasks.CreateTask). + * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]. * For example, `Content-Type` can be set to `"application/json"`. * * `Content-Length`: This is computed by Cloud Tasks. This value is * output only. It cannot be changed. @@ -309,7 +377,7 @@ public function getHeaders() * * `X-AppEngine-*` * In addition, Cloud Tasks sets some headers when the task is dispatched, * such as headers containing information about the task; see - * [request headers](/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). + * [request headers](https://cloud.google.com/appengine/docs/python/taskqueue/push/creating-handlers#reading_request_headers). * These headers are set only when the task is dispatched, so they are not * visible when the task is returned in a Cloud Tasks response. * Although there is no specific limit for the maximum number of headers or diff --git a/Tasks/src/V2beta2/AppEngineHttpTarget.php b/Tasks/src/V2beta2/AppEngineHttpTarget.php index 177129a052f1..66276398bf42 100644 --- a/Tasks/src/V2beta2/AppEngineHttpTarget.php +++ b/Tasks/src/V2beta2/AppEngineHttpTarget.php @@ -15,7 +15,7 @@ * The documentation for [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] explains how the * task's host URL is constructed. * Using [AppEngineHttpTarget][google.cloud.tasks.v2beta2.AppEngineHttpTarget] requires - * [`appengine.applications.get`](/appengine/docs/admin-api/access-control) + * [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control) * Google IAM permission for the project * and the following scope: * `https://www.googleapis.com/auth/cloud-platform` @@ -35,9 +35,23 @@ class AppEngineHttpTarget extends \Google\Protobuf\Internal\Message */ private $app_engine_routing_override = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Tasks\V2beta2\AppEngineRouting $app_engine_routing_override + * Overrides for the + * [task-level app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing]. + * If set, `app_engine_routing_override` is used for all tasks in + * the queue, no matter what the setting is for the + * [task-level app_engine_routing][google.cloud.tasks.v2beta2.AppEngineHttpRequest.app_engine_routing]. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Target::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Tasks/src/V2beta2/AppEngineRouting.php b/Tasks/src/V2beta2/AppEngineRouting.php index 96fd9e7f0498..b24d22cc0aaa 100644 --- a/Tasks/src/V2beta2/AppEngineRouting.php +++ b/Tasks/src/V2beta2/AppEngineRouting.php @@ -11,10 +11,10 @@ /** * App Engine Routing. * For more information about services, versions, and instances see - * [An Overview of App Engine](/appengine/docs/python/an-overview-of-app-engine), - * [Microservices Architecture on Google App Engine](/appengine/docs/python/microservices-on-app-engine), - * [App Engine Standard request routing](/appengine/docs/standard/python/how-requests-are-routed), - * and [App Engine Flex request routing](/appengine/docs/flexible/python/how-requests-are-routed). + * [An Overview of App Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), + * [Microservices Architecture on Google App Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), + * [App Engine Standard request routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), + * and [App Engine Flex request routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). * * Generated from protobuf message google.cloud.tasks.v2beta2.AppEngineRouting */ @@ -63,10 +63,10 @@ class AppEngineRouting extends \Google\Protobuf\Internal\Message * By default, the task is sent to an instance which is available when * the task is attempted. * Requests can only be sent to a specific instance if - * [manual scaling is used in App Engine Standard](/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). + * [manual scaling is used in App Engine Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). * App Engine Flex does not support instances. For more information, see - * [App Engine Standard request routing](/appengine/docs/standard/python/how-requests-are-routed) - * and [App Engine Flex request routing](/appengine/docs/flexible/python/how-requests-are-routed). + * [App Engine Standard request routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) + * and [App Engine Flex request routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). * * Generated from protobuf field string instance = 3; */ @@ -74,7 +74,7 @@ class AppEngineRouting extends \Google\Protobuf\Internal\Message /** * Output only. The host that the task is sent to. * For more information, see - * [How Requests are Routed](/appengine/docs/standard/python/how-requests-are-routed). + * [How Requests are Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). * The host is constructed as: * * `host = [application_domain_name]`
* `| [service] + '.' + [application_domain_name]`
@@ -121,9 +121,101 @@ class AppEngineRouting extends \Google\Protobuf\Internal\Message */ private $host = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service + * App service. + * By default, the task is sent to the service which is the default + * service when the task is attempted. + * For some queues or tasks which were created using the App Engine + * Task Queue API, [host][google.cloud.tasks.v2beta2.AppEngineRouting.host] is not parsable + * into [service][google.cloud.tasks.v2beta2.AppEngineRouting.service], + * [version][google.cloud.tasks.v2beta2.AppEngineRouting.version], and + * [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance]. For example, some tasks + * which were created using the App Engine SDK use a custom domain + * name; custom domains are not parsed by Cloud Tasks. If + * [host][google.cloud.tasks.v2beta2.AppEngineRouting.host] is not parsable, then + * [service][google.cloud.tasks.v2beta2.AppEngineRouting.service], + * [version][google.cloud.tasks.v2beta2.AppEngineRouting.version], and + * [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] are the empty string. + * @type string $version + * App version. + * By default, the task is sent to the version which is the default + * version when the task is attempted. + * For some queues or tasks which were created using the App Engine + * Task Queue API, [host][google.cloud.tasks.v2beta2.AppEngineRouting.host] is not parsable + * into [service][google.cloud.tasks.v2beta2.AppEngineRouting.service], + * [version][google.cloud.tasks.v2beta2.AppEngineRouting.version], and + * [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance]. For example, some tasks + * which were created using the App Engine SDK use a custom domain + * name; custom domains are not parsed by Cloud Tasks. If + * [host][google.cloud.tasks.v2beta2.AppEngineRouting.host] is not parsable, then + * [service][google.cloud.tasks.v2beta2.AppEngineRouting.service], + * [version][google.cloud.tasks.v2beta2.AppEngineRouting.version], and + * [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] are the empty string. + * @type string $instance + * App instance. + * By default, the task is sent to an instance which is available when + * the task is attempted. + * Requests can only be sent to a specific instance if + * [manual scaling is used in App Engine Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). + * App Engine Flex does not support instances. For more information, see + * [App Engine Standard request routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) + * and [App Engine Flex request routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). + * @type string $host + * Output only. The host that the task is sent to. + * For more information, see + * [How Requests are Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). + * The host is constructed as: + * * `host = [application_domain_name]`
+ * `| [service] + '.' + [application_domain_name]`
+ * `| [version] + '.' + [application_domain_name]`
+ * `| [version_dot_service]+ '.' + [application_domain_name]`
+ * `| [instance] + '.' + [application_domain_name]`
+ * `| [instance_dot_service] + '.' + [application_domain_name]`
+ * `| [instance_dot_version] + '.' + [application_domain_name]`
+ * `| [instance_dot_version_dot_service] + '.' + [application_domain_name]` + * * `application_domain_name` = The domain name of the app, for + * example .appspot.com, which is associated with the + * queue's project ID. Some tasks which were created using the App Engine + * SDK use a custom domain name. + * * `service =` [service][google.cloud.tasks.v2beta2.AppEngineRouting.service] + * * `version =` [version][google.cloud.tasks.v2beta2.AppEngineRouting.version] + * * `version_dot_service =` + * [version][google.cloud.tasks.v2beta2.AppEngineRouting.version] `+ '.' +` + * [service][google.cloud.tasks.v2beta2.AppEngineRouting.service] + * * `instance =` [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] + * * `instance_dot_service =` + * [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] `+ '.' +` + * [service][google.cloud.tasks.v2beta2.AppEngineRouting.service] + * * `instance_dot_version =` + * [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] `+ '.' +` + * [version][google.cloud.tasks.v2beta2.AppEngineRouting.version] + * * `instance_dot_version_dot_service =` + * [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] `+ '.' +` + * [version][google.cloud.tasks.v2beta2.AppEngineRouting.version] `+ '.' +` + * [service][google.cloud.tasks.v2beta2.AppEngineRouting.service] + * If [service][google.cloud.tasks.v2beta2.AppEngineRouting.service] is empty, then the task will be sent + * to the service which is the default service when the task is attempted. + * If [version][google.cloud.tasks.v2beta2.AppEngineRouting.version] is empty, then the task will be sent + * to the version which is the default version when the task is attempted. + * If [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] is empty, then the task + * will be sent to an instance which is available when the task is + * attempted. + * If [service][google.cloud.tasks.v2beta2.AppEngineRouting.service], + * [version][google.cloud.tasks.v2beta2.AppEngineRouting.version], or + * [instance][google.cloud.tasks.v2beta2.AppEngineRouting.instance] is invalid, then the task + * will be sent to the default version of the default service when + * the task is attempted. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Target::initOnce(); - parent::__construct(); + parent::__construct($data); } /** @@ -235,10 +327,10 @@ public function setVersion($var) * By default, the task is sent to an instance which is available when * the task is attempted. * Requests can only be sent to a specific instance if - * [manual scaling is used in App Engine Standard](/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). + * [manual scaling is used in App Engine Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). * App Engine Flex does not support instances. For more information, see - * [App Engine Standard request routing](/appengine/docs/standard/python/how-requests-are-routed) - * and [App Engine Flex request routing](/appengine/docs/flexible/python/how-requests-are-routed). + * [App Engine Standard request routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) + * and [App Engine Flex request routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). * * Generated from protobuf field string instance = 3; * @return string @@ -253,10 +345,10 @@ public function getInstance() * By default, the task is sent to an instance which is available when * the task is attempted. * Requests can only be sent to a specific instance if - * [manual scaling is used in App Engine Standard](/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). + * [manual scaling is used in App Engine Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). * App Engine Flex does not support instances. For more information, see - * [App Engine Standard request routing](/appengine/docs/standard/python/how-requests-are-routed) - * and [App Engine Flex request routing](/appengine/docs/flexible/python/how-requests-are-routed). + * [App Engine Standard request routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) + * and [App Engine Flex request routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). * * Generated from protobuf field string instance = 3; * @param string $var @@ -273,7 +365,7 @@ public function setInstance($var) /** * Output only. The host that the task is sent to. * For more information, see - * [How Requests are Routed](/appengine/docs/standard/python/how-requests-are-routed). + * [How Requests are Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). * The host is constructed as: * * `host = [application_domain_name]`
* `| [service] + '.' + [application_domain_name]`
@@ -327,7 +419,7 @@ public function getHost() /** * Output only. The host that the task is sent to. * For more information, see - * [How Requests are Routed](/appengine/docs/standard/python/how-requests-are-routed). + * [How Requests are Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). * The host is constructed as: * * `host = [application_domain_name]`
* `| [service] + '.' + [application_domain_name]`
diff --git a/Tasks/src/V2beta2/AttemptStatus.php b/Tasks/src/V2beta2/AttemptStatus.php index 4ed76802667a..2287d90af98d 100644 --- a/Tasks/src/V2beta2/AttemptStatus.php +++ b/Tasks/src/V2beta2/AttemptStatus.php @@ -45,9 +45,30 @@ class AttemptStatus extends \Google\Protobuf\Internal\Message */ private $response_status = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $schedule_time + * Output only. The time that this attempt was scheduled. + * `schedule_time` will be truncated to the nearest microsecond. + * @type \Google\Protobuf\Timestamp $dispatch_time + * Output only. The time that this attempt was dispatched. + * `dispatch_time` will be truncated to the nearest microsecond. + * @type \Google\Protobuf\Timestamp $response_time + * Output only. The time that this attempt response was received. + * `response_time` will be truncated to the nearest microsecond. + * @type \Google\Rpc\Status $response_status + * Output only. The response from the target for this attempt. + * If the task has not been attempted or the task is currently running + * then the response status is unset. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Task::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Tasks/src/V2beta2/CancelLeaseRequest.php b/Tasks/src/V2beta2/CancelLeaseRequest.php index 218cd017cf2d..d178ae24f60d 100644 --- a/Tasks/src/V2beta2/CancelLeaseRequest.php +++ b/Tasks/src/V2beta2/CancelLeaseRequest.php @@ -44,16 +44,46 @@ class CancelLeaseRequest extends \Google\Protobuf\Internal\Message * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 3; */ private $response_view = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. + * The task name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + * @type \Google\Protobuf\Timestamp $schedule_time + * Required. + * The task's current schedule time, available in the + * [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] returned by + * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] response or + * [RenewLease][google.cloud.tasks.v2beta2.CloudTasks.RenewLease] response. This restriction is + * to ensure that your worker currently holds the lease. + * @type int $response_view + * The response_view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] will be + * returned. + * By default response_view is [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all + * information is retrieved by default because some data, such as + * payloads, might be desirable to return only when needed because + * of its large size or because of the sensitivity of data that it + * contains. + * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Cloudtasks::initOnce(); - parent::__construct(); + parent::__construct($data); } /** @@ -131,8 +161,8 @@ public function setScheduleTime($var) * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 3; * @return int @@ -151,8 +181,8 @@ public function getResponseView() * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 3; * @param int $var diff --git a/Tasks/src/V2beta2/CloudTasksGrpcClient.php b/Tasks/src/V2beta2/CloudTasksGrpcClient.php index f5dfab7c4aa9..725f2ac3cd15 100644 --- a/Tasks/src/V2beta2/CloudTasksGrpcClient.php +++ b/Tasks/src/V2beta2/CloudTasksGrpcClient.php @@ -2,7 +2,7 @@ // GENERATED CODE -- DO NOT EDIT! // Original file comments: -// Copyright 2018 Google Inc. +// Copyright 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -73,7 +73,7 @@ public function GetQueue(\Google\Cloud\Tasks\V2beta2\GetQueueRequest $argument, * WARNING: Using this method may have unintended side effects if you are * using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. * Read - * [Overview of Queue Management and queue.yaml](/cloud-tasks/docs/queue-yaml) + * [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) * before using this method. * @param \Google\Cloud\Tasks\V2beta2\CreateQueueRequest $argument input argument * @param array $metadata metadata @@ -100,7 +100,7 @@ public function CreateQueue(\Google\Cloud\Tasks\V2beta2\CreateQueueRequest $argu * WARNING: Using this method may have unintended side effects if you are * using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. * Read - * [Overview of Queue Management and queue.yaml](/cloud-tasks/docs/queue-yaml) + * [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) * before using this method. * @param \Google\Cloud\Tasks\V2beta2\UpdateQueueRequest $argument input argument * @param array $metadata metadata @@ -125,7 +125,7 @@ public function UpdateQueue(\Google\Cloud\Tasks\V2beta2\UpdateQueueRequest $argu * WARNING: Using this method may have unintended side effects if you are * using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. * Read - * [Overview of Queue Management and queue.yaml](/cloud-tasks/docs/queue-yaml) + * [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) * before using this method. * @param \Google\Cloud\Tasks\V2beta2\DeleteQueueRequest $argument input argument * @param array $metadata metadata @@ -190,7 +190,7 @@ public function PauseQueue(\Google\Cloud\Tasks\V2beta2\PauseQueueRequest $argume * WARNING: Resuming many high-QPS queues at the same time can * lead to target overloading. If you are resuming high-QPS * queues, follow the 500/50/5 pattern described in - * [Managing Cloud Tasks Scaling Risks](/cloud-tasks/pdfs/managing-cloud-tasks-scaling-risks-2017-06-05.pdf). + * [Managing Cloud Tasks Scaling Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling). * @param \Google\Cloud\Tasks\V2beta2\ResumeQueueRequest $argument input argument * @param array $metadata metadata * @param array $options call options @@ -208,8 +208,9 @@ public function ResumeQueue(\Google\Cloud\Tasks\V2beta2\ResumeQueueRequest $argu * Returns an empty policy if the resource exists and does not have a policy * set. * - * Authorization requires the following [Google IAM](/iam) permission on the - * specified resource parent: + * Authorization requires the following + * [Google IAM](https://cloud.google.com/iam) permission on the specified + * resource parent: * * * `cloudtasks.queues.getIamPolicy` * @param \Google\Cloud\Iam\V1\GetIamPolicyRequest $argument input argument @@ -231,8 +232,9 @@ public function GetIamPolicy(\Google\Cloud\Iam\V1\GetIamPolicyRequest $argument, * Note: The Cloud Console does not check queue-level IAM permissions yet. * Project-level permissions are required to use the Cloud Console. * - * Authorization requires the following [Google IAM](/iam) permission on the - * specified resource parent: + * Authorization requires the following + * [Google IAM](https://cloud.google.com/iam) permission on the specified + * resource parent: * * * `cloudtasks.queues.setIamPolicy` * @param \Google\Cloud\Iam\V1\SetIamPolicyRequest $argument input argument @@ -274,6 +276,9 @@ public function TestIamPermissions(\Google\Cloud\Iam\V1\TestIamPermissionsReques * due to performance considerations; * [response_view][google.cloud.tasks.v2beta2.ListTasksRequest.response_view] controls the * subset of information which is returned. + * + * The tasks may be returned in any order. The ordering may change at any + * time. * @param \Google\Cloud\Tasks\V2beta2\ListTasksRequest $argument input argument * @param array $metadata metadata * @param array $options call options @@ -305,10 +310,9 @@ public function GetTask(\Google\Cloud\Tasks\V2beta2\GetTaskRequest $argument, * * Tasks cannot be updated after creation; there is no UpdateTask command. * - * * For [App Engine queues](google.cloud.tasks.v2beta2.AppEngineHttpTarget), - * the maximum task size is 100KB. - * * For [pull queues](google.cloud.tasks.v2beta2.PullTarget), this - * the maximum task size is 1MB. + * * For [App Engine queues][google.cloud.tasks.v2beta2.AppEngineHttpTarget], the maximum task size is + * 100KB. + * * For [pull queues][google.cloud.tasks.v2beta2.PullTarget], the maximum task size is 1MB. * @param \Google\Cloud\Tasks\V2beta2\CreateTaskRequest $argument input argument * @param array $metadata metadata * @param array $options call options diff --git a/Tasks/src/V2beta2/CreateQueueRequest.php b/Tasks/src/V2beta2/CreateQueueRequest.php index ae179621fce5..a75b161c49cb 100644 --- a/Tasks/src/V2beta2/CreateQueueRequest.php +++ b/Tasks/src/V2beta2/CreateQueueRequest.php @@ -35,9 +35,28 @@ class CreateQueueRequest extends \Google\Protobuf\Internal\Message */ private $queue = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. + * The location name in which the queue will be created. + * For example: `projects/PROJECT_ID/locations/LOCATION_ID` + * The list of allowed locations can be obtained by calling Cloud + * Tasks' implementation of + * [ListLocations][google.cloud.location.Locations.ListLocations]. + * @type \Google\Cloud\Tasks\V2beta2\Queue $queue + * Required. + * The queue to create. + * [Queue's name][google.cloud.tasks.v2beta2.Queue.name] cannot be the same as an existing queue. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Cloudtasks::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Tasks/src/V2beta2/CreateTaskRequest.php b/Tasks/src/V2beta2/CreateTaskRequest.php index 1b9e6f638991..f0e21d59d547 100644 --- a/Tasks/src/V2beta2/CreateTaskRequest.php +++ b/Tasks/src/V2beta2/CreateTaskRequest.php @@ -67,16 +67,70 @@ class CreateTaskRequest extends \Google\Protobuf\Internal\Message * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 3; */ private $response_view = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. + * The queue name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + * The queue must already exist. + * @type \Google\Cloud\Tasks\V2beta2\Task $task + * Required. + * The task to add. + * Task names have the following format: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`. + * The user can optionally specify a task [name][google.cloud.tasks.v2beta2.Task.name]. If a + * name is not specified then the system will generate a random + * unique task id, which will be set in the task returned in the + * [response][google.cloud.tasks.v2beta2.Task.name]. + * If [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] is not set or is in the + * past then Cloud Tasks will set it to the current time. + * Task De-duplication: + * Explicitly specifying a task ID enables task de-duplication. If + * a task's ID is identical to that of an existing task or a task + * that was deleted or completed recently then the call will fail + * with [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS]. + * If the task's queue was created using Cloud Tasks, then another task with + * the same name can't be created for ~1hour after the original task was + * deleted or completed. If the task's queue was created using queue.yaml or + * queue.xml, then another task with the same name can't be created + * for ~9days after the original task was deleted or completed. + * Because there is an extra lookup cost to identify duplicate task + * names, these [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask] calls have significantly + * increased latency. Using hashed strings for the task id or for + * the prefix of the task id is recommended. Choosing task ids that + * are sequential or have sequential prefixes, for example using a + * timestamp, causes an increase in latency and error rates in all + * task commands. The infrastructure relies on an approximately + * uniform distribution of task ids to store and serve tasks + * efficiently. + * @type int $response_view + * The response_view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] will be + * returned. + * By default response_view is [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all + * information is retrieved by default because some data, such as + * payloads, might be desirable to return only when needed because + * of its large size or because of the sensitivity of data that it + * contains. + * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Cloudtasks::initOnce(); - parent::__construct(); + parent::__construct($data); } /** @@ -202,8 +256,8 @@ public function setTask($var) * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 3; * @return int @@ -222,8 +276,8 @@ public function getResponseView() * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 3; * @param int $var diff --git a/Tasks/src/V2beta2/DeleteQueueRequest.php b/Tasks/src/V2beta2/DeleteQueueRequest.php index 1c5777183e45..59d47465929a 100644 --- a/Tasks/src/V2beta2/DeleteQueueRequest.php +++ b/Tasks/src/V2beta2/DeleteQueueRequest.php @@ -24,9 +24,21 @@ class DeleteQueueRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. + * The queue name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Cloudtasks::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Tasks/src/V2beta2/DeleteTaskRequest.php b/Tasks/src/V2beta2/DeleteTaskRequest.php index 06b8cb9fe34f..dbd4b8b81945 100644 --- a/Tasks/src/V2beta2/DeleteTaskRequest.php +++ b/Tasks/src/V2beta2/DeleteTaskRequest.php @@ -25,9 +25,21 @@ class DeleteTaskRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. + * The task name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Cloudtasks::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Tasks/src/V2beta2/Gapic/CloudTasksGapicClient.php b/Tasks/src/V2beta2/Gapic/CloudTasksGapicClient.php index 7237f1628cce..af4b5f7756b4 100644 --- a/Tasks/src/V2beta2/Gapic/CloudTasksGapicClient.php +++ b/Tasks/src/V2beta2/Gapic/CloudTasksGapicClient.php @@ -544,7 +544,7 @@ public function getQueue($name, array $optionalArgs = []) * WARNING: Using this method may have unintended side effects if you are * using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. * Read - * [Overview of Queue Management and queue.yaml](https://cloud.google.com/cloud-tasks/docs/queue-yaml) + * [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) * before using this method. * * Sample code: @@ -621,7 +621,7 @@ public function createQueue($parent, $queue, array $optionalArgs = []) * WARNING: Using this method may have unintended side effects if you are * using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. * Read - * [Overview of Queue Management and queue.yaml](https://cloud.google.com/cloud-tasks/docs/queue-yaml) + * [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) * before using this method. * * Sample code: @@ -697,7 +697,7 @@ public function updateQueue($queue, array $optionalArgs = []) * WARNING: Using this method may have unintended side effects if you are * using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. * Read - * [Overview of Queue Management and queue.yaml](https://cloud.google.com/cloud-tasks/docs/queue-yaml) + * [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) * before using this method. * * Sample code: @@ -877,7 +877,7 @@ public function pauseQueue($name, array $optionalArgs = []) * WARNING: Resuming many high-QPS queues at the same time can * lead to target overloading. If you are resuming high-QPS * queues, follow the 500/50/5 pattern described in - * [Managing Cloud Tasks Scaling Risks](https://cloud.google.com/cloud-tasks/pdfs/managing-cloud-tasks-scaling-risks-2017-06-05.pdf). + * [Managing Cloud Tasks Scaling Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling). * * Sample code: * ``` @@ -934,8 +934,9 @@ public function resumeQueue($name, array $optionalArgs = []) * Returns an empty policy if the resource exists and does not have a policy * set. * - * Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission on the - * specified resource parent: + * Authorization requires the following + * [Google IAM](https://cloud.google.com/iam) permission on the specified + * resource parent: * * * `cloudtasks.queues.getIamPolicy` * @@ -995,8 +996,9 @@ public function getIamPolicy($resource, array $optionalArgs = []) * Note: The Cloud Console does not check queue-level IAM permissions yet. * Project-level permissions are required to use the Cloud Console. * - * Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission on the - * specified resource parent: + * Authorization requires the following + * [Google IAM](https://cloud.google.com/iam) permission on the specified + * resource parent: * * * `cloudtasks.queues.setIamPolicy` * @@ -1127,6 +1129,9 @@ public function testIamPermissions($resource, $permissions, array $optionalArgs * [response_view][google.cloud.tasks.v2beta2.ListTasksRequest.response_view] controls the * subset of information which is returned. * + * The tasks may be returned in any order. The ordering may change at any + * time. + * * Sample code: * ``` * $cloudTasksClient = new CloudTasksClient(); @@ -1168,14 +1173,9 @@ public function testIamPermissions($resource, $permissions, array $optionalArgs * contains. * * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. - * For allowed values, use constants defined on {@see \Google\Cloud\Tasks\V2beta2\Task_View} - * @type string $orderBy - * Sort order used for the query. The only fields supported for sorting - * are `schedule_time` and `pull_message.tag`. All results will be - * returned in approximately ascending order. The default ordering is by - * `schedule_time`. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * For allowed values, use constants defined on {@see \Google\Cloud\Tasks\V2beta2\Task\View} * @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 @@ -1204,9 +1204,6 @@ public function listTasks($parent, array $optionalArgs = []) if (isset($optionalArgs['responseView'])) { $request->setResponseView($optionalArgs['responseView']); } - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } if (isset($optionalArgs['pageSize'])) { $request->setPageSize($optionalArgs['pageSize']); } @@ -1261,9 +1258,9 @@ public function listTasks($parent, array $optionalArgs = []) * contains. * * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. - * For allowed values, use constants defined on {@see \Google\Cloud\Tasks\V2beta2\Task_View} + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * For allowed values, use constants defined on {@see \Google\Cloud\Tasks\V2beta2\Task\View} * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a * {@see Google\ApiCore\RetrySettings} object, or an associative array @@ -1304,10 +1301,9 @@ public function getTask($name, array $optionalArgs = []) * * Tasks cannot be updated after creation; there is no UpdateTask command. * - * * For [App Engine queues](https://cloud.google.comgoogle.cloud.tasks.v2beta2.AppEngineHttpTarget), - * the maximum task size is 100KB. - * * For [pull queues](https://cloud.google.comgoogle.cloud.tasks.v2beta2.PullTarget), this - * the maximum task size is 1MB. + * * For [App Engine queues][google.cloud.tasks.v2beta2.AppEngineHttpTarget], the maximum task size is + * 100KB. + * * For [pull queues][google.cloud.tasks.v2beta2.PullTarget], the maximum task size is 1MB. * * Sample code: * ``` @@ -1376,9 +1372,9 @@ public function getTask($name, array $optionalArgs = []) * contains. * * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. - * For allowed values, use constants defined on {@see \Google\Cloud\Tasks\V2beta2\Task_View} + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * For allowed values, use constants defined on {@see \Google\Cloud\Tasks\V2beta2\Task\View} * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a * {@see Google\ApiCore\RetrySettings} object, or an associative array @@ -1540,9 +1536,9 @@ public function deleteTask($name, array $optionalArgs = []) * contains. * * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. - * For allowed values, use constants defined on {@see \Google\Cloud\Tasks\V2beta2\Task_View} + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * For allowed values, use constants defined on {@see \Google\Cloud\Tasks\V2beta2\Task\View} * @type string $filter * `filter` can be used to specify a subset of tasks to lease. * @@ -1735,9 +1731,9 @@ public function acknowledgeTask($name, $scheduleTime, array $optionalArgs = []) * contains. * * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. - * For allowed values, use constants defined on {@see \Google\Cloud\Tasks\V2beta2\Task_View} + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * For allowed values, use constants defined on {@see \Google\Cloud\Tasks\V2beta2\Task\View} * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a * {@see Google\ApiCore\RetrySettings} object, or an associative array @@ -1820,9 +1816,9 @@ public function renewLease($name, $scheduleTime, $leaseDuration, array $optional * contains. * * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. - * For allowed values, use constants defined on {@see \Google\Cloud\Tasks\V2beta2\Task_View} + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * For allowed values, use constants defined on {@see \Google\Cloud\Tasks\V2beta2\Task\View} * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a * {@see Google\ApiCore\RetrySettings} object, or an associative array @@ -1917,9 +1913,9 @@ public function cancelLease($name, $scheduleTime, array $optionalArgs = []) * contains. * * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. - * For allowed values, use constants defined on {@see \Google\Cloud\Tasks\V2beta2\Task_View} + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * For allowed values, use constants defined on {@see \Google\Cloud\Tasks\V2beta2\Task\View} * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a * {@see Google\ApiCore\RetrySettings} object, or an associative array diff --git a/Tasks/src/V2beta2/GetQueueRequest.php b/Tasks/src/V2beta2/GetQueueRequest.php index 86cd724357d7..cd965950b498 100644 --- a/Tasks/src/V2beta2/GetQueueRequest.php +++ b/Tasks/src/V2beta2/GetQueueRequest.php @@ -24,9 +24,21 @@ class GetQueueRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. + * The resource name of the queue. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Cloudtasks::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Tasks/src/V2beta2/GetTaskRequest.php b/Tasks/src/V2beta2/GetTaskRequest.php index 979fee4bfdd3..e38041ef348f 100644 --- a/Tasks/src/V2beta2/GetTaskRequest.php +++ b/Tasks/src/V2beta2/GetTaskRequest.php @@ -32,16 +32,39 @@ class GetTaskRequest extends \Google\Protobuf\Internal\Message * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 2; */ private $response_view = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. + * The task name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + * @type int $response_view + * The response_view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] will be + * returned. + * By default response_view is [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all + * information is retrieved by default because some data, such as + * payloads, might be desirable to return only when needed because + * of its large size or because of the sensitivity of data that it + * contains. + * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Cloudtasks::initOnce(); - parent::__construct(); + parent::__construct($data); } /** @@ -83,8 +106,8 @@ public function setName($var) * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 2; * @return int @@ -103,8 +126,8 @@ public function getResponseView() * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 2; * @param int $var diff --git a/Tasks/src/V2beta2/HttpMethod.php b/Tasks/src/V2beta2/HttpMethod.php index 9efdcdbf8366..b8a9a4a8ee10 100644 --- a/Tasks/src/V2beta2/HttpMethod.php +++ b/Tasks/src/V2beta2/HttpMethod.php @@ -7,7 +7,7 @@ /** * The HTTP method used to execute the task. * - * Protobuf enum Google\Cloud\Tasks\V2beta2\HttpMethod + * Protobuf type google.cloud.tasks.v2beta2.HttpMethod */ class HttpMethod { @@ -18,31 +18,31 @@ class HttpMethod */ const HTTP_METHOD_UNSPECIFIED = 0; /** - * HTTP Post + * HTTP POST * * Generated from protobuf enum POST = 1; */ const POST = 1; /** - * HTTP Get + * HTTP GET * * Generated from protobuf enum GET = 2; */ const GET = 2; /** - * HTTP Head + * HTTP HEAD * * Generated from protobuf enum HEAD = 3; */ const HEAD = 3; /** - * HTTP Put + * HTTP PUT * * Generated from protobuf enum PUT = 4; */ const PUT = 4; /** - * HTTP Delete + * HTTP DELETE * * Generated from protobuf enum DELETE = 5; */ diff --git a/Tasks/src/V2beta2/LeaseTasksRequest.php b/Tasks/src/V2beta2/LeaseTasksRequest.php index f36ad2f26b03..4e260930846d 100644 --- a/Tasks/src/V2beta2/LeaseTasksRequest.php +++ b/Tasks/src/V2beta2/LeaseTasksRequest.php @@ -54,8 +54,8 @@ class LeaseTasksRequest extends \Google\Protobuf\Internal\Message * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 4; */ @@ -77,7 +77,7 @@ class LeaseTasksRequest extends \Google\Protobuf\Internal\Message * oldest task (ordered by schedule time). * SDK compatibility: Although the SDK allows tags to be either * string or - * [bytes](/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), + * [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), * only UTF-8 encoded tags can be used in Cloud Tasks. Tag which * aren't UTF-8 encoded can't be used in the * [filter][google.cloud.tasks.v2beta2.LeaseTasksRequest.filter] and the task's @@ -87,9 +87,68 @@ class LeaseTasksRequest extends \Google\Protobuf\Internal\Message */ private $filter = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. + * The queue name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + * @type int $max_tasks + * The maximum number of tasks to lease. + * The system will make a best effort to return as close to as + * `max_tasks` as possible. + * The largest that `max_tasks` can be is 1000. + * @type \Google\Protobuf\Duration $lease_duration + * After the worker has successfully finished the work associated + * with the task, the worker must call via + * [AcknowledgeTask][google.cloud.tasks.v2beta2.CloudTasks.AcknowledgeTask] before the + * [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time]. Otherwise the task will be + * returned to a later [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] call so + * that another worker can retry it. + * The maximum lease duration is 1 week. + * `lease_duration` will be truncated to the nearest second. + * @type int $response_view + * The response_view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] will be + * returned. + * By default response_view is [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all + * information is retrieved by default because some data, such as + * payloads, might be desirable to return only when needed because + * of its large size or because of the sensitivity of data that it + * contains. + * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * @type string $filter + * `filter` can be used to specify a subset of tasks to lease. + * When `filter` is set to `tag=` then the + * [response][google.cloud.tasks.v2beta2.LeaseTasksResponse] will contain only tasks whose + * [tag][google.cloud.tasks.v2beta2.PullMessage.tag] is equal to ``. `` must be + * less than 500 characters. + * When `filter` is set to `tag_function=oldest_tag()`, only tasks which have + * the same tag as the task with the oldest + * [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] will be returned. + * Grammar Syntax: + * * `filter = "tag=" tag | "tag_function=" function` + * * `tag = string` + * * `function = "oldest_tag()"` + * The `oldest_tag()` function returns tasks which have the same tag as the + * oldest task (ordered by schedule time). + * SDK compatibility: Although the SDK allows tags to be either + * string or + * [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), + * only UTF-8 encoded tags can be used in Cloud Tasks. Tag which + * aren't UTF-8 encoded can't be used in the + * [filter][google.cloud.tasks.v2beta2.LeaseTasksRequest.filter] and the task's + * [tag][google.cloud.tasks.v2beta2.PullMessage.tag] will be displayed as empty in Cloud Tasks. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Cloudtasks::initOnce(); - parent::__construct(); + parent::__construct($data); } /** @@ -203,8 +262,8 @@ public function setLeaseDuration($var) * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 4; * @return int @@ -223,8 +282,8 @@ public function getResponseView() * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 4; * @param int $var @@ -255,7 +314,7 @@ public function setResponseView($var) * oldest task (ordered by schedule time). * SDK compatibility: Although the SDK allows tags to be either * string or - * [bytes](/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), + * [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), * only UTF-8 encoded tags can be used in Cloud Tasks. Tag which * aren't UTF-8 encoded can't be used in the * [filter][google.cloud.tasks.v2beta2.LeaseTasksRequest.filter] and the task's @@ -286,7 +345,7 @@ public function getFilter() * oldest task (ordered by schedule time). * SDK compatibility: Although the SDK allows tags to be either * string or - * [bytes](/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), + * [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), * only UTF-8 encoded tags can be used in Cloud Tasks. Tag which * aren't UTF-8 encoded can't be used in the * [filter][google.cloud.tasks.v2beta2.LeaseTasksRequest.filter] and the task's diff --git a/Tasks/src/V2beta2/LeaseTasksResponse.php b/Tasks/src/V2beta2/LeaseTasksResponse.php index 5110301c5159..5dc3e76a34da 100644 --- a/Tasks/src/V2beta2/LeaseTasksResponse.php +++ b/Tasks/src/V2beta2/LeaseTasksResponse.php @@ -22,9 +22,19 @@ class LeaseTasksResponse extends \Google\Protobuf\Internal\Message */ private $tasks; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Tasks\V2beta2\Task[]|\Google\Protobuf\Internal\RepeatedField $tasks + * The leased tasks. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Cloudtasks::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Tasks/src/V2beta2/ListQueuesRequest.php b/Tasks/src/V2beta2/ListQueuesRequest.php index d7af92b1eb8f..e8b8ed306abb 100644 --- a/Tasks/src/V2beta2/ListQueuesRequest.php +++ b/Tasks/src/V2beta2/ListQueuesRequest.php @@ -28,7 +28,7 @@ class ListQueuesRequest extends \Google\Protobuf\Internal\Message * field can be used as a filter and several operators as supported. * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as * described in - * [Stackdriver's Advanced Logs Filters](/logging/docs/view/advanced_filters). + * [Stackdriver's Advanced Logs Filters](https://cloud.google.com/logging/docs/view/advanced_filters). * Sample filter "app_engine_http_target: *". * Note that using filters might cause fewer queues than the * requested_page size to be returned. @@ -60,9 +60,45 @@ class ListQueuesRequest extends \Google\Protobuf\Internal\Message */ private $page_token = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. + * The location name. + * For example: `projects/PROJECT_ID/locations/LOCATION_ID` + * @type string $filter + * `filter` can be used to specify a subset of queues. Any [Queue][google.cloud.tasks.v2beta2.Queue] + * field can be used as a filter and several operators as supported. + * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as + * described in + * [Stackdriver's Advanced Logs Filters](https://cloud.google.com/logging/docs/view/advanced_filters). + * Sample filter "app_engine_http_target: *". + * Note that using filters might cause fewer queues than the + * requested_page size to be returned. + * @type int $page_size + * Requested page size. + * The maximum page size is 9800. If unspecified, the page size will + * be the maximum. Fewer queues than requested might be returned, + * even if more queues exist; use the + * [next_page_token][google.cloud.tasks.v2beta2.ListQueuesResponse.next_page_token] in the + * response to determine if more queues exist. + * @type string $page_token + * A token identifying the page of results to return. + * To request the first page results, page_token must be empty. To + * request the next page of results, page_token must be the value of + * [next_page_token][google.cloud.tasks.v2beta2.ListQueuesResponse.next_page_token] returned + * from the previous call to [ListQueues][google.cloud.tasks.v2beta2.CloudTasks.ListQueues] + * method. It is an error to switch the value of the + * [filter][google.cloud.tasks.v2beta2.ListQueuesRequest.filter] while iterating through pages. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Cloudtasks::initOnce(); - parent::__construct(); + parent::__construct($data); } /** @@ -100,7 +136,7 @@ public function setParent($var) * field can be used as a filter and several operators as supported. * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as * described in - * [Stackdriver's Advanced Logs Filters](/logging/docs/view/advanced_filters). + * [Stackdriver's Advanced Logs Filters](https://cloud.google.com/logging/docs/view/advanced_filters). * Sample filter "app_engine_http_target: *". * Note that using filters might cause fewer queues than the * requested_page size to be returned. @@ -118,7 +154,7 @@ public function getFilter() * field can be used as a filter and several operators as supported. * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as * described in - * [Stackdriver's Advanced Logs Filters](/logging/docs/view/advanced_filters). + * [Stackdriver's Advanced Logs Filters](https://cloud.google.com/logging/docs/view/advanced_filters). * Sample filter "app_engine_http_target: *". * Note that using filters might cause fewer queues than the * requested_page size to be returned. diff --git a/Tasks/src/V2beta2/ListQueuesResponse.php b/Tasks/src/V2beta2/ListQueuesResponse.php index dc7fba47a5a1..973759e10588 100644 --- a/Tasks/src/V2beta2/ListQueuesResponse.php +++ b/Tasks/src/V2beta2/ListQueuesResponse.php @@ -33,9 +33,26 @@ class ListQueuesResponse extends \Google\Protobuf\Internal\Message */ private $next_page_token = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Tasks\V2beta2\Queue[]|\Google\Protobuf\Internal\RepeatedField $queues + * The list of queues. + * @type string $next_page_token + * A token to retrieve next page of results. + * To return the next page of results, call + * [ListQueues][google.cloud.tasks.v2beta2.CloudTasks.ListQueues] with this value as the + * [page_token][google.cloud.tasks.v2beta2.ListQueuesRequest.page_token]. + * If the next_page_token is empty, there are no more results. + * The page token is valid for only 2 hours. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Cloudtasks::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Tasks/src/V2beta2/ListTasksRequest.php b/Tasks/src/V2beta2/ListTasksRequest.php index 9878718d20eb..6006b65f8afa 100644 --- a/Tasks/src/V2beta2/ListTasksRequest.php +++ b/Tasks/src/V2beta2/ListTasksRequest.php @@ -32,21 +32,12 @@ class ListTasksRequest extends \Google\Protobuf\Internal\Message * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 2; */ private $response_view = 0; - /** - * Sort order used for the query. The only fields supported for sorting - * are `schedule_time` and `pull_message.tag`. All results will be - * returned in approximately ascending order. The default ordering is by - * `schedule_time`. - * - * Generated from protobuf field string order_by = 3; - */ - private $order_by = ''; /** * Requested page size. Fewer tasks than requested might be returned. * The maximum page size is 1000. If unspecified, the page size will @@ -71,9 +62,47 @@ class ListTasksRequest extends \Google\Protobuf\Internal\Message */ private $page_token = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. + * The queue name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + * @type int $response_view + * The response_view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] will be + * returned. + * By default response_view is [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all + * information is retrieved by default because some data, such as + * payloads, might be desirable to return only when needed because + * of its large size or because of the sensitivity of data that it + * contains. + * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * @type int $page_size + * Requested page size. Fewer tasks than requested might be returned. + * The maximum page size is 1000. If unspecified, the page size will + * be the maximum. Fewer tasks than requested might be returned, + * even if more tasks exist; use + * [next_page_token][google.cloud.tasks.v2beta2.ListTasksResponse.next_page_token] in the + * response to determine if more tasks exist. + * @type string $page_token + * A token identifying the page of results to return. + * To request the first page results, page_token must be empty. To + * request the next page of results, page_token must be the value of + * [next_page_token][google.cloud.tasks.v2beta2.ListTasksResponse.next_page_token] returned + * from the previous call to [ListTasks][google.cloud.tasks.v2beta2.CloudTasks.ListTasks] + * method. + * The page token is valid for only 2 hours. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Cloudtasks::initOnce(); - parent::__construct(); + parent::__construct($data); } /** @@ -115,8 +144,8 @@ public function setParent($var) * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 2; * @return int @@ -135,8 +164,8 @@ public function getResponseView() * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 2; * @param int $var @@ -150,38 +179,6 @@ public function setResponseView($var) return $this; } - /** - * Sort order used for the query. The only fields supported for sorting - * are `schedule_time` and `pull_message.tag`. All results will be - * returned in approximately ascending order. The default ordering is by - * `schedule_time`. - * - * Generated from protobuf field string order_by = 3; - * @return string - */ - public function getOrderBy() - { - return $this->order_by; - } - - /** - * Sort order used for the query. The only fields supported for sorting - * are `schedule_time` and `pull_message.tag`. All results will be - * returned in approximately ascending order. The default ordering is by - * `schedule_time`. - * - * Generated from protobuf field string order_by = 3; - * @param string $var - * @return $this - */ - public function setOrderBy($var) - { - GPBUtil::checkString($var, True); - $this->order_by = $var; - - return $this; - } - /** * Requested page size. Fewer tasks than requested might be returned. * The maximum page size is 1000. If unspecified, the page size will diff --git a/Tasks/src/V2beta2/ListTasksResponse.php b/Tasks/src/V2beta2/ListTasksResponse.php index 3f6224a412e7..a9886a126597 100644 --- a/Tasks/src/V2beta2/ListTasksResponse.php +++ b/Tasks/src/V2beta2/ListTasksResponse.php @@ -32,9 +32,25 @@ class ListTasksResponse extends \Google\Protobuf\Internal\Message */ private $next_page_token = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Tasks\V2beta2\Task[]|\Google\Protobuf\Internal\RepeatedField $tasks + * The list of tasks. + * @type string $next_page_token + * A token to retrieve next page of results. + * To return the next page of results, call + * [ListTasks][google.cloud.tasks.v2beta2.CloudTasks.ListTasks] with this value as the + * [page_token][google.cloud.tasks.v2beta2.ListTasksRequest.page_token]. + * If the next_page_token is empty, there are no more results. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Cloudtasks::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Tasks/src/V2beta2/PauseQueueRequest.php b/Tasks/src/V2beta2/PauseQueueRequest.php index 6f7b726baa46..3a41c8fb80fd 100644 --- a/Tasks/src/V2beta2/PauseQueueRequest.php +++ b/Tasks/src/V2beta2/PauseQueueRequest.php @@ -24,9 +24,21 @@ class PauseQueueRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. + * The queue name. For example: + * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Cloudtasks::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Tasks/src/V2beta2/PullMessage.php b/Tasks/src/V2beta2/PullMessage.php index 5962a992feca..47df6f5737e6 100644 --- a/Tasks/src/V2beta2/PullMessage.php +++ b/Tasks/src/V2beta2/PullMessage.php @@ -36,7 +36,7 @@ class PullMessage extends \Google\Protobuf\Internal\Message * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]. * The tag must be less than 500 characters. * SDK compatibility: Although the SDK allows tags to be either - * string or [bytes](/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), + * string or [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), * only UTF-8 encoded tags can be used in Cloud Tasks. If a tag isn't UTF-8 * encoded, the tag will be empty when the task is returned by Cloud Tasks. * @@ -44,9 +44,34 @@ class PullMessage extends \Google\Protobuf\Internal\Message */ private $tag = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $payload + * A data payload consumed by the worker to execute the task. + * @type string $tag + * The task's tag. + * Tags allow similar tasks to be processed in a batch. If you label + * tasks with a tag, your worker can + * [lease tasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] with the same tag using + * [filter][google.cloud.tasks.v2beta2.LeaseTasksRequest.filter]. For example, if you want to + * aggregate the events associated with a specific user once a day, + * you could tag tasks with the user ID. + * The task's tag can only be set when the + * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]. + * The tag must be less than 500 characters. + * SDK compatibility: Although the SDK allows tags to be either + * string or [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), + * only UTF-8 encoded tags can be used in Cloud Tasks. If a tag isn't UTF-8 + * encoded, the tag will be empty when the task is returned by Cloud Tasks. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Target::initOnce(); - parent::__construct(); + parent::__construct($data); } /** @@ -87,7 +112,7 @@ public function setPayload($var) * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]. * The tag must be less than 500 characters. * SDK compatibility: Although the SDK allows tags to be either - * string or [bytes](/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), + * string or [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), * only UTF-8 encoded tags can be used in Cloud Tasks. If a tag isn't UTF-8 * encoded, the tag will be empty when the task is returned by Cloud Tasks. * @@ -111,7 +136,7 @@ public function getTag() * [task is created][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]. * The tag must be less than 500 characters. * SDK compatibility: Although the SDK allows tags to be either - * string or [bytes](/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), + * string or [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-), * only UTF-8 encoded tags can be used in Cloud Tasks. If a tag isn't UTF-8 * encoded, the tag will be empty when the task is returned by Cloud Tasks. * diff --git a/Tasks/src/V2beta2/PullTarget.php b/Tasks/src/V2beta2/PullTarget.php index 0359d4d92f4b..32baa5104df5 100644 --- a/Tasks/src/V2beta2/PullTarget.php +++ b/Tasks/src/V2beta2/PullTarget.php @@ -16,9 +16,17 @@ class PullTarget extends \Google\Protobuf\Internal\Message { - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Target::initOnce(); - parent::__construct(); + parent::__construct($data); } } diff --git a/Tasks/src/V2beta2/PurgeQueueRequest.php b/Tasks/src/V2beta2/PurgeQueueRequest.php index 4d0ec2c2c263..6ba5c05cc77a 100644 --- a/Tasks/src/V2beta2/PurgeQueueRequest.php +++ b/Tasks/src/V2beta2/PurgeQueueRequest.php @@ -24,9 +24,21 @@ class PurgeQueueRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. + * The queue name. For example: + * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Cloudtasks::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Tasks/src/V2beta2/Queue.php b/Tasks/src/V2beta2/Queue.php index 4105d85126fd..fd8250ddb822 100644 --- a/Tasks/src/V2beta2/Queue.php +++ b/Tasks/src/V2beta2/Queue.php @@ -26,7 +26,7 @@ class Queue extends \Google\Protobuf\Internal\Message * * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), * hyphens (-), colons (:), or periods (.). * For more information, see - * [Identifying projects](/resource-manager/docs/creating-managing-projects#identifying_projects) + * [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) * * `LOCATION_ID` is the canonical ID for the queue's location. * The list of available locations can be obtained by calling * [ListLocations][google.cloud.location.Locations.ListLocations]. @@ -63,7 +63,7 @@ class Queue extends \Google\Protobuf\Internal\Message * * For tasks created using the App Engine SDK: the queue-level retry * settings apply to all tasks in the queue which do not have retry settings * explicitly set on the task and were created by the App Engine SDK. See - * [App Engine documentation](/appengine/docs/standard/python/taskqueue/push/retrying-tasks). + * [App Engine documentation](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/retrying-tasks). * * Generated from protobuf field .google.cloud.tasks.v2beta2.RetryConfig retry_config = 6; */ @@ -73,7 +73,7 @@ class Queue extends \Google\Protobuf\Internal\Message * `state` can only be changed by called * [PauseQueue][google.cloud.tasks.v2beta2.CloudTasks.PauseQueue], * [ResumeQueue][google.cloud.tasks.v2beta2.CloudTasks.ResumeQueue], or uploading - * [queue.yaml/xml](/appengine/docs/python/config/queueref). + * [queue.yaml/xml](https://cloud.google.com/appengine/docs/python/config/queueref). * [UpdateQueue][google.cloud.tasks.v2beta2.CloudTasks.UpdateQueue] cannot be used to change `state`. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Queue.State state = 7; @@ -84,7 +84,7 @@ class Queue extends \Google\Protobuf\Internal\Message * All tasks that were [created][google.cloud.tasks.v2beta2.Task.create_time] before this time * were purged. * A queue can be purged using [PurgeQueue][google.cloud.tasks.v2beta2.CloudTasks.PurgeQueue], the - * [App Engine Task Queue SDK, or the Cloud Console](/appengine/docs/standard/python/taskqueue/push/deleting-tasks-and-queues#purging_all_tasks_from_a_queue). + * [App Engine Task Queue SDK, or the Cloud Console](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/deleting-tasks-and-queues#purging_all_tasks_from_a_queue). * Purge time will be truncated to the nearest microsecond. Purge * time will be unset if the queue has never been purged. * @@ -93,9 +93,77 @@ class Queue extends \Google\Protobuf\Internal\Message private $purge_time = null; protected $target_type; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Caller-specified and required in [CreateQueue][google.cloud.tasks.v2beta2.CloudTasks.CreateQueue], + * after which it becomes output only. + * The queue name. + * The queue name must have the following format: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` + * * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), + * hyphens (-), colons (:), or periods (.). + * For more information, see + * [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + * * `LOCATION_ID` is the canonical ID for the queue's location. + * The list of available locations can be obtained by calling + * [ListLocations][google.cloud.location.Locations.ListLocations]. + * For more information, see https://cloud.google.com/about/locations/. + * * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or + * hyphens (-). The maximum length is 100 characters. + * @type \Google\Cloud\Tasks\V2beta2\AppEngineHttpTarget $app_engine_http_target + * App Engine HTTP target. + * An App Engine queue is a queue that has an [AppEngineHttpTarget][google.cloud.tasks.v2beta2.AppEngineHttpTarget]. + * @type \Google\Cloud\Tasks\V2beta2\PullTarget $pull_target + * Pull target. + * A pull queue is a queue that has a [PullTarget][google.cloud.tasks.v2beta2.PullTarget]. + * @type \Google\Cloud\Tasks\V2beta2\RateLimits $rate_limits + * Rate limits for task dispatches. + * [rate_limits][google.cloud.tasks.v2beta2.Queue.rate_limits] and + * [retry_config][google.cloud.tasks.v2beta2.Queue.retry_config] are related because they both + * control task attempts however they control how tasks are + * attempted in different ways: + * * [rate_limits][google.cloud.tasks.v2beta2.Queue.rate_limits] controls the total rate of + * dispatches from a queue (i.e. all traffic dispatched from the + * queue, regardless of whether the dispatch is from a first + * attempt or a retry). + * * [retry_config][google.cloud.tasks.v2beta2.Queue.retry_config] controls what happens to + * particular a task after its first attempt fails. That is, + * [retry_config][google.cloud.tasks.v2beta2.Queue.retry_config] controls task retries (the + * second attempt, third attempt, etc). + * @type \Google\Cloud\Tasks\V2beta2\RetryConfig $retry_config + * Settings that determine the retry behavior. + * * For tasks created using Cloud Tasks: the queue-level retry settings + * apply to all tasks in the queue that were created using Cloud Tasks. + * Retry settings cannot be set on individual tasks. + * * For tasks created using the App Engine SDK: the queue-level retry + * settings apply to all tasks in the queue which do not have retry settings + * explicitly set on the task and were created by the App Engine SDK. See + * [App Engine documentation](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/retrying-tasks). + * @type int $state + * Output only. The state of the queue. + * `state` can only be changed by called + * [PauseQueue][google.cloud.tasks.v2beta2.CloudTasks.PauseQueue], + * [ResumeQueue][google.cloud.tasks.v2beta2.CloudTasks.ResumeQueue], or uploading + * [queue.yaml/xml](https://cloud.google.com/appengine/docs/python/config/queueref). + * [UpdateQueue][google.cloud.tasks.v2beta2.CloudTasks.UpdateQueue] cannot be used to change `state`. + * @type \Google\Protobuf\Timestamp $purge_time + * Output only. The last time this queue was purged. + * All tasks that were [created][google.cloud.tasks.v2beta2.Task.create_time] before this time + * were purged. + * A queue can be purged using [PurgeQueue][google.cloud.tasks.v2beta2.CloudTasks.PurgeQueue], the + * [App Engine Task Queue SDK, or the Cloud Console](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/deleting-tasks-and-queues#purging_all_tasks_from_a_queue). + * Purge time will be truncated to the nearest microsecond. Purge + * time will be unset if the queue has never been purged. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Queue::initOnce(); - parent::__construct(); + parent::__construct($data); } /** @@ -107,7 +175,7 @@ public function __construct() { * * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), * hyphens (-), colons (:), or periods (.). * For more information, see - * [Identifying projects](/resource-manager/docs/creating-managing-projects#identifying_projects) + * [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) * * `LOCATION_ID` is the canonical ID for the queue's location. * The list of available locations can be obtained by calling * [ListLocations][google.cloud.location.Locations.ListLocations]. @@ -132,7 +200,7 @@ public function getName() * * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), * hyphens (-), colons (:), or periods (.). * For more information, see - * [Identifying projects](/resource-manager/docs/creating-managing-projects#identifying_projects) + * [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) * * `LOCATION_ID` is the canonical ID for the queue's location. * The list of available locations can be obtained by calling * [ListLocations][google.cloud.location.Locations.ListLocations]. @@ -266,7 +334,7 @@ public function setRateLimits($var) * * For tasks created using the App Engine SDK: the queue-level retry * settings apply to all tasks in the queue which do not have retry settings * explicitly set on the task and were created by the App Engine SDK. See - * [App Engine documentation](/appengine/docs/standard/python/taskqueue/push/retrying-tasks). + * [App Engine documentation](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/retrying-tasks). * * Generated from protobuf field .google.cloud.tasks.v2beta2.RetryConfig retry_config = 6; * @return \Google\Cloud\Tasks\V2beta2\RetryConfig @@ -284,7 +352,7 @@ public function getRetryConfig() * * For tasks created using the App Engine SDK: the queue-level retry * settings apply to all tasks in the queue which do not have retry settings * explicitly set on the task and were created by the App Engine SDK. See - * [App Engine documentation](/appengine/docs/standard/python/taskqueue/push/retrying-tasks). + * [App Engine documentation](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/retrying-tasks). * * Generated from protobuf field .google.cloud.tasks.v2beta2.RetryConfig retry_config = 6; * @param \Google\Cloud\Tasks\V2beta2\RetryConfig $var @@ -303,7 +371,7 @@ public function setRetryConfig($var) * `state` can only be changed by called * [PauseQueue][google.cloud.tasks.v2beta2.CloudTasks.PauseQueue], * [ResumeQueue][google.cloud.tasks.v2beta2.CloudTasks.ResumeQueue], or uploading - * [queue.yaml/xml](/appengine/docs/python/config/queueref). + * [queue.yaml/xml](https://cloud.google.com/appengine/docs/python/config/queueref). * [UpdateQueue][google.cloud.tasks.v2beta2.CloudTasks.UpdateQueue] cannot be used to change `state`. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Queue.State state = 7; @@ -319,7 +387,7 @@ public function getState() * `state` can only be changed by called * [PauseQueue][google.cloud.tasks.v2beta2.CloudTasks.PauseQueue], * [ResumeQueue][google.cloud.tasks.v2beta2.CloudTasks.ResumeQueue], or uploading - * [queue.yaml/xml](/appengine/docs/python/config/queueref). + * [queue.yaml/xml](https://cloud.google.com/appengine/docs/python/config/queueref). * [UpdateQueue][google.cloud.tasks.v2beta2.CloudTasks.UpdateQueue] cannot be used to change `state`. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Queue.State state = 7; @@ -339,7 +407,7 @@ public function setState($var) * All tasks that were [created][google.cloud.tasks.v2beta2.Task.create_time] before this time * were purged. * A queue can be purged using [PurgeQueue][google.cloud.tasks.v2beta2.CloudTasks.PurgeQueue], the - * [App Engine Task Queue SDK, or the Cloud Console](/appengine/docs/standard/python/taskqueue/push/deleting-tasks-and-queues#purging_all_tasks_from_a_queue). + * [App Engine Task Queue SDK, or the Cloud Console](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/deleting-tasks-and-queues#purging_all_tasks_from_a_queue). * Purge time will be truncated to the nearest microsecond. Purge * time will be unset if the queue has never been purged. * @@ -356,7 +424,7 @@ public function getPurgeTime() * All tasks that were [created][google.cloud.tasks.v2beta2.Task.create_time] before this time * were purged. * A queue can be purged using [PurgeQueue][google.cloud.tasks.v2beta2.CloudTasks.PurgeQueue], the - * [App Engine Task Queue SDK, or the Cloud Console](/appengine/docs/standard/python/taskqueue/push/deleting-tasks-and-queues#purging_all_tasks_from_a_queue). + * [App Engine Task Queue SDK, or the Cloud Console](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/deleting-tasks-and-queues#purging_all_tasks_from_a_queue). * Purge time will be truncated to the nearest microsecond. Purge * time will be unset if the queue has never been purged. * diff --git a/Tasks/src/V2beta2/Queue/State.php b/Tasks/src/V2beta2/Queue/State.php new file mode 100644 index 000000000000..0fca031d5721 --- /dev/null +++ b/Tasks/src/V2beta2/Queue/State.php @@ -0,0 +1,62 @@ +google.cloud.tasks.v2beta2.Queue.State + */ +class State +{ + /** + * Unspecified state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The queue is running. Tasks can be dispatched. + * If the queue was created using Cloud Tasks and the queue has + * had no activity (method calls or task dispatches) for 30 days, + * the queue may take a few minutes to re-activate. Some method + * calls may return [NOT_FOUND][google.rpc.Code.NOT_FOUND] and + * tasks may not be dispatched for a few minutes until the queue + * has been re-activated. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * Tasks are paused by the user. If the queue is paused then Cloud + * Tasks will stop delivering tasks from it, but more tasks can + * still be added to it by the user. When a pull queue is paused, + * all [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] calls will return a + * [FAILED_PRECONDITION][google.rpc.Code.FAILED_PRECONDITION]. + * + * Generated from protobuf enum PAUSED = 2; + */ + const PAUSED = 2; + /** + * The queue is disabled. + * A queue becomes `DISABLED` when + * [queue.yaml](https://cloud.google.com/appengine/docs/python/config/queueref) or + * [queue.xml](https://cloud.google.com/appengine/docs/standard/java/config/queueref) is uploaded + * which does not contain the queue. You cannot directly disable a queue. + * When a queue is disabled, tasks can still be added to a queue + * but the tasks are not dispatched and + * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] calls return a + * `FAILED_PRECONDITION` error. + * To permanently delete this queue and all of its tasks, call + * [DeleteQueue][google.cloud.tasks.v2beta2.CloudTasks.DeleteQueue]. + * + * Generated from protobuf enum DISABLED = 3; + */ + const DISABLED = 3; +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Tasks\V2beta2\Queue_State::class); + diff --git a/Tasks/src/V2beta2/Queue_State.php b/Tasks/src/V2beta2/Queue_State.php index b5f12f453a04..0bac44e86b21 100644 --- a/Tasks/src/V2beta2/Queue_State.php +++ b/Tasks/src/V2beta2/Queue_State.php @@ -4,56 +4,13 @@ namespace Google\Cloud\Tasks\V2beta2; -/** - * State of the queue. - * - * Protobuf enum Google\Cloud\Tasks\V2beta2\Queue\State - */ -class Queue_State -{ +if (false) { /** - * Unspecified state. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; + * This class is deprecated. Use Google\Cloud\Tasks\V2beta2\Queue\State instead. + * @deprecated */ - const STATE_UNSPECIFIED = 0; - /** - * The queue is running. Tasks can be dispatched. - * If the queue was created using Cloud Tasks and the queue has - * had no activity (method calls or task dispatches) for 30 days, - * the queue may take a few minutes to re-activate. Some method - * calls may return [NOT_FOUND][google.rpc.Code.NOT_FOUND] and - * tasks may not be dispatched for a few minutes until the queue - * has been re-activated. - * - * Generated from protobuf enum RUNNING = 1; - */ - const RUNNING = 1; - /** - * Tasks are paused by the user. If the queue is paused then Cloud - * Tasks will stop delivering tasks from it, but more tasks can - * still be added to it by the user. When a pull queue is paused, - * all [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] calls will return a - * [FAILED_PRECONDITION][google.rpc.Code.FAILED_PRECONDITION]. - * - * Generated from protobuf enum PAUSED = 2; - */ - const PAUSED = 2; - /** - * The queue is disabled. - * A queue becomes `DISABLED` when - * [queue.yaml](/appengine/docs/python/config/queueref) or - * [queue.xml](appengine/docs/standard/java/config/queueref) is uploaded - * which does not contain the queue. You cannot directly disable a queue. - * When a queue is disabled, tasks can still be added to a queue - * but the tasks are not dispatched and - * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] calls return a - * `FAILED_PRECONDITION` error. - * To permanently delete this queue and all of its tasks, call - * [DeleteQueue][google.cloud.tasks.v2beta2.CloudTasks.DeleteQueue]. - * - * Generated from protobuf enum DISABLED = 3; - */ - const DISABLED = 3; + class Queue_State {} } +class_exists(Queue\State::class); +@trigger_error('Google\Cloud\Tasks\V2beta2\Queue_State is deprecated and will be removed in a future release. Use Google\Cloud\Tasks\V2beta2\Queue\State instead', E_USER_DEPRECATED); diff --git a/Tasks/src/V2beta2/RateLimits.php b/Tasks/src/V2beta2/RateLimits.php index dab7d16ead53..cd6c8010f1c6 100644 --- a/Tasks/src/V2beta2/RateLimits.php +++ b/Tasks/src/V2beta2/RateLimits.php @@ -23,13 +23,13 @@ class RateLimits extends \Google\Protobuf\Internal\Message * The maximum rate at which tasks are dispatched from this queue. * If unspecified when the queue is created, Cloud Tasks will pick the * default. - * * For App Engine queues, the maximum allowed value is 500. - * * This field is output only for [pull queues](google.cloud.tasks.v2beta2.PullTarget). In - * addition to the `max_tasks_dispatched_per_second` limit, a - * maximum of 10 QPS of [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] - * requests are allowed per pull queue. + * * For [App Engine queues][google.cloud.tasks.v2beta2.AppEngineHttpTarget], the maximum allowed value + * is 500. + * * This field is output only for [pull queues][google.cloud.tasks.v2beta2.PullTarget]. In addition to the + * `max_tasks_dispatched_per_second` limit, a maximum of 10 QPS of + * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] requests are allowed per pull queue. * This field has the same meaning as - * [rate in queue.yaml/xml](/appengine/docs/standard/python/config/queueref#rate). + * [rate in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#rate). * * Generated from protobuf field double max_tasks_dispatched_per_second = 1; */ @@ -54,7 +54,7 @@ class RateLimits extends \Google\Protobuf\Internal\Message * [max_tasks_dispatched_per_second][google.cloud.tasks.v2beta2.RateLimits.max_tasks_dispatched_per_second]. * For App Engine queues that were created or updated using * `queue.yaml/xml`, `max_burst_size` is equal to - * [bucket_size](/appengine/docs/standard/python/config/queueref#bucket_size). + * [bucket_size](https://cloud.google.com/appengine/docs/standard/python/config/queueref#bucket_size). * Since `max_burst_size` is output only, if * [UpdateQueue][google.cloud.tasks.v2beta2.CloudTasks.UpdateQueue] is called on a queue * created by `queue.yaml/xml`, `max_burst_size` will be reset based @@ -76,32 +76,92 @@ class RateLimits extends \Google\Protobuf\Internal\Message * default. * The maximum allowed value is 5,000. * This field is output only for - * [pull queues](google.cloud.tasks.v2beta2.PullTarget) and always -1, which - * indicates no limit. No other queue types can have `max_concurrent_tasks` - * set to -1. + * [pull queues][google.cloud.tasks.v2beta2.PullTarget] and always -1, which indicates no limit. No other + * queue types can have `max_concurrent_tasks` set to -1. * This field has the same meaning as - * [max_concurrent_requests in queue.yaml/xml](/appengine/docs/standard/python/config/queueref#max_concurrent_requests). + * [max_concurrent_requests in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#max_concurrent_requests). * * Generated from protobuf field int32 max_concurrent_tasks = 3; */ private $max_concurrent_tasks = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $max_tasks_dispatched_per_second + * The maximum rate at which tasks are dispatched from this queue. + * If unspecified when the queue is created, Cloud Tasks will pick the + * default. + * * For [App Engine queues][google.cloud.tasks.v2beta2.AppEngineHttpTarget], the maximum allowed value + * is 500. + * * This field is output only for [pull queues][google.cloud.tasks.v2beta2.PullTarget]. In addition to the + * `max_tasks_dispatched_per_second` limit, a maximum of 10 QPS of + * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] requests are allowed per pull queue. + * This field has the same meaning as + * [rate in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#rate). + * @type int $max_burst_size + * Output only. The max burst size. + * Max burst size limits how fast tasks in queue are processed when + * many tasks are in the queue and the rate is high. This field + * allows the queue to have a high rate so processing starts shortly + * after a task is enqueued, but still limits resource usage when + * many tasks are enqueued in a short period of time. + * The [token bucket](https://wikipedia.org/wiki/Token_Bucket) + * algorithm is used to control the rate of task dispatches. Each + * queue has a token bucket that holds tokens, up to the maximum + * specified by `max_burst_size`. Each time a task is dispatched, a + * token is removed from the bucket. Tasks will be dispatched until + * the queue's bucket runs out of tokens. The bucket will be + * continuously refilled with new tokens based on + * [max_tasks_dispatched_per_second][google.cloud.tasks.v2beta2.RateLimits.max_tasks_dispatched_per_second]. + * Cloud Tasks will pick the value of `max_burst_size` based on the + * value of + * [max_tasks_dispatched_per_second][google.cloud.tasks.v2beta2.RateLimits.max_tasks_dispatched_per_second]. + * For App Engine queues that were created or updated using + * `queue.yaml/xml`, `max_burst_size` is equal to + * [bucket_size](https://cloud.google.com/appengine/docs/standard/python/config/queueref#bucket_size). + * Since `max_burst_size` is output only, if + * [UpdateQueue][google.cloud.tasks.v2beta2.CloudTasks.UpdateQueue] is called on a queue + * created by `queue.yaml/xml`, `max_burst_size` will be reset based + * on the value of + * [max_tasks_dispatched_per_second][google.cloud.tasks.v2beta2.RateLimits.max_tasks_dispatched_per_second], + * regardless of whether + * [max_tasks_dispatched_per_second][google.cloud.tasks.v2beta2.RateLimits.max_tasks_dispatched_per_second] + * is updated. + * @type int $max_concurrent_tasks + * The maximum number of concurrent tasks that Cloud Tasks allows + * to be dispatched for this queue. After this threshold has been + * reached, Cloud Tasks stops dispatching tasks until the number of + * concurrent requests decreases. + * If unspecified when the queue is created, Cloud Tasks will pick the + * default. + * The maximum allowed value is 5,000. + * This field is output only for + * [pull queues][google.cloud.tasks.v2beta2.PullTarget] and always -1, which indicates no limit. No other + * queue types can have `max_concurrent_tasks` set to -1. + * This field has the same meaning as + * [max_concurrent_requests in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#max_concurrent_requests). + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Queue::initOnce(); - parent::__construct(); + parent::__construct($data); } /** * The maximum rate at which tasks are dispatched from this queue. * If unspecified when the queue is created, Cloud Tasks will pick the * default. - * * For App Engine queues, the maximum allowed value is 500. - * * This field is output only for [pull queues](google.cloud.tasks.v2beta2.PullTarget). In - * addition to the `max_tasks_dispatched_per_second` limit, a - * maximum of 10 QPS of [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] - * requests are allowed per pull queue. + * * For [App Engine queues][google.cloud.tasks.v2beta2.AppEngineHttpTarget], the maximum allowed value + * is 500. + * * This field is output only for [pull queues][google.cloud.tasks.v2beta2.PullTarget]. In addition to the + * `max_tasks_dispatched_per_second` limit, a maximum of 10 QPS of + * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] requests are allowed per pull queue. * This field has the same meaning as - * [rate in queue.yaml/xml](/appengine/docs/standard/python/config/queueref#rate). + * [rate in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#rate). * * Generated from protobuf field double max_tasks_dispatched_per_second = 1; * @return float @@ -115,13 +175,13 @@ public function getMaxTasksDispatchedPerSecond() * The maximum rate at which tasks are dispatched from this queue. * If unspecified when the queue is created, Cloud Tasks will pick the * default. - * * For App Engine queues, the maximum allowed value is 500. - * * This field is output only for [pull queues](google.cloud.tasks.v2beta2.PullTarget). In - * addition to the `max_tasks_dispatched_per_second` limit, a - * maximum of 10 QPS of [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] - * requests are allowed per pull queue. + * * For [App Engine queues][google.cloud.tasks.v2beta2.AppEngineHttpTarget], the maximum allowed value + * is 500. + * * This field is output only for [pull queues][google.cloud.tasks.v2beta2.PullTarget]. In addition to the + * `max_tasks_dispatched_per_second` limit, a maximum of 10 QPS of + * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] requests are allowed per pull queue. * This field has the same meaning as - * [rate in queue.yaml/xml](/appengine/docs/standard/python/config/queueref#rate). + * [rate in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#rate). * * Generated from protobuf field double max_tasks_dispatched_per_second = 1; * @param float $var @@ -155,7 +215,7 @@ public function setMaxTasksDispatchedPerSecond($var) * [max_tasks_dispatched_per_second][google.cloud.tasks.v2beta2.RateLimits.max_tasks_dispatched_per_second]. * For App Engine queues that were created or updated using * `queue.yaml/xml`, `max_burst_size` is equal to - * [bucket_size](/appengine/docs/standard/python/config/queueref#bucket_size). + * [bucket_size](https://cloud.google.com/appengine/docs/standard/python/config/queueref#bucket_size). * Since `max_burst_size` is output only, if * [UpdateQueue][google.cloud.tasks.v2beta2.CloudTasks.UpdateQueue] is called on a queue * created by `queue.yaml/xml`, `max_burst_size` will be reset based @@ -193,7 +253,7 @@ public function getMaxBurstSize() * [max_tasks_dispatched_per_second][google.cloud.tasks.v2beta2.RateLimits.max_tasks_dispatched_per_second]. * For App Engine queues that were created or updated using * `queue.yaml/xml`, `max_burst_size` is equal to - * [bucket_size](/appengine/docs/standard/python/config/queueref#bucket_size). + * [bucket_size](https://cloud.google.com/appengine/docs/standard/python/config/queueref#bucket_size). * Since `max_burst_size` is output only, if * [UpdateQueue][google.cloud.tasks.v2beta2.CloudTasks.UpdateQueue] is called on a queue * created by `queue.yaml/xml`, `max_burst_size` will be reset based @@ -224,11 +284,10 @@ public function setMaxBurstSize($var) * default. * The maximum allowed value is 5,000. * This field is output only for - * [pull queues](google.cloud.tasks.v2beta2.PullTarget) and always -1, which - * indicates no limit. No other queue types can have `max_concurrent_tasks` - * set to -1. + * [pull queues][google.cloud.tasks.v2beta2.PullTarget] and always -1, which indicates no limit. No other + * queue types can have `max_concurrent_tasks` set to -1. * This field has the same meaning as - * [max_concurrent_requests in queue.yaml/xml](/appengine/docs/standard/python/config/queueref#max_concurrent_requests). + * [max_concurrent_requests in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#max_concurrent_requests). * * Generated from protobuf field int32 max_concurrent_tasks = 3; * @return int @@ -247,11 +306,10 @@ public function getMaxConcurrentTasks() * default. * The maximum allowed value is 5,000. * This field is output only for - * [pull queues](google.cloud.tasks.v2beta2.PullTarget) and always -1, which - * indicates no limit. No other queue types can have `max_concurrent_tasks` - * set to -1. + * [pull queues][google.cloud.tasks.v2beta2.PullTarget] and always -1, which indicates no limit. No other + * queue types can have `max_concurrent_tasks` set to -1. * This field has the same meaning as - * [max_concurrent_requests in queue.yaml/xml](/appengine/docs/standard/python/config/queueref#max_concurrent_requests). + * [max_concurrent_requests in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#max_concurrent_requests). * * Generated from protobuf field int32 max_concurrent_tasks = 3; * @param int $var diff --git a/Tasks/src/V2beta2/RenewLeaseRequest.php b/Tasks/src/V2beta2/RenewLeaseRequest.php index c493cf41a615..0cc15be05caa 100644 --- a/Tasks/src/V2beta2/RenewLeaseRequest.php +++ b/Tasks/src/V2beta2/RenewLeaseRequest.php @@ -53,16 +53,51 @@ class RenewLeaseRequest extends \Google\Protobuf\Internal\Message * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 4; */ private $response_view = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. + * The task name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + * @type \Google\Protobuf\Timestamp $schedule_time + * Required. + * The task's current schedule time, available in the + * [schedule_time][google.cloud.tasks.v2beta2.Task.schedule_time] returned by + * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] response or + * [RenewLease][google.cloud.tasks.v2beta2.CloudTasks.RenewLease] response. This restriction is + * to ensure that your worker currently holds the lease. + * @type \Google\Protobuf\Duration $lease_duration + * Required. + * The desired new lease duration, starting from now. + * The maximum lease duration is 1 week. + * `lease_duration` will be truncated to the nearest second. + * @type int $response_view + * The response_view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] will be + * returned. + * By default response_view is [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all + * information is retrieved by default because some data, such as + * payloads, might be desirable to return only when needed because + * of its large size or because of the sensitivity of data that it + * contains. + * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Cloudtasks::initOnce(); - parent::__construct(); + parent::__construct($data); } /** @@ -172,8 +207,8 @@ public function setLeaseDuration($var) * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 4; * @return int @@ -192,8 +227,8 @@ public function getResponseView() * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 4; * @param int $var diff --git a/Tasks/src/V2beta2/ResumeQueueRequest.php b/Tasks/src/V2beta2/ResumeQueueRequest.php index a5765b3c5d9c..fcdecfa07a5b 100644 --- a/Tasks/src/V2beta2/ResumeQueueRequest.php +++ b/Tasks/src/V2beta2/ResumeQueueRequest.php @@ -24,9 +24,21 @@ class ResumeQueueRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. + * The queue name. For example: + * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Cloudtasks::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Tasks/src/V2beta2/RetryConfig.php b/Tasks/src/V2beta2/RetryConfig.php index 3c36d990d3be..363c43847907 100644 --- a/Tasks/src/V2beta2/RetryConfig.php +++ b/Tasks/src/V2beta2/RetryConfig.php @@ -26,45 +26,42 @@ class RetryConfig extends \Google\Protobuf\Internal\Message * If zero, then the task age is unlimited. * If unspecified when the queue is created, Cloud Tasks will pick the * default. - * This field is output only for - * [pull queues](google.cloud.tasks.v2beta2.PullTarget). + * This field is output only for [pull queues][google.cloud.tasks.v2beta2.PullTarget]. * `max_retry_duration` will be truncated to the nearest second. * This field has the same meaning as - * [task_age_limit in queue.yaml/xml](/appengine/docs/standard/python/config/queueref#retry_parameters). + * [task_age_limit in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). * * Generated from protobuf field .google.protobuf.Duration max_retry_duration = 3; */ private $max_retry_duration = null; /** - * A task will be [scheduled](Task.schedule_time) for retry between + * A task will be [scheduled][google.cloud.tasks.v2beta2.Task.schedule_time] for retry between * [min_backoff][google.cloud.tasks.v2beta2.RetryConfig.min_backoff] and * [max_backoff][google.cloud.tasks.v2beta2.RetryConfig.max_backoff] duration after it fails, * if the queue's [RetryConfig][google.cloud.tasks.v2beta2.RetryConfig] specifies that the task should be * retried. * If unspecified when the queue is created, Cloud Tasks will pick the * default. - * This field is output only for - * [pull queues](google.cloud.tasks.v2beta2.PullTarget). + * This field is output only for [pull queues][google.cloud.tasks.v2beta2.PullTarget]. * `min_backoff` will be truncated to the nearest second. * This field has the same meaning as - * [min_backoff_seconds in queue.yaml/xml](/appengine/docs/standard/python/config/queueref#retry_parameters). + * [min_backoff_seconds in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). * * Generated from protobuf field .google.protobuf.Duration min_backoff = 4; */ private $min_backoff = null; /** - * A task will be [scheduled](Task.schedule_time) for retry between + * A task will be [scheduled][google.cloud.tasks.v2beta2.Task.schedule_time] for retry between * [min_backoff][google.cloud.tasks.v2beta2.RetryConfig.min_backoff] and * [max_backoff][google.cloud.tasks.v2beta2.RetryConfig.max_backoff] duration after it fails, * if the queue's [RetryConfig][google.cloud.tasks.v2beta2.RetryConfig] specifies that the task should be * retried. * If unspecified when the queue is created, Cloud Tasks will pick the * default. - * This field is output only for - * [pull queues](google.cloud.tasks.v2beta2.PullTarget). + * This field is output only for [pull queues][google.cloud.tasks.v2beta2.PullTarget]. * `max_backoff` will be truncated to the nearest second. * This field has the same meaning as - * [max_backoff_seconds in queue.yaml/xml](/appengine/docs/standard/python/config/queueref#retry_parameters). + * [max_backoff_seconds in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). * * Generated from protobuf field .google.protobuf.Duration max_backoff = 5; */ @@ -88,19 +85,93 @@ class RetryConfig extends \Google\Protobuf\Internal\Message * 240s, 300s, 300s, .... * If unspecified when the queue is created, Cloud Tasks will pick the * default. - * This field is output only for - * [pull queues](google.cloud.tasks.v2beta2.PullTarget). + * This field is output only for [pull queues][google.cloud.tasks.v2beta2.PullTarget]. * This field has the same meaning as - * [max_doublings in queue.yaml/xml](/appengine/docs/standard/python/config/queueref#retry_parameters). + * [max_doublings in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). * * Generated from protobuf field int32 max_doublings = 6; */ private $max_doublings = 0; protected $num_attempts; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $max_attempts + * The maximum number of attempts for a task. + * Cloud Tasks will attempt the task `max_attempts` times (that + * is, if the first attempt fails, then there will be + * `max_attempts - 1` retries). Must be > 0. + * @type bool $unlimited_attempts + * If true, then the number of attempts is unlimited. + * @type \Google\Protobuf\Duration $max_retry_duration + * If positive, `max_retry_duration` specifies the time limit for + * retrying a failed task, measured from when the task was first + * attempted. Once `max_retry_duration` time has passed *and* the + * task has been attempted [max_attempts][google.cloud.tasks.v2beta2.RetryConfig.max_attempts] + * times, no further attempts will be made and the task will be + * deleted. + * If zero, then the task age is unlimited. + * If unspecified when the queue is created, Cloud Tasks will pick the + * default. + * This field is output only for [pull queues][google.cloud.tasks.v2beta2.PullTarget]. + * `max_retry_duration` will be truncated to the nearest second. + * This field has the same meaning as + * [task_age_limit in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). + * @type \Google\Protobuf\Duration $min_backoff + * A task will be [scheduled][google.cloud.tasks.v2beta2.Task.schedule_time] for retry between + * [min_backoff][google.cloud.tasks.v2beta2.RetryConfig.min_backoff] and + * [max_backoff][google.cloud.tasks.v2beta2.RetryConfig.max_backoff] duration after it fails, + * if the queue's [RetryConfig][google.cloud.tasks.v2beta2.RetryConfig] specifies that the task should be + * retried. + * If unspecified when the queue is created, Cloud Tasks will pick the + * default. + * This field is output only for [pull queues][google.cloud.tasks.v2beta2.PullTarget]. + * `min_backoff` will be truncated to the nearest second. + * This field has the same meaning as + * [min_backoff_seconds in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). + * @type \Google\Protobuf\Duration $max_backoff + * A task will be [scheduled][google.cloud.tasks.v2beta2.Task.schedule_time] for retry between + * [min_backoff][google.cloud.tasks.v2beta2.RetryConfig.min_backoff] and + * [max_backoff][google.cloud.tasks.v2beta2.RetryConfig.max_backoff] duration after it fails, + * if the queue's [RetryConfig][google.cloud.tasks.v2beta2.RetryConfig] specifies that the task should be + * retried. + * If unspecified when the queue is created, Cloud Tasks will pick the + * default. + * This field is output only for [pull queues][google.cloud.tasks.v2beta2.PullTarget]. + * `max_backoff` will be truncated to the nearest second. + * This field has the same meaning as + * [max_backoff_seconds in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). + * @type int $max_doublings + * The time between retries will double `max_doublings` times. + * A task's retry interval starts at + * [min_backoff][google.cloud.tasks.v2beta2.RetryConfig.min_backoff], then doubles + * `max_doublings` times, then increases linearly, and finally + * retries retries at intervals of + * [max_backoff][google.cloud.tasks.v2beta2.RetryConfig.max_backoff] up to + * [max_attempts][google.cloud.tasks.v2beta2.RetryConfig.max_attempts] times. + * For example, if [min_backoff][google.cloud.tasks.v2beta2.RetryConfig.min_backoff] is 10s, + * [max_backoff][google.cloud.tasks.v2beta2.RetryConfig.max_backoff] is 300s, and + * `max_doublings` is 3, then the a task will first be retried in + * 10s. The retry interval will double three times, and then + * increase linearly by 2^3 * 10s. Finally, the task will retry at + * intervals of [max_backoff][google.cloud.tasks.v2beta2.RetryConfig.max_backoff] until the + * task has been attempted [max_attempts][google.cloud.tasks.v2beta2.RetryConfig.max_attempts] + * times. Thus, the requests will retry at 10s, 20s, 40s, 80s, 160s, + * 240s, 300s, 300s, .... + * If unspecified when the queue is created, Cloud Tasks will pick the + * default. + * This field is output only for [pull queues][google.cloud.tasks.v2beta2.PullTarget]. + * This field has the same meaning as + * [max_doublings in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Queue::initOnce(); - parent::__construct(); + parent::__construct($data); } /** @@ -171,11 +242,10 @@ public function setUnlimitedAttempts($var) * If zero, then the task age is unlimited. * If unspecified when the queue is created, Cloud Tasks will pick the * default. - * This field is output only for - * [pull queues](google.cloud.tasks.v2beta2.PullTarget). + * This field is output only for [pull queues][google.cloud.tasks.v2beta2.PullTarget]. * `max_retry_duration` will be truncated to the nearest second. * This field has the same meaning as - * [task_age_limit in queue.yaml/xml](/appengine/docs/standard/python/config/queueref#retry_parameters). + * [task_age_limit in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). * * Generated from protobuf field .google.protobuf.Duration max_retry_duration = 3; * @return \Google\Protobuf\Duration @@ -195,11 +265,10 @@ public function getMaxRetryDuration() * If zero, then the task age is unlimited. * If unspecified when the queue is created, Cloud Tasks will pick the * default. - * This field is output only for - * [pull queues](google.cloud.tasks.v2beta2.PullTarget). + * This field is output only for [pull queues][google.cloud.tasks.v2beta2.PullTarget]. * `max_retry_duration` will be truncated to the nearest second. * This field has the same meaning as - * [task_age_limit in queue.yaml/xml](/appengine/docs/standard/python/config/queueref#retry_parameters). + * [task_age_limit in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). * * Generated from protobuf field .google.protobuf.Duration max_retry_duration = 3; * @param \Google\Protobuf\Duration $var @@ -214,18 +283,17 @@ public function setMaxRetryDuration($var) } /** - * A task will be [scheduled](Task.schedule_time) for retry between + * A task will be [scheduled][google.cloud.tasks.v2beta2.Task.schedule_time] for retry between * [min_backoff][google.cloud.tasks.v2beta2.RetryConfig.min_backoff] and * [max_backoff][google.cloud.tasks.v2beta2.RetryConfig.max_backoff] duration after it fails, * if the queue's [RetryConfig][google.cloud.tasks.v2beta2.RetryConfig] specifies that the task should be * retried. * If unspecified when the queue is created, Cloud Tasks will pick the * default. - * This field is output only for - * [pull queues](google.cloud.tasks.v2beta2.PullTarget). + * This field is output only for [pull queues][google.cloud.tasks.v2beta2.PullTarget]. * `min_backoff` will be truncated to the nearest second. * This field has the same meaning as - * [min_backoff_seconds in queue.yaml/xml](/appengine/docs/standard/python/config/queueref#retry_parameters). + * [min_backoff_seconds in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). * * Generated from protobuf field .google.protobuf.Duration min_backoff = 4; * @return \Google\Protobuf\Duration @@ -236,18 +304,17 @@ public function getMinBackoff() } /** - * A task will be [scheduled](Task.schedule_time) for retry between + * A task will be [scheduled][google.cloud.tasks.v2beta2.Task.schedule_time] for retry between * [min_backoff][google.cloud.tasks.v2beta2.RetryConfig.min_backoff] and * [max_backoff][google.cloud.tasks.v2beta2.RetryConfig.max_backoff] duration after it fails, * if the queue's [RetryConfig][google.cloud.tasks.v2beta2.RetryConfig] specifies that the task should be * retried. * If unspecified when the queue is created, Cloud Tasks will pick the * default. - * This field is output only for - * [pull queues](google.cloud.tasks.v2beta2.PullTarget). + * This field is output only for [pull queues][google.cloud.tasks.v2beta2.PullTarget]. * `min_backoff` will be truncated to the nearest second. * This field has the same meaning as - * [min_backoff_seconds in queue.yaml/xml](/appengine/docs/standard/python/config/queueref#retry_parameters). + * [min_backoff_seconds in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). * * Generated from protobuf field .google.protobuf.Duration min_backoff = 4; * @param \Google\Protobuf\Duration $var @@ -262,18 +329,17 @@ public function setMinBackoff($var) } /** - * A task will be [scheduled](Task.schedule_time) for retry between + * A task will be [scheduled][google.cloud.tasks.v2beta2.Task.schedule_time] for retry between * [min_backoff][google.cloud.tasks.v2beta2.RetryConfig.min_backoff] and * [max_backoff][google.cloud.tasks.v2beta2.RetryConfig.max_backoff] duration after it fails, * if the queue's [RetryConfig][google.cloud.tasks.v2beta2.RetryConfig] specifies that the task should be * retried. * If unspecified when the queue is created, Cloud Tasks will pick the * default. - * This field is output only for - * [pull queues](google.cloud.tasks.v2beta2.PullTarget). + * This field is output only for [pull queues][google.cloud.tasks.v2beta2.PullTarget]. * `max_backoff` will be truncated to the nearest second. * This field has the same meaning as - * [max_backoff_seconds in queue.yaml/xml](/appengine/docs/standard/python/config/queueref#retry_parameters). + * [max_backoff_seconds in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). * * Generated from protobuf field .google.protobuf.Duration max_backoff = 5; * @return \Google\Protobuf\Duration @@ -284,18 +350,17 @@ public function getMaxBackoff() } /** - * A task will be [scheduled](Task.schedule_time) for retry between + * A task will be [scheduled][google.cloud.tasks.v2beta2.Task.schedule_time] for retry between * [min_backoff][google.cloud.tasks.v2beta2.RetryConfig.min_backoff] and * [max_backoff][google.cloud.tasks.v2beta2.RetryConfig.max_backoff] duration after it fails, * if the queue's [RetryConfig][google.cloud.tasks.v2beta2.RetryConfig] specifies that the task should be * retried. * If unspecified when the queue is created, Cloud Tasks will pick the * default. - * This field is output only for - * [pull queues](google.cloud.tasks.v2beta2.PullTarget). + * This field is output only for [pull queues][google.cloud.tasks.v2beta2.PullTarget]. * `max_backoff` will be truncated to the nearest second. * This field has the same meaning as - * [max_backoff_seconds in queue.yaml/xml](/appengine/docs/standard/python/config/queueref#retry_parameters). + * [max_backoff_seconds in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). * * Generated from protobuf field .google.protobuf.Duration max_backoff = 5; * @param \Google\Protobuf\Duration $var @@ -328,10 +393,9 @@ public function setMaxBackoff($var) * 240s, 300s, 300s, .... * If unspecified when the queue is created, Cloud Tasks will pick the * default. - * This field is output only for - * [pull queues](google.cloud.tasks.v2beta2.PullTarget). + * This field is output only for [pull queues][google.cloud.tasks.v2beta2.PullTarget]. * This field has the same meaning as - * [max_doublings in queue.yaml/xml](/appengine/docs/standard/python/config/queueref#retry_parameters). + * [max_doublings in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). * * Generated from protobuf field int32 max_doublings = 6; * @return int @@ -360,10 +424,9 @@ public function getMaxDoublings() * 240s, 300s, 300s, .... * If unspecified when the queue is created, Cloud Tasks will pick the * default. - * This field is output only for - * [pull queues](google.cloud.tasks.v2beta2.PullTarget). + * This field is output only for [pull queues][google.cloud.tasks.v2beta2.PullTarget]. * This field has the same meaning as - * [max_doublings in queue.yaml/xml](/appengine/docs/standard/python/config/queueref#retry_parameters). + * [max_doublings in queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). * * Generated from protobuf field int32 max_doublings = 6; * @param int $var diff --git a/Tasks/src/V2beta2/RunTaskRequest.php b/Tasks/src/V2beta2/RunTaskRequest.php index 30a37586f0cb..9bbd22af632d 100644 --- a/Tasks/src/V2beta2/RunTaskRequest.php +++ b/Tasks/src/V2beta2/RunTaskRequest.php @@ -33,16 +33,39 @@ class RunTaskRequest extends \Google\Protobuf\Internal\Message * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 2; */ private $response_view = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. + * The task name. For example: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + * @type int $response_view + * The response_view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] will be + * returned. + * By default response_view is [BASIC][google.cloud.tasks.v2beta2.Task.View.BASIC]; not all + * information is retrieved by default because some data, such as + * payloads, might be desirable to return only when needed because + * of its large size or because of the sensitivity of data that it + * contains. + * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Cloudtasks::initOnce(); - parent::__construct(); + parent::__construct($data); } /** @@ -84,8 +107,8 @@ public function setName($var) * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 2; * @return int @@ -104,8 +127,8 @@ public function getResponseView() * of its large size or because of the sensitivity of data that it * contains. * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](/iam/) permission on the - * [Task][google.cloud.tasks.v2beta2.Task] resource. + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Task][google.cloud.tasks.v2beta2.Task] resource. * * Generated from protobuf field .google.cloud.tasks.v2beta2.Task.View response_view = 2; * @param int $var diff --git a/Tasks/src/V2beta2/Task.php b/Tasks/src/V2beta2/Task.php index 979e1fd62897..a9c5d1201bd3 100644 --- a/Tasks/src/V2beta2/Task.php +++ b/Tasks/src/V2beta2/Task.php @@ -23,7 +23,7 @@ class Task extends \Google\Protobuf\Internal\Message * * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), * hyphens (-), colons (:), or periods (.). * For more information, see - * [Identifying projects](/resource-manager/docs/creating-managing-projects#identifying_projects) + * [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) * * `LOCATION_ID` is the canonical ID for the task's location. * The list of available locations can be obtained by calling * [ListLocations][google.cloud.location.Locations.ListLocations]. @@ -70,9 +70,60 @@ class Task extends \Google\Protobuf\Internal\Message private $view = 0; protected $payload_type; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Optionally caller-specified in [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask]. + * The task name. + * The task name must have the following format: + * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` + * * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), + * hyphens (-), colons (:), or periods (.). + * For more information, see + * [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) + * * `LOCATION_ID` is the canonical ID for the task's location. + * The list of available locations can be obtained by calling + * [ListLocations][google.cloud.location.Locations.ListLocations]. + * For more information, see https://cloud.google.com/about/locations/. + * * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or + * hyphens (-). The maximum length is 100 characters. + * * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), + * hyphens (-), or underscores (_). The maximum length is 500 characters. + * @type \Google\Cloud\Tasks\V2beta2\AppEngineHttpRequest $app_engine_http_request + * App Engine HTTP request that is sent to the task's target. Can + * be set only if + * [app_engine_http_target][google.cloud.tasks.v2beta2.Queue.app_engine_http_target] is set + * on the queue. + * An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] set. + * @type \Google\Cloud\Tasks\V2beta2\PullMessage $pull_message + * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] to process the task. Can be + * set only if [pull_target][google.cloud.tasks.v2beta2.Queue.pull_target] is set on the queue. + * A pull task is a task that has [PullMessage][google.cloud.tasks.v2beta2.PullMessage] set. + * @type \Google\Protobuf\Timestamp $schedule_time + * The time when the task is scheduled to be attempted. + * For App Engine queues, this is when the task will be attempted or retried. + * For pull queues, this is the time when the task is available to + * be leased; if a task is currently leased, this is the time when + * the current lease expires, that is, the time that the task was + * leased plus the [lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration]. + * `schedule_time` will be truncated to the nearest microsecond. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time that the task was created. + * `create_time` will be truncated to the nearest second. + * @type \Google\Cloud\Tasks\V2beta2\TaskStatus $status + * Output only. The task status. + * @type int $view + * Output only. The view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] has + * been returned. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Task::initOnce(); - parent::__construct(); + parent::__construct($data); } /** @@ -83,7 +134,7 @@ public function __construct() { * * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), * hyphens (-), colons (:), or periods (.). * For more information, see - * [Identifying projects](/resource-manager/docs/creating-managing-projects#identifying_projects) + * [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) * * `LOCATION_ID` is the canonical ID for the task's location. * The list of available locations can be obtained by calling * [ListLocations][google.cloud.location.Locations.ListLocations]. @@ -109,7 +160,7 @@ public function getName() * * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), * hyphens (-), colons (:), or periods (.). * For more information, see - * [Identifying projects](/resource-manager/docs/creating-managing-projects#identifying_projects) + * [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) * * `LOCATION_ID` is the canonical ID for the task's location. * The list of available locations can be obtained by calling * [ListLocations][google.cloud.location.Locations.ListLocations]. diff --git a/Tasks/src/V2beta2/Task/View.php b/Tasks/src/V2beta2/Task/View.php new file mode 100644 index 000000000000..517fa8ce3897 --- /dev/null +++ b/Tasks/src/V2beta2/Task/View.php @@ -0,0 +1,51 @@ +google.cloud.tasks.v2beta2.Task.View + */ +class View +{ + /** + * Unspecified. Defaults to BASIC. + * + * Generated from protobuf enum VIEW_UNSPECIFIED = 0; + */ + const VIEW_UNSPECIFIED = 0; + /** + * The basic view omits fields which can be large or can contain + * sensitive data. + * This view does not include the + * ([payload in AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] and + * [payload in PullMessage][google.cloud.tasks.v2beta2.PullMessage.payload]). These payloads are + * desirable to return only when needed, because they can be large + * and because of the sensitivity of the data that you choose to + * store in it. + * + * Generated from protobuf enum BASIC = 1; + */ + const BASIC = 1; + /** + * All information is returned. + * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires + * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) + * permission on the [Queue][google.cloud.tasks.v2beta2.Queue] resource. + * + * Generated from protobuf enum FULL = 2; + */ + const FULL = 2; +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(View::class, \Google\Cloud\Tasks\V2beta2\Task_View::class); + diff --git a/Tasks/src/V2beta2/TaskStatus.php b/Tasks/src/V2beta2/TaskStatus.php index a597dfb7404c..c4a77b1a084f 100644 --- a/Tasks/src/V2beta2/TaskStatus.php +++ b/Tasks/src/V2beta2/TaskStatus.php @@ -25,8 +25,7 @@ class TaskStatus extends \Google\Protobuf\Internal\Message private $attempt_dispatch_count = 0; /** * Output only. The number of attempts which have received a response. - * This field is not calculated for - * [pull tasks](google.cloud.tasks.v2beta2.PullTaskTarget). + * This field is not calculated for [pull tasks][google.cloud.tasks.v2beta2.PullMessage]. * * Generated from protobuf field int32 attempt_response_count = 2; */ @@ -35,24 +34,45 @@ class TaskStatus extends \Google\Protobuf\Internal\Message * Output only. The status of the task's first attempt. * Only [dispatch_time][google.cloud.tasks.v2beta2.AttemptStatus.dispatch_time] will be set. * The other [AttemptStatus][google.cloud.tasks.v2beta2.AttemptStatus] information is not retained by Cloud Tasks. - * This field is not calculated for - * [pull tasks](google.cloud.tasks.v2beta2.PullTaskTarget). + * This field is not calculated for [pull tasks][google.cloud.tasks.v2beta2.PullMessage]. * * Generated from protobuf field .google.cloud.tasks.v2beta2.AttemptStatus first_attempt_status = 3; */ private $first_attempt_status = null; /** * Output only. The status of the task's last attempt. - * This field is not calculated for - * [pull tasks](google.cloud.tasks.v2beta2.PullTaskTarget). + * This field is not calculated for [pull tasks][google.cloud.tasks.v2beta2.PullMessage]. * * Generated from protobuf field .google.cloud.tasks.v2beta2.AttemptStatus last_attempt_status = 4; */ private $last_attempt_status = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $attempt_dispatch_count + * Output only. The number of attempts dispatched. + * This count includes tasks which have been dispatched but haven't + * received a response. + * @type int $attempt_response_count + * Output only. The number of attempts which have received a response. + * This field is not calculated for [pull tasks][google.cloud.tasks.v2beta2.PullMessage]. + * @type \Google\Cloud\Tasks\V2beta2\AttemptStatus $first_attempt_status + * Output only. The status of the task's first attempt. + * Only [dispatch_time][google.cloud.tasks.v2beta2.AttemptStatus.dispatch_time] will be set. + * The other [AttemptStatus][google.cloud.tasks.v2beta2.AttemptStatus] information is not retained by Cloud Tasks. + * This field is not calculated for [pull tasks][google.cloud.tasks.v2beta2.PullMessage]. + * @type \Google\Cloud\Tasks\V2beta2\AttemptStatus $last_attempt_status + * Output only. The status of the task's last attempt. + * This field is not calculated for [pull tasks][google.cloud.tasks.v2beta2.PullMessage]. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Task::initOnce(); - parent::__construct(); + parent::__construct($data); } /** @@ -87,8 +107,7 @@ public function setAttemptDispatchCount($var) /** * Output only. The number of attempts which have received a response. - * This field is not calculated for - * [pull tasks](google.cloud.tasks.v2beta2.PullTaskTarget). + * This field is not calculated for [pull tasks][google.cloud.tasks.v2beta2.PullMessage]. * * Generated from protobuf field int32 attempt_response_count = 2; * @return int @@ -100,8 +119,7 @@ public function getAttemptResponseCount() /** * Output only. The number of attempts which have received a response. - * This field is not calculated for - * [pull tasks](google.cloud.tasks.v2beta2.PullTaskTarget). + * This field is not calculated for [pull tasks][google.cloud.tasks.v2beta2.PullMessage]. * * Generated from protobuf field int32 attempt_response_count = 2; * @param int $var @@ -119,8 +137,7 @@ public function setAttemptResponseCount($var) * Output only. The status of the task's first attempt. * Only [dispatch_time][google.cloud.tasks.v2beta2.AttemptStatus.dispatch_time] will be set. * The other [AttemptStatus][google.cloud.tasks.v2beta2.AttemptStatus] information is not retained by Cloud Tasks. - * This field is not calculated for - * [pull tasks](google.cloud.tasks.v2beta2.PullTaskTarget). + * This field is not calculated for [pull tasks][google.cloud.tasks.v2beta2.PullMessage]. * * Generated from protobuf field .google.cloud.tasks.v2beta2.AttemptStatus first_attempt_status = 3; * @return \Google\Cloud\Tasks\V2beta2\AttemptStatus @@ -134,8 +151,7 @@ public function getFirstAttemptStatus() * Output only. The status of the task's first attempt. * Only [dispatch_time][google.cloud.tasks.v2beta2.AttemptStatus.dispatch_time] will be set. * The other [AttemptStatus][google.cloud.tasks.v2beta2.AttemptStatus] information is not retained by Cloud Tasks. - * This field is not calculated for - * [pull tasks](google.cloud.tasks.v2beta2.PullTaskTarget). + * This field is not calculated for [pull tasks][google.cloud.tasks.v2beta2.PullMessage]. * * Generated from protobuf field .google.cloud.tasks.v2beta2.AttemptStatus first_attempt_status = 3; * @param \Google\Cloud\Tasks\V2beta2\AttemptStatus $var @@ -151,8 +167,7 @@ public function setFirstAttemptStatus($var) /** * Output only. The status of the task's last attempt. - * This field is not calculated for - * [pull tasks](google.cloud.tasks.v2beta2.PullTaskTarget). + * This field is not calculated for [pull tasks][google.cloud.tasks.v2beta2.PullMessage]. * * Generated from protobuf field .google.cloud.tasks.v2beta2.AttemptStatus last_attempt_status = 4; * @return \Google\Cloud\Tasks\V2beta2\AttemptStatus @@ -164,8 +179,7 @@ public function getLastAttemptStatus() /** * Output only. The status of the task's last attempt. - * This field is not calculated for - * [pull tasks](google.cloud.tasks.v2beta2.PullTaskTarget). + * This field is not calculated for [pull tasks][google.cloud.tasks.v2beta2.PullMessage]. * * Generated from protobuf field .google.cloud.tasks.v2beta2.AttemptStatus last_attempt_status = 4; * @param \Google\Cloud\Tasks\V2beta2\AttemptStatus $var diff --git a/Tasks/src/V2beta2/Task_View.php b/Tasks/src/V2beta2/Task_View.php index e1b609a64a84..cbe691e18027 100644 --- a/Tasks/src/V2beta2/Task_View.php +++ b/Tasks/src/V2beta2/Task_View.php @@ -4,45 +4,13 @@ namespace Google\Cloud\Tasks\V2beta2; -/** - * The view specifies a subset of [Task][google.cloud.tasks.v2beta2.Task] data. - * When a task is returned in a response, not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * - * Protobuf enum Google\Cloud\Tasks\V2beta2\Task\View - */ -class Task_View -{ +if (false) { /** - * Unspecified. Defaults to BASIC. - * - * Generated from protobuf enum VIEW_UNSPECIFIED = 0; + * This class is deprecated. Use Google\Cloud\Tasks\V2beta2\Task\View instead. + * @deprecated */ - const VIEW_UNSPECIFIED = 0; - /** - * The basic view omits fields which can be large or can contain - * sensitive data. - * This view does not include the - * ([payload in AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] and - * [payload in PullMessage][google.cloud.tasks.v2beta2.PullMessage.payload]). These payloads are - * desirable to return only when needed, because they can be large - * and because of the sensitivity of the data that you choose to - * store in it. - * - * Generated from protobuf enum BASIC = 1; - */ - const BASIC = 1; - /** - * All information is returned. - * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires - * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the [Queue][google.cloud.tasks.v2beta2.Queue] resource. - * - * Generated from protobuf enum FULL = 2; - */ - const FULL = 2; + class Task_View {} } +class_exists(Task\View::class); +@trigger_error('Google\Cloud\Tasks\V2beta2\Task_View is deprecated and will be removed in a future release. Use Google\Cloud\Tasks\V2beta2\Task\View instead', E_USER_DEPRECATED); diff --git a/Tasks/src/V2beta2/UpdateQueueRequest.php b/Tasks/src/V2beta2/UpdateQueueRequest.php index 0c9bab2f7271..eaae410587bf 100644 --- a/Tasks/src/V2beta2/UpdateQueueRequest.php +++ b/Tasks/src/V2beta2/UpdateQueueRequest.php @@ -34,9 +34,27 @@ class UpdateQueueRequest extends \Google\Protobuf\Internal\Message */ private $update_mask = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Tasks\V2beta2\Queue $queue + * Required. + * The queue to create or update. + * The queue's [name][google.cloud.tasks.v2beta2.Queue.name] must be specified. + * Output only fields cannot be modified using UpdateQueue. + * Any value specified for an output only field will be ignored. + * The queue's [name][google.cloud.tasks.v2beta2.Queue.name] cannot be changed. + * @type \Google\Protobuf\FieldMask $update_mask + * A mask used to specify which fields of the queue are being updated. + * If empty, then all fields will be updated. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Tasks\V2Beta2\Cloudtasks::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Tasks/synth.py b/Tasks/synth.py index 1ea76183d464..65701df7d531 100644 --- a/Tasks/synth.py +++ b/Tasks/synth.py @@ -34,3 +34,15 @@ s.copy(v2beta2_library / f'proto/src/GPBMetadata/Google/Cloud/Tasks', f'metadata') s.copy(v2beta2_library / f'proto/src/Google/Cloud/Tasks', f'src') s.copy(v2beta2_library / f'tests') + +# Use new namespace in the doc sample. See +# https://github.com/googleapis/gapic-generator/issues/2141 +s.replace( + 'src/V2beta2/Gapic/CloudTasksGapicClient.php', + r'Task_View', + 'Task\View') +# Change the wording for the deprecation warning. +s.replace( + 'src/*/*_*.php', + r'will be removed in the next major release', + 'will be removed in a future release') diff --git a/TextToSpeech/VERSION b/TextToSpeech/VERSION new file mode 100644 index 000000000000..6da28dde76d6 --- /dev/null +++ b/TextToSpeech/VERSION @@ -0,0 +1 @@ +0.1.1 \ No newline at end of file diff --git a/TextToSpeech/composer.json b/TextToSpeech/composer.json index 5c32a78f3d93..78536379fbce 100644 --- a/TextToSpeech/composer.json +++ b/TextToSpeech/composer.json @@ -23,7 +23,7 @@ } }, "require": { - "google/gax": "^0.34.0" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Trace/VERSION b/Trace/VERSION index 71172b43ae95..42624f314efd 100644 --- a/Trace/VERSION +++ b/Trace/VERSION @@ -1 +1 @@ -0.10.1 \ No newline at end of file +0.10.2 \ No newline at end of file diff --git a/Trace/composer.json b/Trace/composer.json index db13382fd69d..cf860d2740d2 100644 --- a/Trace/composer.json +++ b/Trace/composer.json @@ -6,7 +6,7 @@ "require": { "google/cloud-core": "^1.14", "ramsey/uuid": "~3", - "google/gax": "^0.34" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Trace/src/TraceClient.php b/Trace/src/TraceClient.php index 89f2bb93471e..7ef00cf2c9cd 100644 --- a/Trace/src/TraceClient.php +++ b/Trace/src/TraceClient.php @@ -44,7 +44,7 @@ class TraceClient { use ClientTrait; - const VERSION = '0.10.1'; + const VERSION = '0.10.2'; const FULL_CONTROL_SCOPE = 'https://www.googleapis.com/auth/cloud-platform'; diff --git a/VideoIntelligence/VERSION b/VideoIntelligence/VERSION index e6d5cb833c63..a6a3a43c3a04 100644 --- a/VideoIntelligence/VERSION +++ b/VideoIntelligence/VERSION @@ -1 +1 @@ -1.0.2 \ No newline at end of file +1.0.4 \ No newline at end of file diff --git a/VideoIntelligence/composer.json b/VideoIntelligence/composer.json index c79bb19d4608..12c680d5976a 100644 --- a/VideoIntelligence/composer.json +++ b/VideoIntelligence/composer.json @@ -4,7 +4,7 @@ "license": "Apache-2.0", "minimum-stability": "stable", "require": { - "google/gax": "^0.34" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Vision/VERSION b/Vision/VERSION index 1c16bd1a4199..8076af51c002 100644 --- a/Vision/VERSION +++ b/Vision/VERSION @@ -1 +1 @@ -0.14.2 \ No newline at end of file +0.15.1 \ No newline at end of file diff --git a/Vision/composer.json b/Vision/composer.json index abf4e64154a8..e5ba59d1ef60 100644 --- a/Vision/composer.json +++ b/Vision/composer.json @@ -5,7 +5,7 @@ "minimum-stability": "stable", "require": { "google/cloud-core": "^1.14", - "google/gax": "^0.34" + "google/gax": "^0.36" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", diff --git a/Vision/src/Annotation/SafeSearch.php b/Vision/src/Annotation/SafeSearch.php index 5e51ab19af5d..eae856eb6f51 100644 --- a/Vision/src/Annotation/SafeSearch.php +++ b/Vision/src/Annotation/SafeSearch.php @@ -76,6 +76,16 @@ * * @return string * } + * @method racy() { + * Racy likelihood. + * + * Example: + * ``` + * echo $safeSearch->racy(); + * ``` + * + * @return string + * } * @method info() { * Get the raw annotation result * @@ -119,7 +129,7 @@ public function __construct(array $info) * ``` * * @param string $strength [optional] Value should be one of "low", - * "medium" or "high". Recommended usage is via `Face::STRENGTH_*` + * "medium" or "high". Recommended usage is via `SafeSearch::STRENGTH_*` * constants. Higher strength will result in fewer `true` results, * but fewer false positives. **Defaults to** `"low"`. * @return bool @@ -140,7 +150,7 @@ public function isAdult($strength = self::STRENGTH_LOW) * ``` * * @param string $strength [optional] Value should be one of "low", - * "medium" or "high". Recommended usage is via `Face::STRENGTH_*` + * "medium" or "high". Recommended usage is via `SafeSearch::STRENGTH_*` * constants. Higher strength will result in fewer `true` results, * but fewer false positives. **Defaults to** `"low"`. * @return bool @@ -161,7 +171,7 @@ public function isSpoof($strength = self::STRENGTH_LOW) * ``` * * @param string $strength [optional] Value should be one of "low", - * "medium" or "high". Recommended usage is via `Face::STRENGTH_*` + * "medium" or "high". Recommended usage is via `SafeSearch::STRENGTH_*` * constants. Higher strength will result in fewer `true` results, * but fewer false positives. **Defaults to** `"low"`. * @return bool @@ -182,7 +192,7 @@ public function isMedical($strength = self::STRENGTH_LOW) * ``` * * @param string $strength [optional] Value should be one of "low", - * "medium" or "high". Recommended usage is via `Face::STRENGTH_*` + * "medium" or "high". Recommended usage is via `SafeSearch::STRENGTH_*` * constants. Higher strength will result in fewer `true` results, * but fewer false positives. **Defaults to** `"low"`. * @return bool @@ -191,4 +201,25 @@ public function isViolent($strength = self::STRENGTH_LOW) { return $this->likelihood($this->info['violence'], $strength); } + + /** + * Check whether the image contains racy content + * + * Example: + * ``` + * if ($safeSearch->isRacy()) { + * echo "Image contains racy content."; + * } + * ``` + * + * @param string $strength [optional] Value should be one of "low", + * "medium" or "high". Recommended usage is via `SafeSearch::STRENGTH_*` + * constants. Higher strength will result in fewer `true` results, + * but fewer false positives. **Defaults to** `"low"`. + * @return bool + */ + public function isRacy($strength = self::STRENGTH_LOW) + { + return $this->likelihood($this->info['racy'], $strength); + } } diff --git a/Vision/src/VisionClient.php b/Vision/src/VisionClient.php index ef1c399a0a1b..939205da8818 100644 --- a/Vision/src/VisionClient.php +++ b/Vision/src/VisionClient.php @@ -43,7 +43,7 @@ class VisionClient use ClientTrait; use ValidateTrait; - const VERSION = '0.14.2'; + const VERSION = '0.15.1'; const FULL_CONTROL_SCOPE = 'https://www.googleapis.com/auth/cloud-platform'; diff --git a/Vision/tests/Snippet/Annotation/SafeSearchTest.php b/Vision/tests/Snippet/Annotation/SafeSearchTest.php index 5103f3358f67..69b2b4eb67e8 100644 --- a/Vision/tests/Snippet/Annotation/SafeSearchTest.php +++ b/Vision/tests/Snippet/Annotation/SafeSearchTest.php @@ -37,6 +37,7 @@ public function setUp() 'spoof' => 'VERY_LIKELY', 'medical' => 'VERY_LIKELY', 'violence' => 'VERY_LIKELY', + 'racy' => 'VERY_LIKELY', ]; $this->ss = new SafeSearch($this->ssData); } @@ -109,6 +110,15 @@ public function testViolence() $this->assertEquals($this->ssData['violence'], $res->output()); } + public function testRacy() + { + $snippet = $this->snippetFromMagicMethod(SafeSearch::class, 'racy'); + $snippet->addLocal('safeSearch', $this->ss); + + $res = $snippet->invoke(); + $this->assertEquals($this->ssData['racy'], $res->output()); + } + public function testIsAdult() { $snippet = $this->snippetFromMethod(SafeSearch::class, 'isAdult'); @@ -145,6 +155,15 @@ public function testIsViolent() $this->assertEquals(sprintf('Image contains %s content.', 'violent'), $res->output()); } + public function testIsRacy() + { + $snippet = $this->snippetFromMethod(SafeSearch::class, 'isRacy'); + $snippet->addLocal('safeSearch', $this->ss); + + $res = $snippet->invoke(); + $this->assertEquals(sprintf('Image contains %s content.', 'racy'), $res->output()); + } + public function testInfo() { $snippet = $this->snippetFromMagicMethod(SafeSearch::class, 'info'); diff --git a/Vision/tests/System/AnnotationsTest.php b/Vision/tests/System/AnnotationsTest.php index 04651e50d81b..5e54934c0fc1 100644 --- a/Vision/tests/System/AnnotationsTest.php +++ b/Vision/tests/System/AnnotationsTest.php @@ -67,10 +67,12 @@ public function testAnnotate() $this->assertEquals('VERY_UNLIKELY', $res->safeSearch()->spoof()); $this->assertEquals('VERY_UNLIKELY', $res->safeSearch()->medical()); $this->assertEquals('VERY_UNLIKELY', $res->safeSearch()->violence()); + $this->assertEquals('VERY_UNLIKELY', $res->safeSearch()->racy()); $this->assertFalse($res->safeSearch()->isAdult()); $this->assertFalse($res->safeSearch()->isSpoof()); $this->assertFalse($res->safeSearch()->isMedical()); $this->assertFalse($res->safeSearch()->isViolent()); + $this->assertFalse($res->safeSearch()->isRacy()); // Image Properties $this->assertInstanceOf(ImageProperties::class, $res->imageProperties()); diff --git a/Vision/tests/Unit/Annotation/SafeSearchTest.php b/Vision/tests/Unit/Annotation/SafeSearchTest.php index 0289c64252bd..69c6de037008 100644 --- a/Vision/tests/Unit/Annotation/SafeSearchTest.php +++ b/Vision/tests/Unit/Annotation/SafeSearchTest.php @@ -33,7 +33,8 @@ public function setUp() 'adult' => 'VERY_LIKELY', 'spoof' => 'VERY_LIKELY', 'medical' => 'VERY_LIKELY', - 'violence' => 'VERY_LIKELY' + 'violence' => 'VERY_LIKELY', + 'racy' => 'VERY_LIKELY' ]); } @@ -57,6 +58,11 @@ public function testIsViolent() $this->assertTrue($this->safeSearch->isViolent()); } + public function testIsRacy() + { + $this->assertTrue($this->safeSearch->isRacy()); + } + public function testCall() { $this->assertEquals('VERY_LIKELY', $this->safeSearch->violence()); diff --git a/Vision/tests/Unit/V1/ImageAnnotatorClientExtensionTest.php b/Vision/tests/Unit/V1/ImageAnnotatorClientExtensionTest.php index 9b1f0d1fe158..ee44b5a1c2c8 100644 --- a/Vision/tests/Unit/V1/ImageAnnotatorClientExtensionTest.php +++ b/Vision/tests/Unit/V1/ImageAnnotatorClientExtensionTest.php @@ -115,7 +115,12 @@ public function testAnnotateImageWithImageContext() $this->transport->startUnaryCall( Argument::allOf( Argument::type(Call::class), Argument::which('getMethod', 'google.cloud.vision.v1.ImageAnnotator/BatchAnnotateImages'), - Argument::which('getMessage', $expectedMessage) + Argument::that(function($arg) use ($expectedMessage) { + if ($arg->getMessage()->serializeToString() === $expectedMessage->serializeToString()) { + return true; + } + return false; + }) ), Argument::type('array') ) @@ -160,7 +165,12 @@ public function testDetectionMethod($methodName, $featureType, $image) Argument::allOf( Argument::type(Call::class), Argument::which('getMethod', 'google.cloud.vision.v1.ImageAnnotator/BatchAnnotateImages'), - Argument::which('getMessage', $expectedMessage) + Argument::that(function($arg) use ($expectedMessage) { + if ($arg->getMessage()->serializeToString() === $expectedMessage->serializeToString()) { + return true; + } + return false; + }) ), Argument::type('array') ) diff --git a/composer.json b/composer.json index 2e4ab5c7dd34..9a95bb7dc03a 100644 --- a/composer.json +++ b/composer.json @@ -50,7 +50,8 @@ "monolog/monolog": "~1", "psr/http-message": "1.0.*", "ramsey/uuid": "~3", - "google/gax": "^0.34" + "google/gax": "^0.36", + "google/auth": "1.2.0 - 1.3.0" }, "require-dev": { "phpunit/phpunit": "^4.8|^5.0", @@ -66,35 +67,35 @@ "swaggest/json-schema": "^0.12.0" }, "replace": { - "google/cloud-bigquery": "1.2.4", - "google/cloud-bigquerydatatransfer": "0.6.1", - "google/cloud-bigtable": "0.5.1", - "google/cloud-container": "0.5.1", - "google/cloud-core": "1.20.7", - "google/cloud-dataproc": "0.5.1", + "google/cloud-bigquery": "1.4.0", + "google/cloud-bigquerydatatransfer": "0.6.2", + "google/cloud-bigtable": "0.5.3", + "google/cloud-container": "0.5.2", + "google/cloud-core": "1.21.1", + "google/cloud-dataproc": "0.5.3", "google/cloud-datastore": "1.5.4", - "google/cloud-debugger": "0.12.1", - "google/cloud-dialogflow": "0.3.1", - "google/cloud-dlp": "0.11.0", - "google/cloud-error-reporting": "0.11.1", - "google/cloud-firestore": "0.11.2", - "google/cloud-iot": "0.3.1", - "google/cloud-kms": "0.1.0", - "google/cloud-language": "0.15.1", - "google/cloud-logging": "1.12.3", - "google/cloud-monitoring": "0.11.1", - "google/cloud-oslogin": "0.6.0", - "google/cloud-pubsub": "1.4.0", - "google/cloud-redis": "0.3.1", - "google/cloud-spanner": "1.6.1", - "google/cloud-speech": "0.15.1", - "google/cloud-storage": "1.5.2", - "google/cloud-tasks": "0.1.0", - "google/cloud-text-to-speech": "0.1.0", - "google/cloud-trace": "0.10.1", + "google/cloud-debugger": "0.12.2", + "google/cloud-dialogflow": "0.3.2", + "google/cloud-dlp": "0.11.2", + "google/cloud-error-reporting": "0.11.2", + "google/cloud-firestore": "0.12.0", + "google/cloud-iot": "0.3.2", + "google/cloud-kms": "0.2.0", + "google/cloud-language": "0.15.2", + "google/cloud-logging": "1.12.5", + "google/cloud-monitoring": "0.11.2", + "google/cloud-oslogin": "0.6.1", + "google/cloud-pubsub": "1.4.1", + "google/cloud-redis": "0.3.3", + "google/cloud-spanner": "1.6.2", + "google/cloud-speech": "0.15.2", + "google/cloud-storage": "1.6.0", + "google/cloud-tasks": "0.2.0", + "google/cloud-text-to-speech": "0.1.1", + "google/cloud-trace": "0.10.2", "google/cloud-translate": "1.2.3", - "google/cloud-videointelligence": "1.0.2", - "google/cloud-vision": "0.14.2" + "google/cloud-videointelligence": "1.0.4", + "google/cloud-vision": "0.15.1" }, "suggest": { "opis/closure": "May be used to serialize closures to process jobs in the batch daemon. Please require version ^3.", @@ -213,4 +214,4 @@ ] } } -} \ No newline at end of file +} diff --git a/dev/google-cloud b/dev/google-cloud index db25ce6c3313..53fe586d52fc 100755 --- a/dev/google-cloud +++ b/dev/google-cloud @@ -22,7 +22,8 @@ use Google\Cloud\Dev\AddComponent\Command\AddComponent; use Google\Cloud\Dev\ComponentIntegration\Command\ComponentIntegration; use Google\Cloud\Dev\Credentials\Command as Credentials; use Google\Cloud\Dev\DocGenerator\Command\Docs; -use Google\Cloud\Dev\Release\Command\Release; +use Google\Cloud\Dev\Release\Release; +use Google\Cloud\Dev\ReleaseBuilder\ReleaseBuilder; use Google\Cloud\Dev\Split\Command\Split; use Symfony\Component\Console\Application; @@ -41,5 +42,6 @@ $app->add(new ComponentIntegration($rootDirectory)); $app->add(new Credentials($rootDirectory)); $app->add(new Docs($rootDirectory)); $app->add(new Release($rootDirectory)); +$app->add(new ReleaseBuilder($rootDirectory)); $app->add(new Split($rootDirectory)); $app->run(); diff --git a/dev/sh/bump-gax.sh b/dev/sh/bump-gax.sh new file mode 100755 index 000000000000..65c2256fb871 --- /dev/null +++ b/dev/sh/bump-gax.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -ev + +# This script expects to be run from the google-cloud-php root. +# It finds all composer.json files and updates the google/gax +# version to the specified command line argument. +# +# Usage (to update gax version to e.g. 0.1.2): +# $ ./dev/sh/bump-gax.sh 0.1.2 + +find . -maxdepth 2 -name composer.json \ + -not -path "./vendor/*" \ + -exec sed -i "s/google\/gax[\"']: [\"']\^[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?[\"']/google\/gax\": \"\^$1\"/" "{}" \; diff --git a/dev/src/AddComponent/Command/AddComponent.php b/dev/src/AddComponent/Command/AddComponent.php index eedd8219bf62..6a61f7c6af7f 100644 --- a/dev/src/AddComponent/Command/AddComponent.php +++ b/dev/src/AddComponent/Command/AddComponent.php @@ -24,10 +24,10 @@ use Google\Cloud\Dev\AddComponent\License; use Google\Cloud\Dev\AddComponent\Manifest; use Google\Cloud\Dev\AddComponent\PullRequestTemplate; -use Google\Cloud\Dev\AddComponent\QuestionTrait; use Google\Cloud\Dev\AddComponent\Readmes; use Google\Cloud\Dev\AddComponent\TableOfContents; use Google\Cloud\Dev\Command\GoogleCloudCommand; +use Google\Cloud\Dev\QuestionTrait; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; diff --git a/dev/src/AddComponent/Composer.php b/dev/src/AddComponent/Composer.php index 582e75191b2a..435d97ca6fc7 100644 --- a/dev/src/AddComponent/Composer.php +++ b/dev/src/AddComponent/Composer.php @@ -17,6 +17,7 @@ namespace Google\Cloud\Dev\AddComponent; +use Google\Cloud\Dev\QuestionTrait; use GuzzleHttp\Client; use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputInterface; diff --git a/dev/src/AddComponent/Info.php b/dev/src/AddComponent/Info.php index 2eeb5a822a61..637e757d3ec1 100644 --- a/dev/src/AddComponent/Info.php +++ b/dev/src/AddComponent/Info.php @@ -17,6 +17,7 @@ namespace Google\Cloud\Dev\AddComponent; +use Google\Cloud\Dev\QuestionTrait; use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; use Symfony\Component\Console\Helper\QuestionHelper; diff --git a/dev/src/AddComponent/Manifest.php b/dev/src/AddComponent/Manifest.php index 52baa90ed21e..6cb028e0d834 100644 --- a/dev/src/AddComponent/Manifest.php +++ b/dev/src/AddComponent/Manifest.php @@ -17,6 +17,7 @@ namespace Google\Cloud\Dev\AddComponent; +use Google\Cloud\Dev\QuestionTrait; use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; diff --git a/dev/src/AddComponent/Readmes.php b/dev/src/AddComponent/Readmes.php index 6ba99b3e7158..09fe830b3937 100644 --- a/dev/src/AddComponent/Readmes.php +++ b/dev/src/AddComponent/Readmes.php @@ -18,6 +18,7 @@ namespace Google\Cloud\Dev\AddComponent; use Google\Cloud\Dev\AddComponent\Command\AddComponent; +use Google\Cloud\Dev\QuestionTrait; use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; diff --git a/dev/src/AddComponent/TableOfContents.php b/dev/src/AddComponent/TableOfContents.php index e89fbd638445..0d1f1d06ec63 100644 --- a/dev/src/AddComponent/TableOfContents.php +++ b/dev/src/AddComponent/TableOfContents.php @@ -17,6 +17,7 @@ namespace Google\Cloud\Dev\AddComponent; +use Google\Cloud\Dev\QuestionTrait; use Symfony\Component\Console\Helper\FormatterHelper; use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputInterface; diff --git a/dev/src/ComponentVersionTrait.php b/dev/src/ComponentVersionTrait.php new file mode 100644 index 000000000000..9c87b8f14e9e --- /dev/null +++ b/dev/src/ComponentVersionTrait.php @@ -0,0 +1,114 @@ +getManifest($this->manifest()); + $index = $this->getManifestComponentModuleIndex($manifest, $component['id']); + + array_unshift($manifest['modules'][$index]['versions'], 'v'. $version); + + $content = json_encode($manifest, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) ."\n"; + $result = file_put_contents($this->manifest(), $content); + $this->setManifest($manifest); + + if (!$result) { + throw new \RuntimeException('File write failed'); + } + } + + /** + * Update the VERSION constant in a veneer entry file. + * + * @param string $version The new version. (do not prefix with `v`). + * @param string $componentPath The path to the component, relative to the root of the project. + * @param string $componentEntry The name of the entry file to modify (i.e. FooClient.php). + * @return bool + */ + private function updateComponentVersionConstant($version, $componentPath, $componentEntry) + { + if (is_null($componentEntry)) { + return false; + } + + $path = $this->rootPath() .'/'. $componentPath .'/'. $componentEntry; + if (!file_exists($path)) { + throw new \RuntimeException(sprintf( + 'Component entry file %s does not exist', + $path + )); + } + + $entry = file_get_contents($path); + + $replacement = sprintf("const VERSION = '%s';", $version); + + $entry = preg_replace("/const VERSION = [\'\\\"]([0-9.]{0,}|master)[\'\\\"]\;/", $replacement, $entry); + + $result = file_put_contents($path, $entry); + + if (!$result) { + throw new \RuntimeException('File write failed'); + } + + return true; + } + + /** + * Update the VERSION file in a component directory. + * + * @param string $version The new version. (do not prefix with `v`). + * @param array $component The component data as an array. + * @return bool + */ + private function updateComponentVersionFile($version, array $component) + { + $path = $this->rootPath() .'/'. $component['path'] .'/VERSION'; + $result = file_put_contents($path, $version); + + if (!$result) { + throw new \RuntimeException('File write failed'); + } + + return true; + } + + /** + * Update the `replaces` version in the main composer.json file. + * + * @param string $version The new version. (do not prefix with `v`). + * @param array $component The component data as an array. + * @return void + */ + private function updateComposerReplacesVersion($version, array $component) + { + $composer = $this->rootPath() .'/composer.json'; + if (!file_exists($composer)) { + throw new \Exception('Invalid composer.json path'); + } + + $data = json_decode(file_get_contents($composer), true); + + $data['replace'][$component['name']] = $version; + + file_put_contents($composer, json_encode($data, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); + } + + protected abstract function rootPath(); + protected abstract function manifest(); +} diff --git a/dev/src/DocGenerator/Command/Docs.php b/dev/src/DocGenerator/Command/Docs.php index 4bb87cc9fb47..4a7c1fd4ee99 100644 --- a/dev/src/DocGenerator/Command/Docs.php +++ b/dev/src/DocGenerator/Command/Docs.php @@ -21,7 +21,6 @@ use Google\Cloud\Dev\Command\GoogleCloudCommand; use Google\Cloud\Dev\DocGenerator\DocGenerator; use Google\Cloud\Dev\DocGenerator\GuideGenerator; -use Google\Cloud\Dev\DocGenerator\RegexFileFilter; use Google\Cloud\Dev\DocGenerator\TableOfContents; use Google\Cloud\Dev\DocGenerator\TypeGenerator; use Google\Cloud\Dev\GetComponentsTrait; diff --git a/dev/src/GetComponentsTrait.php b/dev/src/GetComponentsTrait.php index c1af256c782a..98496ca03e0c 100644 --- a/dev/src/GetComponentsTrait.php +++ b/dev/src/GetComponentsTrait.php @@ -17,6 +17,9 @@ namespace Google\Cloud\Dev; +/** + * Helper for managing components. + */ trait GetComponentsTrait { private static $__manifest; @@ -122,7 +125,7 @@ private function getManifest($manifestPath) $manifest = json_decode(file_get_contents($manifestPath), true); if (json_last_error() !== JSON_ERROR_NONE) { - throw new RuntimeException('Could not decode manifest json'); + throw new \RuntimeException('Could not decode manifest json'); } self::$__manifest = $manifest; @@ -131,6 +134,11 @@ private function getManifest($manifestPath) return $manifest; } + private function setManifest(array $manifest) + { + self::$__manifest = $manifest; + } + /** * Get the composer.json data for a given component. * diff --git a/dev/src/AddComponent/QuestionTrait.php b/dev/src/QuestionTrait.php similarity index 87% rename from dev/src/AddComponent/QuestionTrait.php rename to dev/src/QuestionTrait.php index f0620ffe151d..0a5fa0b902c9 100644 --- a/dev/src/AddComponent/QuestionTrait.php +++ b/dev/src/QuestionTrait.php @@ -15,17 +15,19 @@ * limitations under the License. */ -namespace Google\Cloud\Dev\AddComponent; +namespace Google\Cloud\Dev; use Symfony\Component\Console\Question\ChoiceQuestion; use Symfony\Component\Console\Question\ConfirmationQuestion; use Symfony\Component\Console\Question\Question; /** - * Helpers for asking questions + * Helpers for asking questions in an interactice CLI. */ trait QuestionTrait { + private $choiceDefaultText = ' (default)'; + protected abstract function questionHelper(); protected abstract function input(); protected abstract function output(); @@ -48,7 +50,7 @@ private function askQuestion(Question $question) private function question($question, $default = null) { if ($default) { - $question = $question . ' (leave blank for '. $default .')'; + $question = $question . ' (leave blank for "'. $default .'")'; } return new Question( @@ -67,10 +69,16 @@ private function choice($question, array $options, $default = null) } $key = array_search($default, $options); - $options[$key] = $options[$key] .' (default)'; + $options[$key] = $options[$key] . $this->choiceDefaultText; + $default = $options[$key]; } - return new ChoiceQuestion($question, $options); + return new ChoiceQuestion($question, $options, $default); + } + + private function removeDefaultFromChoice($answer) + { + return rtrim($answer, $this->choiceDefaultText); } private function confirm($question, $defaultToYes = true) diff --git a/dev/src/Release/Command/Release.php b/dev/src/Release/Release.php similarity index 67% rename from dev/src/Release/Command/Release.php rename to dev/src/Release/Release.php index c4fe2ffa070e..90178e288a3a 100644 --- a/dev/src/Release/Command/Release.php +++ b/dev/src/Release/Release.php @@ -15,10 +15,10 @@ * limitations under the License. */ -namespace Google\Cloud\Dev\Release\Command; +namespace Google\Cloud\Dev\Release; use Google\Cloud\Dev\Command\GoogleCloudCommand; -use Google\Cloud\Dev\GetComponentsTrait; +use Google\Cloud\Dev\ComponentVersionTrait; use RuntimeException; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -27,7 +27,7 @@ class Release extends GoogleCloudCommand { - use GetComponentsTrait; + use ComponentVersionTrait; const COMPONENT_BASE = '%s/'; const DEFAULT_COMPONENT = 'google-cloud'; @@ -149,73 +149,13 @@ private function getNextVersionName($type, array $component) return $lastRelease->inc($type); } - private function addToComponentManifest($version, array $component) + protected function rootPath() { - $manifest = $this->getManifest($this->manifest); - $index = $this->getManifestComponentModuleIndex($manifest, $component['id']); - - array_unshift($manifest['modules'][$index]['versions'], 'v'. $version); - - $content = json_encode($manifest, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) ."\n"; - $result = file_put_contents($this->manifest, $content); - - if (!$result) { - throw new RuntimeException('File write failed'); - } - } - - private function updateComponentVersionConstant($version, $componentPath, $componentEntry) - { - if (is_null($componentEntry)) { - return false; - } - - $path = $this->rootPath .'/'. $componentPath .'/'. $componentEntry; - if (!file_exists($path)) { - throw new \RuntimeException(sprintf( - 'Component entry file %s does not exist', - $path - )); - } - - $entry = file_get_contents($path); - - $replacement = sprintf("const VERSION = '%s';", $version); - - $entry = preg_replace("/const VERSION = [\'\\\"]([0-9.]{0,}|master)[\'\\\"]\;/", $replacement, $entry); - - $result = file_put_contents($path, $entry); - - if (!$result) { - throw new RuntimeException('File write failed'); - } - - return true; - } - - private function updateComponentVersionFile($version, array $component) - { - $path = $this->rootPath .'/'. $component['path'] .'/VERSION'; - $result = file_put_contents($path, $version); - - if (!$result) { - throw new RuntimeException('File write failed'); - } - - return true; + return $this->rootPath; } - private function updateComposerReplacesVersion($version, array $component) + protected function manifest() { - $composer = $this->rootPath .'/composer.json'; - if (!file_exists($composer)) { - throw new \Exception('Invalid composer.json path'); - } - - $data = json_decode(file_get_contents($composer), true); - - $data['replace'][$component['name']] = $version; - - file_put_contents($composer, json_encode($data, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); + return $this->manifest; } } diff --git a/dev/src/ReleaseBuilder/ReleaseBuilder.php b/dev/src/ReleaseBuilder/ReleaseBuilder.php new file mode 100644 index 000000000000..431b397ad528 --- /dev/null +++ b/dev/src/ReleaseBuilder/ReleaseBuilder.php @@ -0,0 +1,759 @@ + 'patch', + self::LEVEL_MINOR => 'minor', + self::LEVEL_MAJOR => 'major', + ]; + + public function __construct($rootPath) + { + $this->manifest = sprintf(self::PATH_MANIFEST, $rootPath); + $this->components = sprintf(self::COMPONENT_BASE, $rootPath); + $this->defaultComponentComposer = $rootPath .'/composer.json'; + + $this->http = new Client; + $this->token = getenv(self::TOKEN_ENV); + + parent::__construct($rootPath); + } + + protected function configure() + { + $this->setName('rb') + ->setDescription('An interactive tool for creating releases.'); + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->input = $input; + $this->output = $output; + + $version = $this->getComponentVersion($this->manifest, 'google-cloud'); + $composer = $this->getComponentComposer($this->manifest, 'google-cloud'); + list ($org, $repo) = $this->getOrgAndRepo($composer); + + if (!$this->hasExpectedBase($org, $repo, $version)) { + throw new \RuntimeException(sprintf( + 'Expected tag %s not found in %s/%s', + $version, + $org, + $repo + )); + } + + $commits = $this->getCommits($org, $repo, $version); + $output->writeln(sprintf('%s commits found.', count($commits))); + + $release = []; + foreach ($commits as $commit) { + $components = $this->getCommitComponentModifiedList($commit['url']); + if (!$components) { + continue; + } + + $commitRelease = $this->interactiveCommitRelease($output, $commit, $components); + $release = $this->mergeCommitIntoRelease($release, $commitRelease); + } + + $release = $this->determineUmbrellaLevel($release); + $release = $this->determineReleaseVersions($release); + + $this->updateComponentVersions($release); + $notesLocation = $this->createReleaseNotes($release); + + $output->writeln(sprintf( + 'Release created!'. PHP_EOL .'Release notes generated at %s', + realpath($notesLocation) + )); + } + + /** + * Iterate through a release and do the work of preparing a release. + * + * @param array $release An associative array, where the key is the + * component ID and the value is structured data describing the + * release. + * @return void + */ + private function updateComponentVersions(array $release) + { + foreach ($release as $key => $releaseComponent) + { + $component = $this->getComponentComposer($this->rootPath(), $key); + + $this->addToComponentManifest($releaseComponent['version'], $component); + foreach ((array) $component['entry'] as $entry) { + $entryUpdated = $this->updateComponentVersionConstant( + $releaseComponent['version'], + $component['path'], + $entry + ); + } + + if ($component['id'] !== 'google-cloud') { + $this->updateComponentVersionFile($releaseComponent['version'], $component); + $this->updateComposerReplacesVersion($releaseComponent['version'], $component); + } + } + } + + /** + * Iterate through a release and determine the new version numbers based on + * the release type of each component (patch, minor, major) and the latest + * previous release number. + * + * @param array $release An associative array, where the key is the + * component ID and the value is structured data describing the + * release. + * @return array $release + */ + private function determineReleaseVersions(array $release) + { + foreach ($release as $key => &$component) { + $latestVersion = $this->getComponentVersion($this->manifest, $key); + $latestVersion = $latestVersion !== 'master' + ? $latestVersion + : '0.0.0'; + + $oldVersion = new version($latestVersion); + + $component['version'] = (string) $oldVersion->inc($this->levels[$component['level']]); + } + + return $release; + } + + /** + * Determine the release level of the umbrella package by examining the + * levels of all affected components and incrementing the umbrella by the + * highest level of a component release. + * + * In other words, if three components are released as patches, the umbrella + * will be a patch release. If there are any minor releases, the umbrella is + * released as a minor. The umbrella package will never be incrememted as a + * major release. + * + * @param array $release An associative array, where the key is the + * component ID and the value is structured data describing the + * release. + * @return array $release + */ + private function determineUmbrellaLevel(array $release) + { + $levels = []; + array_walk($release, function ($component) use (&$levels) { + $levels[] = $component['level']; + }); + + $levels = array_unique($levels); + rsort($levels); + + // Since we don't use major versions of the umbrella, major versions of + // components only bump the umbrella by a minor increment. + if ($levels[0] === self::LEVEL_MAJOR) { + $levels[0] = self::LEVEL_MINOR; + } + + $release[self::DEFAULT_COMPONENT] = [ + 'level' => $levels[0] + ]; + + return $release; + } + + /** + * Build a release notes markdown file. + * + * @param array $release An associative array, where the key is the + * component ID and the value is structured data describing the + * release. + * @return void + */ + private function createReleaseNotes(array $release) + { + $buildDir = $this->rootPath .'/build'; + $locationTemplate = $buildDir . '/release-%s.md'; + + if (!is_dir($buildDir)) { + mkdir($buildDir); + } + + $umbrella = $release[self::DEFAULT_COMPONENT]; + $location = sprintf($locationTemplate, $umbrella['version']); + + unset($release[self::DEFAULT_COMPONENT]); + + ksort($release); + + $notes = []; + foreach ($release as $key => $component) { + $messages = []; + foreach ($component['messages'] as $message) { + $messages[] = sprintf('* %s', $message); + } + + $notes[] = sprintf('### google/%s v%s', $key, $component['version']) + . PHP_EOL . PHP_EOL . implode(PHP_EOL, $messages); + } + + $template = file_get_contents(__DIR__ .'/templates/release-notes.md.txt'); + $template = str_replace('{version}', $umbrella['version'], $template); + $template = str_replace('{notes}', implode(PHP_EOL . PHP_EOL, $notes), $template); + + file_put_contents($location, $template); + + return $location; + } + + /** + * Interlace new commit release data into an existing release structure. + * + * @param array $release An associative array, where the key is the + * component ID and the value is structured data describing the + * release. + * @param array $commitRelease The release data generated for a single commit. + * @return array $release + */ + private function mergeCommitIntoRelease(array $release, array $commitRelease) + { + foreach ($commitRelease as $key => $commit) { + if (!isset($release[$key])) { + $release[$key] = [ + 'level' => $commit['level'], + 'messages' => [$commit['message']] + ]; + } else { + $release[$key]['messages'][] = $commit['message']; + $release[$key]['level'] = ($release[$key]['level'] >= $commit['level']) + ? $release[$key]['level'] + : $commit['level']; + } + } + + return $release; + } + + /** + * Determine defaults for components affected by the commit, display an + * overview and provide an interface for modifications. + * + * @param OutputInterface $output The Symfony Output for writing to stdout + * @param array $commit The commit data. + * @param array $components Components modified by the commit. + * @return array Structured data about components modified in this commit. + */ + private function interactiveCommitRelease(OutputInterface $output, array $commit, array $components) + { + $commitRelease = $this->processCommit($output, $commit, $components); + + $proceed = false; + do { + $this->displayCommitSummary($output, $commitRelease); + + $output->writeln(''); + + $choices = [ + 'Proceed without changes', + 'Change component release type or message.', + 'Start over' + ]; + $q = $this->choice('Choose an action', $choices, $choices[0]); + + $action = $this->removeDefaultFromChoice($this->askQuestion($q)); + + switch ($action) { + case $choices[0]: + $proceed = true; + break; + + case $choices[1]: + $commitRelease = $this->handleChange($output, $commitRelease); + break; + + case $choices[2]: + $commitRelease = $this->processCommit($output, $commit, $components); + break; + } + } while (!$proceed); + + $output->writeln(''); + + return $commitRelease; + } + + /** + * An interactive flow for modifying release data. + * + * @param OutputInterface $output + * @param array $commitRelease Structured data about components modified by + * the current commit. + */ + public function handleChange(OutputInterface $output, array $commitRelease) + { + $choices = array_keys($commitRelease); + + $noMoreChanges = false; + do { + if (count($choices) > 1) { + $q = $this->choice('Choose a component to modify.', array_merge($choices, [ + 'Go Back' + ])); + $component = $this->askQuestion($q); + + if ($component === 'Go Back') { + $noMoreChanges = true; + continue; + } + } else { + $component = $choices[0]; + } + + $componentOverview = sprintf( + 'google/%s [%s]:', + $component, + $this->levels[$commitRelease[$component]['level']] + ); + + $q = $this->choice(sprintf('%s What to you want to change?', $componentOverview), [ + 'Message', + 'Release Type', + 'Go Back' + ]); + $action = $this->askQuestion($q); + + switch ($action) { + case 'Message': + $commitRelease[$component]['message'] = $this->askMessage( + $commitRelease[$component], + $componentOverview + ); + break; + + case 'Release Type': + $commitRelease[$component]['level'] = $this->askLevel( + $componentOverview + ); + break; + + case 'Go Back': + if (count($choices) === 1) { + $noMoreChanges = true; + } + + continue; + break; + } + } while (!$noMoreChanges); + + return $commitRelease; + } + + /** + * Interactive multiple-choice dialog to select a release level. + * + * @param string $overview A string describing the name and current state of + * the component. + * @return int The new commit level. + */ + private function askLevel($overview) + { + $q = $this->choice(sprintf( + '%s Choose a release level.', + $overview + ), $this->levels); + + $level = $this->askQuestion($q); + + return array_search($level, $this->levels); + } + + /** + * An interactive dialog to modify the release note for a component. + * + * @param array $component An array containing component data. + * @param string $overview A string describing the name and current state of + * the component. + * @return string + */ + private function askMessage(array $component, $overview) + { + $message = $this->ask(sprintf( + '%s Enter a release note message. Do not enter the Pull Request reference number.'. + PHP_EOL .' - Message: %s', + $overview, + $component['message'] + ), $component['message']); + + $message .= ' (#'. $component['ref'] .')'; + + return $message; + } + + /** + * Top-level CLI to process a single commit and display information to the user. + * + * @param OutputInterface $output + * @param array $commit Data about the commit. + * @param array $components Data about all components modified in the commit. + * @return array + */ + private function processCommit(OutputInterface $output, array $commit, array $components) + { + $output->writeln(sprintf( + 'Processing Commit: %s', + $commit['message'] + )); + $output->writeln(sprintf('View on GitHub: %s', $commit['htmlUrl'])); + $output->writeln('----------'); + $output->writeln(''); + + $message = trim($this->ask('Enter a release summary for this commit. You can change this later.', $commit['message'])); + + $commitRelease = []; + foreach ($components as $key => $component) { + $componentRelease = isset($commitRelease[$key]) + ? $commitRelease[$key] + : ['level' => self::LEVEL_PATCH, 'message' => '', 'reasons' => []]; + + $lowestAllowedLevel = $componentRelease['level']; + $suggestedLevel = $lowestAllowedLevel; + $allowedLevels = array_filter($this->levels, function ($name, $key) use ($lowestAllowedLevel) { + return $key >= $lowestAllowedLevel; + }, ARRAY_FILTER_USE_BOTH); + + $output->writeln(sprintf('Component %s modified by commit.', $key)); + + list ($suggestedLevel, $reasons) = + $this->determineSuggestedLevel($allowedLevels, $suggestedLevel, $component['files']); + + $output->writeln(sprintf( + 'We suggest a %s release because of the following reasons. Please do not use this as an ' . + 'absolute guide, as this tool is unable to determine the correct outcome in every scenario.', + $this->levels[$suggestedLevel] + )); + $output->writeln(''); + + foreach ($reasons as $reason) { + $output->writeln('* '. $reason); + } + + $output->writeln(''); + + $componentRelease['level'] = $suggestedLevel; + $componentRelease['message'] = $message .' (#'. $commit['reference'] .')'; + $componentRelease['reasons'] = array_merge($componentRelease['reasons'], $reasons); + $componentRelease['ref'] = $commit['reference']; + + $commitRelease[$key] = $componentRelease; + } + + return $commitRelease; + } + + /** + * Formatted summary of the release state of components in the commit. + * + * @param OutputInterface $output + * @param array $commitRelease Release data scoped to a single commit. + * @return void + */ + private function displayCommitSummary(OutputInterface $output, array $commitRelease) + { + $output->writeln('Commit Summary'); + $output->writeln('-----'); + + foreach ($commitRelease as $key => $releaseInfo) { + $output->writeln(sprintf('google/%s [%s]', $key, $this->levels[$releaseInfo['level']])); + $output->writeln(sprintf(' - Message: %s', $releaseInfo['message'])); + } + } + + /** + * Logic to determine the best release level for a component. + * + * @param array $levelChoices Allowed levels for the component. + * @param string $suggestedLevel The current suggested level for the release. + * @param array $files A list of files in the component folder modified in + * the commit. + * @return array [$suggestedLevel, $reasons] + */ + private function determineSuggestedLevel(array $levelChoices, $suggestedLevel, array $files) + { + $reasons = []; + + if ($levelChoices !== $this->levels) { + $suggestedLevel = array_keys($levelChoices)[0]; + $reasons[] = 'Another change specified a higher minimum release level.'; + } + + if (isset($levelChoices[self::LEVEL_MINOR]) && (bool) array_filter($files, function ($file) { + $parts = explode('/', $file); + return isset($parts[1]) && $parts[1] === 'src' && count($parts) > 2; + })) { + $suggestedLevel = self::LEVEL_MINOR; + $reasons[] = 'There are changes in the component `src` folder.'; + } + + if (isset($levelChoices[self::LEVEL_MINOR]) && in_array('composer.json', $files)) { + $suggestedLevel = self::LEVEL_MINOR; + $reasons[] = 'The component `composer.json` file was modified.'; + } + + if ($suggestedLevel === self::LEVEL_PATCH) { + $reasons[] = 'None of the indicators show the commit includes a client-facing code change.'; + } + + return [$suggestedLevel, $reasons]; + } + + /** + * Parse the organization and repo from a composer file. + * + * @param array $composer + * @return array [$org, $repo] + */ + private function getOrgAndRepo(array $composer) + { + $target = $composer['target']; + + $matches = []; + preg_match(self::TARGET_REGEX, $target, $matches); + + $org = $matches[1]; + $repo = $matches[2]; + + return [$org, $repo]; + } + + /** + * Check that a Github Repository has the expected release. + * + * Used to verify existence of the previous release to compare against. + * + * @param string $org The github organization + * @param string $repo The github repository name. + * @param string $version The version to search for. + * @return bool + */ + private function hasExpectedBase($org, $repo, $version) + { + $url = sprintf( + self::GITHUB_RELEASES_ENDPOINT, + $org, + $repo, + $version + ); + + try { + $res = $this->http->get($url, [ + 'auth' => [null, $this->token] + ]); + return true; + } catch (RequestException $e) { + return false; + } + } + + /** + * Get a list of commits between a version and the current repository state. + * + * @param string $org The github organization + * @param string $repo The github repository name. + * @param string $version The version to search for. + * @return array + */ + private function getCommits($org, $repo, $version) + { + $url = sprintf( + self::GITHUB_COMPARE_ENDPOINT, + $org, + $repo, + $version + ); + + $res = json_decode($this->http->get($url, [ + 'auth' => [null, $this->token] + ])->getBody(), true); + $commits = []; + foreach ($res['commits'] as $commit) { + $message = $commit['commit']['message']; + + $description = explode("\n", $message)[0]; + $matches = []; + preg_match('/(.{0,})\(\#(\d{1,})\)/', $description, $matches); + $commits[] = [ + 'url' => $commit['url'], + 'htmlUrl' => $commit['html_url'], + 'message' => trim($matches[1]), + 'reference' => $matches[2], + 'hash' => $commit['sha'] + ]; + } + + return $commits; + } + + /** + * Query the github API for a list of files modified by a commit. + * + * @param string $url The URL to the commit. + * @return array A list of files. + */ + private function getCommitComponentModifiedList($url) + { + $commit = json_decode($this->http->get($url, [ + 'auth' => [null, $this->token] + ])->getBody(), true); + + $changedComponents = []; + $fileDirectoryComponent = []; + foreach ($commit['files'] as $file) { + $filename = $file['filename']; + if (strpos($filename, '/') === false) { + continue; + } + + $fileParts = explode('/', $filename); + $componentDirectory = $fileParts[0]; + + $composerPath = $this->rootPath .'/'. $componentDirectory .'/composer.json'; + if (!array_key_exists($composerPath, $fileDirectoryComponent)) { + if (!file_exists($composerPath)) { + continue; + } + + $composer = json_decode(file_get_contents($composerPath), true)['extra']['component']; + $fileDirectoryComponent[$composerPath] = $composer; + } else { + $composer = $fileDirectoryComponent[$composerPath]; + } + + if (!isset($changedComponents[$composer['id']])) { + $changedComponents[$composer['id']] = [ + 'files' => [], + 'level' => 'minor' + ]; + } + + $changedComponents[$composer['id']]['files'][] = $file['filename']; + } + + return $changedComponents; + } + + protected function questionHelper() + { + return $this->getHelper('question'); + } + + protected function input() + { + return $this->input; + } + + protected function output() + { + return $this->output; + } + + protected function rootPath() + { + return $this->rootPath; + } + + protected function manifest() + { + return $this->manifest; + } +} diff --git a/dev/src/ReleaseBuilder/templates/release-notes.md.txt b/dev/src/ReleaseBuilder/templates/release-notes.md.txt new file mode 100644 index 000000000000..1e3269b248f6 --- /dev/null +++ b/dev/src/ReleaseBuilder/templates/release-notes.md.txt @@ -0,0 +1,3 @@ +## Google Cloud PHP v{version} + +{notes} diff --git a/docs/manifest.json b/docs/manifest.json index f5acdedd401b..20bc12e4c161 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -11,6 +11,8 @@ "name": "google/cloud", "defaultService": "servicebuilder", "versions": [ + "v0.72.0", + "v0.71.0", "v0.70.0", "v0.69.1", "v0.69.0", @@ -109,6 +111,8 @@ "name": "google/cloud-bigquery", "defaultService": "bigquery/bigqueryclient", "versions": [ + "v1.4.0", + "v1.3.0", "v1.2.4", "v1.2.3", "v1.2.2", @@ -138,6 +142,7 @@ "name": "google/cloud-bigquerydatatransfer", "defaultService": "bigquerydatatransfer/readme", "versions": [ + "v0.6.2", "v0.6.1", "v0.6.0", "v0.5.1", @@ -156,6 +161,8 @@ "name": "google/cloud-bigtable", "defaultService": "bigtable/readme", "versions": [ + "v0.5.3", + "v0.5.2", "v0.5.1", "v0.5.0", "v0.4.1", @@ -179,6 +186,7 @@ "name": "google/cloud-container", "defaultService": "container/readme", "versions": [ + "v0.5.2", "v0.5.1", "v0.5.0", "v0.4.1", @@ -202,6 +210,8 @@ "name": "google/cloud-core", "defaultService": "core/servicebuilder", "versions": [ + "v1.21.1", + "v1.21.0", "v1.20.7", "v1.20.6", "v1.20.5", @@ -254,6 +264,8 @@ "name": "google/cloud-dataproc", "defaultService": "dataproc/readme", "versions": [ + "v0.5.3", + "v0.5.2", "v0.5.1", "v0.5.0", "v0.4.1", @@ -304,6 +316,7 @@ "name": "google/cloud-debugger", "defaultService": "debugger/debuggerclient", "versions": [ + "v0.12.2", "v0.12.1", "v0.12.0", "v0.11.0", @@ -327,6 +340,7 @@ "name": "google/cloud-dialogflow", "defaultService": "dialogflow/readme", "versions": [ + "v0.3.2", "v0.3.1", "v0.3.0", "v0.2.1", @@ -341,6 +355,8 @@ "name": "google/cloud-dlp", "defaultService": "dlp/readme", "versions": [ + "v0.11.2", + "v0.11.1", "v0.11.0", "v0.10.0", "v0.9.1", @@ -373,6 +389,7 @@ "name": "google/cloud-error-reporting", "defaultService": "errorreporting/readme", "versions": [ + "v0.11.2", "v0.11.1", "v0.11.0", "v0.10.1", @@ -411,6 +428,7 @@ "name": "google/cloud-firestore", "defaultService": "firestore/firestoreclient", "versions": [ + "v0.12.0", "v0.11.2", "v0.11.1", "v0.11.0", @@ -444,6 +462,7 @@ "name": "google/cloud-iot", "defaultService": "iot/readme", "versions": [ + "v0.3.2", "v0.3.1", "v0.3.0", "v0.2.1", @@ -460,6 +479,8 @@ "name": "google/cloud-kms", "defaultService": "kms/readme", "versions": [ + "v0.2.0", + "v0.1.1", "v0.1.0", "master" ] @@ -469,6 +490,7 @@ "name": "google/cloud-language", "defaultService": "language/languageclient", "versions": [ + "v0.15.2", "v0.15.1", "v0.15.0", "v0.14.1", @@ -506,6 +528,8 @@ "name": "google/cloud-logging", "defaultService": "logging/loggingclient", "versions": [ + "v1.12.5", + "v1.12.4", "v1.12.3", "v1.12.2", "v1.12.1", @@ -548,6 +572,7 @@ "name": "google/cloud-monitoring", "defaultService": "monitoring/readme", "versions": [ + "v0.11.2", "v0.11.1", "v0.11.0", "v0.10.1", @@ -584,6 +609,7 @@ "name": "google/cloud-oslogin", "defaultService": "oslogin/readme", "versions": [ + "v0.6.1", "v0.6.0", "v0.5.0", "v0.4.1", @@ -607,6 +633,7 @@ "name": "google/cloud-pubsub", "defaultService": "pubsub/pubsubclient", "versions": [ + "v1.4.1", "v1.4.0", "v1.3.0", "v1.2.1", @@ -649,6 +676,8 @@ "name": "google/cloud-redis", "defaultService": "redis/readme", "versions": [ + "v0.3.3", + "v0.3.2", "v0.3.1", "v0.3.0", "v0.2.1", @@ -663,6 +692,7 @@ "name": "google/cloud-spanner", "defaultService": "spanner/spannerclient", "versions": [ + "v1.6.2", "v1.6.1", "v1.6.0", "v1.5.2", @@ -707,6 +737,7 @@ "name": "google/cloud-speech", "defaultService": "speech/speechclient", "versions": [ + "v0.15.2", "v0.15.1", "v0.15.0", "v0.14.1", @@ -744,6 +775,7 @@ "name": "google/cloud-storage", "defaultService": "storage/storageclient", "versions": [ + "v1.6.0", "v1.5.2", "v1.5.1", "v1.5.0", @@ -771,6 +803,7 @@ "name": "google/cloud-tasks", "defaultService": "tasks/readme", "versions": [ + "v0.2.0", "v0.1.0", "master" ] @@ -780,6 +813,8 @@ "name": "google/cloud-text-to-speech", "defaultService": "texttospeech/readme", "versions": [ + "v0.1.1", + "v0.1.0", "master" ] }, @@ -788,6 +823,7 @@ "name": "google/cloud-trace", "defaultService": "trace/traceclient", "versions": [ + "v0.10.2", "v0.10.1", "v0.10.0", "v0.9.0", @@ -839,6 +875,8 @@ "name": "google/cloud-videointelligence", "defaultService": "videointelligence/readme", "versions": [ + "v1.0.4", + "v1.0.3", "v1.0.2", "v1.0.1", "v1.0.0", @@ -876,6 +914,8 @@ "name": "google/cloud-vision", "defaultService": "vision/visionclient", "versions": [ + "v0.15.1", + "v0.15.0", "v0.14.2", "v0.14.1", "v0.14.0", diff --git a/src/ServiceBuilder.php b/src/ServiceBuilder.php index f7aed1df7feb..7fc46d4d9cb9 100644 --- a/src/ServiceBuilder.php +++ b/src/ServiceBuilder.php @@ -30,5 +30,5 @@ class ServiceBuilder extends CoreServiceBuilder /** * @deprecated */ - const VERSION = '0.70.0'; + const VERSION = '0.72.0'; } diff --git a/src/Version.php b/src/Version.php index a2b8bacd05e8..2013b29fab42 100644 --- a/src/Version.php +++ b/src/Version.php @@ -22,5 +22,5 @@ */ class Version { - const VERSION = '0.70.0'; + const VERSION = '0.72.0'; }