From 5feea695f1cbbec5fadf022d2a8086aa2dbbfa97 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 12 Jul 2024 12:45:36 -0400 Subject: [PATCH] feat: publish ProtoRows Message (#7513) * feat: publish the Cloud Bigtable ExecuteQuery API The ExecuteQuery API will allow users to query Bigtable using SQL PiperOrigin-RevId: 650660213 Source-Link: https://github.com/googleapis/googleapis/commit/f681f79a93814d8b974da9dd8cdc62228d0f4758 Source-Link: https://github.com/googleapis/googleapis-gen/commit/3180845487136794952b8f365fe6c6868999d9c0 Copy-Tag: eyJwIjoiQmlndGFibGUvLk93bEJvdC55YW1sIiwiaCI6IjMxODA4NDU0ODcxMzY3OTQ5NTJiOGYzNjVmZTZjNjg2ODk5OWQ5YzAifQ== * feat: publish ProtoRows Message This is needed to parse ExecuteQuery responses PiperOrigin-RevId: 651386373 Source-Link: https://github.com/googleapis/googleapis/commit/a5be6fa5ff1603b2cab067408e2640d270f0e300 Source-Link: https://github.com/googleapis/googleapis-gen/commit/d467ce893a04c41e504983346c215d41fd263650 Copy-Tag: eyJwIjoiQmlndGFibGUvLk93bEJvdC55YW1sIiwiaCI6ImQ0NjdjZTg5M2EwNGM0MWU1MDQ5ODMzNDZjMjE1ZDQxZmQyNjM2NTAifQ== --- Bigtable/metadata/V2/Bigtable.php | Bin 11426 -> 12273 bytes Bigtable/metadata/V2/Data.php | Bin 4187 -> 5278 bytes Bigtable/metadata/V2/Types.php | Bin 0 -> 2894 bytes .../V2/BigtableClient/execute_query.php | 83 ++++ Bigtable/src/V2/ArrayValue.php | 67 +++ Bigtable/src/V2/Client/BigtableClient.php | 23 + Bigtable/src/V2/ColumnMetadata.php | 111 +++++ Bigtable/src/V2/ExecuteQueryRequest.php | 383 +++++++++++++++ Bigtable/src/V2/ExecuteQueryResponse.php | 117 +++++ Bigtable/src/V2/PartialResultSet.php | 225 +++++++++ Bigtable/src/V2/ProtoFormat.php | 34 ++ Bigtable/src/V2/ProtoRows.php | 78 +++ Bigtable/src/V2/ProtoRowsBatch.php | 71 +++ Bigtable/src/V2/ProtoSchema.php | 67 +++ Bigtable/src/V2/ResultSetMetadata.php | 75 +++ Bigtable/src/V2/Type.php | 458 ++++++++++++++++++ Bigtable/src/V2/Type/Aggregate.php | 284 +++++++++++ .../HyperLogLogPlusPlusUniqueCount.php | 42 ++ Bigtable/src/V2/Type/Aggregate/Max.php | 38 ++ Bigtable/src/V2/Type/Aggregate/Min.php | 38 ++ Bigtable/src/V2/Type/Aggregate/Sum.php | 38 ++ Bigtable/src/V2/Type/Bytes.php | 81 ++++ Bigtable/src/V2/Type/Bytes/Encoding.php | 78 +++ Bigtable/src/V2/Type/Bytes/Encoding/Raw.php | 39 ++ Bigtable/src/V2/Type/Date.php | 37 ++ Bigtable/src/V2/Type/Float32.php | 37 ++ Bigtable/src/V2/Type/Float64.php | 37 ++ Bigtable/src/V2/Type/Int64.php | 81 ++++ Bigtable/src/V2/Type/Int64/Encoding.php | 78 +++ .../V2/Type/Int64/Encoding/BigEndianBytes.php | 87 ++++ Bigtable/src/V2/Type/Map.php | 134 +++++ Bigtable/src/V2/Type/PBArray.php | 81 ++++ Bigtable/src/V2/Type/PBBool.php | 37 ++ Bigtable/src/V2/Type/PBString.php | 81 ++++ Bigtable/src/V2/Type/PBString/Encoding.php | 78 +++ .../V2/Type/PBString/Encoding/Utf8Bytes.php | 42 ++ Bigtable/src/V2/Type/Struct.php | 73 +++ Bigtable/src/V2/Type/Struct/Field.php | 118 +++++ Bigtable/src/V2/Type/Timestamp.php | 37 ++ Bigtable/src/V2/Value.php | 330 ++++++++++++- Bigtable/src/V2/gapic_metadata.json | 5 + .../V2/resources/bigtable_client_config.json | 3 + .../resources/bigtable_descriptor_config.php | 24 + .../resources/bigtable_rest_client_config.php | 12 + .../Unit/V2/Client/BigtableClientTest.php | 95 ++++ 45 files changed, 3934 insertions(+), 3 deletions(-) create mode 100644 Bigtable/metadata/V2/Types.php create mode 100644 Bigtable/samples/V2/BigtableClient/execute_query.php create mode 100644 Bigtable/src/V2/ArrayValue.php create mode 100644 Bigtable/src/V2/ColumnMetadata.php create mode 100644 Bigtable/src/V2/ExecuteQueryRequest.php create mode 100644 Bigtable/src/V2/ExecuteQueryResponse.php create mode 100644 Bigtable/src/V2/PartialResultSet.php create mode 100644 Bigtable/src/V2/ProtoFormat.php create mode 100644 Bigtable/src/V2/ProtoRows.php create mode 100644 Bigtable/src/V2/ProtoRowsBatch.php create mode 100644 Bigtable/src/V2/ProtoSchema.php create mode 100644 Bigtable/src/V2/ResultSetMetadata.php create mode 100644 Bigtable/src/V2/Type.php create mode 100644 Bigtable/src/V2/Type/Aggregate.php create mode 100644 Bigtable/src/V2/Type/Aggregate/HyperLogLogPlusPlusUniqueCount.php create mode 100644 Bigtable/src/V2/Type/Aggregate/Max.php create mode 100644 Bigtable/src/V2/Type/Aggregate/Min.php create mode 100644 Bigtable/src/V2/Type/Aggregate/Sum.php create mode 100644 Bigtable/src/V2/Type/Bytes.php create mode 100644 Bigtable/src/V2/Type/Bytes/Encoding.php create mode 100644 Bigtable/src/V2/Type/Bytes/Encoding/Raw.php create mode 100644 Bigtable/src/V2/Type/Date.php create mode 100644 Bigtable/src/V2/Type/Float32.php create mode 100644 Bigtable/src/V2/Type/Float64.php create mode 100644 Bigtable/src/V2/Type/Int64.php create mode 100644 Bigtable/src/V2/Type/Int64/Encoding.php create mode 100644 Bigtable/src/V2/Type/Int64/Encoding/BigEndianBytes.php create mode 100644 Bigtable/src/V2/Type/Map.php create mode 100644 Bigtable/src/V2/Type/PBArray.php create mode 100644 Bigtable/src/V2/Type/PBBool.php create mode 100644 Bigtable/src/V2/Type/PBString.php create mode 100644 Bigtable/src/V2/Type/PBString/Encoding.php create mode 100644 Bigtable/src/V2/Type/PBString/Encoding/Utf8Bytes.php create mode 100644 Bigtable/src/V2/Type/Struct.php create mode 100644 Bigtable/src/V2/Type/Struct/Field.php create mode 100644 Bigtable/src/V2/Type/Timestamp.php diff --git a/Bigtable/metadata/V2/Bigtable.php b/Bigtable/metadata/V2/Bigtable.php index 1d67086c27bd722549a5db7261890f5ce37775bb..66b62ccf1e4792ab34360507c577543ebbbfdfab 100644 GIT binary patch delta 641 zcmZ1!`7wTj3k%E5FfPT3-in(uS$>G9Dm6263Ab!Rf^Oz>!f%h>I1dt*BCh z879UgWX{C{R9uoDpO#;gn^+>j0+ix5lAmnIAz~E(l5hiydoTz|a`6KXip3+gqTaLo;Sj|h!P1OO%+AT*VETWSyNQ>~>D4FY*8R=I;mbMgxf$=0gO^41U%$!8x zi}(d11LBjQUmzAA{R$ri@dteK1Kj7#BwBn+)?Rz9z1B&-ufDH;`XVu4MZRi1AdJRerH9#% z>ri|1s1~nh%1^7yy&&khwAo3Wn!{F;ai>O~3s+atx%h@QO*Xbk36+$Ho@ z%$&6NI|I2B;tr^`0a?z_r&py-rKQJfrLv4?#ZTn+%WI%?MvO-GkW=*xQq;XEtpaMq zLdWl=xQuua@dYS4K1;zof--_-fKCv&DGG=d5JlxPHy~rOg0O_}7L+D2>|s~9syI_x z)kYF034wVVlUi}lx&go=rYC&o<_bl?F;-6~n@`LKVdUh!|of`VRphZ3G1F~8a^=p zVDp$Fo@%_6VD5l~%pvaNFzpV^B?pD*VT+yk+02r4RS(~&3~GpRJZiJxg8F(6OH#EZ qDC6JA!FK6svTaAs3#w;vnlooHZDMG1dGm_|m2Ti+TMMyY`t=9Ltsr** delta 70 zcmV-M0J;C3Dcc~h(*cux0xtrJ9FwjBGqXAa5CI2S3I$eSY;}`*1UHl51QZBD1_}gg cX>Me*`USEJ2tu_13KnB;ZIj^z6O*wM?IWxgBLDyZ diff --git a/Bigtable/metadata/V2/Types.php b/Bigtable/metadata/V2/Types.php new file mode 100644 index 0000000000000000000000000000000000000000..997c6ecf4fa26d4404380f2cc9a668662eed0dac GIT binary patch literal 2894 zcmb7`-)|d55Xb8{N#jXWm3u&zfv}X)xKJ+OhEOgI$d{j$2#MM>66hpreO_NyJ?|ZN zduap88{)saic`O_~tY7-JPA;dH7X)9K-u$hY6NY z$$F%FO5`ykaT3YMk3!PT`hAuVKN`e5WQk44=05pm|B!5LK0164(KN~upE)Fmq9A0; zT^>l<#fOvDvOJAhYHL>jf(}?3Q=gHY19y)}+M|+sJDT#`obrxZYXE*o)07-48h!+V zKXKL#xld9_C4SuIX@?6gISu&_sCk|AX_zu3FWUAq;Y%I~qJVwjv*ul5d@9@9afEAJ zCqo?vYT3AC?~#x!5j6BRS?VV|mQiwmrj8RZS!|a2rg=9HtK9KEX&Q}=b3x=fkx9nJ zqZ5)anI&RP>sAiViYM< z5ko~>g8$xt#mkdtS?0YxOs;*>y7lu-m{uvWRsg!ElBFG$?s|n(n)9ti`yyd0Yui<( zyVtB$m``QGMPRTgjlElnJ<+zvVKiLW>WaZ;u84+dTwOux0W9>xh|2pd!!2lzl!n_j z#$)6#Vr>#q$815ZiwDF6oYUAlr2$>E#ApxUhU8c$k`7`6f(CDuf`>zMq%k5E6*J)c z6%jYl(nO>|kg%WtXRnCZ9-1R*38?b`?5#l-D{0sDlnr@ob?6FG2ur&JaPFM^_EIujo4ecedAl08$MeOR1^9< zck$7L9_+{TIjWg~Dn7U{lG6CS0<-39qvw|uHcQ@FQ9dYp<}yXhsXrP|N?v+)wy z()dvSCfqpx9ahL|_o{OXpM_~vsf`+3&s#+CxVobDt0>0?nyM0O{A4nW=id4ZX8Wpr zr+9p-*d;$GT^Z&V0b4iw#sJ$STG3M!%SD_`CeHd4K;5^K zMRKcux2u?hYMKq|rhnWi+b_FNWIxFU*n2u)9fx5YcQV1h$EEpECS={*KkW&;?BeB@ zd>sY&dk|)+`g^K9Z74?=0Cf%Mi@NE)ljz!`FLI2Fy6LZl8Vi#Ocmwu|ps)NdRPCgX`QAkB#M@g_8Frf#; zW%G*0JRP4Q*M=jMa90j(+Pn iL)3AOTHRS4{r*xh6x}mp+SpWAI?-uMGk2ZA8NmM~zlC=I literal 0 HcmV?d00001 diff --git a/Bigtable/samples/V2/BigtableClient/execute_query.php b/Bigtable/samples/V2/BigtableClient/execute_query.php new file mode 100644 index 000000000000..166de231d987 --- /dev/null +++ b/Bigtable/samples/V2/BigtableClient/execute_query.php @@ -0,0 +1,83 @@ +/instances/` + * Please see {@see BigtableClient::instanceName()} for help formatting this field. + * @param string $query The query string. + */ +function execute_query_sample(string $formattedInstanceName, string $query): void +{ + // Create a client. + $bigtableClient = new BigtableClient(); + + // Prepare the request message. + $params = []; + $request = (new ExecuteQueryRequest()) + ->setInstanceName($formattedInstanceName) + ->setQuery($query) + ->setParams($params); + + // Call the API and handle any network failures. + try { + /** @var ServerStream $stream */ + $stream = $bigtableClient->executeQuery($request); + + /** @var ExecuteQueryResponse $element */ + foreach ($stream->readAll() as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedInstanceName = BigtableClient::instanceName('[PROJECT]', '[INSTANCE]'); + $query = '[QUERY]'; + + execute_query_sample($formattedInstanceName, $query); +} +// [END bigtable_v2_generated_Bigtable_ExecuteQuery_sync] diff --git a/Bigtable/src/V2/ArrayValue.php b/Bigtable/src/V2/ArrayValue.php new file mode 100644 index 000000000000..cb872d55e982 --- /dev/null +++ b/Bigtable/src/V2/ArrayValue.php @@ -0,0 +1,67 @@ +google.bigtable.v2.ArrayValue + */ +class ArrayValue extends \Google\Protobuf\Internal\Message +{ + /** + * The ordered elements in the array. + * + * Generated from protobuf field repeated .google.bigtable.v2.Value values = 1; + */ + private $values; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Bigtable\V2\Value>|\Google\Protobuf\Internal\RepeatedField $values + * The ordered elements in the array. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Data::initOnce(); + parent::__construct($data); + } + + /** + * The ordered elements in the array. + * + * Generated from protobuf field repeated .google.bigtable.v2.Value values = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValues() + { + return $this->values; + } + + /** + * The ordered elements in the array. + * + * Generated from protobuf field repeated .google.bigtable.v2.Value values = 1; + * @param array<\Google\Cloud\Bigtable\V2\Value>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Bigtable\V2\Value::class); + $this->values = $arr; + + return $this; + } + +} + diff --git a/Bigtable/src/V2/Client/BigtableClient.php b/Bigtable/src/V2/Client/BigtableClient.php index 3c72c0f3f846..aeb45221a720 100644 --- a/Bigtable/src/V2/Client/BigtableClient.php +++ b/Bigtable/src/V2/Client/BigtableClient.php @@ -36,6 +36,7 @@ use Google\Auth\FetchAuthTokenInterface; use Google\Cloud\Bigtable\V2\CheckAndMutateRowRequest; use Google\Cloud\Bigtable\V2\CheckAndMutateRowResponse; +use Google\Cloud\Bigtable\V2\ExecuteQueryRequest; use Google\Cloud\Bigtable\V2\GenerateInitialChangeStreamPartitionsRequest; use Google\Cloud\Bigtable\V2\MutateRowRequest; use Google\Cloud\Bigtable\V2\MutateRowResponse; @@ -306,6 +307,28 @@ public function checkAndMutateRow(CheckAndMutateRowRequest $request, array $call return $this->startApiCall('CheckAndMutateRow', $request, $callOptions)->wait(); } + /** + * Executes a BTQL query against a particular Cloud Bigtable instance. + * + * @example samples/V2/BigtableClient/execute_query.php + * + * @param ExecuteQueryRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type int $timeoutMillis + * Timeout to use for this call. + * } + * + * @return ServerStream + * + * @throws ApiException Thrown if the API call fails. + */ + public function executeQuery(ExecuteQueryRequest $request, array $callOptions = []): ServerStream + { + return $this->startApiCall('ExecuteQuery', $request, $callOptions); + } + /** * NOTE: This API is intended to be used by Apache Beam BigtableIO. * Returns the current list of partitions that make up the table's diff --git a/Bigtable/src/V2/ColumnMetadata.php b/Bigtable/src/V2/ColumnMetadata.php new file mode 100644 index 000000000000..35f3c975b0f7 --- /dev/null +++ b/Bigtable/src/V2/ColumnMetadata.php @@ -0,0 +1,111 @@ +google.bigtable.v2.ColumnMetadata + */ +class ColumnMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the column. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The type of the column. + * + * Generated from protobuf field .google.bigtable.v2.Type type = 2; + */ + protected $type = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the column. + * @type \Google\Cloud\Bigtable\V2\Type $type + * The type of the column. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Data::initOnce(); + parent::__construct($data); + } + + /** + * The name of the column. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the column. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The type of the column. + * + * Generated from protobuf field .google.bigtable.v2.Type type = 2; + * @return \Google\Cloud\Bigtable\V2\Type|null + */ + public function getType() + { + return $this->type; + } + + public function hasType() + { + return isset($this->type); + } + + public function clearType() + { + unset($this->type); + } + + /** + * The type of the column. + * + * Generated from protobuf field .google.bigtable.v2.Type type = 2; + * @param \Google\Cloud\Bigtable\V2\Type $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type::class); + $this->type = $var; + + return $this; + } + +} + diff --git a/Bigtable/src/V2/ExecuteQueryRequest.php b/Bigtable/src/V2/ExecuteQueryRequest.php new file mode 100644 index 000000000000..e51a31680124 --- /dev/null +++ b/Bigtable/src/V2/ExecuteQueryRequest.php @@ -0,0 +1,383 @@ +google.bigtable.v2.ExecuteQueryRequest + */ +class ExecuteQueryRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The unique name of the instance against which the query should be + * executed. + * Values are of the form `projects//instances/` + * + * Generated from protobuf field string instance_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $instance_name = ''; + /** + * Optional. This value specifies routing for replication. If not specified, + * the `default` application profile will be used. + * + * Generated from protobuf field string app_profile_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $app_profile_id = ''; + /** + * Required. The query string. + * + * Generated from protobuf field string query = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $query = ''; + /** + * Optional. If this request is resuming a previously interrupted query + * execution, `resume_token` should be copied from the last + * PartialResultSet yielded before the interruption. Doing this + * enables the query execution to resume where the last one left + * off. + * The rest of the request parameters must exactly match the + * request that yielded this token. Otherwise the request will fail. + * + * Generated from protobuf field bytes resume_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $resume_token = ''; + /** + * Required. params contains string type keys and Bigtable type values that + * bind to placeholders in the query string. In query string, a parameter + * placeholder consists of the + * `@` character followed by the parameter name (for example, `@firstName`) in + * the query string. + * For example, if + * `params["firstName"] = bytes_value: "foo" type {bytes_type {}}` + * then `@firstName` will be replaced with googlesql bytes value "foo" in the + * query string during query evaluation. + * In case of Value.kind is not set, it will be set to corresponding null + * value in googlesql. + * `params["firstName"] = type {string_type {}}` + * then `@firstName` will be replaced with googlesql null string. + * Value.type should always be set and no inference of type will be made from + * Value.kind. If Value.type is not set, we will return INVALID_ARGUMENT + * error. + * + * Generated from protobuf field map params = 7 [(.google.api.field_behavior) = REQUIRED]; + */ + private $params; + protected $data_format; + + /** + * @param string $instanceName Required. The unique name of the instance against which the query should be + * executed. + * Values are of the form `projects//instances/` + * Please see {@see BigtableClient::instanceName()} for help formatting this field. + * @param string $query Required. The query string. + * + * @return \Google\Cloud\Bigtable\V2\ExecuteQueryRequest + * + * @experimental + */ + public static function build(string $instanceName, string $query): self + { + return (new self()) + ->setInstanceName($instanceName) + ->setQuery($query); + } + + /** + * @param string $instanceName Required. The unique name of the instance against which the query should be + * executed. + * Values are of the form `projects//instances/` + * Please see {@see BigtableClient::instanceName()} for help formatting this field. + * @param string $query Required. The query string. + * @param string $appProfileId Optional. This value specifies routing for replication. If not specified, + * the `default` application profile will be used. + * + * @return \Google\Cloud\Bigtable\V2\ExecuteQueryRequest + * + * @experimental + */ + public static function buildFromInstanceNameQueryAppProfileId(string $instanceName, string $query, string $appProfileId): self + { + return (new self()) + ->setInstanceName($instanceName) + ->setQuery($query) + ->setAppProfileId($appProfileId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $instance_name + * Required. The unique name of the instance against which the query should be + * executed. + * Values are of the form `projects//instances/` + * @type string $app_profile_id + * Optional. This value specifies routing for replication. If not specified, + * the `default` application profile will be used. + * @type string $query + * Required. The query string. + * @type \Google\Cloud\Bigtable\V2\ProtoFormat $proto_format + * Protocol buffer format as described by ProtoSchema and ProtoRows + * messages. + * @type string $resume_token + * Optional. If this request is resuming a previously interrupted query + * execution, `resume_token` should be copied from the last + * PartialResultSet yielded before the interruption. Doing this + * enables the query execution to resume where the last one left + * off. + * The rest of the request parameters must exactly match the + * request that yielded this token. Otherwise the request will fail. + * @type array|\Google\Protobuf\Internal\MapField $params + * Required. params contains string type keys and Bigtable type values that + * bind to placeholders in the query string. In query string, a parameter + * placeholder consists of the + * `@` character followed by the parameter name (for example, `@firstName`) in + * the query string. + * For example, if + * `params["firstName"] = bytes_value: "foo" type {bytes_type {}}` + * then `@firstName` will be replaced with googlesql bytes value "foo" in the + * query string during query evaluation. + * In case of Value.kind is not set, it will be set to corresponding null + * value in googlesql. + * `params["firstName"] = type {string_type {}}` + * then `@firstName` will be replaced with googlesql null string. + * Value.type should always be set and no inference of type will be made from + * Value.kind. If Value.type is not set, we will return INVALID_ARGUMENT + * error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Bigtable::initOnce(); + parent::__construct($data); + } + + /** + * Required. The unique name of the instance against which the query should be + * executed. + * Values are of the form `projects//instances/` + * + * Generated from protobuf field string instance_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getInstanceName() + { + return $this->instance_name; + } + + /** + * Required. The unique name of the instance against which the query should be + * executed. + * Values are of the form `projects//instances/` + * + * Generated from protobuf field string instance_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setInstanceName($var) + { + GPBUtil::checkString($var, True); + $this->instance_name = $var; + + return $this; + } + + /** + * Optional. This value specifies routing for replication. If not specified, + * the `default` application profile will be used. + * + * Generated from protobuf field string app_profile_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getAppProfileId() + { + return $this->app_profile_id; + } + + /** + * Optional. This value specifies routing for replication. If not specified, + * the `default` application profile will be used. + * + * Generated from protobuf field string app_profile_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setAppProfileId($var) + { + GPBUtil::checkString($var, True); + $this->app_profile_id = $var; + + return $this; + } + + /** + * Required. The query string. + * + * Generated from protobuf field string query = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getQuery() + { + return $this->query; + } + + /** + * Required. The query string. + * + * Generated from protobuf field string query = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setQuery($var) + { + GPBUtil::checkString($var, True); + $this->query = $var; + + return $this; + } + + /** + * Protocol buffer format as described by ProtoSchema and ProtoRows + * messages. + * + * Generated from protobuf field .google.bigtable.v2.ProtoFormat proto_format = 4; + * @return \Google\Cloud\Bigtable\V2\ProtoFormat|null + */ + public function getProtoFormat() + { + return $this->readOneof(4); + } + + public function hasProtoFormat() + { + return $this->hasOneof(4); + } + + /** + * Protocol buffer format as described by ProtoSchema and ProtoRows + * messages. + * + * Generated from protobuf field .google.bigtable.v2.ProtoFormat proto_format = 4; + * @param \Google\Cloud\Bigtable\V2\ProtoFormat $var + * @return $this + */ + public function setProtoFormat($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\ProtoFormat::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Optional. If this request is resuming a previously interrupted query + * execution, `resume_token` should be copied from the last + * PartialResultSet yielded before the interruption. Doing this + * enables the query execution to resume where the last one left + * off. + * The rest of the request parameters must exactly match the + * request that yielded this token. Otherwise the request will fail. + * + * Generated from protobuf field bytes resume_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getResumeToken() + { + return $this->resume_token; + } + + /** + * Optional. If this request is resuming a previously interrupted query + * execution, `resume_token` should be copied from the last + * PartialResultSet yielded before the interruption. Doing this + * enables the query execution to resume where the last one left + * off. + * The rest of the request parameters must exactly match the + * request that yielded this token. Otherwise the request will fail. + * + * Generated from protobuf field bytes resume_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setResumeToken($var) + { + GPBUtil::checkString($var, False); + $this->resume_token = $var; + + return $this; + } + + /** + * Required. params contains string type keys and Bigtable type values that + * bind to placeholders in the query string. In query string, a parameter + * placeholder consists of the + * `@` character followed by the parameter name (for example, `@firstName`) in + * the query string. + * For example, if + * `params["firstName"] = bytes_value: "foo" type {bytes_type {}}` + * then `@firstName` will be replaced with googlesql bytes value "foo" in the + * query string during query evaluation. + * In case of Value.kind is not set, it will be set to corresponding null + * value in googlesql. + * `params["firstName"] = type {string_type {}}` + * then `@firstName` will be replaced with googlesql null string. + * Value.type should always be set and no inference of type will be made from + * Value.kind. If Value.type is not set, we will return INVALID_ARGUMENT + * error. + * + * Generated from protobuf field map params = 7 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getParams() + { + return $this->params; + } + + /** + * Required. params contains string type keys and Bigtable type values that + * bind to placeholders in the query string. In query string, a parameter + * placeholder consists of the + * `@` character followed by the parameter name (for example, `@firstName`) in + * the query string. + * For example, if + * `params["firstName"] = bytes_value: "foo" type {bytes_type {}}` + * then `@firstName` will be replaced with googlesql bytes value "foo" in the + * query string during query evaluation. + * In case of Value.kind is not set, it will be set to corresponding null + * value in googlesql. + * `params["firstName"] = type {string_type {}}` + * then `@firstName` will be replaced with googlesql null string. + * Value.type should always be set and no inference of type will be made from + * Value.kind. If Value.type is not set, we will return INVALID_ARGUMENT + * error. + * + * Generated from protobuf field map params = 7 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setParams($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Bigtable\V2\Value::class); + $this->params = $arr; + + return $this; + } + + /** + * @return string + */ + public function getDataFormat() + { + return $this->whichOneof("data_format"); + } + +} + diff --git a/Bigtable/src/V2/ExecuteQueryResponse.php b/Bigtable/src/V2/ExecuteQueryResponse.php new file mode 100644 index 000000000000..d007d3387015 --- /dev/null +++ b/Bigtable/src/V2/ExecuteQueryResponse.php @@ -0,0 +1,117 @@ +google.bigtable.v2.ExecuteQueryResponse + */ +class ExecuteQueryResponse extends \Google\Protobuf\Internal\Message +{ + protected $response; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\V2\ResultSetMetadata $metadata + * Structure of rows in this response stream. The first (and only the first) + * response streamed from the server will be of this type. + * @type \Google\Cloud\Bigtable\V2\PartialResultSet $results + * A partial result set with row data potentially including additional + * instructions on how recent past and future partial responses should be + * interpreted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Bigtable::initOnce(); + parent::__construct($data); + } + + /** + * Structure of rows in this response stream. The first (and only the first) + * response streamed from the server will be of this type. + * + * Generated from protobuf field .google.bigtable.v2.ResultSetMetadata metadata = 1; + * @return \Google\Cloud\Bigtable\V2\ResultSetMetadata|null + */ + public function getMetadata() + { + return $this->readOneof(1); + } + + public function hasMetadata() + { + return $this->hasOneof(1); + } + + /** + * Structure of rows in this response stream. The first (and only the first) + * response streamed from the server will be of this type. + * + * Generated from protobuf field .google.bigtable.v2.ResultSetMetadata metadata = 1; + * @param \Google\Cloud\Bigtable\V2\ResultSetMetadata $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\ResultSetMetadata::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * A partial result set with row data potentially including additional + * instructions on how recent past and future partial responses should be + * interpreted. + * + * Generated from protobuf field .google.bigtable.v2.PartialResultSet results = 2; + * @return \Google\Cloud\Bigtable\V2\PartialResultSet|null + */ + public function getResults() + { + return $this->readOneof(2); + } + + public function hasResults() + { + return $this->hasOneof(2); + } + + /** + * A partial result set with row data potentially including additional + * instructions on how recent past and future partial responses should be + * interpreted. + * + * Generated from protobuf field .google.bigtable.v2.PartialResultSet results = 2; + * @param \Google\Cloud\Bigtable\V2\PartialResultSet $var + * @return $this + */ + public function setResults($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\PartialResultSet::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getResponse() + { + return $this->whichOneof("response"); + } + +} + diff --git a/Bigtable/src/V2/PartialResultSet.php b/Bigtable/src/V2/PartialResultSet.php new file mode 100644 index 000000000000..321757c77992 --- /dev/null +++ b/Bigtable/src/V2/PartialResultSet.php @@ -0,0 +1,225 @@ +google.bigtable.v2.PartialResultSet + */ +class PartialResultSet extends \Google\Protobuf\Internal\Message +{ + /** + * An opaque token sent by the server to allow query resumption and signal + * the client to accumulate `partial_rows` since the last non-empty + * `resume_token`. On resumption, the resumed query will return the remaining + * rows for this query. + * If there is a batch in progress, a non-empty `resume_token` + * means that that the batch of `partial_rows` will be complete after merging + * the `partial_rows` from this response. The client must only yield + * completed batches to the application, and must ensure that any future + * retries send the latest token to avoid returning duplicate data. + * The server may set 'resume_token' without a 'partial_rows'. If there is a + * batch in progress the client should yield it. + * The server will also send a sentinel `resume_token` when last batch of + * `partial_rows` is sent. If the client retries the ExecuteQueryRequest with + * the sentinel `resume_token`, the server will emit it again without any + * `partial_rows`, then return OK. + * + * Generated from protobuf field bytes resume_token = 5; + */ + protected $resume_token = ''; + /** + * Estimated size of a new batch. The server will always set this when + * returning the first `partial_rows` of a batch, and will not set it at any + * other time. + * The client can use this estimate to allocate an initial buffer for the + * batched results. This helps minimize the number of allocations required, + * though the buffer size may still need to be increased if the estimate is + * too low. + * + * Generated from protobuf field int32 estimated_batch_size = 4; + */ + protected $estimated_batch_size = 0; + protected $partial_rows; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\V2\ProtoRowsBatch $proto_rows_batch + * Partial rows in serialized ProtoRows format. + * @type string $resume_token + * An opaque token sent by the server to allow query resumption and signal + * the client to accumulate `partial_rows` since the last non-empty + * `resume_token`. On resumption, the resumed query will return the remaining + * rows for this query. + * If there is a batch in progress, a non-empty `resume_token` + * means that that the batch of `partial_rows` will be complete after merging + * the `partial_rows` from this response. The client must only yield + * completed batches to the application, and must ensure that any future + * retries send the latest token to avoid returning duplicate data. + * The server may set 'resume_token' without a 'partial_rows'. If there is a + * batch in progress the client should yield it. + * The server will also send a sentinel `resume_token` when last batch of + * `partial_rows` is sent. If the client retries the ExecuteQueryRequest with + * the sentinel `resume_token`, the server will emit it again without any + * `partial_rows`, then return OK. + * @type int $estimated_batch_size + * Estimated size of a new batch. The server will always set this when + * returning the first `partial_rows` of a batch, and will not set it at any + * other time. + * The client can use this estimate to allocate an initial buffer for the + * batched results. This helps minimize the number of allocations required, + * though the buffer size may still need to be increased if the estimate is + * too low. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Data::initOnce(); + parent::__construct($data); + } + + /** + * Partial rows in serialized ProtoRows format. + * + * Generated from protobuf field .google.bigtable.v2.ProtoRowsBatch proto_rows_batch = 3; + * @return \Google\Cloud\Bigtable\V2\ProtoRowsBatch|null + */ + public function getProtoRowsBatch() + { + return $this->readOneof(3); + } + + public function hasProtoRowsBatch() + { + return $this->hasOneof(3); + } + + /** + * Partial rows in serialized ProtoRows format. + * + * Generated from protobuf field .google.bigtable.v2.ProtoRowsBatch proto_rows_batch = 3; + * @param \Google\Cloud\Bigtable\V2\ProtoRowsBatch $var + * @return $this + */ + public function setProtoRowsBatch($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\ProtoRowsBatch::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * An opaque token sent by the server to allow query resumption and signal + * the client to accumulate `partial_rows` since the last non-empty + * `resume_token`. On resumption, the resumed query will return the remaining + * rows for this query. + * If there is a batch in progress, a non-empty `resume_token` + * means that that the batch of `partial_rows` will be complete after merging + * the `partial_rows` from this response. The client must only yield + * completed batches to the application, and must ensure that any future + * retries send the latest token to avoid returning duplicate data. + * The server may set 'resume_token' without a 'partial_rows'. If there is a + * batch in progress the client should yield it. + * The server will also send a sentinel `resume_token` when last batch of + * `partial_rows` is sent. If the client retries the ExecuteQueryRequest with + * the sentinel `resume_token`, the server will emit it again without any + * `partial_rows`, then return OK. + * + * Generated from protobuf field bytes resume_token = 5; + * @return string + */ + public function getResumeToken() + { + return $this->resume_token; + } + + /** + * An opaque token sent by the server to allow query resumption and signal + * the client to accumulate `partial_rows` since the last non-empty + * `resume_token`. On resumption, the resumed query will return the remaining + * rows for this query. + * If there is a batch in progress, a non-empty `resume_token` + * means that that the batch of `partial_rows` will be complete after merging + * the `partial_rows` from this response. The client must only yield + * completed batches to the application, and must ensure that any future + * retries send the latest token to avoid returning duplicate data. + * The server may set 'resume_token' without a 'partial_rows'. If there is a + * batch in progress the client should yield it. + * The server will also send a sentinel `resume_token` when last batch of + * `partial_rows` is sent. If the client retries the ExecuteQueryRequest with + * the sentinel `resume_token`, the server will emit it again without any + * `partial_rows`, then return OK. + * + * Generated from protobuf field bytes resume_token = 5; + * @param string $var + * @return $this + */ + public function setResumeToken($var) + { + GPBUtil::checkString($var, False); + $this->resume_token = $var; + + return $this; + } + + /** + * Estimated size of a new batch. The server will always set this when + * returning the first `partial_rows` of a batch, and will not set it at any + * other time. + * The client can use this estimate to allocate an initial buffer for the + * batched results. This helps minimize the number of allocations required, + * though the buffer size may still need to be increased if the estimate is + * too low. + * + * Generated from protobuf field int32 estimated_batch_size = 4; + * @return int + */ + public function getEstimatedBatchSize() + { + return $this->estimated_batch_size; + } + + /** + * Estimated size of a new batch. The server will always set this when + * returning the first `partial_rows` of a batch, and will not set it at any + * other time. + * The client can use this estimate to allocate an initial buffer for the + * batched results. This helps minimize the number of allocations required, + * though the buffer size may still need to be increased if the estimate is + * too low. + * + * Generated from protobuf field int32 estimated_batch_size = 4; + * @param int $var + * @return $this + */ + public function setEstimatedBatchSize($var) + { + GPBUtil::checkInt32($var); + $this->estimated_batch_size = $var; + + return $this; + } + + /** + * @return string + */ + public function getPartialRows() + { + return $this->whichOneof("partial_rows"); + } + +} + diff --git a/Bigtable/src/V2/ProtoFormat.php b/Bigtable/src/V2/ProtoFormat.php new file mode 100644 index 000000000000..3317d0383327 --- /dev/null +++ b/Bigtable/src/V2/ProtoFormat.php @@ -0,0 +1,34 @@ +google.bigtable.v2.ProtoFormat + */ +class ProtoFormat extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Data::initOnce(); + parent::__construct($data); + } + +} + diff --git a/Bigtable/src/V2/ProtoRows.php b/Bigtable/src/V2/ProtoRows.php new file mode 100644 index 000000000000..42447f5b08bf --- /dev/null +++ b/Bigtable/src/V2/ProtoRows.php @@ -0,0 +1,78 @@ +google.bigtable.v2.ProtoRows + */ +class ProtoRows extends \Google\Protobuf\Internal\Message +{ + /** + * A proto rows message consists of a list of values. Every N complete values + * defines a row, where N is equal to the number of entries in the + * `metadata.proto_schema.columns` value received in the first response. + * + * Generated from protobuf field repeated .google.bigtable.v2.Value values = 2; + */ + private $values; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Bigtable\V2\Value>|\Google\Protobuf\Internal\RepeatedField $values + * A proto rows message consists of a list of values. Every N complete values + * defines a row, where N is equal to the number of entries in the + * `metadata.proto_schema.columns` value received in the first response. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Data::initOnce(); + parent::__construct($data); + } + + /** + * A proto rows message consists of a list of values. Every N complete values + * defines a row, where N is equal to the number of entries in the + * `metadata.proto_schema.columns` value received in the first response. + * + * Generated from protobuf field repeated .google.bigtable.v2.Value values = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValues() + { + return $this->values; + } + + /** + * A proto rows message consists of a list of values. Every N complete values + * defines a row, where N is equal to the number of entries in the + * `metadata.proto_schema.columns` value received in the first response. + * + * Generated from protobuf field repeated .google.bigtable.v2.Value values = 2; + * @param array<\Google\Cloud\Bigtable\V2\Value>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Bigtable\V2\Value::class); + $this->values = $arr; + + return $this; + } + +} + diff --git a/Bigtable/src/V2/ProtoRowsBatch.php b/Bigtable/src/V2/ProtoRowsBatch.php new file mode 100644 index 000000000000..3c7ea10177e7 --- /dev/null +++ b/Bigtable/src/V2/ProtoRowsBatch.php @@ -0,0 +1,71 @@ +google.bigtable.v2.ProtoRowsBatch + */ +class ProtoRowsBatch extends \Google\Protobuf\Internal\Message +{ + /** + * Merge partial results by concatenating these bytes, then parsing the + * overall value as a `ProtoRows` message. + * + * Generated from protobuf field bytes batch_data = 1; + */ + protected $batch_data = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $batch_data + * Merge partial results by concatenating these bytes, then parsing the + * overall value as a `ProtoRows` message. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Data::initOnce(); + parent::__construct($data); + } + + /** + * Merge partial results by concatenating these bytes, then parsing the + * overall value as a `ProtoRows` message. + * + * Generated from protobuf field bytes batch_data = 1; + * @return string + */ + public function getBatchData() + { + return $this->batch_data; + } + + /** + * Merge partial results by concatenating these bytes, then parsing the + * overall value as a `ProtoRows` message. + * + * Generated from protobuf field bytes batch_data = 1; + * @param string $var + * @return $this + */ + public function setBatchData($var) + { + GPBUtil::checkString($var, False); + $this->batch_data = $var; + + return $this; + } + +} + diff --git a/Bigtable/src/V2/ProtoSchema.php b/Bigtable/src/V2/ProtoSchema.php new file mode 100644 index 000000000000..efd883b7c5e2 --- /dev/null +++ b/Bigtable/src/V2/ProtoSchema.php @@ -0,0 +1,67 @@ +google.bigtable.v2.ProtoSchema + */ +class ProtoSchema extends \Google\Protobuf\Internal\Message +{ + /** + * The columns in the result set. + * + * Generated from protobuf field repeated .google.bigtable.v2.ColumnMetadata columns = 1; + */ + private $columns; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Bigtable\V2\ColumnMetadata>|\Google\Protobuf\Internal\RepeatedField $columns + * The columns in the result set. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Data::initOnce(); + parent::__construct($data); + } + + /** + * The columns in the result set. + * + * Generated from protobuf field repeated .google.bigtable.v2.ColumnMetadata columns = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getColumns() + { + return $this->columns; + } + + /** + * The columns in the result set. + * + * Generated from protobuf field repeated .google.bigtable.v2.ColumnMetadata columns = 1; + * @param array<\Google\Cloud\Bigtable\V2\ColumnMetadata>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setColumns($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Bigtable\V2\ColumnMetadata::class); + $this->columns = $arr; + + return $this; + } + +} + diff --git a/Bigtable/src/V2/ResultSetMetadata.php b/Bigtable/src/V2/ResultSetMetadata.php new file mode 100644 index 000000000000..9e61567a09bd --- /dev/null +++ b/Bigtable/src/V2/ResultSetMetadata.php @@ -0,0 +1,75 @@ +google.bigtable.v2.ResultSetMetadata + */ +class ResultSetMetadata extends \Google\Protobuf\Internal\Message +{ + protected $schema; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\V2\ProtoSchema $proto_schema + * Schema in proto format + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Data::initOnce(); + parent::__construct($data); + } + + /** + * Schema in proto format + * + * Generated from protobuf field .google.bigtable.v2.ProtoSchema proto_schema = 1; + * @return \Google\Cloud\Bigtable\V2\ProtoSchema|null + */ + public function getProtoSchema() + { + return $this->readOneof(1); + } + + public function hasProtoSchema() + { + return $this->hasOneof(1); + } + + /** + * Schema in proto format + * + * Generated from protobuf field .google.bigtable.v2.ProtoSchema proto_schema = 1; + * @param \Google\Cloud\Bigtable\V2\ProtoSchema $var + * @return $this + */ + public function setProtoSchema($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\ProtoSchema::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getSchema() + { + return $this->whichOneof("schema"); + } + +} + diff --git a/Bigtable/src/V2/Type.php b/Bigtable/src/V2/Type.php new file mode 100644 index 000000000000..0000b3ed8eba --- /dev/null +++ b/Bigtable/src/V2/Type.php @@ -0,0 +1,458 @@ + INT64(-1)`, but `STRING("-00001") > STRING("00001)`. + * * Self-delimiting: If we concatenate two encoded values, can we always tell + * where the first one ends and the second one begins? + * - Example: If we encode INT64s to fixed-width STRINGs, the first value + * will always contain exactly N digits, possibly preceded by a sign. + * - Counterexample: If we concatenate two UTF-8 encoded STRINGs, we have + * no way to tell where the first one ends. + * * Compatibility: Which other systems have matching encoding schemes? For + * example, does this encoding have a GoogleSQL equivalent? HBase? Java? + * + * Generated from protobuf message google.bigtable.v2.Type + */ +class Type extends \Google\Protobuf\Internal\Message +{ + protected $kind; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\V2\Type\Bytes $bytes_type + * Bytes + * @type \Google\Cloud\Bigtable\V2\Type\PBString $string_type + * String + * @type \Google\Cloud\Bigtable\V2\Type\Int64 $int64_type + * Int64 + * @type \Google\Cloud\Bigtable\V2\Type\Float32 $float32_type + * Float32 + * @type \Google\Cloud\Bigtable\V2\Type\Float64 $float64_type + * Float64 + * @type \Google\Cloud\Bigtable\V2\Type\PBBool $bool_type + * Bool + * @type \Google\Cloud\Bigtable\V2\Type\Timestamp $timestamp_type + * Timestamp + * @type \Google\Cloud\Bigtable\V2\Type\Date $date_type + * Date + * @type \Google\Cloud\Bigtable\V2\Type\Aggregate $aggregate_type + * Aggregate + * @type \Google\Cloud\Bigtable\V2\Type\Struct $struct_type + * Struct + * @type \Google\Cloud\Bigtable\V2\Type\PBArray $array_type + * Array + * @type \Google\Cloud\Bigtable\V2\Type\Map $map_type + * Map + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * Bytes + * + * Generated from protobuf field .google.bigtable.v2.Type.Bytes bytes_type = 1; + * @return \Google\Cloud\Bigtable\V2\Type\Bytes|null + */ + public function getBytesType() + { + return $this->readOneof(1); + } + + public function hasBytesType() + { + return $this->hasOneof(1); + } + + /** + * Bytes + * + * Generated from protobuf field .google.bigtable.v2.Type.Bytes bytes_type = 1; + * @param \Google\Cloud\Bigtable\V2\Type\Bytes $var + * @return $this + */ + public function setBytesType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Bytes::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * String + * + * Generated from protobuf field .google.bigtable.v2.Type.String string_type = 2; + * @return \Google\Cloud\Bigtable\V2\Type\PBString|null + */ + public function getStringType() + { + return $this->readOneof(2); + } + + public function hasStringType() + { + return $this->hasOneof(2); + } + + /** + * String + * + * Generated from protobuf field .google.bigtable.v2.Type.String string_type = 2; + * @param \Google\Cloud\Bigtable\V2\Type\PBString $var + * @return $this + */ + public function setStringType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\PBString::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Int64 + * + * Generated from protobuf field .google.bigtable.v2.Type.Int64 int64_type = 5; + * @return \Google\Cloud\Bigtable\V2\Type\Int64|null + */ + public function getInt64Type() + { + return $this->readOneof(5); + } + + public function hasInt64Type() + { + return $this->hasOneof(5); + } + + /** + * Int64 + * + * Generated from protobuf field .google.bigtable.v2.Type.Int64 int64_type = 5; + * @param \Google\Cloud\Bigtable\V2\Type\Int64 $var + * @return $this + */ + public function setInt64Type($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Int64::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Float32 + * + * Generated from protobuf field .google.bigtable.v2.Type.Float32 float32_type = 12; + * @return \Google\Cloud\Bigtable\V2\Type\Float32|null + */ + public function getFloat32Type() + { + return $this->readOneof(12); + } + + public function hasFloat32Type() + { + return $this->hasOneof(12); + } + + /** + * Float32 + * + * Generated from protobuf field .google.bigtable.v2.Type.Float32 float32_type = 12; + * @param \Google\Cloud\Bigtable\V2\Type\Float32 $var + * @return $this + */ + public function setFloat32Type($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Float32::class); + $this->writeOneof(12, $var); + + return $this; + } + + /** + * Float64 + * + * Generated from protobuf field .google.bigtable.v2.Type.Float64 float64_type = 9; + * @return \Google\Cloud\Bigtable\V2\Type\Float64|null + */ + public function getFloat64Type() + { + return $this->readOneof(9); + } + + public function hasFloat64Type() + { + return $this->hasOneof(9); + } + + /** + * Float64 + * + * Generated from protobuf field .google.bigtable.v2.Type.Float64 float64_type = 9; + * @param \Google\Cloud\Bigtable\V2\Type\Float64 $var + * @return $this + */ + public function setFloat64Type($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Float64::class); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * Bool + * + * Generated from protobuf field .google.bigtable.v2.Type.Bool bool_type = 8; + * @return \Google\Cloud\Bigtable\V2\Type\PBBool|null + */ + public function getBoolType() + { + return $this->readOneof(8); + } + + public function hasBoolType() + { + return $this->hasOneof(8); + } + + /** + * Bool + * + * Generated from protobuf field .google.bigtable.v2.Type.Bool bool_type = 8; + * @param \Google\Cloud\Bigtable\V2\Type\PBBool $var + * @return $this + */ + public function setBoolType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\PBBool::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * Timestamp + * + * Generated from protobuf field .google.bigtable.v2.Type.Timestamp timestamp_type = 10; + * @return \Google\Cloud\Bigtable\V2\Type\Timestamp|null + */ + public function getTimestampType() + { + return $this->readOneof(10); + } + + public function hasTimestampType() + { + return $this->hasOneof(10); + } + + /** + * Timestamp + * + * Generated from protobuf field .google.bigtable.v2.Type.Timestamp timestamp_type = 10; + * @param \Google\Cloud\Bigtable\V2\Type\Timestamp $var + * @return $this + */ + public function setTimestampType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Timestamp::class); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * Date + * + * Generated from protobuf field .google.bigtable.v2.Type.Date date_type = 11; + * @return \Google\Cloud\Bigtable\V2\Type\Date|null + */ + public function getDateType() + { + return $this->readOneof(11); + } + + public function hasDateType() + { + return $this->hasOneof(11); + } + + /** + * Date + * + * Generated from protobuf field .google.bigtable.v2.Type.Date date_type = 11; + * @param \Google\Cloud\Bigtable\V2\Type\Date $var + * @return $this + */ + public function setDateType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Date::class); + $this->writeOneof(11, $var); + + return $this; + } + + /** + * Aggregate + * + * Generated from protobuf field .google.bigtable.v2.Type.Aggregate aggregate_type = 6; + * @return \Google\Cloud\Bigtable\V2\Type\Aggregate|null + */ + public function getAggregateType() + { + return $this->readOneof(6); + } + + public function hasAggregateType() + { + return $this->hasOneof(6); + } + + /** + * Aggregate + * + * Generated from protobuf field .google.bigtable.v2.Type.Aggregate aggregate_type = 6; + * @param \Google\Cloud\Bigtable\V2\Type\Aggregate $var + * @return $this + */ + public function setAggregateType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Aggregate::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Struct + * + * Generated from protobuf field .google.bigtable.v2.Type.Struct struct_type = 7; + * @return \Google\Cloud\Bigtable\V2\Type\Struct|null + */ + public function getStructType() + { + return $this->readOneof(7); + } + + public function hasStructType() + { + return $this->hasOneof(7); + } + + /** + * Struct + * + * Generated from protobuf field .google.bigtable.v2.Type.Struct struct_type = 7; + * @param \Google\Cloud\Bigtable\V2\Type\Struct $var + * @return $this + */ + public function setStructType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Struct::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * Array + * + * Generated from protobuf field .google.bigtable.v2.Type.Array array_type = 3; + * @return \Google\Cloud\Bigtable\V2\Type\PBArray|null + */ + public function getArrayType() + { + return $this->readOneof(3); + } + + public function hasArrayType() + { + return $this->hasOneof(3); + } + + /** + * Array + * + * Generated from protobuf field .google.bigtable.v2.Type.Array array_type = 3; + * @param \Google\Cloud\Bigtable\V2\Type\PBArray $var + * @return $this + */ + public function setArrayType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\PBArray::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Map + * + * Generated from protobuf field .google.bigtable.v2.Type.Map map_type = 4; + * @return \Google\Cloud\Bigtable\V2\Type\Map|null + */ + public function getMapType() + { + return $this->readOneof(4); + } + + public function hasMapType() + { + return $this->hasOneof(4); + } + + /** + * Map + * + * Generated from protobuf field .google.bigtable.v2.Type.Map map_type = 4; + * @param \Google\Cloud\Bigtable\V2\Type\Map $var + * @return $this + */ + public function setMapType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Map::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * @return string + */ + public function getKind() + { + return $this->whichOneof("kind"); + } + +} + diff --git a/Bigtable/src/V2/Type/Aggregate.php b/Bigtable/src/V2/Type/Aggregate.php new file mode 100644 index 000000000000..efd66b84d05b --- /dev/null +++ b/Bigtable/src/V2/Type/Aggregate.php @@ -0,0 +1,284 @@ +google.bigtable.v2.Type.Aggregate + */ +class Aggregate extends \Google\Protobuf\Internal\Message +{ + /** + * Type of the inputs that are accumulated by this `Aggregate`, which must + * specify a full encoding. + * Use `AddInput` mutations to accumulate new inputs. + * + * Generated from protobuf field .google.bigtable.v2.Type input_type = 1; + */ + protected $input_type = null; + /** + * Output only. Type that holds the internal accumulator state for the + * `Aggregate`. This is a function of the `input_type` and `aggregator` + * chosen, and will always specify a full encoding. + * + * Generated from protobuf field .google.bigtable.v2.Type state_type = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state_type = null; + protected $aggregator; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\V2\Type $input_type + * Type of the inputs that are accumulated by this `Aggregate`, which must + * specify a full encoding. + * Use `AddInput` mutations to accumulate new inputs. + * @type \Google\Cloud\Bigtable\V2\Type $state_type + * Output only. Type that holds the internal accumulator state for the + * `Aggregate`. This is a function of the `input_type` and `aggregator` + * chosen, and will always specify a full encoding. + * @type \Google\Cloud\Bigtable\V2\Type\Aggregate\Sum $sum + * Sum aggregator. + * @type \Google\Cloud\Bigtable\V2\Type\Aggregate\HyperLogLogPlusPlusUniqueCount $hllpp_unique_count + * HyperLogLogPlusPlusUniqueCount aggregator. + * @type \Google\Cloud\Bigtable\V2\Type\Aggregate\Max $max + * Max aggregator. + * @type \Google\Cloud\Bigtable\V2\Type\Aggregate\Min $min + * Min aggregator. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * Type of the inputs that are accumulated by this `Aggregate`, which must + * specify a full encoding. + * Use `AddInput` mutations to accumulate new inputs. + * + * Generated from protobuf field .google.bigtable.v2.Type input_type = 1; + * @return \Google\Cloud\Bigtable\V2\Type|null + */ + public function getInputType() + { + return $this->input_type; + } + + public function hasInputType() + { + return isset($this->input_type); + } + + public function clearInputType() + { + unset($this->input_type); + } + + /** + * Type of the inputs that are accumulated by this `Aggregate`, which must + * specify a full encoding. + * Use `AddInput` mutations to accumulate new inputs. + * + * Generated from protobuf field .google.bigtable.v2.Type input_type = 1; + * @param \Google\Cloud\Bigtable\V2\Type $var + * @return $this + */ + public function setInputType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type::class); + $this->input_type = $var; + + return $this; + } + + /** + * Output only. Type that holds the internal accumulator state for the + * `Aggregate`. This is a function of the `input_type` and `aggregator` + * chosen, and will always specify a full encoding. + * + * Generated from protobuf field .google.bigtable.v2.Type state_type = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Bigtable\V2\Type|null + */ + public function getStateType() + { + return $this->state_type; + } + + public function hasStateType() + { + return isset($this->state_type); + } + + public function clearStateType() + { + unset($this->state_type); + } + + /** + * Output only. Type that holds the internal accumulator state for the + * `Aggregate`. This is a function of the `input_type` and `aggregator` + * chosen, and will always specify a full encoding. + * + * Generated from protobuf field .google.bigtable.v2.Type state_type = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Bigtable\V2\Type $var + * @return $this + */ + public function setStateType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type::class); + $this->state_type = $var; + + return $this; + } + + /** + * Sum aggregator. + * + * Generated from protobuf field .google.bigtable.v2.Type.Aggregate.Sum sum = 4; + * @return \Google\Cloud\Bigtable\V2\Type\Aggregate\Sum|null + */ + public function getSum() + { + return $this->readOneof(4); + } + + public function hasSum() + { + return $this->hasOneof(4); + } + + /** + * Sum aggregator. + * + * Generated from protobuf field .google.bigtable.v2.Type.Aggregate.Sum sum = 4; + * @param \Google\Cloud\Bigtable\V2\Type\Aggregate\Sum $var + * @return $this + */ + public function setSum($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Aggregate\Sum::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * HyperLogLogPlusPlusUniqueCount aggregator. + * + * Generated from protobuf field .google.bigtable.v2.Type.Aggregate.HyperLogLogPlusPlusUniqueCount hllpp_unique_count = 5; + * @return \Google\Cloud\Bigtable\V2\Type\Aggregate\HyperLogLogPlusPlusUniqueCount|null + */ + public function getHllppUniqueCount() + { + return $this->readOneof(5); + } + + public function hasHllppUniqueCount() + { + return $this->hasOneof(5); + } + + /** + * HyperLogLogPlusPlusUniqueCount aggregator. + * + * Generated from protobuf field .google.bigtable.v2.Type.Aggregate.HyperLogLogPlusPlusUniqueCount hllpp_unique_count = 5; + * @param \Google\Cloud\Bigtable\V2\Type\Aggregate\HyperLogLogPlusPlusUniqueCount $var + * @return $this + */ + public function setHllppUniqueCount($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Aggregate\HyperLogLogPlusPlusUniqueCount::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Max aggregator. + * + * Generated from protobuf field .google.bigtable.v2.Type.Aggregate.Max max = 6; + * @return \Google\Cloud\Bigtable\V2\Type\Aggregate\Max|null + */ + public function getMax() + { + return $this->readOneof(6); + } + + public function hasMax() + { + return $this->hasOneof(6); + } + + /** + * Max aggregator. + * + * Generated from protobuf field .google.bigtable.v2.Type.Aggregate.Max max = 6; + * @param \Google\Cloud\Bigtable\V2\Type\Aggregate\Max $var + * @return $this + */ + public function setMax($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Aggregate\Max::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Min aggregator. + * + * Generated from protobuf field .google.bigtable.v2.Type.Aggregate.Min min = 7; + * @return \Google\Cloud\Bigtable\V2\Type\Aggregate\Min|null + */ + public function getMin() + { + return $this->readOneof(7); + } + + public function hasMin() + { + return $this->hasOneof(7); + } + + /** + * Min aggregator. + * + * Generated from protobuf field .google.bigtable.v2.Type.Aggregate.Min min = 7; + * @param \Google\Cloud\Bigtable\V2\Type\Aggregate\Min $var + * @return $this + */ + public function setMin($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Aggregate\Min::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * @return string + */ + public function getAggregator() + { + return $this->whichOneof("aggregator"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Aggregate::class, \Google\Cloud\Bigtable\V2\Type_Aggregate::class); + diff --git a/Bigtable/src/V2/Type/Aggregate/HyperLogLogPlusPlusUniqueCount.php b/Bigtable/src/V2/Type/Aggregate/HyperLogLogPlusPlusUniqueCount.php new file mode 100644 index 000000000000..4c4bfed012b3 --- /dev/null +++ b/Bigtable/src/V2/Type/Aggregate/HyperLogLogPlusPlusUniqueCount.php @@ -0,0 +1,42 @@ +google.bigtable.v2.Type.Aggregate.HyperLogLogPlusPlusUniqueCount + */ +class HyperLogLogPlusPlusUniqueCount extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(HyperLogLogPlusPlusUniqueCount::class, \Google\Cloud\Bigtable\V2\Type_Aggregate_HyperLogLogPlusPlusUniqueCount::class); + diff --git a/Bigtable/src/V2/Type/Aggregate/Max.php b/Bigtable/src/V2/Type/Aggregate/Max.php new file mode 100644 index 000000000000..eb735d381cdf --- /dev/null +++ b/Bigtable/src/V2/Type/Aggregate/Max.php @@ -0,0 +1,38 @@ +google.bigtable.v2.Type.Aggregate.Max + */ +class Max extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Max::class, \Google\Cloud\Bigtable\V2\Type_Aggregate_Max::class); + diff --git a/Bigtable/src/V2/Type/Aggregate/Min.php b/Bigtable/src/V2/Type/Aggregate/Min.php new file mode 100644 index 000000000000..13500014fafb --- /dev/null +++ b/Bigtable/src/V2/Type/Aggregate/Min.php @@ -0,0 +1,38 @@ +google.bigtable.v2.Type.Aggregate.Min + */ +class Min extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Min::class, \Google\Cloud\Bigtable\V2\Type_Aggregate_Min::class); + diff --git a/Bigtable/src/V2/Type/Aggregate/Sum.php b/Bigtable/src/V2/Type/Aggregate/Sum.php new file mode 100644 index 000000000000..df53d9cbe95f --- /dev/null +++ b/Bigtable/src/V2/Type/Aggregate/Sum.php @@ -0,0 +1,38 @@ +google.bigtable.v2.Type.Aggregate.Sum + */ +class Sum extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Sum::class, \Google\Cloud\Bigtable\V2\Type_Aggregate_Sum::class); + diff --git a/Bigtable/src/V2/Type/Bytes.php b/Bigtable/src/V2/Type/Bytes.php new file mode 100644 index 000000000000..d917db5a3ce1 --- /dev/null +++ b/Bigtable/src/V2/Type/Bytes.php @@ -0,0 +1,81 @@ +google.bigtable.v2.Type.Bytes + */ +class Bytes extends \Google\Protobuf\Internal\Message +{ + /** + * The encoding to use when converting to/from lower level types. + * + * Generated from protobuf field .google.bigtable.v2.Type.Bytes.Encoding encoding = 1; + */ + protected $encoding = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\V2\Type\Bytes\Encoding $encoding + * The encoding to use when converting to/from lower level types. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * The encoding to use when converting to/from lower level types. + * + * Generated from protobuf field .google.bigtable.v2.Type.Bytes.Encoding encoding = 1; + * @return \Google\Cloud\Bigtable\V2\Type\Bytes\Encoding|null + */ + public function getEncoding() + { + return $this->encoding; + } + + public function hasEncoding() + { + return isset($this->encoding); + } + + public function clearEncoding() + { + unset($this->encoding); + } + + /** + * The encoding to use when converting to/from lower level types. + * + * Generated from protobuf field .google.bigtable.v2.Type.Bytes.Encoding encoding = 1; + * @param \Google\Cloud\Bigtable\V2\Type\Bytes\Encoding $var + * @return $this + */ + public function setEncoding($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Bytes\Encoding::class); + $this->encoding = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Bytes::class, \Google\Cloud\Bigtable\V2\Type_Bytes::class); + diff --git a/Bigtable/src/V2/Type/Bytes/Encoding.php b/Bigtable/src/V2/Type/Bytes/Encoding.php new file mode 100644 index 000000000000..c42a574fe96a --- /dev/null +++ b/Bigtable/src/V2/Type/Bytes/Encoding.php @@ -0,0 +1,78 @@ +google.bigtable.v2.Type.Bytes.Encoding + */ +class Encoding extends \Google\Protobuf\Internal\Message +{ + protected $encoding; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\V2\Type\Bytes\Encoding\Raw $raw + * Use `Raw` encoding. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * Use `Raw` encoding. + * + * Generated from protobuf field .google.bigtable.v2.Type.Bytes.Encoding.Raw raw = 1; + * @return \Google\Cloud\Bigtable\V2\Type\Bytes\Encoding\Raw|null + */ + public function getRaw() + { + return $this->readOneof(1); + } + + public function hasRaw() + { + return $this->hasOneof(1); + } + + /** + * Use `Raw` encoding. + * + * Generated from protobuf field .google.bigtable.v2.Type.Bytes.Encoding.Raw raw = 1; + * @param \Google\Cloud\Bigtable\V2\Type\Bytes\Encoding\Raw $var + * @return $this + */ + public function setRaw($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Bytes\Encoding\Raw::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getEncoding() + { + return $this->whichOneof("encoding"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Encoding::class, \Google\Cloud\Bigtable\V2\Type_Bytes_Encoding::class); + diff --git a/Bigtable/src/V2/Type/Bytes/Encoding/Raw.php b/Bigtable/src/V2/Type/Bytes/Encoding/Raw.php new file mode 100644 index 000000000000..ac7f617bb59c --- /dev/null +++ b/Bigtable/src/V2/Type/Bytes/Encoding/Raw.php @@ -0,0 +1,39 @@ +google.bigtable.v2.Type.Bytes.Encoding.Raw + */ +class Raw extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Raw::class, \Google\Cloud\Bigtable\V2\Type_Bytes_Encoding_Raw::class); + diff --git a/Bigtable/src/V2/Type/Date.php b/Bigtable/src/V2/Type/Date.php new file mode 100644 index 000000000000..fdcf13439190 --- /dev/null +++ b/Bigtable/src/V2/Type/Date.php @@ -0,0 +1,37 @@ +google.bigtable.v2.Type.Date + */ +class Date extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Date::class, \Google\Cloud\Bigtable\V2\Type_Date::class); + diff --git a/Bigtable/src/V2/Type/Float32.php b/Bigtable/src/V2/Type/Float32.php new file mode 100644 index 000000000000..fb0d845917a3 --- /dev/null +++ b/Bigtable/src/V2/Type/Float32.php @@ -0,0 +1,37 @@ +google.bigtable.v2.Type.Float32 + */ +class Float32 extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Float32::class, \Google\Cloud\Bigtable\V2\Type_Float32::class); + diff --git a/Bigtable/src/V2/Type/Float64.php b/Bigtable/src/V2/Type/Float64.php new file mode 100644 index 000000000000..d8e9770f447a --- /dev/null +++ b/Bigtable/src/V2/Type/Float64.php @@ -0,0 +1,37 @@ +google.bigtable.v2.Type.Float64 + */ +class Float64 extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Float64::class, \Google\Cloud\Bigtable\V2\Type_Float64::class); + diff --git a/Bigtable/src/V2/Type/Int64.php b/Bigtable/src/V2/Type/Int64.php new file mode 100644 index 000000000000..f535202b8c73 --- /dev/null +++ b/Bigtable/src/V2/Type/Int64.php @@ -0,0 +1,81 @@ +google.bigtable.v2.Type.Int64 + */ +class Int64 extends \Google\Protobuf\Internal\Message +{ + /** + * The encoding to use when converting to/from lower level types. + * + * Generated from protobuf field .google.bigtable.v2.Type.Int64.Encoding encoding = 1; + */ + protected $encoding = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\V2\Type\Int64\Encoding $encoding + * The encoding to use when converting to/from lower level types. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * The encoding to use when converting to/from lower level types. + * + * Generated from protobuf field .google.bigtable.v2.Type.Int64.Encoding encoding = 1; + * @return \Google\Cloud\Bigtable\V2\Type\Int64\Encoding|null + */ + public function getEncoding() + { + return $this->encoding; + } + + public function hasEncoding() + { + return isset($this->encoding); + } + + public function clearEncoding() + { + unset($this->encoding); + } + + /** + * The encoding to use when converting to/from lower level types. + * + * Generated from protobuf field .google.bigtable.v2.Type.Int64.Encoding encoding = 1; + * @param \Google\Cloud\Bigtable\V2\Type\Int64\Encoding $var + * @return $this + */ + public function setEncoding($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Int64\Encoding::class); + $this->encoding = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Int64::class, \Google\Cloud\Bigtable\V2\Type_Int64::class); + diff --git a/Bigtable/src/V2/Type/Int64/Encoding.php b/Bigtable/src/V2/Type/Int64/Encoding.php new file mode 100644 index 000000000000..e9cf46b73553 --- /dev/null +++ b/Bigtable/src/V2/Type/Int64/Encoding.php @@ -0,0 +1,78 @@ +google.bigtable.v2.Type.Int64.Encoding + */ +class Encoding extends \Google\Protobuf\Internal\Message +{ + protected $encoding; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\V2\Type\Int64\Encoding\BigEndianBytes $big_endian_bytes + * Use `BigEndianBytes` encoding. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * Use `BigEndianBytes` encoding. + * + * Generated from protobuf field .google.bigtable.v2.Type.Int64.Encoding.BigEndianBytes big_endian_bytes = 1; + * @return \Google\Cloud\Bigtable\V2\Type\Int64\Encoding\BigEndianBytes|null + */ + public function getBigEndianBytes() + { + return $this->readOneof(1); + } + + public function hasBigEndianBytes() + { + return $this->hasOneof(1); + } + + /** + * Use `BigEndianBytes` encoding. + * + * Generated from protobuf field .google.bigtable.v2.Type.Int64.Encoding.BigEndianBytes big_endian_bytes = 1; + * @param \Google\Cloud\Bigtable\V2\Type\Int64\Encoding\BigEndianBytes $var + * @return $this + */ + public function setBigEndianBytes($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Int64\Encoding\BigEndianBytes::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getEncoding() + { + return $this->whichOneof("encoding"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Encoding::class, \Google\Cloud\Bigtable\V2\Type_Int64_Encoding::class); + diff --git a/Bigtable/src/V2/Type/Int64/Encoding/BigEndianBytes.php b/Bigtable/src/V2/Type/Int64/Encoding/BigEndianBytes.php new file mode 100644 index 000000000000..50020d3b2248 --- /dev/null +++ b/Bigtable/src/V2/Type/Int64/Encoding/BigEndianBytes.php @@ -0,0 +1,87 @@ +google.bigtable.v2.Type.Int64.Encoding.BigEndianBytes + */ +class BigEndianBytes extends \Google\Protobuf\Internal\Message +{ + /** + * Deprecated: ignored if set. + * + * Generated from protobuf field .google.bigtable.v2.Type.Bytes bytes_type = 1; + */ + protected $bytes_type = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\V2\Type\Bytes $bytes_type + * Deprecated: ignored if set. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * Deprecated: ignored if set. + * + * Generated from protobuf field .google.bigtable.v2.Type.Bytes bytes_type = 1; + * @return \Google\Cloud\Bigtable\V2\Type\Bytes|null + */ + public function getBytesType() + { + return $this->bytes_type; + } + + public function hasBytesType() + { + return isset($this->bytes_type); + } + + public function clearBytesType() + { + unset($this->bytes_type); + } + + /** + * Deprecated: ignored if set. + * + * Generated from protobuf field .google.bigtable.v2.Type.Bytes bytes_type = 1; + * @param \Google\Cloud\Bigtable\V2\Type\Bytes $var + * @return $this + */ + public function setBytesType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\Bytes::class); + $this->bytes_type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BigEndianBytes::class, \Google\Cloud\Bigtable\V2\Type_Int64_Encoding_BigEndianBytes::class); + diff --git a/Bigtable/src/V2/Type/Map.php b/Bigtable/src/V2/Type/Map.php new file mode 100644 index 000000000000..3e1ca5948521 --- /dev/null +++ b/Bigtable/src/V2/Type/Map.php @@ -0,0 +1,134 @@ +google.bigtable.v2.Type.Map + */ +class Map extends \Google\Protobuf\Internal\Message +{ + /** + * The type of a map key. + * Only `Bytes`, `String`, and `Int64` are allowed as key types. + * + * Generated from protobuf field .google.bigtable.v2.Type key_type = 1; + */ + protected $key_type = null; + /** + * The type of the values in a map. + * + * Generated from protobuf field .google.bigtable.v2.Type value_type = 2; + */ + protected $value_type = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\V2\Type $key_type + * The type of a map key. + * Only `Bytes`, `String`, and `Int64` are allowed as key types. + * @type \Google\Cloud\Bigtable\V2\Type $value_type + * The type of the values in a map. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * The type of a map key. + * Only `Bytes`, `String`, and `Int64` are allowed as key types. + * + * Generated from protobuf field .google.bigtable.v2.Type key_type = 1; + * @return \Google\Cloud\Bigtable\V2\Type|null + */ + public function getKeyType() + { + return $this->key_type; + } + + public function hasKeyType() + { + return isset($this->key_type); + } + + public function clearKeyType() + { + unset($this->key_type); + } + + /** + * The type of a map key. + * Only `Bytes`, `String`, and `Int64` are allowed as key types. + * + * Generated from protobuf field .google.bigtable.v2.Type key_type = 1; + * @param \Google\Cloud\Bigtable\V2\Type $var + * @return $this + */ + public function setKeyType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type::class); + $this->key_type = $var; + + return $this; + } + + /** + * The type of the values in a map. + * + * Generated from protobuf field .google.bigtable.v2.Type value_type = 2; + * @return \Google\Cloud\Bigtable\V2\Type|null + */ + public function getValueType() + { + return $this->value_type; + } + + public function hasValueType() + { + return isset($this->value_type); + } + + public function clearValueType() + { + unset($this->value_type); + } + + /** + * The type of the values in a map. + * + * Generated from protobuf field .google.bigtable.v2.Type value_type = 2; + * @param \Google\Cloud\Bigtable\V2\Type $var + * @return $this + */ + public function setValueType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type::class); + $this->value_type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Map::class, \Google\Cloud\Bigtable\V2\Type_Map::class); + diff --git a/Bigtable/src/V2/Type/PBArray.php b/Bigtable/src/V2/Type/PBArray.php new file mode 100644 index 000000000000..71bbb92cadac --- /dev/null +++ b/Bigtable/src/V2/Type/PBArray.php @@ -0,0 +1,81 @@ +google.bigtable.v2.Type.Array + */ +class PBArray extends \Google\Protobuf\Internal\Message +{ + /** + * The type of the elements in the array. This must not be `Array`. + * + * Generated from protobuf field .google.bigtable.v2.Type element_type = 1; + */ + protected $element_type = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\V2\Type $element_type + * The type of the elements in the array. This must not be `Array`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * The type of the elements in the array. This must not be `Array`. + * + * Generated from protobuf field .google.bigtable.v2.Type element_type = 1; + * @return \Google\Cloud\Bigtable\V2\Type|null + */ + public function getElementType() + { + return $this->element_type; + } + + public function hasElementType() + { + return isset($this->element_type); + } + + public function clearElementType() + { + unset($this->element_type); + } + + /** + * The type of the elements in the array. This must not be `Array`. + * + * Generated from protobuf field .google.bigtable.v2.Type element_type = 1; + * @param \Google\Cloud\Bigtable\V2\Type $var + * @return $this + */ + public function setElementType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type::class); + $this->element_type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PBArray::class, \Google\Cloud\Bigtable\V2\Type_Array::class); + diff --git a/Bigtable/src/V2/Type/PBBool.php b/Bigtable/src/V2/Type/PBBool.php new file mode 100644 index 000000000000..9de6cd8f9cab --- /dev/null +++ b/Bigtable/src/V2/Type/PBBool.php @@ -0,0 +1,37 @@ +google.bigtable.v2.Type.Bool + */ +class PBBool extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PBBool::class, \Google\Cloud\Bigtable\V2\Type_Bool::class); + diff --git a/Bigtable/src/V2/Type/PBString.php b/Bigtable/src/V2/Type/PBString.php new file mode 100644 index 000000000000..fbb2f0da8c4a --- /dev/null +++ b/Bigtable/src/V2/Type/PBString.php @@ -0,0 +1,81 @@ +google.bigtable.v2.Type.String + */ +class PBString extends \Google\Protobuf\Internal\Message +{ + /** + * The encoding to use when converting to/from lower level types. + * + * Generated from protobuf field .google.bigtable.v2.Type.String.Encoding encoding = 1; + */ + protected $encoding = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\V2\Type\PBString\Encoding $encoding + * The encoding to use when converting to/from lower level types. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * The encoding to use when converting to/from lower level types. + * + * Generated from protobuf field .google.bigtable.v2.Type.String.Encoding encoding = 1; + * @return \Google\Cloud\Bigtable\V2\Type\PBString\Encoding|null + */ + public function getEncoding() + { + return $this->encoding; + } + + public function hasEncoding() + { + return isset($this->encoding); + } + + public function clearEncoding() + { + unset($this->encoding); + } + + /** + * The encoding to use when converting to/from lower level types. + * + * Generated from protobuf field .google.bigtable.v2.Type.String.Encoding encoding = 1; + * @param \Google\Cloud\Bigtable\V2\Type\PBString\Encoding $var + * @return $this + */ + public function setEncoding($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\PBString\Encoding::class); + $this->encoding = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PBString::class, \Google\Cloud\Bigtable\V2\Type_String::class); + diff --git a/Bigtable/src/V2/Type/PBString/Encoding.php b/Bigtable/src/V2/Type/PBString/Encoding.php new file mode 100644 index 000000000000..156f04ac2f8b --- /dev/null +++ b/Bigtable/src/V2/Type/PBString/Encoding.php @@ -0,0 +1,78 @@ +google.bigtable.v2.Type.String.Encoding + */ +class Encoding extends \Google\Protobuf\Internal\Message +{ + protected $encoding; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\V2\Type\PBString\Encoding\Utf8Bytes $utf8_bytes + * Use `Utf8Bytes` encoding. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * Use `Utf8Bytes` encoding. + * + * Generated from protobuf field .google.bigtable.v2.Type.String.Encoding.Utf8Bytes utf8_bytes = 2; + * @return \Google\Cloud\Bigtable\V2\Type\PBString\Encoding\Utf8Bytes|null + */ + public function getUtf8Bytes() + { + return $this->readOneof(2); + } + + public function hasUtf8Bytes() + { + return $this->hasOneof(2); + } + + /** + * Use `Utf8Bytes` encoding. + * + * Generated from protobuf field .google.bigtable.v2.Type.String.Encoding.Utf8Bytes utf8_bytes = 2; + * @param \Google\Cloud\Bigtable\V2\Type\PBString\Encoding\Utf8Bytes $var + * @return $this + */ + public function setUtf8Bytes($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type\PBString\Encoding\Utf8Bytes::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getEncoding() + { + return $this->whichOneof("encoding"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Encoding::class, \Google\Cloud\Bigtable\V2\Type_String_Encoding::class); + diff --git a/Bigtable/src/V2/Type/PBString/Encoding/Utf8Bytes.php b/Bigtable/src/V2/Type/PBString/Encoding/Utf8Bytes.php new file mode 100644 index 000000000000..998216c290b9 --- /dev/null +++ b/Bigtable/src/V2/Type/PBString/Encoding/Utf8Bytes.php @@ -0,0 +1,42 @@ +google.bigtable.v2.Type.String.Encoding.Utf8Bytes + */ +class Utf8Bytes extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Utf8Bytes::class, \Google\Cloud\Bigtable\V2\Type_String_Encoding_Utf8Bytes::class); + diff --git a/Bigtable/src/V2/Type/Struct.php b/Bigtable/src/V2/Type/Struct.php new file mode 100644 index 000000000000..01b9fbc598fa --- /dev/null +++ b/Bigtable/src/V2/Type/Struct.php @@ -0,0 +1,73 @@ +google.bigtable.v2.Type.Struct + */ +class Struct extends \Google\Protobuf\Internal\Message +{ + /** + * The names and types of the fields in this struct. + * + * Generated from protobuf field repeated .google.bigtable.v2.Type.Struct.Field fields = 1; + */ + private $fields; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Bigtable\V2\Type\Struct\Field>|\Google\Protobuf\Internal\RepeatedField $fields + * The names and types of the fields in this struct. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * The names and types of the fields in this struct. + * + * Generated from protobuf field repeated .google.bigtable.v2.Type.Struct.Field fields = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFields() + { + return $this->fields; + } + + /** + * The names and types of the fields in this struct. + * + * Generated from protobuf field repeated .google.bigtable.v2.Type.Struct.Field fields = 1; + * @param array<\Google\Cloud\Bigtable\V2\Type\Struct\Field>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFields($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Bigtable\V2\Type\Struct\Field::class); + $this->fields = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Struct::class, \Google\Cloud\Bigtable\V2\Type_Struct::class); + diff --git a/Bigtable/src/V2/Type/Struct/Field.php b/Bigtable/src/V2/Type/Struct/Field.php new file mode 100644 index 000000000000..0aa221b2a746 --- /dev/null +++ b/Bigtable/src/V2/Type/Struct/Field.php @@ -0,0 +1,118 @@ +google.bigtable.v2.Type.Struct.Field + */ +class Field extends \Google\Protobuf\Internal\Message +{ + /** + * The field name (optional). Fields without a `field_name` are considered + * anonymous and cannot be referenced by name. + * + * Generated from protobuf field string field_name = 1; + */ + protected $field_name = ''; + /** + * The type of values in this field. + * + * Generated from protobuf field .google.bigtable.v2.Type type = 2; + */ + protected $type = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $field_name + * The field name (optional). Fields without a `field_name` are considered + * anonymous and cannot be referenced by name. + * @type \Google\Cloud\Bigtable\V2\Type $type + * The type of values in this field. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * The field name (optional). Fields without a `field_name` are considered + * anonymous and cannot be referenced by name. + * + * Generated from protobuf field string field_name = 1; + * @return string + */ + public function getFieldName() + { + return $this->field_name; + } + + /** + * The field name (optional). Fields without a `field_name` are considered + * anonymous and cannot be referenced by name. + * + * Generated from protobuf field string field_name = 1; + * @param string $var + * @return $this + */ + public function setFieldName($var) + { + GPBUtil::checkString($var, True); + $this->field_name = $var; + + return $this; + } + + /** + * The type of values in this field. + * + * Generated from protobuf field .google.bigtable.v2.Type type = 2; + * @return \Google\Cloud\Bigtable\V2\Type|null + */ + public function getType() + { + return $this->type; + } + + public function hasType() + { + return isset($this->type); + } + + public function clearType() + { + unset($this->type); + } + + /** + * The type of values in this field. + * + * Generated from protobuf field .google.bigtable.v2.Type type = 2; + * @param \Google\Cloud\Bigtable\V2\Type $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type::class); + $this->type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Field::class, \Google\Cloud\Bigtable\V2\Type_Struct_Field::class); + diff --git a/Bigtable/src/V2/Type/Timestamp.php b/Bigtable/src/V2/Type/Timestamp.php new file mode 100644 index 000000000000..3c437f884597 --- /dev/null +++ b/Bigtable/src/V2/Type/Timestamp.php @@ -0,0 +1,37 @@ +google.bigtable.v2.Type.Timestamp + */ +class Timestamp extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Types::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Timestamp::class, \Google\Cloud\Bigtable\V2\Type_Timestamp::class); + diff --git a/Bigtable/src/V2/Value.php b/Bigtable/src/V2/Value.php index 1c91f2d6273b..d35a8ede4c5b 100644 --- a/Bigtable/src/V2/Value.php +++ b/Bigtable/src/V2/Value.php @@ -18,6 +18,22 @@ */ class Value extends \Google\Protobuf\Internal\Message { + /** + * The verified `Type` of this `Value`, if it cannot be inferred. + * Read results will never specify the encoding for `type` since the value + * will already have been decoded by the server. Furthermore, the `type` will + * be omitted entirely if it can be inferred from a previous response. The + * exact semantics for inferring `type` will vary, and are therefore + * documented separately for each read method. + * When using composite types (Struct, Array, Map) only the outermost `Value` + * will specify the `type`. This top-level `type` will define the types for + * any nested `Struct' fields, `Array` elements, or `Map` key/value pairs. + * If a nested `Value` provides a `type` on write, the request will be + * rejected with INVALID_ARGUMENT. + * + * Generated from protobuf field .google.bigtable.v2.Type type = 7; + */ + protected $type = null; protected $kind; /** @@ -26,15 +42,44 @@ class Value extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * + * @type \Google\Cloud\Bigtable\V2\Type $type + * The verified `Type` of this `Value`, if it cannot be inferred. + * Read results will never specify the encoding for `type` since the value + * will already have been decoded by the server. Furthermore, the `type` will + * be omitted entirely if it can be inferred from a previous response. The + * exact semantics for inferring `type` will vary, and are therefore + * documented separately for each read method. + * When using composite types (Struct, Array, Map) only the outermost `Value` + * will specify the `type`. This top-level `type` will define the types for + * any nested `Struct' fields, `Array` elements, or `Map` key/value pairs. + * If a nested `Value` provides a `type` on write, the request will be + * rejected with INVALID_ARGUMENT. * @type string $raw_value * Represents a raw byte sequence with no type information. * The `type` field must be omitted. * @type int|string $raw_timestamp_micros * Represents a raw cell timestamp with no type information. * The `type` field must be omitted. + * @type string $bytes_value + * Represents a typed value transported as a byte sequence. + * @type string $string_value + * Represents a typed value transported as a string. * @type int|string $int_value * Represents a typed value transported as an integer. - * Default type for writes: `Int64` + * @type bool $bool_value + * Represents a typed value transported as a boolean. + * @type float $float_value + * Represents a typed value transported as a floating point number. + * @type \Google\Protobuf\Timestamp $timestamp_value + * Represents a typed value transported as a timestamp. + * @type \Google\Type\Date $date_value + * Represents a typed value transported as a date. + * @type \Google\Cloud\Bigtable\V2\ArrayValue $array_value + * Represents a typed value transported as a sequence of values. + * To differentiate between `Struct`, `Array`, and `Map`, the outermost + * `Value` must provide an explicit `type` on write. This `type` will + * apply recursively to the nested `Struct` fields, `Array` elements, + * or `Map` key/value pairs, which *must not* supply their own `type`. * } */ public function __construct($data = NULL) { @@ -42,6 +87,62 @@ public function __construct($data = NULL) { parent::__construct($data); } + /** + * The verified `Type` of this `Value`, if it cannot be inferred. + * Read results will never specify the encoding for `type` since the value + * will already have been decoded by the server. Furthermore, the `type` will + * be omitted entirely if it can be inferred from a previous response. The + * exact semantics for inferring `type` will vary, and are therefore + * documented separately for each read method. + * When using composite types (Struct, Array, Map) only the outermost `Value` + * will specify the `type`. This top-level `type` will define the types for + * any nested `Struct' fields, `Array` elements, or `Map` key/value pairs. + * If a nested `Value` provides a `type` on write, the request will be + * rejected with INVALID_ARGUMENT. + * + * Generated from protobuf field .google.bigtable.v2.Type type = 7; + * @return \Google\Cloud\Bigtable\V2\Type|null + */ + public function getType() + { + return $this->type; + } + + public function hasType() + { + return isset($this->type); + } + + public function clearType() + { + unset($this->type); + } + + /** + * The verified `Type` of this `Value`, if it cannot be inferred. + * Read results will never specify the encoding for `type` since the value + * will already have been decoded by the server. Furthermore, the `type` will + * be omitted entirely if it can be inferred from a previous response. The + * exact semantics for inferring `type` will vary, and are therefore + * documented separately for each read method. + * When using composite types (Struct, Array, Map) only the outermost `Value` + * will specify the `type`. This top-level `type` will define the types for + * any nested `Struct' fields, `Array` elements, or `Map` key/value pairs. + * If a nested `Value` provides a `type` on write, the request will be + * rejected with INVALID_ARGUMENT. + * + * Generated from protobuf field .google.bigtable.v2.Type type = 7; + * @param \Google\Cloud\Bigtable\V2\Type $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Type::class); + $this->type = $var; + + return $this; + } + /** * Represents a raw byte sequence with no type information. * The `type` field must be omitted. @@ -108,9 +209,70 @@ public function setRawTimestampMicros($var) return $this; } + /** + * Represents a typed value transported as a byte sequence. + * + * Generated from protobuf field bytes bytes_value = 2; + * @return string + */ + public function getBytesValue() + { + return $this->readOneof(2); + } + + public function hasBytesValue() + { + return $this->hasOneof(2); + } + + /** + * Represents a typed value transported as a byte sequence. + * + * Generated from protobuf field bytes bytes_value = 2; + * @param string $var + * @return $this + */ + public function setBytesValue($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Represents a typed value transported as a string. + * + * Generated from protobuf field string string_value = 3; + * @return string + */ + public function getStringValue() + { + return $this->readOneof(3); + } + + public function hasStringValue() + { + return $this->hasOneof(3); + } + + /** + * Represents a typed value transported as a string. + * + * Generated from protobuf field string string_value = 3; + * @param string $var + * @return $this + */ + public function setStringValue($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + /** * Represents a typed value transported as an integer. - * Default type for writes: `Int64` * * Generated from protobuf field int64 int_value = 6; * @return int|string @@ -127,7 +289,6 @@ public function hasIntValue() /** * Represents a typed value transported as an integer. - * Default type for writes: `Int64` * * Generated from protobuf field int64 int_value = 6; * @param int|string $var @@ -141,6 +302,169 @@ public function setIntValue($var) return $this; } + /** + * Represents a typed value transported as a boolean. + * + * Generated from protobuf field bool bool_value = 10; + * @return bool + */ + public function getBoolValue() + { + return $this->readOneof(10); + } + + public function hasBoolValue() + { + return $this->hasOneof(10); + } + + /** + * Represents a typed value transported as a boolean. + * + * Generated from protobuf field bool bool_value = 10; + * @param bool $var + * @return $this + */ + public function setBoolValue($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * Represents a typed value transported as a floating point number. + * + * Generated from protobuf field double float_value = 11; + * @return float + */ + public function getFloatValue() + { + return $this->readOneof(11); + } + + public function hasFloatValue() + { + return $this->hasOneof(11); + } + + /** + * Represents a typed value transported as a floating point number. + * + * Generated from protobuf field double float_value = 11; + * @param float $var + * @return $this + */ + public function setFloatValue($var) + { + GPBUtil::checkDouble($var); + $this->writeOneof(11, $var); + + return $this; + } + + /** + * Represents a typed value transported as a timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp timestamp_value = 12; + * @return \Google\Protobuf\Timestamp|null + */ + public function getTimestampValue() + { + return $this->readOneof(12); + } + + public function hasTimestampValue() + { + return $this->hasOneof(12); + } + + /** + * Represents a typed value transported as a timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp timestamp_value = 12; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setTimestampValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->writeOneof(12, $var); + + return $this; + } + + /** + * Represents a typed value transported as a date. + * + * Generated from protobuf field .google.type.Date date_value = 13; + * @return \Google\Type\Date|null + */ + public function getDateValue() + { + return $this->readOneof(13); + } + + public function hasDateValue() + { + return $this->hasOneof(13); + } + + /** + * Represents a typed value transported as a date. + * + * Generated from protobuf field .google.type.Date date_value = 13; + * @param \Google\Type\Date $var + * @return $this + */ + public function setDateValue($var) + { + GPBUtil::checkMessage($var, \Google\Type\Date::class); + $this->writeOneof(13, $var); + + return $this; + } + + /** + * Represents a typed value transported as a sequence of values. + * To differentiate between `Struct`, `Array`, and `Map`, the outermost + * `Value` must provide an explicit `type` on write. This `type` will + * apply recursively to the nested `Struct` fields, `Array` elements, + * or `Map` key/value pairs, which *must not* supply their own `type`. + * + * Generated from protobuf field .google.bigtable.v2.ArrayValue array_value = 4; + * @return \Google\Cloud\Bigtable\V2\ArrayValue|null + */ + public function getArrayValue() + { + return $this->readOneof(4); + } + + public function hasArrayValue() + { + return $this->hasOneof(4); + } + + /** + * Represents a typed value transported as a sequence of values. + * To differentiate between `Struct`, `Array`, and `Map`, the outermost + * `Value` must provide an explicit `type` on write. This `type` will + * apply recursively to the nested `Struct` fields, `Array` elements, + * or `Map` key/value pairs, which *must not* supply their own `type`. + * + * Generated from protobuf field .google.bigtable.v2.ArrayValue array_value = 4; + * @param \Google\Cloud\Bigtable\V2\ArrayValue $var + * @return $this + */ + public function setArrayValue($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\ArrayValue::class); + $this->writeOneof(4, $var); + + return $this; + } + /** * @return string */ diff --git a/Bigtable/src/V2/gapic_metadata.json b/Bigtable/src/V2/gapic_metadata.json index 38b379d3786b..fe7b9844ea9d 100644 --- a/Bigtable/src/V2/gapic_metadata.json +++ b/Bigtable/src/V2/gapic_metadata.json @@ -15,6 +15,11 @@ "checkAndMutateRow" ] }, + "ExecuteQuery": { + "methods": [ + "executeQuery" + ] + }, "GenerateInitialChangeStreamPartitions": { "methods": [ "generateInitialChangeStreamPartitions" diff --git a/Bigtable/src/V2/resources/bigtable_client_config.json b/Bigtable/src/V2/resources/bigtable_client_config.json index 15b71e3eaaf7..ee5dae96485d 100644 --- a/Bigtable/src/V2/resources/bigtable_client_config.json +++ b/Bigtable/src/V2/resources/bigtable_client_config.json @@ -25,6 +25,9 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "ExecuteQuery": { + "timeout_millis": 60000 + }, "GenerateInitialChangeStreamPartitions": { "timeout_millis": 60000 }, diff --git a/Bigtable/src/V2/resources/bigtable_descriptor_config.php b/Bigtable/src/V2/resources/bigtable_descriptor_config.php index 072e59d30db5..77b7d119b420 100644 --- a/Bigtable/src/V2/resources/bigtable_descriptor_config.php +++ b/Bigtable/src/V2/resources/bigtable_descriptor_config.php @@ -53,6 +53,30 @@ ], ], ], + 'ExecuteQuery' => [ + 'grpcStreaming' => [ + 'grpcStreamingType' => 'ServerStreaming', + ], + 'callType' => \Google\ApiCore\Call::SERVER_STREAMING_CALL, + 'responseType' => 'Google\Cloud\Bigtable\V2\ExecuteQueryResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getInstanceName', + ], + 'matchers' => [ + '/^(?projects\/[^\/]+\/instances\/[^\/]+)$/', + ], + ], + [ + 'keyName' => 'app_profile_id', + 'fieldAccessors' => [ + 'getAppProfileId', + ], + ], + ], + ], 'GenerateInitialChangeStreamPartitions' => [ 'grpcStreaming' => [ 'grpcStreamingType' => 'ServerStreaming', diff --git a/Bigtable/src/V2/resources/bigtable_rest_client_config.php b/Bigtable/src/V2/resources/bigtable_rest_client_config.php index e19d76ba2bf0..33dbd11ee56e 100644 --- a/Bigtable/src/V2/resources/bigtable_rest_client_config.php +++ b/Bigtable/src/V2/resources/bigtable_rest_client_config.php @@ -47,6 +47,18 @@ ], ], ], + 'ExecuteQuery' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{instance_name=projects/*/instances/*}:executeQuery', + 'body' => '*', + 'placeholders' => [ + 'instance_name' => [ + 'getters' => [ + 'getInstanceName', + ], + ], + ], + ], 'GenerateInitialChangeStreamPartitions' => [ 'method' => 'post', 'uriTemplate' => '/v2/{table_name=projects/*/instances/*/tables/*}:generateInitialChangeStreamPartitions', diff --git a/Bigtable/tests/Unit/V2/Client/BigtableClientTest.php b/Bigtable/tests/Unit/V2/Client/BigtableClientTest.php index 7106025be3cb..c419ae22f524 100644 --- a/Bigtable/tests/Unit/V2/Client/BigtableClientTest.php +++ b/Bigtable/tests/Unit/V2/Client/BigtableClientTest.php @@ -30,6 +30,8 @@ use Google\Cloud\Bigtable\V2\CheckAndMutateRowRequest; use Google\Cloud\Bigtable\V2\CheckAndMutateRowResponse; use Google\Cloud\Bigtable\V2\Client\BigtableClient; +use Google\Cloud\Bigtable\V2\ExecuteQueryRequest; +use Google\Cloud\Bigtable\V2\ExecuteQueryResponse; use Google\Cloud\Bigtable\V2\GenerateInitialChangeStreamPartitionsRequest; use Google\Cloud\Bigtable\V2\GenerateInitialChangeStreamPartitionsResponse; use Google\Cloud\Bigtable\V2\MutateRowRequest; @@ -46,6 +48,7 @@ use Google\Cloud\Bigtable\V2\ReadRowsResponse; use Google\Cloud\Bigtable\V2\SampleRowKeysRequest; use Google\Cloud\Bigtable\V2\SampleRowKeysResponse; +use Google\Cloud\Bigtable\V2\Value; use Google\Rpc\Code; use stdClass; @@ -147,6 +150,98 @@ public function checkAndMutateRowExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function executeQueryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ExecuteQueryResponse(); + $transport->addResponse($expectedResponse); + $expectedResponse2 = new ExecuteQueryResponse(); + $transport->addResponse($expectedResponse2); + $expectedResponse3 = new ExecuteQueryResponse(); + $transport->addResponse($expectedResponse3); + // Mock request + $formattedInstanceName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $query = 'query107944136'; + $paramsValue = new Value(); + $params = [ + 'paramsKey' => $paramsValue, + ]; + $request = (new ExecuteQueryRequest()) + ->setInstanceName($formattedInstanceName) + ->setQuery($query) + ->setParams($params); + $serverStream = $gapicClient->executeQuery($request); + $this->assertInstanceOf(ServerStream::class, $serverStream); + $responses = iterator_to_array($serverStream->readAll()); + $expectedResponses = []; + $expectedResponses[] = $expectedResponse; + $expectedResponses[] = $expectedResponse2; + $expectedResponses[] = $expectedResponse3; + $this->assertEquals($expectedResponses, $responses); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.bigtable.v2.Bigtable/ExecuteQuery', $actualFuncCall); + $actualValue = $actualRequestObject->getInstanceName(); + $this->assertProtobufEquals($formattedInstanceName, $actualValue); + $actualValue = $actualRequestObject->getQuery(); + $this->assertProtobufEquals($query, $actualValue); + $actualValue = $actualRequestObject->getParams(); + $this->assertProtobufEquals($params, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function executeQueryExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->setStreamingStatus($status); + $this->assertTrue($transport->isExhausted()); + // Mock request + $formattedInstanceName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $query = 'query107944136'; + $paramsValue = new Value(); + $params = [ + 'paramsKey' => $paramsValue, + ]; + $request = (new ExecuteQueryRequest()) + ->setInstanceName($formattedInstanceName) + ->setQuery($query) + ->setParams($params); + $serverStream = $gapicClient->executeQuery($request); + $results = $serverStream->readAll(); + try { + iterator_to_array($results); + // If the close stream method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function generateInitialChangeStreamPartitionsTest() {