diff --git a/Spanner/metadata/Admin/Database/V1/SpannerDatabaseAdmin.php b/Spanner/metadata/Admin/Database/V1/SpannerDatabaseAdmin.php index d6119c8597f8..1375b8aa4925 100644 Binary files a/Spanner/metadata/Admin/Database/V1/SpannerDatabaseAdmin.php and b/Spanner/metadata/Admin/Database/V1/SpannerDatabaseAdmin.php differ diff --git a/Spanner/src/Admin/Database/V1/CreateDatabaseRequest.php b/Spanner/src/Admin/Database/V1/CreateDatabaseRequest.php index bc3aa8aadcc7..2d89bee7142b 100644 --- a/Spanner/src/Admin/Database/V1/CreateDatabaseRequest.php +++ b/Spanner/src/Admin/Database/V1/CreateDatabaseRequest.php @@ -55,6 +55,26 @@ class CreateDatabaseRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 5 [(.google.api.field_behavior) = OPTIONAL]; */ private $database_dialect = 0; + /** + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in + * 'extra_statements' above. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * + * Generated from protobuf field bytes proto_descriptors = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $proto_descriptors = ''; /** * @param string $parent Required. The name of the instance that will serve the new database. @@ -103,6 +123,22 @@ public static function build(string $parent, string $createStatement): self * Google default encryption. * @type int $database_dialect * Optional. The dialect of the Cloud Spanner Database. + * @type string $proto_descriptors + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in + * 'extra_statements' above. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). * } */ public function __construct($data = NULL) { @@ -270,5 +306,59 @@ public function setDatabaseDialect($var) return $this; } + /** + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in + * 'extra_statements' above. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * + * Generated from protobuf field bytes proto_descriptors = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getProtoDescriptors() + { + return $this->proto_descriptors; + } + + /** + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in + * 'extra_statements' above. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * + * Generated from protobuf field bytes proto_descriptors = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setProtoDescriptors($var) + { + GPBUtil::checkString($var, False); + $this->proto_descriptors = $var; + + return $this; + } + } diff --git a/Spanner/src/Admin/Database/V1/Gapic/DatabaseAdminGapicClient.php b/Spanner/src/Admin/Database/V1/Gapic/DatabaseAdminGapicClient.php index 63a3138fe703..416d4bfaf0bf 100644 --- a/Spanner/src/Admin/Database/V1/Gapic/DatabaseAdminGapicClient.php +++ b/Spanner/src/Admin/Database/V1/Gapic/DatabaseAdminGapicClient.php @@ -829,6 +829,22 @@ public function createBackup( * @type int $databaseDialect * Optional. The dialect of the Cloud Spanner Database. * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\Admin\Database\V1\DatabaseDialect} + * @type string $protoDescriptors + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in + * 'extra_statements' above. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an * associative array of retry settings parameters. See the documentation on @@ -861,6 +877,10 @@ public function createDatabase( $request->setDatabaseDialect($optionalArgs['databaseDialect']); } + if (isset($optionalArgs['protoDescriptors'])) { + $request->setProtoDescriptors($optionalArgs['protoDescriptors']); + } + $requestParams = new RequestParamsHeaderDescriptor( $requestParamHeaders ); @@ -2256,6 +2276,21 @@ public function updateDatabase( * underscore. If the named operation already exists, * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] returns * `ALREADY_EXISTS`. + * @type string $protoDescriptors + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an * associative array of retry settings parameters. See the documentation on @@ -2280,6 +2315,10 @@ public function updateDatabaseDdl( $request->setOperationId($optionalArgs['operationId']); } + if (isset($optionalArgs['protoDescriptors'])) { + $request->setProtoDescriptors($optionalArgs['protoDescriptors']); + } + $requestParams = new RequestParamsHeaderDescriptor( $requestParamHeaders ); diff --git a/Spanner/src/Admin/Database/V1/GetDatabaseDdlResponse.php b/Spanner/src/Admin/Database/V1/GetDatabaseDdlResponse.php index fa2a173fdcb5..6e51152a8b3d 100644 --- a/Spanner/src/Admin/Database/V1/GetDatabaseDdlResponse.php +++ b/Spanner/src/Admin/Database/V1/GetDatabaseDdlResponse.php @@ -22,6 +22,16 @@ class GetDatabaseDdlResponse extends \Google\Protobuf\Internal\Message * Generated from protobuf field repeated string statements = 1; */ private $statements; + /** + * Proto descriptors stored in the database. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * + * Generated from protobuf field bytes proto_descriptors = 2; + */ + private $proto_descriptors = ''; /** * Constructor. @@ -32,6 +42,12 @@ class GetDatabaseDdlResponse extends \Google\Protobuf\Internal\Message * @type array|\Google\Protobuf\Internal\RepeatedField $statements * A list of formatted DDL statements defining the schema of the database * specified in the request. + * @type string $proto_descriptors + * Proto descriptors stored in the database. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). * } */ public function __construct($data = NULL) { @@ -67,5 +83,39 @@ public function setStatements($var) return $this; } + /** + * Proto descriptors stored in the database. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * + * Generated from protobuf field bytes proto_descriptors = 2; + * @return string + */ + public function getProtoDescriptors() + { + return $this->proto_descriptors; + } + + /** + * Proto descriptors stored in the database. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * + * Generated from protobuf field bytes proto_descriptors = 2; + * @param string $var + * @return $this + */ + public function setProtoDescriptors($var) + { + GPBUtil::checkString($var, False); + $this->proto_descriptors = $var; + + return $this; + } + } diff --git a/Spanner/src/Admin/Database/V1/UpdateDatabaseDdlRequest.php b/Spanner/src/Admin/Database/V1/UpdateDatabaseDdlRequest.php index ee3cf859cf7c..fefb1928a3d6 100644 --- a/Spanner/src/Admin/Database/V1/UpdateDatabaseDdlRequest.php +++ b/Spanner/src/Admin/Database/V1/UpdateDatabaseDdlRequest.php @@ -63,6 +63,25 @@ class UpdateDatabaseDdlRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field string operation_id = 3; */ private $operation_id = ''; + /** + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * + * Generated from protobuf field bytes proto_descriptors = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $proto_descriptors = ''; /** * @param string $database Required. The database to update. Please see @@ -108,6 +127,21 @@ public static function build(string $database, array $statements): self * underscore. If the named operation already exists, * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] returns * `ALREADY_EXISTS`. + * @type string $proto_descriptors + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). * } */ public function __construct($data = NULL) { @@ -225,5 +259,57 @@ public function setOperationId($var) return $this; } + /** + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * + * Generated from protobuf field bytes proto_descriptors = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getProtoDescriptors() + { + return $this->proto_descriptors; + } + + /** + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * + * Generated from protobuf field bytes proto_descriptors = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setProtoDescriptors($var) + { + GPBUtil::checkString($var, False); + $this->proto_descriptors = $var; + + return $this; + } + } diff --git a/Spanner/tests/Unit/Admin/Database/V1/Client/DatabaseAdminClientTest.php b/Spanner/tests/Unit/Admin/Database/V1/Client/DatabaseAdminClientTest.php index 46cf66f3b846..f91d06e8531f 100644 --- a/Spanner/tests/Unit/Admin/Database/V1/Client/DatabaseAdminClientTest.php +++ b/Spanner/tests/Unit/Admin/Database/V1/Client/DatabaseAdminClientTest.php @@ -788,7 +788,9 @@ public function getDatabaseDdlTest() ]); $this->assertTrue($transport->isExhausted()); // Mock response + $protoDescriptors = '13'; $expectedResponse = new GetDatabaseDdlResponse(); + $expectedResponse->setProtoDescriptors($protoDescriptors); $transport->addResponse($expectedResponse); // Mock request $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); diff --git a/Spanner/tests/Unit/Admin/Database/V1/DatabaseAdminClientTest.php b/Spanner/tests/Unit/Admin/Database/V1/DatabaseAdminClientTest.php index 248bab56f04d..529e0e8cc6f4 100644 --- a/Spanner/tests/Unit/Admin/Database/V1/DatabaseAdminClientTest.php +++ b/Spanner/tests/Unit/Admin/Database/V1/DatabaseAdminClientTest.php @@ -728,7 +728,9 @@ public function getDatabaseDdlTest() ]); $this->assertTrue($transport->isExhausted()); // Mock response + $protoDescriptors = '13'; $expectedResponse = new GetDatabaseDdlResponse(); + $expectedResponse->setProtoDescriptors($protoDescriptors); $transport->addResponse($expectedResponse); // Mock request $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]');