diff --git a/Spanner/owlbot.py b/Spanner/owlbot.py
index 84d9db0ddeb1..d1e761b3a56b 100644
--- a/Spanner/owlbot.py
+++ b/Spanner/owlbot.py
@@ -70,56 +70,15 @@
# copy GPBMetadata file to metadata
s.move(admin_library / f'proto/src/GPBMetadata/Google/Spanner', f'metadata/', merge=php._merge)
-
-# Fix test namespaces
-s.replace(
- 'tests/Unit/Admin/Database/*/*.php',
- r'namespace Google\\Cloud\\Spanner\\Admin\\Database\\Tests\\Unit',
- r'namespace Google\\Cloud\\Spanner\\Tests\\Unit\\Admin\\Database')
+# remove class_alias code
s.replace(
- 'tests/Unit/Admin/Instance/*/*.php',
- r'namespace Google\\Cloud\\Spanner\\Admin\\Instance\\Tests\\Unit',
- r'namespace Google\\Cloud\\Spanner\\Tests\\Unit\\Admin\\Instance')
-
-# fix test group
-s.replace(
- 'tests/**/Admin/Database/V1/*Test.php',
- '@group database',
- '@group spanner-admin-database')
-
-s.replace(
- 'tests/**/Admin/Instance/V1/*Test.php',
- '@group instance',
- '@group spanner-admin-instance')
-
-# remove ReadOnly class_alias code
-s.replace(
- "src/V*/**/PBReadOnly.php",
- r"^// Adding a class alias for backwards compatibility with the \"readonly\" keyword.$"
+ "src/V*/**/*.php",
+ r"^// Adding a class alias for backwards compatibility with the previous class name.$"
+ "\n"
- + r"^class_alias\(PBReadOnly::class, __NAMESPACE__ . '\\ReadOnly'\);$"
+ + r"^class_alias\(.*\);$"
+ "\n",
'')
-### [START] protoc backwards compatibility fixes
-
-# roll back to private properties.
-s.replace(
- "src/**/V*/**/*.php",
- r"Generated from protobuf field ([^\n]{0,})\n\s{5}\*/\n\s{4}protected \$",
- r"""Generated from protobuf field \1
- */
- private $""")
-
-# Replace "Unwrapped" with "Value" for method names.
-s.replace(
- "src/**/V*/**/*.php",
- r"public function ([s|g]\w{3,})Unwrapped",
- r"public function \1Value"
-)
-
-### [END] protoc backwards compatibility fixes
-
# fix relative cloud.google.com links
s.replace(
"src/**/V*/**/*.php",
diff --git a/Spanner/src/Admin/Database/V1/Backup.php b/Spanner/src/Admin/Database/V1/Backup.php
index e91578bad1e6..fa62e2c3d8f9 100644
--- a/Spanner/src/Admin/Database/V1/Backup.php
+++ b/Spanner/src/Admin/Database/V1/Backup.php
@@ -24,7 +24,7 @@ class Backup extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string database = 2 [(.google.api.resource_reference) = {
*/
- private $database = '';
+ protected $database = '';
/**
* The backup will contain an externally consistent copy of the database at
* the timestamp specified by `version_time`. If `version_time` is not
@@ -33,7 +33,7 @@ class Backup extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp version_time = 9;
*/
- private $version_time = null;
+ protected $version_time = null;
/**
* Required for the
* [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
@@ -45,7 +45,7 @@ class Backup extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp expire_time = 3;
*/
- private $expire_time = null;
+ protected $expire_time = null;
/**
* Output only for the
* [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
@@ -64,7 +64,7 @@ class Backup extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1;
*/
- private $name = '';
+ protected $name = '';
/**
* Output only. The time the
* [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
@@ -73,13 +73,13 @@ class Backup extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $create_time = null;
+ protected $create_time = null;
/**
* Output only. Size of the backup in bytes.
*
* Generated from protobuf field int64 size_bytes = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $size_bytes = 0;
+ protected $size_bytes = 0;
/**
* Output only. The number of bytes that will be freed by deleting this
* backup. This value will be zero if, for example, this backup is part of an
@@ -108,7 +108,7 @@ class Backup extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.database.v1.Backup.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $state = 0;
+ protected $state = 0;
/**
* Output only. The names of the restored databases that reference the backup.
* The database names are of
@@ -126,7 +126,7 @@ class Backup extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.database.v1.EncryptionInfo encryption_info = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $encryption_info = null;
+ protected $encryption_info = null;
/**
* Output only. The encryption information for the backup, whether it is
* protected by one or more KMS keys. The information includes all Cloud
@@ -143,7 +143,7 @@ class Backup extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $database_dialect = 0;
+ protected $database_dialect = 0;
/**
* Output only. The names of the destination backups being created by copying
* this source backup. The backup names are of the form
diff --git a/Spanner/src/Admin/Database/V1/BackupInfo.php b/Spanner/src/Admin/Database/V1/BackupInfo.php
index daaf059905a8..301cdec6653a 100644
--- a/Spanner/src/Admin/Database/V1/BackupInfo.php
+++ b/Spanner/src/Admin/Database/V1/BackupInfo.php
@@ -20,7 +20,7 @@ class BackupInfo extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string backup = 1 [(.google.api.resource_reference) = {
*/
- private $backup = '';
+ protected $backup = '';
/**
* The backup contains an externally consistent copy of `source_database` at
* the timestamp specified by `version_time`. If the
@@ -30,7 +30,7 @@ class BackupInfo extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp version_time = 4;
*/
- private $version_time = null;
+ protected $version_time = null;
/**
* The time the
* [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
@@ -38,13 +38,13 @@ class BackupInfo extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp create_time = 2;
*/
- private $create_time = null;
+ protected $create_time = null;
/**
* Name of the database the backup was created from.
*
* Generated from protobuf field string source_database = 3 [(.google.api.resource_reference) = {
*/
- private $source_database = '';
+ protected $source_database = '';
/**
* Constructor.
diff --git a/Spanner/src/Admin/Database/V1/Backup_State.php b/Spanner/src/Admin/Database/V1/Backup_State.php
deleted file mode 100644
index c284017a215d..000000000000
--- a/Spanner/src/Admin/Database/V1/Backup_State.php
+++ /dev/null
@@ -1,16 +0,0 @@
-.google.spanner.admin.database.v1.CopyBackupEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $encryption_type = 0;
+ protected $encryption_type = 0;
/**
* Optional. The Cloud KMS key that will be used to protect the backup.
* This field should be set only when
@@ -30,7 +30,7 @@ class CopyBackupEncryptionConfig extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = {
*/
- private $kms_key_name = '';
+ protected $kms_key_name = '';
/**
* Optional. Specifies the KMS configuration for the one or more keys used to
* protect the backup. Values are of the form
diff --git a/Spanner/src/Admin/Database/V1/CopyBackupEncryptionConfig_EncryptionType.php b/Spanner/src/Admin/Database/V1/CopyBackupEncryptionConfig_EncryptionType.php
deleted file mode 100644
index 9bd0d193130f..000000000000
--- a/Spanner/src/Admin/Database/V1/CopyBackupEncryptionConfig_EncryptionType.php
+++ /dev/null
@@ -1,16 +0,0 @@
-string name = 1 [(.google.api.resource_reference) = {
*/
- private $name = '';
+ protected $name = '';
/**
* The name of the source backup that is being copied.
* Values are of the form
@@ -31,7 +31,7 @@ class CopyBackupMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string source_backup = 2 [(.google.api.resource_reference) = {
*/
- private $source_backup = '';
+ protected $source_backup = '';
/**
* The progress of the
* [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup]
@@ -39,7 +39,7 @@ class CopyBackupMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 3;
*/
- private $progress = null;
+ protected $progress = null;
/**
* The time at which cancellation of CopyBackup operation was received.
* [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]
@@ -56,7 +56,7 @@ class CopyBackupMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp cancel_time = 4;
*/
- private $cancel_time = null;
+ protected $cancel_time = null;
/**
* Constructor.
diff --git a/Spanner/src/Admin/Database/V1/CopyBackupRequest.php b/Spanner/src/Admin/Database/V1/CopyBackupRequest.php
index 5f378df44f18..8a80683e54fa 100644
--- a/Spanner/src/Admin/Database/V1/CopyBackupRequest.php
+++ b/Spanner/src/Admin/Database/V1/CopyBackupRequest.php
@@ -22,7 +22,7 @@ class CopyBackupRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Required. The id of the backup copy.
* The `backup_id` appended to `parent` forms the full backup_uri of the form
@@ -30,7 +30,7 @@ class CopyBackupRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $backup_id = '';
+ protected $backup_id = '';
/**
* Required. The source backup to be copied.
* The source backup needs to be in READY state for it to be copied.
@@ -41,7 +41,7 @@ class CopyBackupRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string source_backup = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $source_backup = '';
+ protected $source_backup = '';
/**
* Required. The expiration time of the backup in microsecond granularity.
* The expiration time must be at least 6 hours and at most 366 days
@@ -51,7 +51,7 @@ class CopyBackupRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp expire_time = 4 [(.google.api.field_behavior) = REQUIRED];
*/
- private $expire_time = null;
+ protected $expire_time = null;
/**
* Optional. The encryption configuration used to encrypt the backup. If this
* field is not specified, the backup will use the same encryption
@@ -61,7 +61,7 @@ class CopyBackupRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.database.v1.CopyBackupEncryptionConfig encryption_config = 5 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $encryption_config = null;
+ protected $encryption_config = null;
/**
* @param string $parent Required. The name of the destination instance that will contain the backup
diff --git a/Spanner/src/Admin/Database/V1/CreateBackupEncryptionConfig.php b/Spanner/src/Admin/Database/V1/CreateBackupEncryptionConfig.php
index 856296def13e..40ec928a4b04 100644
--- a/Spanner/src/Admin/Database/V1/CreateBackupEncryptionConfig.php
+++ b/Spanner/src/Admin/Database/V1/CreateBackupEncryptionConfig.php
@@ -20,7 +20,7 @@ class CreateBackupEncryptionConfig extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.database.v1.CreateBackupEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $encryption_type = 0;
+ protected $encryption_type = 0;
/**
* Optional. The Cloud KMS key that will be used to protect the backup.
* This field should be set only when
@@ -30,7 +30,7 @@ class CreateBackupEncryptionConfig extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = {
*/
- private $kms_key_name = '';
+ protected $kms_key_name = '';
/**
* Optional. Specifies the KMS configuration for the one or more keys used to
* protect the backup. Values are of the form
diff --git a/Spanner/src/Admin/Database/V1/CreateBackupEncryptionConfig_EncryptionType.php b/Spanner/src/Admin/Database/V1/CreateBackupEncryptionConfig_EncryptionType.php
deleted file mode 100644
index 46d3b8504968..000000000000
--- a/Spanner/src/Admin/Database/V1/CreateBackupEncryptionConfig_EncryptionType.php
+++ /dev/null
@@ -1,16 +0,0 @@
-string name = 1 [(.google.api.resource_reference) = {
*/
- private $name = '';
+ protected $name = '';
/**
* The name of the database the backup is created from.
*
* Generated from protobuf field string database = 2 [(.google.api.resource_reference) = {
*/
- private $database = '';
+ protected $database = '';
/**
* The progress of the
* [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]
@@ -35,7 +35,7 @@ class CreateBackupMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 3;
*/
- private $progress = null;
+ protected $progress = null;
/**
* The time at which cancellation of this operation was received.
* [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]
@@ -52,7 +52,7 @@ class CreateBackupMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp cancel_time = 4;
*/
- private $cancel_time = null;
+ protected $cancel_time = null;
/**
* Constructor.
diff --git a/Spanner/src/Admin/Database/V1/CreateBackupRequest.php b/Spanner/src/Admin/Database/V1/CreateBackupRequest.php
index 552eaff66df3..9c216c980f6f 100644
--- a/Spanner/src/Admin/Database/V1/CreateBackupRequest.php
+++ b/Spanner/src/Admin/Database/V1/CreateBackupRequest.php
@@ -26,7 +26,7 @@ class CreateBackupRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Required. The id of the backup to be created. The `backup_id` appended to
* `parent` forms the full backup name of the form
@@ -34,13 +34,13 @@ class CreateBackupRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $backup_id = '';
+ protected $backup_id = '';
/**
* Required. The backup to create.
*
* Generated from protobuf field .google.spanner.admin.database.v1.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED];
*/
- private $backup = null;
+ protected $backup = null;
/**
* Optional. The encryption configuration used to encrypt the backup. If this
* field is not specified, the backup will use the same encryption
@@ -50,7 +50,7 @@ class CreateBackupRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.database.v1.CreateBackupEncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $encryption_config = null;
+ protected $encryption_config = null;
/**
* @param string $parent Required. The name of the instance in which the backup will be
diff --git a/Spanner/src/Admin/Database/V1/CreateDatabaseMetadata.php b/Spanner/src/Admin/Database/V1/CreateDatabaseMetadata.php
index 1c30d36327dc..15e141e01574 100644
--- a/Spanner/src/Admin/Database/V1/CreateDatabaseMetadata.php
+++ b/Spanner/src/Admin/Database/V1/CreateDatabaseMetadata.php
@@ -21,7 +21,7 @@ class CreateDatabaseMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string database = 1 [(.google.api.resource_reference) = {
*/
- private $database = '';
+ protected $database = '';
/**
* Constructor.
diff --git a/Spanner/src/Admin/Database/V1/CreateDatabaseRequest.php b/Spanner/src/Admin/Database/V1/CreateDatabaseRequest.php
index 3dbfcc5511cc..52e40ad3836f 100644
--- a/Spanner/src/Admin/Database/V1/CreateDatabaseRequest.php
+++ b/Spanner/src/Admin/Database/V1/CreateDatabaseRequest.php
@@ -22,7 +22,7 @@ class CreateDatabaseRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Required. A `CREATE DATABASE` statement, which specifies the ID of the
* new database. The database ID must conform to the regular expression
@@ -32,7 +32,7 @@ class CreateDatabaseRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string create_statement = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $create_statement = '';
+ protected $create_statement = '';
/**
* Optional. A list of DDL statements to run inside the newly created
* database. Statements can create tables, indexes, etc. These
@@ -49,13 +49,13 @@ class CreateDatabaseRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $encryption_config = null;
+ protected $encryption_config = null;
/**
* Optional. The dialect of the Cloud Spanner Database.
*
* Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 5 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $database_dialect = 0;
+ protected $database_dialect = 0;
/**
* Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in
* 'extra_statements' above.
@@ -75,7 +75,7 @@ class CreateDatabaseRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bytes proto_descriptors = 6 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $proto_descriptors = '';
+ protected $proto_descriptors = '';
/**
* @param string $parent Required. The name of the instance that will serve the new database.
diff --git a/Spanner/src/Admin/Database/V1/Database.php b/Spanner/src/Admin/Database/V1/Database.php
index a9b8a57a434e..7116c55f5d1a 100644
--- a/Spanner/src/Admin/Database/V1/Database.php
+++ b/Spanner/src/Admin/Database/V1/Database.php
@@ -24,26 +24,26 @@ class Database extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $name = '';
+ protected $name = '';
/**
* Output only. The current database state.
*
* Generated from protobuf field .google.spanner.admin.database.v1.Database.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $state = 0;
+ protected $state = 0;
/**
* Output only. If exists, the time at which the database creation started.
*
* Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $create_time = null;
+ protected $create_time = null;
/**
* Output only. Applicable only for restored databases. Contains information
* about the restore source.
*
* Generated from protobuf field .google.spanner.admin.database.v1.RestoreInfo restore_info = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $restore_info = null;
+ protected $restore_info = null;
/**
* Output only. For databases that are using customer managed encryption, this
* field contains the encryption configuration for the database.
@@ -52,7 +52,7 @@ class Database extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $encryption_config = null;
+ protected $encryption_config = null;
/**
* Output only. For databases that are using customer managed encryption, this
* field contains the encryption information for the database, such as
@@ -75,7 +75,7 @@ class Database extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string version_retention_period = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $version_retention_period = '';
+ protected $version_retention_period = '';
/**
* Output only. Earliest timestamp at which older versions of the data can be
* read. This value is continuously updated by Cloud Spanner and becomes stale
@@ -85,7 +85,7 @@ class Database extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp earliest_version_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $earliest_version_time = null;
+ protected $earliest_version_time = null;
/**
* Output only. The read-write region which contains the database's leader
* replicas.
@@ -95,13 +95,13 @@ class Database extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string default_leader = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $default_leader = '';
+ protected $default_leader = '';
/**
* Output only. The dialect of the Cloud Spanner Database.
*
* Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $database_dialect = 0;
+ protected $database_dialect = 0;
/**
* Whether drop protection is enabled for this database. Defaults to false,
* if not set. For more details, please see how to [prevent accidental
@@ -110,14 +110,14 @@ class Database extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bool enable_drop_protection = 11;
*/
- private $enable_drop_protection = false;
+ protected $enable_drop_protection = false;
/**
* Output only. If true, the database is being updated. If false, there are no
* ongoing update operations for the database.
*
* Generated from protobuf field bool reconciling = 12 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $reconciling = false;
+ protected $reconciling = false;
/**
* Constructor.
diff --git a/Spanner/src/Admin/Database/V1/DatabaseAdminGrpcClient.php b/Spanner/src/Admin/Database/V1/DatabaseAdminGrpcClient.php
deleted file mode 100644
index c62e9062faa4..000000000000
--- a/Spanner/src/Admin/Database/V1/DatabaseAdminGrpcClient.php
+++ /dev/null
@@ -1,473 +0,0 @@
-_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabases',
- $argument,
- ['\Google\Cloud\Spanner\Admin\Database\V1\ListDatabasesResponse', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Creates a new Cloud Spanner database and starts to prepare it for serving.
- * The returned [long-running operation][google.longrunning.Operation] will
- * have a name of the format `/operations/` and
- * can be used to track preparation of the database. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. The
- * [response][google.longrunning.Operation.response] field type is
- * [Database][google.spanner.admin.database.v1.Database], if successful.
- * @param \Google\Cloud\Spanner\Admin\Database\V1\CreateDatabaseRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function CreateDatabase(\Google\Cloud\Spanner\Admin\Database\V1\CreateDatabaseRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/CreateDatabase',
- $argument,
- ['\Google\LongRunning\Operation', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Gets the state of a Cloud Spanner database.
- * @param \Google\Cloud\Spanner\Admin\Database\V1\GetDatabaseRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function GetDatabase(\Google\Cloud\Spanner\Admin\Database\V1\GetDatabaseRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/GetDatabase',
- $argument,
- ['\Google\Cloud\Spanner\Admin\Database\V1\Database', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Updates a Cloud Spanner database. The returned
- * [long-running operation][google.longrunning.Operation] can be used to track
- * the progress of updating the database. If the named database does not
- * exist, returns `NOT_FOUND`.
- *
- * While the operation is pending:
- *
- * * The database's
- * [reconciling][google.spanner.admin.database.v1.Database.reconciling]
- * field is set to true.
- * * Cancelling the operation is best-effort. If the cancellation succeeds,
- * the operation metadata's
- * [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time]
- * is set, the updates are reverted, and the operation terminates with a
- * `CANCELLED` status.
- * * New UpdateDatabase requests will return a `FAILED_PRECONDITION` error
- * until the pending operation is done (returns successfully or with
- * error).
- * * Reading the database via the API continues to give the pre-request
- * values.
- *
- * Upon completion of the returned operation:
- *
- * * The new values are in effect and readable via the API.
- * * The database's
- * [reconciling][google.spanner.admin.database.v1.Database.reconciling]
- * field becomes false.
- *
- * The returned [long-running operation][google.longrunning.Operation] will
- * have a name of the format
- * `projects//instances//databases//operations/`
- * and can be used to track the database modification. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata].
- * The [response][google.longrunning.Operation.response] field type is
- * [Database][google.spanner.admin.database.v1.Database], if successful.
- * @param \Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function UpdateDatabase(\Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/UpdateDatabase',
- $argument,
- ['\Google\LongRunning\Operation', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Updates the schema of a Cloud Spanner database by
- * creating/altering/dropping tables, columns, indexes, etc. The returned
- * [long-running operation][google.longrunning.Operation] will have a name of
- * the format `/operations/` and can be used to
- * track execution of the schema change(s). The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]. The operation has no response.
- * @param \Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseDdlRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function UpdateDatabaseDdl(\Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseDdlRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/UpdateDatabaseDdl',
- $argument,
- ['\Google\LongRunning\Operation', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Drops (aka deletes) a Cloud Spanner database.
- * Completed backups for the database will be retained according to their
- * `expire_time`.
- * Note: Cloud Spanner might continue to accept requests for a few seconds
- * after the database has been deleted.
- * @param \Google\Cloud\Spanner\Admin\Database\V1\DropDatabaseRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function DropDatabase(\Google\Cloud\Spanner\Admin\Database\V1\DropDatabaseRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/DropDatabase',
- $argument,
- ['\Google\Protobuf\GPBEmpty', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Returns the schema of a Cloud Spanner database as a list of formatted
- * DDL statements. This method does not show pending schema updates, those may
- * be queried using the [Operations][google.longrunning.Operations] API.
- * @param \Google\Cloud\Spanner\Admin\Database\V1\GetDatabaseDdlRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function GetDatabaseDdl(\Google\Cloud\Spanner\Admin\Database\V1\GetDatabaseDdlRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/GetDatabaseDdl',
- $argument,
- ['\Google\Cloud\Spanner\Admin\Database\V1\GetDatabaseDdlResponse', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Sets the access control policy on a database or backup resource.
- * Replaces any existing policy.
- *
- * Authorization requires `spanner.databases.setIamPolicy`
- * permission on [resource][google.iam.v1.SetIamPolicyRequest.resource].
- * For backups, authorization requires `spanner.backups.setIamPolicy`
- * permission on [resource][google.iam.v1.SetIamPolicyRequest.resource].
- * @param \Google\Cloud\Iam\V1\SetIamPolicyRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function SetIamPolicy(\Google\Cloud\Iam\V1\SetIamPolicyRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/SetIamPolicy',
- $argument,
- ['\Google\Cloud\Iam\V1\Policy', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Gets the access control policy for a database or backup resource.
- * Returns an empty policy if a database or backup exists but does not have a
- * policy set.
- *
- * Authorization requires `spanner.databases.getIamPolicy` permission on
- * [resource][google.iam.v1.GetIamPolicyRequest.resource].
- * For backups, authorization requires `spanner.backups.getIamPolicy`
- * permission on [resource][google.iam.v1.GetIamPolicyRequest.resource].
- * @param \Google\Cloud\Iam\V1\GetIamPolicyRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function GetIamPolicy(\Google\Cloud\Iam\V1\GetIamPolicyRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/GetIamPolicy',
- $argument,
- ['\Google\Cloud\Iam\V1\Policy', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Returns permissions that the caller has on the specified database or backup
- * resource.
- *
- * Attempting this RPC on a non-existent Cloud Spanner database will
- * result in a NOT_FOUND error if the user has
- * `spanner.databases.list` permission on the containing Cloud
- * Spanner instance. Otherwise returns an empty set of permissions.
- * Calling this method on a backup that does not exist will
- * result in a NOT_FOUND error if the user has
- * `spanner.backups.list` permission on the containing instance.
- * @param \Google\Cloud\Iam\V1\TestIamPermissionsRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function TestIamPermissions(\Google\Cloud\Iam\V1\TestIamPermissionsRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/TestIamPermissions',
- $argument,
- ['\Google\Cloud\Iam\V1\TestIamPermissionsResponse', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Starts creating a new Cloud Spanner Backup.
- * The returned backup [long-running operation][google.longrunning.Operation]
- * will have a name of the format
- * `projects//instances//backups//operations/`
- * and can be used to track creation of the backup. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. The
- * [response][google.longrunning.Operation.response] field type is
- * [Backup][google.spanner.admin.database.v1.Backup], if successful. Cancelling the returned operation will stop the
- * creation and delete the backup.
- * There can be only one pending backup creation per database. Backup creation
- * of different databases can run concurrently.
- * @param \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function CreateBackup(\Google\Cloud\Spanner\Admin\Database\V1\CreateBackupRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/CreateBackup',
- $argument,
- ['\Google\LongRunning\Operation', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Starts copying a Cloud Spanner Backup.
- * The returned backup [long-running operation][google.longrunning.Operation]
- * will have a name of the format
- * `projects//instances//backups//operations/`
- * and can be used to track copying of the backup. The operation is associated
- * with the destination backup.
- * The [metadata][google.longrunning.Operation.metadata] field type is
- * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata].
- * The [response][google.longrunning.Operation.response] field type is
- * [Backup][google.spanner.admin.database.v1.Backup], if successful. Cancelling the returned operation will stop the
- * copying and delete the backup.
- * Concurrent CopyBackup requests can run on the same source backup.
- * @param \Google\Cloud\Spanner\Admin\Database\V1\CopyBackupRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function CopyBackup(\Google\Cloud\Spanner\Admin\Database\V1\CopyBackupRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/CopyBackup',
- $argument,
- ['\Google\LongRunning\Operation', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Gets metadata on a pending or completed [Backup][google.spanner.admin.database.v1.Backup].
- * @param \Google\Cloud\Spanner\Admin\Database\V1\GetBackupRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function GetBackup(\Google\Cloud\Spanner\Admin\Database\V1\GetBackupRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/GetBackup',
- $argument,
- ['\Google\Cloud\Spanner\Admin\Database\V1\Backup', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Updates a pending or completed [Backup][google.spanner.admin.database.v1.Backup].
- * @param \Google\Cloud\Spanner\Admin\Database\V1\UpdateBackupRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function UpdateBackup(\Google\Cloud\Spanner\Admin\Database\V1\UpdateBackupRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/UpdateBackup',
- $argument,
- ['\Google\Cloud\Spanner\Admin\Database\V1\Backup', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Deletes a pending or completed [Backup][google.spanner.admin.database.v1.Backup].
- * @param \Google\Cloud\Spanner\Admin\Database\V1\DeleteBackupRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function DeleteBackup(\Google\Cloud\Spanner\Admin\Database\V1\DeleteBackupRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/DeleteBackup',
- $argument,
- ['\Google\Protobuf\GPBEmpty', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Lists completed and pending backups.
- * Backups returned are ordered by `create_time` in descending order,
- * starting from the most recent `create_time`.
- * @param \Google\Cloud\Spanner\Admin\Database\V1\ListBackupsRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function ListBackups(\Google\Cloud\Spanner\Admin\Database\V1\ListBackupsRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/ListBackups',
- $argument,
- ['\Google\Cloud\Spanner\Admin\Database\V1\ListBackupsResponse', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Create a new database by restoring from a completed backup. The new
- * database must be in the same project and in an instance with the same
- * instance configuration as the instance containing
- * the backup. The returned database [long-running
- * operation][google.longrunning.Operation] has a name of the format
- * `projects//instances//databases//operations/`,
- * and can be used to track the progress of the operation, and to cancel it.
- * The [metadata][google.longrunning.Operation.metadata] field type is
- * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata].
- * The [response][google.longrunning.Operation.response] type
- * is [Database][google.spanner.admin.database.v1.Database], if
- * successful. Cancelling the returned operation will stop the restore and
- * delete the database.
- * There can be only one database being restored into an instance at a time.
- * Once the restore operation completes, a new restore operation can be
- * initiated, without waiting for the optimize operation associated with the
- * first restore to complete.
- * @param \Google\Cloud\Spanner\Admin\Database\V1\RestoreDatabaseRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function RestoreDatabase(\Google\Cloud\Spanner\Admin\Database\V1\RestoreDatabaseRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/RestoreDatabase',
- $argument,
- ['\Google\LongRunning\Operation', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Lists database [longrunning-operations][google.longrunning.Operation].
- * A database operation has a name of the form
- * `projects//instances//databases//operations/`.
- * The long-running operation
- * [metadata][google.longrunning.Operation.metadata] field type
- * `metadata.type_url` describes the type of the metadata. Operations returned
- * include those that have completed/failed/canceled within the last 7 days,
- * and pending operations.
- * @param \Google\Cloud\Spanner\Admin\Database\V1\ListDatabaseOperationsRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function ListDatabaseOperations(\Google\Cloud\Spanner\Admin\Database\V1\ListDatabaseOperationsRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabaseOperations',
- $argument,
- ['\Google\Cloud\Spanner\Admin\Database\V1\ListDatabaseOperationsResponse', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Lists the backup [long-running operations][google.longrunning.Operation] in
- * the given instance. A backup operation has a name of the form
- * `projects//instances//backups//operations/`.
- * The long-running operation
- * [metadata][google.longrunning.Operation.metadata] field type
- * `metadata.type_url` describes the type of the metadata. Operations returned
- * include those that have completed/failed/canceled within the last 7 days,
- * and pending operations. Operations returned are ordered by
- * `operation.metadata.value.progress.start_time` in descending order starting
- * from the most recently started operation.
- * @param \Google\Cloud\Spanner\Admin\Database\V1\ListBackupOperationsRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function ListBackupOperations(\Google\Cloud\Spanner\Admin\Database\V1\ListBackupOperationsRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/ListBackupOperations',
- $argument,
- ['\Google\Cloud\Spanner\Admin\Database\V1\ListBackupOperationsResponse', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Lists Cloud Spanner database roles.
- * @param \Google\Cloud\Spanner\Admin\Database\V1\ListDatabaseRolesRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function ListDatabaseRoles(\Google\Cloud\Spanner\Admin\Database\V1\ListDatabaseRolesRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabaseRoles',
- $argument,
- ['\Google\Cloud\Spanner\Admin\Database\V1\ListDatabaseRolesResponse', 'decode'],
- $metadata, $options);
- }
-
-}
diff --git a/Spanner/src/Admin/Database/V1/DatabaseRole.php b/Spanner/src/Admin/Database/V1/DatabaseRole.php
index f7e32c23f83a..f34003461bac 100644
--- a/Spanner/src/Admin/Database/V1/DatabaseRole.php
+++ b/Spanner/src/Admin/Database/V1/DatabaseRole.php
@@ -22,7 +22,7 @@ class DatabaseRole extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $name = '';
+ protected $name = '';
/**
* Constructor.
diff --git a/Spanner/src/Admin/Database/V1/Database_State.php b/Spanner/src/Admin/Database/V1/Database_State.php
deleted file mode 100644
index 7aa7a007185b..000000000000
--- a/Spanner/src/Admin/Database/V1/Database_State.php
+++ /dev/null
@@ -1,16 +0,0 @@
-string action = 1;
*/
- private $action = '';
+ protected $action = '';
/**
* The entity type for the DDL statement, e.g. TABLE, INDEX, VIEW, etc.
* This field can be empty string for some DDL statement,
@@ -31,7 +31,7 @@ class DdlStatementActionInfo extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string entity_type = 2;
*/
- private $entity_type = '';
+ protected $entity_type = '';
/**
* The entity name(s) being operated on the DDL statement.
* E.g.
diff --git a/Spanner/src/Admin/Database/V1/DeleteBackupRequest.php b/Spanner/src/Admin/Database/V1/DeleteBackupRequest.php
index f8ae101ba9d9..a2418220b700 100644
--- a/Spanner/src/Admin/Database/V1/DeleteBackupRequest.php
+++ b/Spanner/src/Admin/Database/V1/DeleteBackupRequest.php
@@ -23,7 +23,7 @@ class DeleteBackupRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $name = '';
+ protected $name = '';
/**
* @param string $name Required. Name of the backup to delete.
diff --git a/Spanner/src/Admin/Database/V1/DropDatabaseRequest.php b/Spanner/src/Admin/Database/V1/DropDatabaseRequest.php
index 993cbe1e73ee..29d92fc6d153 100644
--- a/Spanner/src/Admin/Database/V1/DropDatabaseRequest.php
+++ b/Spanner/src/Admin/Database/V1/DropDatabaseRequest.php
@@ -21,7 +21,7 @@ class DropDatabaseRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $database = '';
+ protected $database = '';
/**
* @param string $database Required. The database to be dropped. Please see
diff --git a/Spanner/src/Admin/Database/V1/EncryptionConfig.php b/Spanner/src/Admin/Database/V1/EncryptionConfig.php
index 62529b83264e..c0bc45190b62 100644
--- a/Spanner/src/Admin/Database/V1/EncryptionConfig.php
+++ b/Spanner/src/Admin/Database/V1/EncryptionConfig.php
@@ -22,7 +22,7 @@ class EncryptionConfig extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = {
*/
- private $kms_key_name = '';
+ protected $kms_key_name = '';
/**
* Specifies the KMS configuration for the one or more keys used to encrypt
* the database. Values are of the form
diff --git a/Spanner/src/Admin/Database/V1/EncryptionInfo.php b/Spanner/src/Admin/Database/V1/EncryptionInfo.php
index 38ae91890389..960ada451ae8 100644
--- a/Spanner/src/Admin/Database/V1/EncryptionInfo.php
+++ b/Spanner/src/Admin/Database/V1/EncryptionInfo.php
@@ -20,7 +20,7 @@ class EncryptionInfo extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.database.v1.EncryptionInfo.Type encryption_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $encryption_type = 0;
+ protected $encryption_type = 0;
/**
* Output only. If present, the status of a recent encrypt/decrypt call on
* underlying data for this database or backup. Regardless of status, data is
@@ -28,14 +28,14 @@ class EncryptionInfo extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.rpc.Status encryption_status = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $encryption_status = null;
+ protected $encryption_status = null;
/**
* Output only. A Cloud KMS key version that is being used to protect the
* database or backup.
*
* Generated from protobuf field string kms_key_version = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = {
*/
- private $kms_key_version = '';
+ protected $kms_key_version = '';
/**
* Constructor.
diff --git a/Spanner/src/Admin/Database/V1/EncryptionInfo_Type.php b/Spanner/src/Admin/Database/V1/EncryptionInfo_Type.php
deleted file mode 100644
index 069d2c13182c..000000000000
--- a/Spanner/src/Admin/Database/V1/EncryptionInfo_Type.php
+++ /dev/null
@@ -1,16 +0,0 @@
-instanceName('[PROJECT]', '[INSTANCE]');
- * $backupId = 'backup_id';
- * $formattedSourceBackup = $databaseAdminClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]');
- * $expireTime = new Timestamp();
- * $operationResponse = $databaseAdminClient->copyBackup($formattedParent, $backupId, $formattedSourceBackup, $expireTime);
- * $operationResponse->pollUntilComplete();
- * if ($operationResponse->operationSucceeded()) {
- * $result = $operationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $operationResponse->getError();
- * // handleError($error)
- * }
- * // Alternatively:
- * // start the operation, keep the operation name, and resume later
- * $operationResponse = $databaseAdminClient->copyBackup($formattedParent, $backupId, $formattedSourceBackup, $expireTime);
- * $operationName = $operationResponse->getName();
- * // ... do other work
- * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'copyBackup');
- * while (!$newOperationResponse->isDone()) {
- * // ... do other work
- * $newOperationResponse->reload();
- * }
- * if ($newOperationResponse->operationSucceeded()) {
- * $result = $newOperationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $newOperationResponse->getError();
- * // handleError($error)
- * }
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * Many parameters require resource names to be formatted in a particular way. To
- * assist with these names, this class includes a format method for each type of
- * name, and additionally a parseName method to extract the individual identifiers
- * contained within formatted names that are returned by the API.
- *
- * @deprecated Please use the new service client {@see \Google\Cloud\Spanner\Admin\Database\V1\Client\DatabaseAdminClient}.
- */
-class DatabaseAdminGapicClient
-{
- use GapicClientTrait;
-
- /** The name of the service. */
- const SERVICE_NAME = 'google.spanner.admin.database.v1.DatabaseAdmin';
-
- /**
- * The default address of the service.
- *
- * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead.
- */
- const SERVICE_ADDRESS = 'spanner.googleapis.com';
-
- /** The address template of the service. */
- private const SERVICE_ADDRESS_TEMPLATE = 'spanner.UNIVERSE_DOMAIN';
-
- /** The default port of the service. */
- const DEFAULT_SERVICE_PORT = 443;
-
- /** The name of the code generator, to be included in the agent header. */
- const CODEGEN_NAME = 'gapic';
-
- /** The default scopes required by the service. */
- public static $serviceScopes = [
- 'https://www.googleapis.com/auth/cloud-platform',
- 'https://www.googleapis.com/auth/spanner.admin',
- ];
-
- private static $backupNameTemplate;
-
- private static $backupScheduleNameTemplate;
-
- private static $cryptoKeyNameTemplate;
-
- private static $cryptoKeyVersionNameTemplate;
-
- private static $databaseNameTemplate;
-
- private static $instanceNameTemplate;
-
- private static $pathTemplateMap;
-
- private $operationsClient;
-
- private static function getClientDefaults()
- {
- return [
- 'serviceName' => self::SERVICE_NAME,
- 'apiEndpoint' =>
- self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT,
- 'clientConfig' =>
- __DIR__ . '/../resources/database_admin_client_config.json',
- 'descriptorsConfigPath' =>
- __DIR__ . '/../resources/database_admin_descriptor_config.php',
- 'gcpApiConfigPath' =>
- __DIR__ . '/../resources/database_admin_grpc_config.json',
- 'credentialsConfig' => [
- 'defaultScopes' => self::$serviceScopes,
- ],
- 'transportConfig' => [
- 'rest' => [
- 'restClientConfigPath' =>
- __DIR__ .
- '/../resources/database_admin_rest_client_config.php',
- ],
- ],
- ];
- }
-
- private static function getBackupNameTemplate()
- {
- if (self::$backupNameTemplate == null) {
- self::$backupNameTemplate = new PathTemplate(
- 'projects/{project}/instances/{instance}/backups/{backup}'
- );
- }
-
- return self::$backupNameTemplate;
- }
-
- private static function getBackupScheduleNameTemplate()
- {
- if (self::$backupScheduleNameTemplate == null) {
- self::$backupScheduleNameTemplate = new PathTemplate(
- 'projects/{project}/instances/{instance}/databases/{database}/backupSchedules/{schedule}'
- );
- }
-
- return self::$backupScheduleNameTemplate;
- }
-
- private static function getCryptoKeyNameTemplate()
- {
- if (self::$cryptoKeyNameTemplate == null) {
- self::$cryptoKeyNameTemplate = new PathTemplate(
- 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}'
- );
- }
-
- return self::$cryptoKeyNameTemplate;
- }
-
- private static function getCryptoKeyVersionNameTemplate()
- {
- if (self::$cryptoKeyVersionNameTemplate == null) {
- self::$cryptoKeyVersionNameTemplate = new PathTemplate(
- 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}'
- );
- }
-
- return self::$cryptoKeyVersionNameTemplate;
- }
-
- private static function getDatabaseNameTemplate()
- {
- if (self::$databaseNameTemplate == null) {
- self::$databaseNameTemplate = new PathTemplate(
- 'projects/{project}/instances/{instance}/databases/{database}'
- );
- }
-
- return self::$databaseNameTemplate;
- }
-
- private static function getInstanceNameTemplate()
- {
- if (self::$instanceNameTemplate == null) {
- self::$instanceNameTemplate = new PathTemplate(
- 'projects/{project}/instances/{instance}'
- );
- }
-
- return self::$instanceNameTemplate;
- }
-
- private static function getPathTemplateMap()
- {
- if (self::$pathTemplateMap == null) {
- self::$pathTemplateMap = [
- 'backup' => self::getBackupNameTemplate(),
- 'backupSchedule' => self::getBackupScheduleNameTemplate(),
- 'cryptoKey' => self::getCryptoKeyNameTemplate(),
- 'cryptoKeyVersion' => self::getCryptoKeyVersionNameTemplate(),
- 'database' => self::getDatabaseNameTemplate(),
- 'instance' => self::getInstanceNameTemplate(),
- ];
- }
-
- return self::$pathTemplateMap;
- }
-
- /**
- * Formats a string containing the fully-qualified path to represent a backup
- * resource.
- *
- * @param string $project
- * @param string $instance
- * @param string $backup
- *
- * @return string The formatted backup resource.
- */
- public static function backupName($project, $instance, $backup)
- {
- return self::getBackupNameTemplate()->render([
- 'project' => $project,
- 'instance' => $instance,
- 'backup' => $backup,
- ]);
- }
-
- /**
- * Formats a string containing the fully-qualified path to represent a
- * backup_schedule resource.
- *
- * @param string $project
- * @param string $instance
- * @param string $database
- * @param string $schedule
- *
- * @return string The formatted backup_schedule resource.
- */
- public static function backupScheduleName(
- $project,
- $instance,
- $database,
- $schedule
- ) {
- return self::getBackupScheduleNameTemplate()->render([
- 'project' => $project,
- 'instance' => $instance,
- 'database' => $database,
- 'schedule' => $schedule,
- ]);
- }
-
- /**
- * Formats a string containing the fully-qualified path to represent a crypto_key
- * resource.
- *
- * @param string $project
- * @param string $location
- * @param string $keyRing
- * @param string $cryptoKey
- *
- * @return string The formatted crypto_key resource.
- */
- public static function cryptoKeyName(
- $project,
- $location,
- $keyRing,
- $cryptoKey
- ) {
- return self::getCryptoKeyNameTemplate()->render([
- 'project' => $project,
- 'location' => $location,
- 'key_ring' => $keyRing,
- 'crypto_key' => $cryptoKey,
- ]);
- }
-
- /**
- * Formats a string containing the fully-qualified path to represent a
- * crypto_key_version resource.
- *
- * @param string $project
- * @param string $location
- * @param string $keyRing
- * @param string $cryptoKey
- * @param string $cryptoKeyVersion
- *
- * @return string The formatted crypto_key_version resource.
- */
- public static function cryptoKeyVersionName(
- $project,
- $location,
- $keyRing,
- $cryptoKey,
- $cryptoKeyVersion
- ) {
- return self::getCryptoKeyVersionNameTemplate()->render([
- 'project' => $project,
- 'location' => $location,
- 'key_ring' => $keyRing,
- 'crypto_key' => $cryptoKey,
- 'crypto_key_version' => $cryptoKeyVersion,
- ]);
- }
-
- /**
- * Formats a string containing the fully-qualified path to represent a database
- * resource.
- *
- * @param string $project
- * @param string $instance
- * @param string $database
- *
- * @return string The formatted database resource.
- */
- public static function databaseName($project, $instance, $database)
- {
- return self::getDatabaseNameTemplate()->render([
- 'project' => $project,
- 'instance' => $instance,
- 'database' => $database,
- ]);
- }
-
- /**
- * Formats a string containing the fully-qualified path to represent a instance
- * resource.
- *
- * @param string $project
- * @param string $instance
- *
- * @return string The formatted instance resource.
- */
- public static function instanceName($project, $instance)
- {
- return self::getInstanceNameTemplate()->render([
- 'project' => $project,
- 'instance' => $instance,
- ]);
- }
-
- /**
- * Parses a formatted name string and returns an associative array of the components in the name.
- * The following name formats are supported:
- * Template: Pattern
- * - backup: projects/{project}/instances/{instance}/backups/{backup}
- * - backupSchedule: projects/{project}/instances/{instance}/databases/{database}/backupSchedules/{schedule}
- * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}
- * - cryptoKeyVersion: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}
- * - database: projects/{project}/instances/{instance}/databases/{database}
- * - instance: projects/{project}/instances/{instance}
- *
- * The optional $template argument can be supplied to specify a particular pattern,
- * and must match one of the templates listed above. If no $template argument is
- * provided, or if the $template argument does not match one of the templates
- * listed, then parseName will check each of the supported templates, and return
- * the first match.
- *
- * @param string $formattedName The formatted name string
- * @param string $template Optional name of template to match
- *
- * @return array An associative array from name component IDs to component values.
- *
- * @throws ValidationException If $formattedName could not be matched.
- */
- public static function parseName($formattedName, $template = null)
- {
- $templateMap = self::getPathTemplateMap();
- if ($template) {
- if (!isset($templateMap[$template])) {
- throw new ValidationException(
- "Template name $template does not exist"
- );
- }
-
- return $templateMap[$template]->match($formattedName);
- }
-
- foreach ($templateMap as $templateName => $pathTemplate) {
- try {
- return $pathTemplate->match($formattedName);
- } catch (ValidationException $ex) {
- // Swallow the exception to continue trying other path templates
- }
- }
-
- throw new ValidationException(
- "Input did not match any known format. Input: $formattedName"
- );
- }
-
- /**
- * Return an OperationsClient object with the same endpoint as $this.
- *
- * @return OperationsClient
- */
- public function getOperationsClient()
- {
- return $this->operationsClient;
- }
-
- /**
- * Resume an existing long running operation that was previously started by a long
- * running API method. If $methodName is not provided, or does not match a long
- * running API method, then the operation can still be resumed, but the
- * OperationResponse object will not deserialize the final response.
- *
- * @param string $operationName The name of the long running operation
- * @param string $methodName The name of the method used to start the operation
- *
- * @return OperationResponse
- */
- public function resumeOperation($operationName, $methodName = null)
- {
- $options = isset($this->descriptors[$methodName]['longRunning'])
- ? $this->descriptors[$methodName]['longRunning']
- : [];
- $operation = new OperationResponse(
- $operationName,
- $this->getOperationsClient(),
- $options
- );
- $operation->reload();
- return $operation;
- }
-
- /**
- * Constructor.
- *
- * @param array $options {
- * Optional. Options for configuring the service API wrapper.
- *
- * @type string $apiEndpoint
- * The address of the API remote host. May optionally include the port, formatted
- * as ":". Default 'spanner.googleapis.com:443'.
- * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
- * The credentials to be used by the client to authorize API calls. This option
- * accepts either a path to a credentials file, or a decoded credentials file as a
- * PHP array.
- * *Advanced usage*: In addition, this option can also accept a pre-constructed
- * {@see \Google\Auth\FetchAuthTokenInterface} object or
- * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these
- * objects are provided, any settings in $credentialsConfig will be ignored.
- * @type array $credentialsConfig
- * Options used to configure credentials, including auth token caching, for the
- * client. For a full list of supporting configuration options, see
- * {@see \Google\ApiCore\CredentialsWrapper::build()} .
- * @type bool $disableRetries
- * Determines whether or not retries defined by the client configuration should be
- * disabled. Defaults to `false`.
- * @type string|array $clientConfig
- * Client method configuration, including retry settings. This option can be either
- * a path to a JSON file, or a PHP array containing the decoded JSON data. By
- * default this settings points to the default client config file, which is
- * provided in the resources folder.
- * @type string|TransportInterface $transport
- * The transport used for executing network requests. May be either the string
- * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system.
- * *Advanced usage*: Additionally, it is possible to pass in an already
- * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note
- * that when this object is provided, any settings in $transportConfig, and any
- * $apiEndpoint setting, will be ignored.
- * @type array $transportConfig
- * Configuration options that will be used to construct the transport. Options for
- * each supported transport type should be passed in a key for that transport. For
- * example:
- * $transportConfig = [
- * 'grpc' => [...],
- * 'rest' => [...],
- * ];
- * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and
- * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the
- * supported options.
- * @type callable $clientCertSource
- * A callable which returns the client cert as a string. This can be used to
- * provide a certificate and private key to the transport layer for mTLS.
- * }
- *
- * @throws ValidationException
- */
- public function __construct(array $options = [])
- {
- $clientOptions = $this->buildClientOptions($options);
- $this->setClientOptions($clientOptions);
- $this->operationsClient = $this->createOperationsClient($clientOptions);
- }
-
- /**
- * Starts copying a Cloud Spanner Backup.
- * The returned backup [long-running operation][google.longrunning.Operation]
- * will have a name of the format
- * `projects//instances//backups//operations/`
- * and can be used to track copying of the backup. The operation is associated
- * with the destination backup.
- * The [metadata][google.longrunning.Operation.metadata] field type is
- * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata].
- * The [response][google.longrunning.Operation.response] field type is
- * [Backup][google.spanner.admin.database.v1.Backup], if successful.
- * Cancelling the returned operation will stop the copying and delete the
- * destination backup. Concurrent CopyBackup requests can run on the same
- * source backup.
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]');
- * $backupId = 'backup_id';
- * $formattedSourceBackup = $databaseAdminClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]');
- * $expireTime = new Timestamp();
- * $operationResponse = $databaseAdminClient->copyBackup($formattedParent, $backupId, $formattedSourceBackup, $expireTime);
- * $operationResponse->pollUntilComplete();
- * if ($operationResponse->operationSucceeded()) {
- * $result = $operationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $operationResponse->getError();
- * // handleError($error)
- * }
- * // Alternatively:
- * // start the operation, keep the operation name, and resume later
- * $operationResponse = $databaseAdminClient->copyBackup($formattedParent, $backupId, $formattedSourceBackup, $expireTime);
- * $operationName = $operationResponse->getName();
- * // ... do other work
- * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'copyBackup');
- * while (!$newOperationResponse->isDone()) {
- * // ... do other work
- * $newOperationResponse->reload();
- * }
- * if ($newOperationResponse->operationSucceeded()) {
- * $result = $newOperationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $newOperationResponse->getError();
- * // handleError($error)
- * }
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The name of the destination instance that will contain the backup
- * copy. Values are of the form: `projects//instances/`.
- * @param string $backupId Required. The id of the backup copy.
- * The `backup_id` appended to `parent` forms the full backup_uri of the form
- * `projects//instances//backups/`.
- * @param string $sourceBackup Required. The source backup to be copied.
- * The source backup needs to be in READY state for it to be copied.
- * Once CopyBackup is in progress, the source backup cannot be deleted or
- * cleaned up on expiration until CopyBackup is finished.
- * Values are of the form:
- * `projects//instances//backups/`.
- * @param Timestamp $expireTime Required. The expiration time of the backup in microsecond granularity.
- * The expiration time must be at least 6 hours and at most 366 days
- * from the `create_time` of the source backup. Once the `expire_time` has
- * passed, the backup is eligible to be automatically deleted by Cloud Spanner
- * to free the resources used by the backup.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type CopyBackupEncryptionConfig $encryptionConfig
- * Optional. The encryption configuration used to encrypt the backup. If this
- * field is not specified, the backup will use the same encryption
- * configuration as the source backup by default, namely
- * [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type]
- * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`.
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\OperationResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function copyBackup(
- $parent,
- $backupId,
- $sourceBackup,
- $expireTime,
- array $optionalArgs = []
- ) {
- $request = new CopyBackupRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $request->setBackupId($backupId);
- $request->setSourceBackup($sourceBackup);
- $request->setExpireTime($expireTime);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['encryptionConfig'])) {
- $request->setEncryptionConfig($optionalArgs['encryptionConfig']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startOperationsCall(
- 'CopyBackup',
- $optionalArgs,
- $request,
- $this->getOperationsClient()
- )->wait();
- }
-
- /**
- * Starts creating a new Cloud Spanner Backup.
- * The returned backup [long-running operation][google.longrunning.Operation]
- * will have a name of the format
- * `projects//instances//backups//operations/`
- * and can be used to track creation of the backup. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata].
- * The [response][google.longrunning.Operation.response] field type is
- * [Backup][google.spanner.admin.database.v1.Backup], if successful.
- * Cancelling the returned operation will stop the creation and delete the
- * backup. There can be only one pending backup creation per database. Backup
- * creation of different databases can run concurrently.
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]');
- * $backupId = 'backup_id';
- * $backup = new Backup();
- * $operationResponse = $databaseAdminClient->createBackup($formattedParent, $backupId, $backup);
- * $operationResponse->pollUntilComplete();
- * if ($operationResponse->operationSucceeded()) {
- * $result = $operationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $operationResponse->getError();
- * // handleError($error)
- * }
- * // Alternatively:
- * // start the operation, keep the operation name, and resume later
- * $operationResponse = $databaseAdminClient->createBackup($formattedParent, $backupId, $backup);
- * $operationName = $operationResponse->getName();
- * // ... do other work
- * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'createBackup');
- * while (!$newOperationResponse->isDone()) {
- * // ... do other work
- * $newOperationResponse->reload();
- * }
- * if ($newOperationResponse->operationSucceeded()) {
- * $result = $newOperationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $newOperationResponse->getError();
- * // handleError($error)
- * }
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The name of the instance in which the backup will be
- * created. This must be the same instance that contains the database the
- * backup will be created from. The backup will be stored in the
- * location(s) specified in the instance configuration of this
- * instance. Values are of the form
- * `projects//instances/`.
- * @param string $backupId Required. The id of the backup to be created. The `backup_id` appended to
- * `parent` forms the full backup name of the form
- * `projects//instances//backups/`.
- * @param Backup $backup Required. The backup to create.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type CreateBackupEncryptionConfig $encryptionConfig
- * Optional. The encryption configuration used to encrypt the backup. If this
- * field is not specified, the backup will use the same encryption
- * configuration as the database by default, namely
- * [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type]
- * = `USE_DATABASE_ENCRYPTION`.
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\OperationResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function createBackup(
- $parent,
- $backupId,
- $backup,
- array $optionalArgs = []
- ) {
- $request = new CreateBackupRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $request->setBackupId($backupId);
- $request->setBackup($backup);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['encryptionConfig'])) {
- $request->setEncryptionConfig($optionalArgs['encryptionConfig']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startOperationsCall(
- 'CreateBackup',
- $optionalArgs,
- $request,
- $this->getOperationsClient()
- )->wait();
- }
-
- /**
- * Creates a new backup schedule.
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $formattedParent = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]');
- * $backupScheduleId = 'backup_schedule_id';
- * $backupSchedule = new BackupSchedule();
- * $response = $databaseAdminClient->createBackupSchedule($formattedParent, $backupScheduleId, $backupSchedule);
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The name of the database that this backup schedule applies to.
- * @param string $backupScheduleId Required. The Id to use for the backup schedule. The `backup_schedule_id`
- * appended to `parent` forms the full backup schedule name of the form
- * `projects//instances//databases//backupSchedules/`.
- * @param BackupSchedule $backupSchedule Required. The backup schedule to create.
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule
- *
- * @throws ApiException if the remote call fails
- */
- public function createBackupSchedule(
- $parent,
- $backupScheduleId,
- $backupSchedule,
- array $optionalArgs = []
- ) {
- $request = new CreateBackupScheduleRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $request->setBackupScheduleId($backupScheduleId);
- $request->setBackupSchedule($backupSchedule);
- $requestParamHeaders['parent'] = $parent;
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'CreateBackupSchedule',
- BackupSchedule::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Creates a new Cloud Spanner database and starts to prepare it for serving.
- * The returned [long-running operation][google.longrunning.Operation] will
- * have a name of the format `/operations/` and
- * can be used to track preparation of the database. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata].
- * The [response][google.longrunning.Operation.response] field type is
- * [Database][google.spanner.admin.database.v1.Database], if successful.
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]');
- * $createStatement = 'create_statement';
- * $operationResponse = $databaseAdminClient->createDatabase($formattedParent, $createStatement);
- * $operationResponse->pollUntilComplete();
- * if ($operationResponse->operationSucceeded()) {
- * $result = $operationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $operationResponse->getError();
- * // handleError($error)
- * }
- * // Alternatively:
- * // start the operation, keep the operation name, and resume later
- * $operationResponse = $databaseAdminClient->createDatabase($formattedParent, $createStatement);
- * $operationName = $operationResponse->getName();
- * // ... do other work
- * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'createDatabase');
- * while (!$newOperationResponse->isDone()) {
- * // ... do other work
- * $newOperationResponse->reload();
- * }
- * if ($newOperationResponse->operationSucceeded()) {
- * $result = $newOperationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $newOperationResponse->getError();
- * // handleError($error)
- * }
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The name of the instance that will serve the new database.
- * Values are of the form `projects//instances/`.
- * @param string $createStatement Required. A `CREATE DATABASE` statement, which specifies the ID of the
- * new database. The database ID must conform to the regular expression
- * `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length.
- * If the database ID is a reserved word or if it contains a hyphen, the
- * database ID must be enclosed in backticks (`` ` ``).
- * @param array $optionalArgs {
- * Optional.
- *
- * @type string[] $extraStatements
- * Optional. A list of DDL statements to run inside the newly created
- * database. Statements can create tables, indexes, etc. These
- * statements execute atomically with the creation of the database:
- * if there is an error in any statement, the database is not created.
- * @type EncryptionConfig $encryptionConfig
- * Optional. The encryption configuration for the database. If this field is
- * not specified, Cloud Spanner will encrypt/decrypt all data at rest using
- * Google default encryption.
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\OperationResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function createDatabase(
- $parent,
- $createStatement,
- array $optionalArgs = []
- ) {
- $request = new CreateDatabaseRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $request->setCreateStatement($createStatement);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['extraStatements'])) {
- $request->setExtraStatements($optionalArgs['extraStatements']);
- }
-
- if (isset($optionalArgs['encryptionConfig'])) {
- $request->setEncryptionConfig($optionalArgs['encryptionConfig']);
- }
-
- if (isset($optionalArgs['databaseDialect'])) {
- $request->setDatabaseDialect($optionalArgs['databaseDialect']);
- }
-
- if (isset($optionalArgs['protoDescriptors'])) {
- $request->setProtoDescriptors($optionalArgs['protoDescriptors']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startOperationsCall(
- 'CreateDatabase',
- $optionalArgs,
- $request,
- $this->getOperationsClient()
- )->wait();
- }
-
- /**
- * Deletes a pending or completed
- * [Backup][google.spanner.admin.database.v1.Backup].
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $formattedName = $databaseAdminClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]');
- * $databaseAdminClient->deleteBackup($formattedName);
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $name Required. Name of the backup to delete.
- * Values are of the form
- * `projects//instances//backups/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @throws ApiException if the remote call fails
- */
- public function deleteBackup($name, array $optionalArgs = [])
- {
- $request = new DeleteBackupRequest();
- $requestParamHeaders = [];
- $request->setName($name);
- $requestParamHeaders['name'] = $name;
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'DeleteBackup',
- GPBEmpty::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Deletes a backup schedule.
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $formattedName = $databaseAdminClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]');
- * $databaseAdminClient->deleteBackupSchedule($formattedName);
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $name Required. The name of the schedule to delete.
- * Values are of the form
- * `projects//instances//databases//backupSchedules/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @throws ApiException if the remote call fails
- */
- public function deleteBackupSchedule($name, array $optionalArgs = [])
- {
- $request = new DeleteBackupScheduleRequest();
- $requestParamHeaders = [];
- $request->setName($name);
- $requestParamHeaders['name'] = $name;
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'DeleteBackupSchedule',
- GPBEmpty::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Drops (aka deletes) a Cloud Spanner database.
- * Completed backups for the database will be retained according to their
- * `expire_time`.
- * Note: Cloud Spanner might continue to accept requests for a few seconds
- * after the database has been deleted.
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $formattedDatabase = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]');
- * $databaseAdminClient->dropDatabase($formattedDatabase);
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $database Required. The database to be dropped.
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @throws ApiException if the remote call fails
- */
- public function dropDatabase($database, array $optionalArgs = [])
- {
- $request = new DropDatabaseRequest();
- $requestParamHeaders = [];
- $request->setDatabase($database);
- $requestParamHeaders['database'] = $database;
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'DropDatabase',
- GPBEmpty::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Gets metadata on a pending or completed
- * [Backup][google.spanner.admin.database.v1.Backup].
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $formattedName = $databaseAdminClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]');
- * $response = $databaseAdminClient->getBackup($formattedName);
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $name Required. Name of the backup.
- * Values are of the form
- * `projects//instances//backups/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Spanner\Admin\Database\V1\Backup
- *
- * @throws ApiException if the remote call fails
- */
- public function getBackup($name, array $optionalArgs = [])
- {
- $request = new GetBackupRequest();
- $requestParamHeaders = [];
- $request->setName($name);
- $requestParamHeaders['name'] = $name;
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'GetBackup',
- Backup::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Gets backup schedule for the input schedule name.
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $formattedName = $databaseAdminClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]');
- * $response = $databaseAdminClient->getBackupSchedule($formattedName);
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $name Required. The name of the schedule to retrieve.
- * Values are of the form
- * `projects//instances//databases//backupSchedules/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule
- *
- * @throws ApiException if the remote call fails
- */
- public function getBackupSchedule($name, array $optionalArgs = [])
- {
- $request = new GetBackupScheduleRequest();
- $requestParamHeaders = [];
- $request->setName($name);
- $requestParamHeaders['name'] = $name;
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'GetBackupSchedule',
- BackupSchedule::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Gets the state of a Cloud Spanner database.
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $formattedName = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]');
- * $response = $databaseAdminClient->getDatabase($formattedName);
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $name Required. The name of the requested database. Values are of the form
- * `projects//instances//databases/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Spanner\Admin\Database\V1\Database
- *
- * @throws ApiException if the remote call fails
- */
- public function getDatabase($name, array $optionalArgs = [])
- {
- $request = new GetDatabaseRequest();
- $requestParamHeaders = [];
- $request->setName($name);
- $requestParamHeaders['name'] = $name;
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'GetDatabase',
- Database::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Returns the schema of a Cloud Spanner database as a list of formatted
- * DDL statements. This method does not show pending schema updates, those may
- * be queried using the [Operations][google.longrunning.Operations] API.
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $formattedDatabase = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]');
- * $response = $databaseAdminClient->getDatabaseDdl($formattedDatabase);
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $database Required. The database whose schema we wish to get.
- * Values are of the form
- * `projects//instances//databases/`
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Spanner\Admin\Database\V1\GetDatabaseDdlResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function getDatabaseDdl($database, array $optionalArgs = [])
- {
- $request = new GetDatabaseDdlRequest();
- $requestParamHeaders = [];
- $request->setDatabase($database);
- $requestParamHeaders['database'] = $database;
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'GetDatabaseDdl',
- GetDatabaseDdlResponse::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Gets the access control policy for a database or backup resource.
- * Returns an empty policy if a database or backup exists but does not have a
- * policy set.
- *
- * Authorization requires `spanner.databases.getIamPolicy` permission on
- * [resource][google.iam.v1.GetIamPolicyRequest.resource].
- * For backups, authorization requires `spanner.backups.getIamPolicy`
- * permission on [resource][google.iam.v1.GetIamPolicyRequest.resource].
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $resource = 'resource';
- * $response = $databaseAdminClient->getIamPolicy($resource);
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $resource REQUIRED: The resource for which the policy is being requested.
- * See the operation documentation for the appropriate value for this field.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type GetPolicyOptions $options
- * OPTIONAL: A `GetPolicyOptions` object for specifying options to
- * `GetIamPolicy`.
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Iam\V1\Policy
- *
- * @throws ApiException if the remote call fails
- */
- public function getIamPolicy($resource, array $optionalArgs = [])
- {
- $request = new GetIamPolicyRequest();
- $requestParamHeaders = [];
- $request->setResource($resource);
- $requestParamHeaders['resource'] = $resource;
- if (isset($optionalArgs['options'])) {
- $request->setOptions($optionalArgs['options']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'GetIamPolicy',
- Policy::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Lists the backup [long-running operations][google.longrunning.Operation] in
- * the given instance. A backup operation has a name of the form
- * `projects//instances//backups//operations/`.
- * The long-running operation
- * [metadata][google.longrunning.Operation.metadata] field type
- * `metadata.type_url` describes the type of the metadata. Operations returned
- * include those that have completed/failed/canceled within the last 7 days,
- * and pending operations. Operations returned are ordered by
- * `operation.metadata.value.progress.start_time` in descending order starting
- * from the most recently started operation.
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]');
- * // Iterate over pages of elements
- * $pagedResponse = $databaseAdminClient->listBackupOperations($formattedParent);
- * foreach ($pagedResponse->iteratePages() as $page) {
- * foreach ($page as $element) {
- * // doSomethingWith($element);
- * }
- * }
- * // Alternatively:
- * // Iterate through all elements
- * $pagedResponse = $databaseAdminClient->listBackupOperations($formattedParent);
- * foreach ($pagedResponse->iterateAllElements() as $element) {
- * // doSomethingWith($element);
- * }
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The instance of the backup operations. Values are of
- * the form `projects//instances/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type string $filter
- * An expression that filters the list of returned backup operations.
- *
- * A filter expression consists of a field name, a
- * comparison operator, and a value for filtering.
- * The value must be a string, a number, or a boolean. The comparison operator
- * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
- * Colon `:` is the contains operator. Filter rules are not case sensitive.
- *
- * The following fields in the [operation][google.longrunning.Operation]
- * are eligible for filtering:
- *
- * * `name` - The name of the long-running operation
- * * `done` - False if the operation is in progress, else true.
- * * `metadata.@type` - the type of metadata. For example, the type string
- * for
- * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]
- * is
- * `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`.
- * * `metadata.` - any field in metadata.value.
- * `metadata.@type` must be specified first if filtering on metadata
- * fields.
- * * `error` - Error associated with the long-running operation.
- * * `response.@type` - the type of response.
- * * `response.` - any field in response.value.
- *
- * You can combine multiple expressions by enclosing each expression in
- * parentheses. By default, expressions are combined with AND logic, but
- * you can specify AND, OR, and NOT logic explicitly.
- *
- * Here are a few examples:
- *
- * * `done:true` - The operation is complete.
- * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
- * `metadata.database:prod` - Returns operations where:
- * * The operation's metadata type is
- * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata].
- * * The source database name of backup contains the string "prod".
- * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
- * `(metadata.name:howl) AND` \
- * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
- * `(error:*)` - Returns operations where:
- * * The operation's metadata type is
- * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata].
- * * The backup name contains the string "howl".
- * * The operation started before 2018-03-28T14:50:00Z.
- * * The operation resulted in an error.
- * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \
- * `(metadata.source_backup:test) AND` \
- * `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \
- * `(error:*)` - Returns operations where:
- * * The operation's metadata type is
- * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata].
- * * The source backup name contains the string "test".
- * * The operation started before 2022-01-18T14:50:00Z.
- * * The operation resulted in an error.
- * * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
- * `(metadata.database:test_db)) OR` \
- * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata)
- * AND` \
- * `(metadata.source_backup:test_bkp)) AND` \
- * `(error:*)` - Returns operations where:
- * * The operation's metadata matches either of criteria:
- * * The operation's metadata type is
- * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]
- * AND the source database name of the backup contains the string
- * "test_db"
- * * The operation's metadata type is
- * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]
- * AND the source backup name contains the string "test_bkp"
- * * The operation resulted in an error.
- * @type int $pageSize
- * The maximum number of resources contained in the underlying API
- * response. The API may return fewer values in a page, even if
- * there are additional values to be retrieved.
- * @type string $pageToken
- * A page token is used to specify a page of values to be returned.
- * If no page token is specified (the default), the first page
- * of values will be returned. Any page token used here must have
- * been generated by a previous call to the API.
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\PagedListResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function listBackupOperations($parent, array $optionalArgs = [])
- {
- $request = new ListBackupOperationsRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['filter'])) {
- $request->setFilter($optionalArgs['filter']);
- }
-
- if (isset($optionalArgs['pageSize'])) {
- $request->setPageSize($optionalArgs['pageSize']);
- }
-
- if (isset($optionalArgs['pageToken'])) {
- $request->setPageToken($optionalArgs['pageToken']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->getPagedListResponse(
- 'ListBackupOperations',
- $optionalArgs,
- ListBackupOperationsResponse::class,
- $request
- );
- }
-
- /**
- * Lists all the backup schedules for the database.
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $formattedParent = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]');
- * // Iterate over pages of elements
- * $pagedResponse = $databaseAdminClient->listBackupSchedules($formattedParent);
- * foreach ($pagedResponse->iteratePages() as $page) {
- * foreach ($page as $element) {
- * // doSomethingWith($element);
- * }
- * }
- * // Alternatively:
- * // Iterate through all elements
- * $pagedResponse = $databaseAdminClient->listBackupSchedules($formattedParent);
- * foreach ($pagedResponse->iterateAllElements() as $element) {
- * // doSomethingWith($element);
- * }
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $parent Required. Database is the parent resource whose backup schedules should be
- * listed. Values are of the form
- * projects//instances//databases/
- * @param array $optionalArgs {
- * Optional.
- *
- * @type int $pageSize
- * The maximum number of resources contained in the underlying API
- * response. The API may return fewer values in a page, even if
- * there are additional values to be retrieved.
- * @type string $pageToken
- * A page token is used to specify a page of values to be returned.
- * If no page token is specified (the default), the first page
- * of values will be returned. Any page token used here must have
- * been generated by a previous call to the API.
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\PagedListResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function listBackupSchedules($parent, array $optionalArgs = [])
- {
- $request = new ListBackupSchedulesRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['pageSize'])) {
- $request->setPageSize($optionalArgs['pageSize']);
- }
-
- if (isset($optionalArgs['pageToken'])) {
- $request->setPageToken($optionalArgs['pageToken']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->getPagedListResponse(
- 'ListBackupSchedules',
- $optionalArgs,
- ListBackupSchedulesResponse::class,
- $request
- );
- }
-
- /**
- * Lists completed and pending backups.
- * Backups returned are ordered by `create_time` in descending order,
- * starting from the most recent `create_time`.
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]');
- * // Iterate over pages of elements
- * $pagedResponse = $databaseAdminClient->listBackups($formattedParent);
- * foreach ($pagedResponse->iteratePages() as $page) {
- * foreach ($page as $element) {
- * // doSomethingWith($element);
- * }
- * }
- * // Alternatively:
- * // Iterate through all elements
- * $pagedResponse = $databaseAdminClient->listBackups($formattedParent);
- * foreach ($pagedResponse->iterateAllElements() as $element) {
- * // doSomethingWith($element);
- * }
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The instance to list backups from. Values are of the
- * form `projects//instances/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type string $filter
- * An expression that filters the list of returned backups.
- *
- * A filter expression consists of a field name, a comparison operator, and a
- * value for filtering.
- * The value must be a string, a number, or a boolean. The comparison operator
- * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
- * Colon `:` is the contains operator. Filter rules are not case sensitive.
- *
- * The following fields in the
- * [Backup][google.spanner.admin.database.v1.Backup] are eligible for
- * filtering:
- *
- * * `name`
- * * `database`
- * * `state`
- * * `create_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
- * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
- * * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
- * * `size_bytes`
- * * `backup_schedules`
- *
- * You can combine multiple expressions by enclosing each expression in
- * parentheses. By default, expressions are combined with AND logic, but
- * you can specify AND, OR, and NOT logic explicitly.
- *
- * Here are a few examples:
- *
- * * `name:Howl` - The backup's name contains the string "howl".
- * * `database:prod`
- * - The database's name contains the string "prod".
- * * `state:CREATING` - The backup is pending creation.
- * * `state:READY` - The backup is fully created and ready for use.
- * * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")`
- * - The backup name contains the string "howl" and `create_time`
- * of the backup is before 2018-03-28T14:50:00Z.
- * * `expire_time < \"2018-03-28T14:50:00Z\"`
- * - The backup `expire_time` is before 2018-03-28T14:50:00Z.
- * * `size_bytes > 10000000000` - The backup's size is greater than 10GB
- * * `backup_schedules:daily`
- * - The backup is created from a schedule with "daily" in its name.
- * @type int $pageSize
- * The maximum number of resources contained in the underlying API
- * response. The API may return fewer values in a page, even if
- * there are additional values to be retrieved.
- * @type string $pageToken
- * A page token is used to specify a page of values to be returned.
- * If no page token is specified (the default), the first page
- * of values will be returned. Any page token used here must have
- * been generated by a previous call to the API.
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\PagedListResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function listBackups($parent, array $optionalArgs = [])
- {
- $request = new ListBackupsRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['filter'])) {
- $request->setFilter($optionalArgs['filter']);
- }
-
- if (isset($optionalArgs['pageSize'])) {
- $request->setPageSize($optionalArgs['pageSize']);
- }
-
- if (isset($optionalArgs['pageToken'])) {
- $request->setPageToken($optionalArgs['pageToken']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->getPagedListResponse(
- 'ListBackups',
- $optionalArgs,
- ListBackupsResponse::class,
- $request
- );
- }
-
- /**
- * Lists database [longrunning-operations][google.longrunning.Operation].
- * A database operation has a name of the form
- * `projects//instances//databases//operations/`.
- * The long-running operation
- * [metadata][google.longrunning.Operation.metadata] field type
- * `metadata.type_url` describes the type of the metadata. Operations returned
- * include those that have completed/failed/canceled within the last 7 days,
- * and pending operations.
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]');
- * // Iterate over pages of elements
- * $pagedResponse = $databaseAdminClient->listDatabaseOperations($formattedParent);
- * foreach ($pagedResponse->iteratePages() as $page) {
- * foreach ($page as $element) {
- * // doSomethingWith($element);
- * }
- * }
- * // Alternatively:
- * // Iterate through all elements
- * $pagedResponse = $databaseAdminClient->listDatabaseOperations($formattedParent);
- * foreach ($pagedResponse->iterateAllElements() as $element) {
- * // doSomethingWith($element);
- * }
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The instance of the database operations.
- * Values are of the form `projects//instances/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type string $filter
- * An expression that filters the list of returned operations.
- *
- * A filter expression consists of a field name, a
- * comparison operator, and a value for filtering.
- * The value must be a string, a number, or a boolean. The comparison operator
- * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
- * Colon `:` is the contains operator. Filter rules are not case sensitive.
- *
- * The following fields in the [Operation][google.longrunning.Operation]
- * are eligible for filtering:
- *
- * * `name` - The name of the long-running operation
- * * `done` - False if the operation is in progress, else true.
- * * `metadata.@type` - the type of metadata. For example, the type string
- * for
- * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]
- * is
- * `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
- * * `metadata.` - any field in metadata.value.
- * `metadata.@type` must be specified first, if filtering on metadata
- * fields.
- * * `error` - Error associated with the long-running operation.
- * * `response.@type` - the type of response.
- * * `response.` - any field in response.value.
- *
- * You can combine multiple expressions by enclosing each expression in
- * parentheses. By default, expressions are combined with AND logic. However,
- * you can specify AND, OR, and NOT logic explicitly.
- *
- * Here are a few examples:
- *
- * * `done:true` - The operation is complete.
- * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \
- * `(metadata.source_type:BACKUP) AND` \
- * `(metadata.backup_info.backup:backup_howl) AND` \
- * `(metadata.name:restored_howl) AND` \
- * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
- * `(error:*)` - Return operations where:
- * * The operation's metadata type is
- * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata].
- * * The database is restored from a backup.
- * * The backup name contains "backup_howl".
- * * The restored database's name contains "restored_howl".
- * * The operation started before 2018-03-28T14:50:00Z.
- * * The operation resulted in an error.
- * @type int $pageSize
- * The maximum number of resources contained in the underlying API
- * response. The API may return fewer values in a page, even if
- * there are additional values to be retrieved.
- * @type string $pageToken
- * A page token is used to specify a page of values to be returned.
- * If no page token is specified (the default), the first page
- * of values will be returned. Any page token used here must have
- * been generated by a previous call to the API.
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\PagedListResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function listDatabaseOperations($parent, array $optionalArgs = [])
- {
- $request = new ListDatabaseOperationsRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['filter'])) {
- $request->setFilter($optionalArgs['filter']);
- }
-
- if (isset($optionalArgs['pageSize'])) {
- $request->setPageSize($optionalArgs['pageSize']);
- }
-
- if (isset($optionalArgs['pageToken'])) {
- $request->setPageToken($optionalArgs['pageToken']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->getPagedListResponse(
- 'ListDatabaseOperations',
- $optionalArgs,
- ListDatabaseOperationsResponse::class,
- $request
- );
- }
-
- /**
- * Lists Cloud Spanner database roles.
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $formattedParent = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]');
- * // Iterate over pages of elements
- * $pagedResponse = $databaseAdminClient->listDatabaseRoles($formattedParent);
- * foreach ($pagedResponse->iteratePages() as $page) {
- * foreach ($page as $element) {
- * // doSomethingWith($element);
- * }
- * }
- * // Alternatively:
- * // Iterate through all elements
- * $pagedResponse = $databaseAdminClient->listDatabaseRoles($formattedParent);
- * foreach ($pagedResponse->iterateAllElements() as $element) {
- * // doSomethingWith($element);
- * }
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The database whose roles should be listed.
- * Values are of the form
- * `projects//instances//databases/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type int $pageSize
- * The maximum number of resources contained in the underlying API
- * response. The API may return fewer values in a page, even if
- * there are additional values to be retrieved.
- * @type string $pageToken
- * A page token is used to specify a page of values to be returned.
- * If no page token is specified (the default), the first page
- * of values will be returned. Any page token used here must have
- * been generated by a previous call to the API.
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\PagedListResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function listDatabaseRoles($parent, array $optionalArgs = [])
- {
- $request = new ListDatabaseRolesRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['pageSize'])) {
- $request->setPageSize($optionalArgs['pageSize']);
- }
-
- if (isset($optionalArgs['pageToken'])) {
- $request->setPageToken($optionalArgs['pageToken']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->getPagedListResponse(
- 'ListDatabaseRoles',
- $optionalArgs,
- ListDatabaseRolesResponse::class,
- $request
- );
- }
-
- /**
- * Lists Cloud Spanner databases.
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]');
- * // Iterate over pages of elements
- * $pagedResponse = $databaseAdminClient->listDatabases($formattedParent);
- * foreach ($pagedResponse->iteratePages() as $page) {
- * foreach ($page as $element) {
- * // doSomethingWith($element);
- * }
- * }
- * // Alternatively:
- * // Iterate through all elements
- * $pagedResponse = $databaseAdminClient->listDatabases($formattedParent);
- * foreach ($pagedResponse->iterateAllElements() as $element) {
- * // doSomethingWith($element);
- * }
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The instance whose databases should be listed.
- * Values are of the form `projects//instances/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type int $pageSize
- * The maximum number of resources contained in the underlying API
- * response. The API may return fewer values in a page, even if
- * there are additional values to be retrieved.
- * @type string $pageToken
- * A page token is used to specify a page of values to be returned.
- * If no page token is specified (the default), the first page
- * of values will be returned. Any page token used here must have
- * been generated by a previous call to the API.
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\PagedListResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function listDatabases($parent, array $optionalArgs = [])
- {
- $request = new ListDatabasesRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['pageSize'])) {
- $request->setPageSize($optionalArgs['pageSize']);
- }
-
- if (isset($optionalArgs['pageToken'])) {
- $request->setPageToken($optionalArgs['pageToken']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->getPagedListResponse(
- 'ListDatabases',
- $optionalArgs,
- ListDatabasesResponse::class,
- $request
- );
- }
-
- /**
- * Create a new database by restoring from a completed backup. The new
- * database must be in the same project and in an instance with the same
- * instance configuration as the instance containing
- * the backup. The returned database [long-running
- * operation][google.longrunning.Operation] has a name of the format
- * `projects//instances//databases//operations/`,
- * and can be used to track the progress of the operation, and to cancel it.
- * The [metadata][google.longrunning.Operation.metadata] field type is
- * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata].
- * The [response][google.longrunning.Operation.response] type
- * is [Database][google.spanner.admin.database.v1.Database], if
- * successful. Cancelling the returned operation will stop the restore and
- * delete the database.
- * There can be only one database being restored into an instance at a time.
- * Once the restore operation completes, a new restore operation can be
- * initiated, without waiting for the optimize operation associated with the
- * first restore to complete.
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]');
- * $databaseId = 'database_id';
- * $operationResponse = $databaseAdminClient->restoreDatabase($formattedParent, $databaseId);
- * $operationResponse->pollUntilComplete();
- * if ($operationResponse->operationSucceeded()) {
- * $result = $operationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $operationResponse->getError();
- * // handleError($error)
- * }
- * // Alternatively:
- * // start the operation, keep the operation name, and resume later
- * $operationResponse = $databaseAdminClient->restoreDatabase($formattedParent, $databaseId);
- * $operationName = $operationResponse->getName();
- * // ... do other work
- * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'restoreDatabase');
- * while (!$newOperationResponse->isDone()) {
- * // ... do other work
- * $newOperationResponse->reload();
- * }
- * if ($newOperationResponse->operationSucceeded()) {
- * $result = $newOperationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $newOperationResponse->getError();
- * // handleError($error)
- * }
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The name of the instance in which to create the
- * restored database. This instance must be in the same project and
- * have the same instance configuration as the instance containing
- * the source backup. Values are of the form
- * `projects//instances/`.
- * @param string $databaseId Required. The id of the database to create and restore to. This
- * database must not already exist. The `database_id` appended to
- * `parent` forms the full database name of the form
- * `projects//instances//databases/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type string $backup
- * Name of the backup from which to restore. Values are of the form
- * `projects//instances//backups/`.
- * @type RestoreDatabaseEncryptionConfig $encryptionConfig
- * Optional. An encryption configuration describing the encryption type and
- * key resources in Cloud KMS used to encrypt/decrypt the database to restore
- * to. If this field is not specified, the restored database will use the same
- * encryption configuration as the backup by default, namely
- * [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type]
- * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`.
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\OperationResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function restoreDatabase(
- $parent,
- $databaseId,
- array $optionalArgs = []
- ) {
- $request = new RestoreDatabaseRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $request->setDatabaseId($databaseId);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['backup'])) {
- $request->setBackup($optionalArgs['backup']);
- }
-
- if (isset($optionalArgs['encryptionConfig'])) {
- $request->setEncryptionConfig($optionalArgs['encryptionConfig']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startOperationsCall(
- 'RestoreDatabase',
- $optionalArgs,
- $request,
- $this->getOperationsClient()
- )->wait();
- }
-
- /**
- * Sets the access control policy on a database or backup resource.
- * Replaces any existing policy.
- *
- * Authorization requires `spanner.databases.setIamPolicy`
- * permission on [resource][google.iam.v1.SetIamPolicyRequest.resource].
- * For backups, authorization requires `spanner.backups.setIamPolicy`
- * permission on [resource][google.iam.v1.SetIamPolicyRequest.resource].
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $resource = 'resource';
- * $policy = new Policy();
- * $response = $databaseAdminClient->setIamPolicy($resource, $policy);
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $resource REQUIRED: The resource for which the policy is being specified.
- * See the operation documentation for the appropriate value for this field.
- * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of
- * the policy is limited to a few 10s of KB. An empty policy is a
- * valid policy but certain Cloud Platform services (such as Projects)
- * might reject them.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type FieldMask $updateMask
- * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
- * the fields in the mask will be modified. If no mask is provided, the
- * following default mask is used:
- *
- * `paths: "bindings, etag"`
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Iam\V1\Policy
- *
- * @throws ApiException if the remote call fails
- */
- public function setIamPolicy($resource, $policy, array $optionalArgs = [])
- {
- $request = new SetIamPolicyRequest();
- $requestParamHeaders = [];
- $request->setResource($resource);
- $request->setPolicy($policy);
- $requestParamHeaders['resource'] = $resource;
- if (isset($optionalArgs['updateMask'])) {
- $request->setUpdateMask($optionalArgs['updateMask']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'SetIamPolicy',
- Policy::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Returns permissions that the caller has on the specified database or backup
- * resource.
- *
- * Attempting this RPC on a non-existent Cloud Spanner database will
- * result in a NOT_FOUND error if the user has
- * `spanner.databases.list` permission on the containing Cloud
- * Spanner instance. Otherwise returns an empty set of permissions.
- * Calling this method on a backup that does not exist will
- * result in a NOT_FOUND error if the user has
- * `spanner.backups.list` permission on the containing instance.
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $resource = 'resource';
- * $permissions = [];
- * $response = $databaseAdminClient->testIamPermissions($resource, $permissions);
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $resource REQUIRED: The resource for which the policy detail is being requested.
- * See the operation documentation for the appropriate value for this field.
- * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with
- * wildcards (such as '*' or 'storage.*') are not allowed. For more
- * information see
- * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function testIamPermissions(
- $resource,
- $permissions,
- array $optionalArgs = []
- ) {
- $request = new TestIamPermissionsRequest();
- $requestParamHeaders = [];
- $request->setResource($resource);
- $request->setPermissions($permissions);
- $requestParamHeaders['resource'] = $resource;
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'TestIamPermissions',
- TestIamPermissionsResponse::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Updates a pending or completed
- * [Backup][google.spanner.admin.database.v1.Backup].
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $backup = new Backup();
- * $updateMask = new FieldMask();
- * $response = $databaseAdminClient->updateBackup($backup, $updateMask);
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param Backup $backup Required. The backup to update. `backup.name`, and the fields to be updated
- * as specified by `update_mask` are required. Other fields are ignored.
- * Update is only supported for the following fields:
- * * `backup.expire_time`.
- * @param FieldMask $updateMask Required. A mask specifying which fields (e.g. `expire_time`) in the
- * Backup resource should be updated. This mask is relative to the Backup
- * resource, not to the request message. The field mask must always be
- * specified; this prevents any future fields from being erased accidentally
- * by clients that do not know about them.
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Spanner\Admin\Database\V1\Backup
- *
- * @throws ApiException if the remote call fails
- */
- public function updateBackup($backup, $updateMask, array $optionalArgs = [])
- {
- $request = new UpdateBackupRequest();
- $requestParamHeaders = [];
- $request->setBackup($backup);
- $request->setUpdateMask($updateMask);
- $requestParamHeaders['backup.name'] = $backup->getName();
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'UpdateBackup',
- Backup::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Updates a backup schedule.
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $backupSchedule = new BackupSchedule();
- * $updateMask = new FieldMask();
- * $response = $databaseAdminClient->updateBackupSchedule($backupSchedule, $updateMask);
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param BackupSchedule $backupSchedule Required. The backup schedule to update. `backup_schedule.name`, and the
- * fields to be updated as specified by `update_mask` are required. Other
- * fields are ignored.
- * @param FieldMask $updateMask Required. A mask specifying which fields in the BackupSchedule resource
- * should be updated. This mask is relative to the BackupSchedule resource,
- * not to the request message. The field mask must always be
- * specified; this prevents any future fields from being erased
- * accidentally.
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule
- *
- * @throws ApiException if the remote call fails
- */
- public function updateBackupSchedule(
- $backupSchedule,
- $updateMask,
- array $optionalArgs = []
- ) {
- $request = new UpdateBackupScheduleRequest();
- $requestParamHeaders = [];
- $request->setBackupSchedule($backupSchedule);
- $request->setUpdateMask($updateMask);
- $requestParamHeaders[
- 'backup_schedule.name'
- ] = $backupSchedule->getName();
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'UpdateBackupSchedule',
- BackupSchedule::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Updates a Cloud Spanner database. The returned
- * [long-running operation][google.longrunning.Operation] can be used to track
- * the progress of updating the database. If the named database does not
- * exist, returns `NOT_FOUND`.
- *
- * While the operation is pending:
- *
- * * The database's
- * [reconciling][google.spanner.admin.database.v1.Database.reconciling]
- * field is set to true.
- * * Cancelling the operation is best-effort. If the cancellation succeeds,
- * the operation metadata's
- * [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time]
- * is set, the updates are reverted, and the operation terminates with a
- * `CANCELLED` status.
- * * New UpdateDatabase requests will return a `FAILED_PRECONDITION` error
- * until the pending operation is done (returns successfully or with
- * error).
- * * Reading the database via the API continues to give the pre-request
- * values.
- *
- * Upon completion of the returned operation:
- *
- * * The new values are in effect and readable via the API.
- * * The database's
- * [reconciling][google.spanner.admin.database.v1.Database.reconciling]
- * field becomes false.
- *
- * The returned [long-running operation][google.longrunning.Operation] will
- * have a name of the format
- * `projects//instances//databases//operations/`
- * and can be used to track the database modification. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata].
- * The [response][google.longrunning.Operation.response] field type is
- * [Database][google.spanner.admin.database.v1.Database], if successful.
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $database = new Database();
- * $updateMask = new FieldMask();
- * $operationResponse = $databaseAdminClient->updateDatabase($database, $updateMask);
- * $operationResponse->pollUntilComplete();
- * if ($operationResponse->operationSucceeded()) {
- * $result = $operationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $operationResponse->getError();
- * // handleError($error)
- * }
- * // Alternatively:
- * // start the operation, keep the operation name, and resume later
- * $operationResponse = $databaseAdminClient->updateDatabase($database, $updateMask);
- * $operationName = $operationResponse->getName();
- * // ... do other work
- * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'updateDatabase');
- * while (!$newOperationResponse->isDone()) {
- * // ... do other work
- * $newOperationResponse->reload();
- * }
- * if ($newOperationResponse->operationSucceeded()) {
- * $result = $newOperationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $newOperationResponse->getError();
- * // handleError($error)
- * }
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param Database $database Required. The database to update.
- * The `name` field of the database is of the form
- * `projects//instances//databases/`.
- * @param FieldMask $updateMask Required. The list of fields to update. Currently, only
- * `enable_drop_protection` field can be updated.
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\OperationResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function updateDatabase(
- $database,
- $updateMask,
- array $optionalArgs = []
- ) {
- $request = new UpdateDatabaseRequest();
- $requestParamHeaders = [];
- $request->setDatabase($database);
- $request->setUpdateMask($updateMask);
- $requestParamHeaders['database.name'] = $database->getName();
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startOperationsCall(
- 'UpdateDatabase',
- $optionalArgs,
- $request,
- $this->getOperationsClient()
- )->wait();
- }
-
- /**
- * Updates the schema of a Cloud Spanner database by
- * creating/altering/dropping tables, columns, indexes, etc. The returned
- * [long-running operation][google.longrunning.Operation] will have a name of
- * the format `/operations/` and can be used to
- * track execution of the schema change(s). The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata].
- * The operation has no response.
- *
- * Sample code:
- * ```
- * $databaseAdminClient = new DatabaseAdminClient();
- * try {
- * $formattedDatabase = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]');
- * $statements = [];
- * $operationResponse = $databaseAdminClient->updateDatabaseDdl($formattedDatabase, $statements);
- * $operationResponse->pollUntilComplete();
- * if ($operationResponse->operationSucceeded()) {
- * // operation succeeded and returns no value
- * } else {
- * $error = $operationResponse->getError();
- * // handleError($error)
- * }
- * // Alternatively:
- * // start the operation, keep the operation name, and resume later
- * $operationResponse = $databaseAdminClient->updateDatabaseDdl($formattedDatabase, $statements);
- * $operationName = $operationResponse->getName();
- * // ... do other work
- * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'updateDatabaseDdl');
- * while (!$newOperationResponse->isDone()) {
- * // ... do other work
- * $newOperationResponse->reload();
- * }
- * if ($newOperationResponse->operationSucceeded()) {
- * // operation succeeded and returns no value
- * } else {
- * $error = $newOperationResponse->getError();
- * // handleError($error)
- * }
- * } finally {
- * $databaseAdminClient->close();
- * }
- * ```
- *
- * @param string $database Required. The database to update.
- * @param string[] $statements Required. DDL statements to be applied to the database.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type string $operationId
- * If empty, the new update request is assigned an
- * automatically-generated operation ID. Otherwise, `operation_id`
- * is used to construct the name of the resulting
- * [Operation][google.longrunning.Operation].
- *
- * Specifying an explicit operation ID simplifies determining
- * whether the statements were executed in the event that the
- * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]
- * call is replayed, or the return value is otherwise lost: the
- * [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database]
- * and `operation_id` fields can be combined to form the
- * [name][google.longrunning.Operation.name] of the resulting
- * [longrunning.Operation][google.longrunning.Operation]:
- * `/operations/`.
- *
- * `operation_id` should be unique within the database, and must be
- * a valid identifier: `[a-z][a-z0-9_]*`. Note that
- * automatically-generated operation IDs always begin with an
- * 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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\OperationResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function updateDatabaseDdl(
- $database,
- $statements,
- array $optionalArgs = []
- ) {
- $request = new UpdateDatabaseDdlRequest();
- $requestParamHeaders = [];
- $request->setDatabase($database);
- $request->setStatements($statements);
- $requestParamHeaders['database'] = $database;
- if (isset($optionalArgs['operationId'])) {
- $request->setOperationId($optionalArgs['operationId']);
- }
-
- if (isset($optionalArgs['protoDescriptors'])) {
- $request->setProtoDescriptors($optionalArgs['protoDescriptors']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startOperationsCall(
- 'UpdateDatabaseDdl',
- $optionalArgs,
- $request,
- $this->getOperationsClient()
- )->wait();
- }
-}
diff --git a/Spanner/src/Admin/Database/V1/GetBackupRequest.php b/Spanner/src/Admin/Database/V1/GetBackupRequest.php
index 8023dc513a4d..442d207b6386 100644
--- a/Spanner/src/Admin/Database/V1/GetBackupRequest.php
+++ b/Spanner/src/Admin/Database/V1/GetBackupRequest.php
@@ -23,7 +23,7 @@ class GetBackupRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $name = '';
+ protected $name = '';
/**
* @param string $name Required. Name of the backup.
diff --git a/Spanner/src/Admin/Database/V1/GetDatabaseDdlRequest.php b/Spanner/src/Admin/Database/V1/GetDatabaseDdlRequest.php
index 746e1e6d300f..6e955af72d1a 100644
--- a/Spanner/src/Admin/Database/V1/GetDatabaseDdlRequest.php
+++ b/Spanner/src/Admin/Database/V1/GetDatabaseDdlRequest.php
@@ -23,7 +23,7 @@ class GetDatabaseDdlRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $database = '';
+ protected $database = '';
/**
* @param string $database Required. The database whose schema we wish to get.
diff --git a/Spanner/src/Admin/Database/V1/GetDatabaseDdlResponse.php b/Spanner/src/Admin/Database/V1/GetDatabaseDdlResponse.php
index fc346e69229d..a190d7f20b13 100644
--- a/Spanner/src/Admin/Database/V1/GetDatabaseDdlResponse.php
+++ b/Spanner/src/Admin/Database/V1/GetDatabaseDdlResponse.php
@@ -32,7 +32,7 @@ class GetDatabaseDdlResponse extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bytes proto_descriptors = 2;
*/
- private $proto_descriptors = '';
+ protected $proto_descriptors = '';
/**
* Constructor.
diff --git a/Spanner/src/Admin/Database/V1/GetDatabaseRequest.php b/Spanner/src/Admin/Database/V1/GetDatabaseRequest.php
index dd3f68a8fa17..bacc542101f3 100644
--- a/Spanner/src/Admin/Database/V1/GetDatabaseRequest.php
+++ b/Spanner/src/Admin/Database/V1/GetDatabaseRequest.php
@@ -22,7 +22,7 @@ class GetDatabaseRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $name = '';
+ protected $name = '';
/**
* @param string $name Required. The name of the requested database. Values are of the form
diff --git a/Spanner/src/Admin/Database/V1/ListBackupOperationsRequest.php b/Spanner/src/Admin/Database/V1/ListBackupOperationsRequest.php
index 5c50db837408..c12ea71b9f7e 100644
--- a/Spanner/src/Admin/Database/V1/ListBackupOperationsRequest.php
+++ b/Spanner/src/Admin/Database/V1/ListBackupOperationsRequest.php
@@ -22,7 +22,7 @@ class ListBackupOperationsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* An expression that filters the list of returned backup operations.
* A filter expression consists of a field name, a
@@ -91,14 +91,14 @@ class ListBackupOperationsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string filter = 2;
*/
- private $filter = '';
+ protected $filter = '';
/**
* Number of operations to be returned in the response. If 0 or
* less, defaults to the server's maximum allowed page size.
*
* Generated from protobuf field int32 page_size = 3;
*/
- private $page_size = 0;
+ protected $page_size = 0;
/**
* If non-empty, `page_token` should contain a
* [next_page_token][google.spanner.admin.database.v1.ListBackupOperationsResponse.next_page_token]
@@ -108,7 +108,7 @@ class ListBackupOperationsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string page_token = 4;
*/
- private $page_token = '';
+ protected $page_token = '';
/**
* @param string $parent Required. The instance of the backup operations. Values are of
diff --git a/Spanner/src/Admin/Database/V1/ListBackupOperationsResponse.php b/Spanner/src/Admin/Database/V1/ListBackupOperationsResponse.php
index 5e7b2c82b7d6..145888a176cd 100644
--- a/Spanner/src/Admin/Database/V1/ListBackupOperationsResponse.php
+++ b/Spanner/src/Admin/Database/V1/ListBackupOperationsResponse.php
@@ -37,7 +37,7 @@ class ListBackupOperationsResponse extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string next_page_token = 2;
*/
- private $next_page_token = '';
+ protected $next_page_token = '';
/**
* Constructor.
diff --git a/Spanner/src/Admin/Database/V1/ListBackupsRequest.php b/Spanner/src/Admin/Database/V1/ListBackupsRequest.php
index d7e40757cb6f..cdcfabb13d44 100644
--- a/Spanner/src/Admin/Database/V1/ListBackupsRequest.php
+++ b/Spanner/src/Admin/Database/V1/ListBackupsRequest.php
@@ -22,7 +22,7 @@ class ListBackupsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* An expression that filters the list of returned backups.
* A filter expression consists of a field name, a comparison operator, and a
@@ -61,14 +61,14 @@ class ListBackupsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string filter = 2;
*/
- private $filter = '';
+ protected $filter = '';
/**
* Number of backups to be returned in the response. If 0 or
* less, defaults to the server's maximum allowed page size.
*
* Generated from protobuf field int32 page_size = 3;
*/
- private $page_size = 0;
+ protected $page_size = 0;
/**
* If non-empty, `page_token` should contain a
* [next_page_token][google.spanner.admin.database.v1.ListBackupsResponse.next_page_token]
@@ -78,7 +78,7 @@ class ListBackupsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string page_token = 4;
*/
- private $page_token = '';
+ protected $page_token = '';
/**
* @param string $parent Required. The instance to list backups from. Values are of the
diff --git a/Spanner/src/Admin/Database/V1/ListBackupsResponse.php b/Spanner/src/Admin/Database/V1/ListBackupsResponse.php
index 2e99679b56a5..97493b3614f1 100644
--- a/Spanner/src/Admin/Database/V1/ListBackupsResponse.php
+++ b/Spanner/src/Admin/Database/V1/ListBackupsResponse.php
@@ -30,7 +30,7 @@ class ListBackupsResponse extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string next_page_token = 2;
*/
- private $next_page_token = '';
+ protected $next_page_token = '';
/**
* Constructor.
diff --git a/Spanner/src/Admin/Database/V1/ListDatabaseOperationsRequest.php b/Spanner/src/Admin/Database/V1/ListDatabaseOperationsRequest.php
index 5061df0e46b2..b080b3ec6f4c 100644
--- a/Spanner/src/Admin/Database/V1/ListDatabaseOperationsRequest.php
+++ b/Spanner/src/Admin/Database/V1/ListDatabaseOperationsRequest.php
@@ -22,7 +22,7 @@ class ListDatabaseOperationsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* An expression that filters the list of returned operations.
* A filter expression consists of a field name, a
@@ -66,14 +66,14 @@ class ListDatabaseOperationsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string filter = 2;
*/
- private $filter = '';
+ protected $filter = '';
/**
* Number of operations to be returned in the response. If 0 or
* less, defaults to the server's maximum allowed page size.
*
* Generated from protobuf field int32 page_size = 3;
*/
- private $page_size = 0;
+ protected $page_size = 0;
/**
* If non-empty, `page_token` should contain a
* [next_page_token][google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token]
@@ -83,7 +83,7 @@ class ListDatabaseOperationsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string page_token = 4;
*/
- private $page_token = '';
+ protected $page_token = '';
/**
* @param string $parent Required. The instance of the database operations.
diff --git a/Spanner/src/Admin/Database/V1/ListDatabaseOperationsResponse.php b/Spanner/src/Admin/Database/V1/ListDatabaseOperationsResponse.php
index bc32ed6930c5..5e6f45741b25 100644
--- a/Spanner/src/Admin/Database/V1/ListDatabaseOperationsResponse.php
+++ b/Spanner/src/Admin/Database/V1/ListDatabaseOperationsResponse.php
@@ -33,7 +33,7 @@ class ListDatabaseOperationsResponse extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string next_page_token = 2;
*/
- private $next_page_token = '';
+ protected $next_page_token = '';
/**
* Constructor.
diff --git a/Spanner/src/Admin/Database/V1/ListDatabaseRolesRequest.php b/Spanner/src/Admin/Database/V1/ListDatabaseRolesRequest.php
index d83ec6bf40c0..789226a8d1cd 100644
--- a/Spanner/src/Admin/Database/V1/ListDatabaseRolesRequest.php
+++ b/Spanner/src/Admin/Database/V1/ListDatabaseRolesRequest.php
@@ -23,14 +23,14 @@ class ListDatabaseRolesRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Number of database roles to be returned in the response. If 0 or less,
* defaults to the server's maximum allowed page size.
*
* Generated from protobuf field int32 page_size = 2;
*/
- private $page_size = 0;
+ protected $page_size = 0;
/**
* If non-empty, `page_token` should contain a
* [next_page_token][google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token]
@@ -39,7 +39,7 @@ class ListDatabaseRolesRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string page_token = 3;
*/
- private $page_token = '';
+ protected $page_token = '';
/**
* @param string $parent Required. The database whose roles should be listed.
diff --git a/Spanner/src/Admin/Database/V1/ListDatabaseRolesResponse.php b/Spanner/src/Admin/Database/V1/ListDatabaseRolesResponse.php
index fc36896517be..e2f2c68f908e 100644
--- a/Spanner/src/Admin/Database/V1/ListDatabaseRolesResponse.php
+++ b/Spanner/src/Admin/Database/V1/ListDatabaseRolesResponse.php
@@ -29,7 +29,7 @@ class ListDatabaseRolesResponse extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string next_page_token = 2;
*/
- private $next_page_token = '';
+ protected $next_page_token = '';
/**
* Constructor.
diff --git a/Spanner/src/Admin/Database/V1/ListDatabasesRequest.php b/Spanner/src/Admin/Database/V1/ListDatabasesRequest.php
index 919d73db0cbd..647992bff82d 100644
--- a/Spanner/src/Admin/Database/V1/ListDatabasesRequest.php
+++ b/Spanner/src/Admin/Database/V1/ListDatabasesRequest.php
@@ -22,14 +22,14 @@ class ListDatabasesRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Number of databases to be returned in the response. If 0 or less,
* defaults to the server's maximum allowed page size.
*
* Generated from protobuf field int32 page_size = 3;
*/
- private $page_size = 0;
+ protected $page_size = 0;
/**
* If non-empty, `page_token` should contain a
* [next_page_token][google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token]
@@ -38,7 +38,7 @@ class ListDatabasesRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string page_token = 4;
*/
- private $page_token = '';
+ protected $page_token = '';
/**
* @param string $parent Required. The instance whose databases should be listed.
diff --git a/Spanner/src/Admin/Database/V1/ListDatabasesResponse.php b/Spanner/src/Admin/Database/V1/ListDatabasesResponse.php
index c167bf56afd0..91e10c3ba675 100644
--- a/Spanner/src/Admin/Database/V1/ListDatabasesResponse.php
+++ b/Spanner/src/Admin/Database/V1/ListDatabasesResponse.php
@@ -29,7 +29,7 @@ class ListDatabasesResponse extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string next_page_token = 2;
*/
- private $next_page_token = '';
+ protected $next_page_token = '';
/**
* Constructor.
diff --git a/Spanner/src/Admin/Database/V1/OperationProgress.php b/Spanner/src/Admin/Database/V1/OperationProgress.php
index e5ea82b400d5..457e0f5b87d2 100644
--- a/Spanner/src/Admin/Database/V1/OperationProgress.php
+++ b/Spanner/src/Admin/Database/V1/OperationProgress.php
@@ -22,20 +22,20 @@ class OperationProgress extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field int32 progress_percent = 1;
*/
- private $progress_percent = 0;
+ protected $progress_percent = 0;
/**
* Time the request was received.
*
* Generated from protobuf field .google.protobuf.Timestamp start_time = 2;
*/
- private $start_time = null;
+ protected $start_time = null;
/**
* If set, the time at which this operation failed or was completed
* successfully.
*
* Generated from protobuf field .google.protobuf.Timestamp end_time = 3;
*/
- private $end_time = null;
+ protected $end_time = null;
/**
* Constructor.
diff --git a/Spanner/src/Admin/Database/V1/OptimizeRestoredDatabaseMetadata.php b/Spanner/src/Admin/Database/V1/OptimizeRestoredDatabaseMetadata.php
index 99c53601ba38..6030a18943a5 100644
--- a/Spanner/src/Admin/Database/V1/OptimizeRestoredDatabaseMetadata.php
+++ b/Spanner/src/Admin/Database/V1/OptimizeRestoredDatabaseMetadata.php
@@ -23,13 +23,13 @@ class OptimizeRestoredDatabaseMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1 [(.google.api.resource_reference) = {
*/
- private $name = '';
+ protected $name = '';
/**
* The progress of the post-restore optimizations.
*
* Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 2;
*/
- private $progress = null;
+ protected $progress = null;
/**
* Constructor.
diff --git a/Spanner/src/Admin/Database/V1/RestoreDatabaseEncryptionConfig.php b/Spanner/src/Admin/Database/V1/RestoreDatabaseEncryptionConfig.php
index 54f3e913a322..7826049bac09 100644
--- a/Spanner/src/Admin/Database/V1/RestoreDatabaseEncryptionConfig.php
+++ b/Spanner/src/Admin/Database/V1/RestoreDatabaseEncryptionConfig.php
@@ -20,7 +20,7 @@ class RestoreDatabaseEncryptionConfig extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $encryption_type = 0;
+ protected $encryption_type = 0;
/**
* Optional. The Cloud KMS key that will be used to encrypt/decrypt the
* restored database. This field should be set only when
@@ -30,7 +30,7 @@ class RestoreDatabaseEncryptionConfig extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = {
*/
- private $kms_key_name = '';
+ protected $kms_key_name = '';
/**
* Optional. Specifies the KMS configuration for the one or more keys used to
* encrypt the database. Values are of the form
diff --git a/Spanner/src/Admin/Database/V1/RestoreDatabaseEncryptionConfig_EncryptionType.php b/Spanner/src/Admin/Database/V1/RestoreDatabaseEncryptionConfig_EncryptionType.php
deleted file mode 100644
index 6ddb496117ef..000000000000
--- a/Spanner/src/Admin/Database/V1/RestoreDatabaseEncryptionConfig_EncryptionType.php
+++ /dev/null
@@ -1,16 +0,0 @@
-string name = 1 [(.google.api.resource_reference) = {
*/
- private $name = '';
+ protected $name = '';
/**
* The type of the restore source.
*
* Generated from protobuf field .google.spanner.admin.database.v1.RestoreSourceType source_type = 2;
*/
- private $source_type = 0;
+ protected $source_type = 0;
/**
* The progress of the
* [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase]
@@ -35,7 +35,7 @@ class RestoreDatabaseMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 4;
*/
- private $progress = null;
+ protected $progress = null;
/**
* The time at which cancellation of this operation was received.
* [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]
@@ -52,7 +52,7 @@ class RestoreDatabaseMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp cancel_time = 5;
*/
- private $cancel_time = null;
+ protected $cancel_time = null;
/**
* If exists, the name of the long-running operation that will be used to
* track the post-restore optimization process to optimize the performance of
@@ -68,7 +68,7 @@ class RestoreDatabaseMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string optimize_database_operation_name = 6;
*/
- private $optimize_database_operation_name = '';
+ protected $optimize_database_operation_name = '';
protected $source_info;
/**
diff --git a/Spanner/src/Admin/Database/V1/RestoreDatabaseRequest.php b/Spanner/src/Admin/Database/V1/RestoreDatabaseRequest.php
index e9f2ef8b7d8c..7e9f39516096 100644
--- a/Spanner/src/Admin/Database/V1/RestoreDatabaseRequest.php
+++ b/Spanner/src/Admin/Database/V1/RestoreDatabaseRequest.php
@@ -25,7 +25,7 @@ class RestoreDatabaseRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Required. The id of the database to create and restore to. This
* database must not already exist. The `database_id` appended to
@@ -34,7 +34,7 @@ class RestoreDatabaseRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string database_id = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $database_id = '';
+ protected $database_id = '';
/**
* Optional. An encryption configuration describing the encryption type and
* key resources in Cloud KMS used to encrypt/decrypt the database to restore
@@ -45,7 +45,7 @@ class RestoreDatabaseRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $encryption_config = null;
+ protected $encryption_config = null;
protected $source;
/**
diff --git a/Spanner/src/Admin/Database/V1/RestoreInfo.php b/Spanner/src/Admin/Database/V1/RestoreInfo.php
index 97e9c5168127..2bcfe27d1868 100644
--- a/Spanner/src/Admin/Database/V1/RestoreInfo.php
+++ b/Spanner/src/Admin/Database/V1/RestoreInfo.php
@@ -20,7 +20,7 @@ class RestoreInfo extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.database.v1.RestoreSourceType source_type = 1;
*/
- private $source_type = 0;
+ protected $source_type = 0;
protected $source_info;
/**
diff --git a/Spanner/src/Admin/Database/V1/UpdateBackupRequest.php b/Spanner/src/Admin/Database/V1/UpdateBackupRequest.php
index 94db96b17083..0c76d8690c85 100644
--- a/Spanner/src/Admin/Database/V1/UpdateBackupRequest.php
+++ b/Spanner/src/Admin/Database/V1/UpdateBackupRequest.php
@@ -24,7 +24,7 @@ class UpdateBackupRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.database.v1.Backup backup = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $backup = null;
+ protected $backup = null;
/**
* Required. A mask specifying which fields (e.g. `expire_time`) in the
* Backup resource should be updated. This mask is relative to the Backup
@@ -34,7 +34,7 @@ class UpdateBackupRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $update_mask = null;
+ protected $update_mask = null;
/**
* @param \Google\Cloud\Spanner\Admin\Database\V1\Backup $backup Required. The backup to update. `backup.name`, and the fields to be updated
diff --git a/Spanner/src/Admin/Database/V1/UpdateDatabaseDdlMetadata.php b/Spanner/src/Admin/Database/V1/UpdateDatabaseDdlMetadata.php
index 07d475e07c0d..767766fad333 100644
--- a/Spanner/src/Admin/Database/V1/UpdateDatabaseDdlMetadata.php
+++ b/Spanner/src/Admin/Database/V1/UpdateDatabaseDdlMetadata.php
@@ -21,7 +21,7 @@ class UpdateDatabaseDdlMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string database = 1 [(.google.api.resource_reference) = {
*/
- private $database = '';
+ protected $database = '';
/**
* For an update this list contains all the statements. For an
* individual statement, this list contains only that statement.
@@ -44,7 +44,7 @@ class UpdateDatabaseDdlMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bool throttled = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $throttled = false;
+ protected $throttled = false;
/**
* The progress of the
* [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]
diff --git a/Spanner/src/Admin/Database/V1/UpdateDatabaseDdlRequest.php b/Spanner/src/Admin/Database/V1/UpdateDatabaseDdlRequest.php
index 9e9e7ff08124..d520012a1ad1 100644
--- a/Spanner/src/Admin/Database/V1/UpdateDatabaseDdlRequest.php
+++ b/Spanner/src/Admin/Database/V1/UpdateDatabaseDdlRequest.php
@@ -34,7 +34,7 @@ class UpdateDatabaseDdlRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $database = '';
+ protected $database = '';
/**
* Required. DDL statements to be applied to the database.
*
@@ -64,7 +64,7 @@ class UpdateDatabaseDdlRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string operation_id = 3;
*/
- private $operation_id = '';
+ protected $operation_id = '';
/**
* Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements.
* Contains a protobuf-serialized
@@ -83,7 +83,7 @@ class UpdateDatabaseDdlRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bytes proto_descriptors = 4 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $proto_descriptors = '';
+ protected $proto_descriptors = '';
/**
* @param string $database Required. The database to update. Please see
diff --git a/Spanner/src/Admin/Database/V1/UpdateDatabaseMetadata.php b/Spanner/src/Admin/Database/V1/UpdateDatabaseMetadata.php
index 52d8a69cb546..19c926a4aa5e 100644
--- a/Spanner/src/Admin/Database/V1/UpdateDatabaseMetadata.php
+++ b/Spanner/src/Admin/Database/V1/UpdateDatabaseMetadata.php
@@ -22,7 +22,7 @@ class UpdateDatabaseMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.database.v1.UpdateDatabaseRequest request = 1;
*/
- private $request = null;
+ protected $request = null;
/**
* The progress of the
* [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]
@@ -30,14 +30,14 @@ class UpdateDatabaseMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 2;
*/
- private $progress = null;
+ protected $progress = null;
/**
* The time at which this operation was cancelled. If set, this operation is
* in the process of undoing itself (which is best-effort).
*
* Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3;
*/
- private $cancel_time = null;
+ protected $cancel_time = null;
/**
* Constructor.
diff --git a/Spanner/src/Admin/Database/V1/UpdateDatabaseRequest.php b/Spanner/src/Admin/Database/V1/UpdateDatabaseRequest.php
index 27e65dd2d9c8..7fecddf2dd12 100644
--- a/Spanner/src/Admin/Database/V1/UpdateDatabaseRequest.php
+++ b/Spanner/src/Admin/Database/V1/UpdateDatabaseRequest.php
@@ -23,14 +23,14 @@ class UpdateDatabaseRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.database.v1.Database database = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $database = null;
+ protected $database = null;
/**
* Required. The list of fields to update. Currently, only
* `enable_drop_protection` field can be updated.
*
* Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $update_mask = null;
+ protected $update_mask = null;
/**
* @param \Google\Cloud\Spanner\Admin\Database\V1\Database $database Required. The database to update.
diff --git a/Spanner/src/Admin/Instance/V1/AutoscalingConfig.php b/Spanner/src/Admin/Instance/V1/AutoscalingConfig.php
index 341c101be0f1..0553c0701882 100644
--- a/Spanner/src/Admin/Instance/V1/AutoscalingConfig.php
+++ b/Spanner/src/Admin/Instance/V1/AutoscalingConfig.php
@@ -20,7 +20,7 @@ class AutoscalingConfig extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $autoscaling_limits = null;
+ protected $autoscaling_limits = null;
/**
* Required. The autoscaling targets for an instance.
*
diff --git a/Spanner/src/Admin/Instance/V1/AutoscalingConfig/AutoscalingTargets.php b/Spanner/src/Admin/Instance/V1/AutoscalingConfig/AutoscalingTargets.php
index 45f359fee624..a4325501a92d 100644
--- a/Spanner/src/Admin/Instance/V1/AutoscalingConfig/AutoscalingTargets.php
+++ b/Spanner/src/Admin/Instance/V1/AutoscalingConfig/AutoscalingTargets.php
@@ -23,7 +23,7 @@ class AutoscalingTargets extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field int32 high_priority_cpu_utilization_percent = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $high_priority_cpu_utilization_percent = 0;
+ protected $high_priority_cpu_utilization_percent = 0;
/**
* Required. The target storage utilization percentage that the autoscaler
* should be trying to achieve for the instance. This number is on a scale
@@ -32,7 +32,7 @@ class AutoscalingTargets extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field int32 storage_utilization_percent = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $storage_utilization_percent = 0;
+ protected $storage_utilization_percent = 0;
/**
* Constructor.
diff --git a/Spanner/src/Admin/Instance/V1/Client/InstanceAdminClient.php b/Spanner/src/Admin/Instance/V1/Client/InstanceAdminClient.php
index 1b3d5d0816e3..5203711d0482 100644
--- a/Spanner/src/Admin/Instance/V1/Client/InstanceAdminClient.php
+++ b/Spanner/src/Admin/Instance/V1/Client/InstanceAdminClient.php
@@ -1,6 +1,6 @@
.google.spanner.admin.instance.v1.InstanceConfig instance_config = 1;
*/
- private $instance_config = null;
+ protected $instance_config = null;
/**
* The progress of the
* [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig]
@@ -29,13 +29,13 @@ class CreateInstanceConfigMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.instance.v1.OperationProgress progress = 2;
*/
- private $progress = null;
+ protected $progress = null;
/**
* The time at which this operation was cancelled.
*
* Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3;
*/
- private $cancel_time = null;
+ protected $cancel_time = null;
/**
* Constructor.
diff --git a/Spanner/src/Admin/Instance/V1/CreateInstanceConfigRequest.php b/Spanner/src/Admin/Instance/V1/CreateInstanceConfigRequest.php
index 72182a6d1a46..8044c33e1cf9 100644
--- a/Spanner/src/Admin/Instance/V1/CreateInstanceConfigRequest.php
+++ b/Spanner/src/Admin/Instance/V1/CreateInstanceConfigRequest.php
@@ -22,7 +22,7 @@ class CreateInstanceConfigRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Required. The ID of the instance configuration to create. Valid identifiers
* are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64
@@ -31,7 +31,7 @@ class CreateInstanceConfigRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string instance_config_id = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $instance_config_id = '';
+ protected $instance_config_id = '';
/**
* Required. The InstanceConfig proto of the configuration to create.
* instance_config.name must be
@@ -41,14 +41,14 @@ class CreateInstanceConfigRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 3 [(.google.api.field_behavior) = REQUIRED];
*/
- private $instance_config = null;
+ protected $instance_config = null;
/**
* An option to validate, but not actually execute, a request,
* and provide the same response.
*
* Generated from protobuf field bool validate_only = 4;
*/
- private $validate_only = false;
+ protected $validate_only = false;
/**
* @param string $parent Required. The name of the project in which to create the instance
diff --git a/Spanner/src/Admin/Instance/V1/CreateInstanceMetadata.php b/Spanner/src/Admin/Instance/V1/CreateInstanceMetadata.php
index 42d25b24f565..0b08f1253a6f 100644
--- a/Spanner/src/Admin/Instance/V1/CreateInstanceMetadata.php
+++ b/Spanner/src/Admin/Instance/V1/CreateInstanceMetadata.php
@@ -21,7 +21,7 @@ class CreateInstanceMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1;
*/
- private $instance = null;
+ protected $instance = null;
/**
* The time at which the
* [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance]
@@ -29,7 +29,7 @@ class CreateInstanceMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp start_time = 2;
*/
- private $start_time = null;
+ protected $start_time = null;
/**
* The time at which this operation was cancelled. If set, this operation is
* in the process of undoing itself (which is guaranteed to succeed) and
@@ -37,19 +37,19 @@ class CreateInstanceMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3;
*/
- private $cancel_time = null;
+ protected $cancel_time = null;
/**
* The time at which this operation failed or was completed successfully.
*
* Generated from protobuf field .google.protobuf.Timestamp end_time = 4;
*/
- private $end_time = null;
+ protected $end_time = null;
/**
* The expected fulfillment period of this create operation.
*
* Generated from protobuf field .google.spanner.admin.instance.v1.FulfillmentPeriod expected_fulfillment_period = 5;
*/
- private $expected_fulfillment_period = 0;
+ protected $expected_fulfillment_period = 0;
/**
* Constructor.
diff --git a/Spanner/src/Admin/Instance/V1/CreateInstancePartitionMetadata.php b/Spanner/src/Admin/Instance/V1/CreateInstancePartitionMetadata.php
index 5829af2605bf..3494bbcea33a 100644
--- a/Spanner/src/Admin/Instance/V1/CreateInstancePartitionMetadata.php
+++ b/Spanner/src/Admin/Instance/V1/CreateInstancePartitionMetadata.php
@@ -21,7 +21,7 @@ class CreateInstancePartitionMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1;
*/
- private $instance_partition = null;
+ protected $instance_partition = null;
/**
* The time at which the
* [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition]
@@ -29,7 +29,7 @@ class CreateInstancePartitionMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp start_time = 2;
*/
- private $start_time = null;
+ protected $start_time = null;
/**
* The time at which this operation was cancelled. If set, this operation is
* in the process of undoing itself (which is guaranteed to succeed) and
@@ -37,13 +37,13 @@ class CreateInstancePartitionMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3;
*/
- private $cancel_time = null;
+ protected $cancel_time = null;
/**
* The time at which this operation failed or was completed successfully.
*
* Generated from protobuf field .google.protobuf.Timestamp end_time = 4;
*/
- private $end_time = null;
+ protected $end_time = null;
/**
* Constructor.
diff --git a/Spanner/src/Admin/Instance/V1/CreateInstancePartitionRequest.php b/Spanner/src/Admin/Instance/V1/CreateInstancePartitionRequest.php
index 7cf1add96d36..d12f2223ea98 100644
--- a/Spanner/src/Admin/Instance/V1/CreateInstancePartitionRequest.php
+++ b/Spanner/src/Admin/Instance/V1/CreateInstancePartitionRequest.php
@@ -23,7 +23,7 @@ class CreateInstancePartitionRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Required. The ID of the instance partition to create. Valid identifiers are
* of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64
@@ -31,7 +31,7 @@ class CreateInstancePartitionRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string instance_partition_id = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $instance_partition_id = '';
+ protected $instance_partition_id = '';
/**
* Required. The instance partition to create. The instance_partition.name may
* be omitted, but if specified must be
@@ -39,7 +39,7 @@ class CreateInstancePartitionRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED];
*/
- private $instance_partition = null;
+ protected $instance_partition = null;
/**
* @param string $parent Required. The name of the instance in which to create the instance
diff --git a/Spanner/src/Admin/Instance/V1/CreateInstanceRequest.php b/Spanner/src/Admin/Instance/V1/CreateInstanceRequest.php
index c31fbd9c0f15..1954b4933248 100644
--- a/Spanner/src/Admin/Instance/V1/CreateInstanceRequest.php
+++ b/Spanner/src/Admin/Instance/V1/CreateInstanceRequest.php
@@ -22,7 +22,7 @@ class CreateInstanceRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Required. The ID of the instance to create. Valid identifiers are of the
* form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in
@@ -30,14 +30,14 @@ class CreateInstanceRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $instance_id = '';
+ protected $instance_id = '';
/**
* Required. The instance to create. The name may be omitted, but if
* specified must be `/instances/`.
*
* Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED];
*/
- private $instance = null;
+ protected $instance = null;
/**
* @param string $parent Required. The name of the project in which to create the instance. Values
diff --git a/Spanner/src/Admin/Instance/V1/DeleteInstanceConfigRequest.php b/Spanner/src/Admin/Instance/V1/DeleteInstanceConfigRequest.php
index 6cc41a917dcc..ad65aa6051e0 100644
--- a/Spanner/src/Admin/Instance/V1/DeleteInstanceConfigRequest.php
+++ b/Spanner/src/Admin/Instance/V1/DeleteInstanceConfigRequest.php
@@ -23,7 +23,7 @@ class DeleteInstanceConfigRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $name = '';
+ protected $name = '';
/**
* Used for optimistic concurrency control as a way to help prevent
* simultaneous deletes of an instance configuration from overwriting each
@@ -35,14 +35,14 @@ class DeleteInstanceConfigRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string etag = 2;
*/
- private $etag = '';
+ protected $etag = '';
/**
* An option to validate, but not actually execute, a request,
* and provide the same response.
*
* Generated from protobuf field bool validate_only = 3;
*/
- private $validate_only = false;
+ protected $validate_only = false;
/**
* @param string $name Required. The name of the instance configuration to be deleted.
diff --git a/Spanner/src/Admin/Instance/V1/DeleteInstancePartitionRequest.php b/Spanner/src/Admin/Instance/V1/DeleteInstancePartitionRequest.php
index 74984498840b..430f00f61956 100644
--- a/Spanner/src/Admin/Instance/V1/DeleteInstancePartitionRequest.php
+++ b/Spanner/src/Admin/Instance/V1/DeleteInstancePartitionRequest.php
@@ -23,7 +23,7 @@ class DeleteInstancePartitionRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $name = '';
+ protected $name = '';
/**
* Optional. If not empty, the API only deletes the instance partition when
* the etag provided matches the current status of the requested instance
@@ -32,7 +32,7 @@ class DeleteInstancePartitionRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string etag = 2;
*/
- private $etag = '';
+ protected $etag = '';
/**
* @param string $name Required. The name of the instance partition to be deleted.
diff --git a/Spanner/src/Admin/Instance/V1/DeleteInstanceRequest.php b/Spanner/src/Admin/Instance/V1/DeleteInstanceRequest.php
index ac15b862152d..f8633ecef64d 100644
--- a/Spanner/src/Admin/Instance/V1/DeleteInstanceRequest.php
+++ b/Spanner/src/Admin/Instance/V1/DeleteInstanceRequest.php
@@ -22,7 +22,7 @@ class DeleteInstanceRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $name = '';
+ protected $name = '';
/**
* @param string $name Required. The name of the instance to be deleted. Values are of the form
diff --git a/Spanner/src/Admin/Instance/V1/Gapic/InstanceAdminGapicClient.php b/Spanner/src/Admin/Instance/V1/Gapic/InstanceAdminGapicClient.php
deleted file mode 100644
index 4e93f047478a..000000000000
--- a/Spanner/src/Admin/Instance/V1/Gapic/InstanceAdminGapicClient.php
+++ /dev/null
@@ -1,2526 +0,0 @@
-projectName('[PROJECT]');
- * $instanceId = 'instance_id';
- * $instance = new Instance();
- * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance);
- * $operationResponse->pollUntilComplete();
- * if ($operationResponse->operationSucceeded()) {
- * $result = $operationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $operationResponse->getError();
- * // handleError($error)
- * }
- * // Alternatively:
- * // start the operation, keep the operation name, and resume later
- * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance);
- * $operationName = $operationResponse->getName();
- * // ... do other work
- * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'createInstance');
- * while (!$newOperationResponse->isDone()) {
- * // ... do other work
- * $newOperationResponse->reload();
- * }
- * if ($newOperationResponse->operationSucceeded()) {
- * $result = $newOperationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $newOperationResponse->getError();
- * // handleError($error)
- * }
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * Many parameters require resource names to be formatted in a particular way. To
- * assist with these names, this class includes a format method for each type of
- * name, and additionally a parseName method to extract the individual identifiers
- * contained within formatted names that are returned by the API.
- *
- * @deprecated Please use the new service client {@see \Google\Cloud\Spanner\Admin\Instance\V1\Client\InstanceAdminClient}.
- */
-class InstanceAdminGapicClient
-{
- use GapicClientTrait;
-
- /** The name of the service. */
- const SERVICE_NAME = 'google.spanner.admin.instance.v1.InstanceAdmin';
-
- /**
- * The default address of the service.
- *
- * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead.
- */
- const SERVICE_ADDRESS = 'spanner.googleapis.com';
-
- /** The address template of the service. */
- private const SERVICE_ADDRESS_TEMPLATE = 'spanner.UNIVERSE_DOMAIN';
-
- /** The default port of the service. */
- const DEFAULT_SERVICE_PORT = 443;
-
- /** The name of the code generator, to be included in the agent header. */
- const CODEGEN_NAME = 'gapic';
-
- /** The default scopes required by the service. */
- public static $serviceScopes = [
- 'https://www.googleapis.com/auth/cloud-platform',
- 'https://www.googleapis.com/auth/spanner.admin',
- ];
-
- private static $instanceNameTemplate;
-
- private static $instanceConfigNameTemplate;
-
- private static $instancePartitionNameTemplate;
-
- private static $projectNameTemplate;
-
- private static $pathTemplateMap;
-
- private $operationsClient;
-
- private static function getClientDefaults()
- {
- return [
- 'serviceName' => self::SERVICE_NAME,
- 'apiEndpoint' =>
- self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT,
- 'clientConfig' =>
- __DIR__ . '/../resources/instance_admin_client_config.json',
- 'descriptorsConfigPath' =>
- __DIR__ . '/../resources/instance_admin_descriptor_config.php',
- 'gcpApiConfigPath' =>
- __DIR__ . '/../resources/instance_admin_grpc_config.json',
- 'credentialsConfig' => [
- 'defaultScopes' => self::$serviceScopes,
- ],
- 'transportConfig' => [
- 'rest' => [
- 'restClientConfigPath' =>
- __DIR__ .
- '/../resources/instance_admin_rest_client_config.php',
- ],
- ],
- ];
- }
-
- private static function getInstanceNameTemplate()
- {
- if (self::$instanceNameTemplate == null) {
- self::$instanceNameTemplate = new PathTemplate(
- 'projects/{project}/instances/{instance}'
- );
- }
-
- return self::$instanceNameTemplate;
- }
-
- private static function getInstanceConfigNameTemplate()
- {
- if (self::$instanceConfigNameTemplate == null) {
- self::$instanceConfigNameTemplate = new PathTemplate(
- 'projects/{project}/instanceConfigs/{instance_config}'
- );
- }
-
- return self::$instanceConfigNameTemplate;
- }
-
- private static function getInstancePartitionNameTemplate()
- {
- if (self::$instancePartitionNameTemplate == null) {
- self::$instancePartitionNameTemplate = new PathTemplate(
- 'projects/{project}/instances/{instance}/instancePartitions/{instance_partition}'
- );
- }
-
- return self::$instancePartitionNameTemplate;
- }
-
- private static function getProjectNameTemplate()
- {
- if (self::$projectNameTemplate == null) {
- self::$projectNameTemplate = new PathTemplate('projects/{project}');
- }
-
- return self::$projectNameTemplate;
- }
-
- private static function getPathTemplateMap()
- {
- if (self::$pathTemplateMap == null) {
- self::$pathTemplateMap = [
- 'instance' => self::getInstanceNameTemplate(),
- 'instanceConfig' => self::getInstanceConfigNameTemplate(),
- 'instancePartition' => self::getInstancePartitionNameTemplate(),
- 'project' => self::getProjectNameTemplate(),
- ];
- }
-
- return self::$pathTemplateMap;
- }
-
- /**
- * Formats a string containing the fully-qualified path to represent a instance
- * resource.
- *
- * @param string $project
- * @param string $instance
- *
- * @return string The formatted instance resource.
- */
- public static function instanceName($project, $instance)
- {
- return self::getInstanceNameTemplate()->render([
- 'project' => $project,
- 'instance' => $instance,
- ]);
- }
-
- /**
- * Formats a string containing the fully-qualified path to represent a
- * instance_config resource.
- *
- * @param string $project
- * @param string $instanceConfig
- *
- * @return string The formatted instance_config resource.
- */
- public static function instanceConfigName($project, $instanceConfig)
- {
- return self::getInstanceConfigNameTemplate()->render([
- 'project' => $project,
- 'instance_config' => $instanceConfig,
- ]);
- }
-
- /**
- * Formats a string containing the fully-qualified path to represent a
- * instance_partition resource.
- *
- * @param string $project
- * @param string $instance
- * @param string $instancePartition
- *
- * @return string The formatted instance_partition resource.
- */
- public static function instancePartitionName(
- $project,
- $instance,
- $instancePartition
- ) {
- return self::getInstancePartitionNameTemplate()->render([
- 'project' => $project,
- 'instance' => $instance,
- 'instance_partition' => $instancePartition,
- ]);
- }
-
- /**
- * Formats a string containing the fully-qualified path to represent a project
- * resource.
- *
- * @param string $project
- *
- * @return string The formatted project resource.
- */
- public static function projectName($project)
- {
- return self::getProjectNameTemplate()->render([
- 'project' => $project,
- ]);
- }
-
- /**
- * Parses a formatted name string and returns an associative array of the components in the name.
- * The following name formats are supported:
- * Template: Pattern
- * - instance: projects/{project}/instances/{instance}
- * - instanceConfig: projects/{project}/instanceConfigs/{instance_config}
- * - instancePartition: projects/{project}/instances/{instance}/instancePartitions/{instance_partition}
- * - project: projects/{project}
- *
- * The optional $template argument can be supplied to specify a particular pattern,
- * and must match one of the templates listed above. If no $template argument is
- * provided, or if the $template argument does not match one of the templates
- * listed, then parseName will check each of the supported templates, and return
- * the first match.
- *
- * @param string $formattedName The formatted name string
- * @param string $template Optional name of template to match
- *
- * @return array An associative array from name component IDs to component values.
- *
- * @throws ValidationException If $formattedName could not be matched.
- */
- public static function parseName($formattedName, $template = null)
- {
- $templateMap = self::getPathTemplateMap();
- if ($template) {
- if (!isset($templateMap[$template])) {
- throw new ValidationException(
- "Template name $template does not exist"
- );
- }
-
- return $templateMap[$template]->match($formattedName);
- }
-
- foreach ($templateMap as $templateName => $pathTemplate) {
- try {
- return $pathTemplate->match($formattedName);
- } catch (ValidationException $ex) {
- // Swallow the exception to continue trying other path templates
- }
- }
-
- throw new ValidationException(
- "Input did not match any known format. Input: $formattedName"
- );
- }
-
- /**
- * Return an OperationsClient object with the same endpoint as $this.
- *
- * @return OperationsClient
- */
- public function getOperationsClient()
- {
- return $this->operationsClient;
- }
-
- /**
- * Resume an existing long running operation that was previously started by a long
- * running API method. If $methodName is not provided, or does not match a long
- * running API method, then the operation can still be resumed, but the
- * OperationResponse object will not deserialize the final response.
- *
- * @param string $operationName The name of the long running operation
- * @param string $methodName The name of the method used to start the operation
- *
- * @return OperationResponse
- */
- public function resumeOperation($operationName, $methodName = null)
- {
- $options = isset($this->descriptors[$methodName]['longRunning'])
- ? $this->descriptors[$methodName]['longRunning']
- : [];
- $operation = new OperationResponse(
- $operationName,
- $this->getOperationsClient(),
- $options
- );
- $operation->reload();
- return $operation;
- }
-
- /**
- * Constructor.
- *
- * @param array $options {
- * Optional. Options for configuring the service API wrapper.
- *
- * @type string $apiEndpoint
- * The address of the API remote host. May optionally include the port, formatted
- * as ":". Default 'spanner.googleapis.com:443'.
- * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
- * The credentials to be used by the client to authorize API calls. This option
- * accepts either a path to a credentials file, or a decoded credentials file as a
- * PHP array.
- * *Advanced usage*: In addition, this option can also accept a pre-constructed
- * {@see \Google\Auth\FetchAuthTokenInterface} object or
- * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these
- * objects are provided, any settings in $credentialsConfig will be ignored.
- * @type array $credentialsConfig
- * Options used to configure credentials, including auth token caching, for the
- * client. For a full list of supporting configuration options, see
- * {@see \Google\ApiCore\CredentialsWrapper::build()} .
- * @type bool $disableRetries
- * Determines whether or not retries defined by the client configuration should be
- * disabled. Defaults to `false`.
- * @type string|array $clientConfig
- * Client method configuration, including retry settings. This option can be either
- * a path to a JSON file, or a PHP array containing the decoded JSON data. By
- * default this settings points to the default client config file, which is
- * provided in the resources folder.
- * @type string|TransportInterface $transport
- * The transport used for executing network requests. May be either the string
- * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system.
- * *Advanced usage*: Additionally, it is possible to pass in an already
- * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note
- * that when this object is provided, any settings in $transportConfig, and any
- * $apiEndpoint setting, will be ignored.
- * @type array $transportConfig
- * Configuration options that will be used to construct the transport. Options for
- * each supported transport type should be passed in a key for that transport. For
- * example:
- * $transportConfig = [
- * 'grpc' => [...],
- * 'rest' => [...],
- * ];
- * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and
- * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the
- * supported options.
- * @type callable $clientCertSource
- * A callable which returns the client cert as a string. This can be used to
- * provide a certificate and private key to the transport layer for mTLS.
- * }
- *
- * @throws ValidationException
- */
- public function __construct(array $options = [])
- {
- $clientOptions = $this->buildClientOptions($options);
- $this->setClientOptions($clientOptions);
- $this->operationsClient = $this->createOperationsClient($clientOptions);
- }
-
- /**
- * Creates an instance and begins preparing it to begin serving. The
- * returned [long-running operation][google.longrunning.Operation]
- * can be used to track the progress of preparing the new
- * instance. The instance name is assigned by the caller. If the
- * named instance already exists, `CreateInstance` returns
- * `ALREADY_EXISTS`.
- *
- * Immediately upon completion of this request:
- *
- * * The instance is readable via the API, with all requested attributes
- * but no allocated resources. Its state is `CREATING`.
- *
- * Until completion of the returned operation:
- *
- * * Cancelling the operation renders the instance immediately unreadable
- * via the API.
- * * The instance can be deleted.
- * * All other attempts to modify the instance are rejected.
- *
- * Upon completion of the returned operation:
- *
- * * Billing for all successfully-allocated resources begins (some types
- * may have lower than the requested levels).
- * * Databases can be created in the instance.
- * * The instance's allocated resource levels are readable via the API.
- * * The instance's state becomes `READY`.
- *
- * The returned [long-running operation][google.longrunning.Operation] will
- * have a name of the format `/operations/` and
- * can be used to track creation of the instance. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata].
- * The [response][google.longrunning.Operation.response] field type is
- * [Instance][google.spanner.admin.instance.v1.Instance], if successful.
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $formattedParent = $instanceAdminClient->projectName('[PROJECT]');
- * $instanceId = 'instance_id';
- * $instance = new Instance();
- * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance);
- * $operationResponse->pollUntilComplete();
- * if ($operationResponse->operationSucceeded()) {
- * $result = $operationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $operationResponse->getError();
- * // handleError($error)
- * }
- * // Alternatively:
- * // start the operation, keep the operation name, and resume later
- * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance);
- * $operationName = $operationResponse->getName();
- * // ... do other work
- * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'createInstance');
- * while (!$newOperationResponse->isDone()) {
- * // ... do other work
- * $newOperationResponse->reload();
- * }
- * if ($newOperationResponse->operationSucceeded()) {
- * $result = $newOperationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $newOperationResponse->getError();
- * // handleError($error)
- * }
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The name of the project in which to create the instance. Values
- * are of the form `projects/`.
- * @param string $instanceId Required. The ID of the instance to create. Valid identifiers are of the
- * form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in
- * length.
- * @param Instance $instance Required. The instance to create. The name may be omitted, but if
- * specified must be `/instances/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\OperationResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function createInstance(
- $parent,
- $instanceId,
- $instance,
- array $optionalArgs = []
- ) {
- $request = new CreateInstanceRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $request->setInstanceId($instanceId);
- $request->setInstance($instance);
- $requestParamHeaders['parent'] = $parent;
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startOperationsCall(
- 'CreateInstance',
- $optionalArgs,
- $request,
- $this->getOperationsClient()
- )->wait();
- }
-
- /**
- * Creates an instance configuration and begins preparing it to be used. The
- * returned [long-running operation][google.longrunning.Operation]
- * can be used to track the progress of preparing the new
- * instance configuration. The instance configuration name is assigned by the
- * caller. If the named instance configuration already exists,
- * `CreateInstanceConfig` returns `ALREADY_EXISTS`.
- *
- * Immediately after the request returns:
- *
- * * The instance configuration is readable via the API, with all requested
- * attributes. The instance configuration's
- * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling]
- * field is set to true. Its state is `CREATING`.
- *
- * While the operation is pending:
- *
- * * Cancelling the operation renders the instance configuration immediately
- * unreadable via the API.
- * * Except for deleting the creating resource, all other attempts to modify
- * the instance configuration are rejected.
- *
- * Upon completion of the returned operation:
- *
- * * Instances can be created using the instance configuration.
- * * The instance configuration's
- * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling]
- * field becomes false. Its state becomes `READY`.
- *
- * The returned [long-running operation][google.longrunning.Operation] will
- * have a name of the format
- * `/operations/` and can be used to track
- * creation of the instance configuration. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata].
- * The [response][google.longrunning.Operation.response] field type is
- * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if
- * successful.
- *
- * Authorization requires `spanner.instanceConfigs.create` permission on
- * the resource
- * [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.parent].
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $formattedParent = $instanceAdminClient->projectName('[PROJECT]');
- * $instanceConfigId = 'instance_config_id';
- * $instanceConfig = new InstanceConfig();
- * $operationResponse = $instanceAdminClient->createInstanceConfig($formattedParent, $instanceConfigId, $instanceConfig);
- * $operationResponse->pollUntilComplete();
- * if ($operationResponse->operationSucceeded()) {
- * $result = $operationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $operationResponse->getError();
- * // handleError($error)
- * }
- * // Alternatively:
- * // start the operation, keep the operation name, and resume later
- * $operationResponse = $instanceAdminClient->createInstanceConfig($formattedParent, $instanceConfigId, $instanceConfig);
- * $operationName = $operationResponse->getName();
- * // ... do other work
- * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'createInstanceConfig');
- * while (!$newOperationResponse->isDone()) {
- * // ... do other work
- * $newOperationResponse->reload();
- * }
- * if ($newOperationResponse->operationSucceeded()) {
- * $result = $newOperationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $newOperationResponse->getError();
- * // handleError($error)
- * }
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The name of the project in which to create the instance
- * configuration. Values are of the form `projects/`.
- * @param string $instanceConfigId Required. The ID of the instance configuration to create. Valid identifiers
- * are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64
- * characters in length. The `custom-` prefix is required to avoid name
- * conflicts with Google-managed configurations.
- * @param InstanceConfig $instanceConfig Required. The InstanceConfig proto of the configuration to create.
- * instance_config.name must be
- * `/instanceConfigs/`.
- * instance_config.base_config must be a Google managed configuration name,
- * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type bool $validateOnly
- * An option to validate, but not actually execute, a request,
- * and provide the same response.
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\OperationResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function createInstanceConfig(
- $parent,
- $instanceConfigId,
- $instanceConfig,
- array $optionalArgs = []
- ) {
- $request = new CreateInstanceConfigRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $request->setInstanceConfigId($instanceConfigId);
- $request->setInstanceConfig($instanceConfig);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['validateOnly'])) {
- $request->setValidateOnly($optionalArgs['validateOnly']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startOperationsCall(
- 'CreateInstanceConfig',
- $optionalArgs,
- $request,
- $this->getOperationsClient()
- )->wait();
- }
-
- /**
- * Creates an instance partition and begins preparing it to be used. The
- * returned [long-running operation][google.longrunning.Operation]
- * can be used to track the progress of preparing the new instance partition.
- * The instance partition name is assigned by the caller. If the named
- * instance partition already exists, `CreateInstancePartition` returns
- * `ALREADY_EXISTS`.
- *
- * Immediately upon completion of this request:
- *
- * * The instance partition is readable via the API, with all requested
- * attributes but no allocated resources. Its state is `CREATING`.
- *
- * Until completion of the returned operation:
- *
- * * Cancelling the operation renders the instance partition immediately
- * unreadable via the API.
- * * The instance partition can be deleted.
- * * All other attempts to modify the instance partition are rejected.
- *
- * Upon completion of the returned operation:
- *
- * * Billing for all successfully-allocated resources begins (some types
- * may have lower than the requested levels).
- * * Databases can start using this instance partition.
- * * The instance partition's allocated resource levels are readable via the
- * API.
- * * The instance partition's state becomes `READY`.
- *
- * The returned [long-running operation][google.longrunning.Operation] will
- * have a name of the format
- * `/operations/` and can be used to
- * track creation of the instance partition. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata].
- * The [response][google.longrunning.Operation.response] field type is
- * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if
- * successful.
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $formattedParent = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]');
- * $instancePartitionId = 'instance_partition_id';
- * $instancePartition = new InstancePartition();
- * $operationResponse = $instanceAdminClient->createInstancePartition($formattedParent, $instancePartitionId, $instancePartition);
- * $operationResponse->pollUntilComplete();
- * if ($operationResponse->operationSucceeded()) {
- * $result = $operationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $operationResponse->getError();
- * // handleError($error)
- * }
- * // Alternatively:
- * // start the operation, keep the operation name, and resume later
- * $operationResponse = $instanceAdminClient->createInstancePartition($formattedParent, $instancePartitionId, $instancePartition);
- * $operationName = $operationResponse->getName();
- * // ... do other work
- * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'createInstancePartition');
- * while (!$newOperationResponse->isDone()) {
- * // ... do other work
- * $newOperationResponse->reload();
- * }
- * if ($newOperationResponse->operationSucceeded()) {
- * $result = $newOperationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $newOperationResponse->getError();
- * // handleError($error)
- * }
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The name of the instance in which to create the instance
- * partition. Values are of the form
- * `projects//instances/`.
- * @param string $instancePartitionId Required. The ID of the instance partition to create. Valid identifiers are
- * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64
- * characters in length.
- * @param InstancePartition $instancePartition Required. The instance partition to create. The instance_partition.name may
- * be omitted, but if specified must be
- * `/instancePartitions/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\OperationResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function createInstancePartition(
- $parent,
- $instancePartitionId,
- $instancePartition,
- array $optionalArgs = []
- ) {
- $request = new CreateInstancePartitionRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $request->setInstancePartitionId($instancePartitionId);
- $request->setInstancePartition($instancePartition);
- $requestParamHeaders['parent'] = $parent;
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startOperationsCall(
- 'CreateInstancePartition',
- $optionalArgs,
- $request,
- $this->getOperationsClient()
- )->wait();
- }
-
- /**
- * Deletes an instance.
- *
- * Immediately upon completion of the request:
- *
- * * Billing ceases for all of the instance's reserved resources.
- *
- * Soon afterward:
- *
- * * The instance and *all of its databases* immediately and
- * irrevocably disappear from the API. All data in the databases
- * is permanently deleted.
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $formattedName = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]');
- * $instanceAdminClient->deleteInstance($formattedName);
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param string $name Required. The name of the instance to be deleted. Values are of the form
- * `projects//instances/`
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @throws ApiException if the remote call fails
- */
- public function deleteInstance($name, array $optionalArgs = [])
- {
- $request = new DeleteInstanceRequest();
- $requestParamHeaders = [];
- $request->setName($name);
- $requestParamHeaders['name'] = $name;
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'DeleteInstance',
- GPBEmpty::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Deletes the instance configuration. Deletion is only allowed when no
- * instances are using the configuration. If any instances are using
- * the configuration, returns `FAILED_PRECONDITION`.
- *
- * Only user-managed configurations can be deleted.
- *
- * Authorization requires `spanner.instanceConfigs.delete` permission on
- * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name].
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $formattedName = $instanceAdminClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]');
- * $instanceAdminClient->deleteInstanceConfig($formattedName);
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param string $name Required. The name of the instance configuration to be deleted.
- * Values are of the form
- * `projects//instanceConfigs/`
- * @param array $optionalArgs {
- * Optional.
- *
- * @type string $etag
- * Used for optimistic concurrency control as a way to help prevent
- * simultaneous deletes of an instance configuration from overwriting each
- * other. If not empty, the API
- * only deletes the instance configuration when the etag provided matches the
- * current status of the requested instance configuration. Otherwise, deletes
- * the instance configuration without checking the current status of the
- * requested instance configuration.
- * @type bool $validateOnly
- * An option to validate, but not actually execute, a request,
- * and provide the same response.
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @throws ApiException if the remote call fails
- */
- public function deleteInstanceConfig($name, array $optionalArgs = [])
- {
- $request = new DeleteInstanceConfigRequest();
- $requestParamHeaders = [];
- $request->setName($name);
- $requestParamHeaders['name'] = $name;
- if (isset($optionalArgs['etag'])) {
- $request->setEtag($optionalArgs['etag']);
- }
-
- if (isset($optionalArgs['validateOnly'])) {
- $request->setValidateOnly($optionalArgs['validateOnly']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'DeleteInstanceConfig',
- GPBEmpty::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Deletes an existing instance partition. Requires that the
- * instance partition is not used by any database or backup and is not the
- * default instance partition of an instance.
- *
- * Authorization requires `spanner.instancePartitions.delete` permission on
- * the resource
- * [name][google.spanner.admin.instance.v1.InstancePartition.name].
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $formattedName = $instanceAdminClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]');
- * $instanceAdminClient->deleteInstancePartition($formattedName);
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param string $name Required. The name of the instance partition to be deleted.
- * Values are of the form
- * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`
- * @param array $optionalArgs {
- * Optional.
- *
- * @type string $etag
- * Optional. If not empty, the API only deletes the instance partition when
- * the etag provided matches the current status of the requested instance
- * partition. Otherwise, deletes the instance partition without checking the
- * current status of the requested instance partition.
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @throws ApiException if the remote call fails
- */
- public function deleteInstancePartition($name, array $optionalArgs = [])
- {
- $request = new DeleteInstancePartitionRequest();
- $requestParamHeaders = [];
- $request->setName($name);
- $requestParamHeaders['name'] = $name;
- if (isset($optionalArgs['etag'])) {
- $request->setEtag($optionalArgs['etag']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'DeleteInstancePartition',
- GPBEmpty::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Gets the access control policy for an instance resource. Returns an empty
- * policy if an instance exists but does not have a policy set.
- *
- * Authorization requires `spanner.instances.getIamPolicy` on
- * [resource][google.iam.v1.GetIamPolicyRequest.resource].
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $resource = 'resource';
- * $response = $instanceAdminClient->getIamPolicy($resource);
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param string $resource REQUIRED: The resource for which the policy is being requested.
- * See the operation documentation for the appropriate value for this field.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type GetPolicyOptions $options
- * OPTIONAL: A `GetPolicyOptions` object for specifying options to
- * `GetIamPolicy`.
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Iam\V1\Policy
- *
- * @throws ApiException if the remote call fails
- */
- public function getIamPolicy($resource, array $optionalArgs = [])
- {
- $request = new GetIamPolicyRequest();
- $requestParamHeaders = [];
- $request->setResource($resource);
- $requestParamHeaders['resource'] = $resource;
- if (isset($optionalArgs['options'])) {
- $request->setOptions($optionalArgs['options']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'GetIamPolicy',
- Policy::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Gets information about a particular instance.
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $formattedName = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]');
- * $response = $instanceAdminClient->getInstance($formattedName);
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param string $name Required. The name of the requested instance. Values are of the form
- * `projects//instances/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type FieldMask $fieldMask
- * If field_mask is present, specifies the subset of
- * [Instance][google.spanner.admin.instance.v1.Instance] fields that should be
- * returned. If absent, all
- * [Instance][google.spanner.admin.instance.v1.Instance] fields are returned.
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Spanner\Admin\Instance\V1\Instance
- *
- * @throws ApiException if the remote call fails
- */
- public function getInstance($name, array $optionalArgs = [])
- {
- $request = new GetInstanceRequest();
- $requestParamHeaders = [];
- $request->setName($name);
- $requestParamHeaders['name'] = $name;
- if (isset($optionalArgs['fieldMask'])) {
- $request->setFieldMask($optionalArgs['fieldMask']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'GetInstance',
- Instance::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Gets information about a particular instance configuration.
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $formattedName = $instanceAdminClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]');
- * $response = $instanceAdminClient->getInstanceConfig($formattedName);
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param string $name Required. The name of the requested instance configuration. Values are of
- * the form `projects//instanceConfigs/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig
- *
- * @throws ApiException if the remote call fails
- */
- public function getInstanceConfig($name, array $optionalArgs = [])
- {
- $request = new GetInstanceConfigRequest();
- $requestParamHeaders = [];
- $request->setName($name);
- $requestParamHeaders['name'] = $name;
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'GetInstanceConfig',
- InstanceConfig::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Gets information about a particular instance partition.
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $formattedName = $instanceAdminClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]');
- * $response = $instanceAdminClient->getInstancePartition($formattedName);
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param string $name Required. The name of the requested instance partition. Values are of
- * the form
- * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition
- *
- * @throws ApiException if the remote call fails
- */
- public function getInstancePartition($name, array $optionalArgs = [])
- {
- $request = new GetInstancePartitionRequest();
- $requestParamHeaders = [];
- $request->setName($name);
- $requestParamHeaders['name'] = $name;
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'GetInstancePartition',
- InstancePartition::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Lists the user-managed instance configuration [long-running
- * operations][google.longrunning.Operation] in the given project. An instance
- * configuration operation has a name of the form
- * `projects//instanceConfigs//operations/`.
- * The long-running operation
- * [metadata][google.longrunning.Operation.metadata] field type
- * `metadata.type_url` describes the type of the metadata. Operations returned
- * include those that have completed/failed/canceled within the last 7 days,
- * and pending operations. Operations returned are ordered by
- * `operation.metadata.value.start_time` in descending order starting
- * from the most recently started operation.
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $formattedParent = $instanceAdminClient->projectName('[PROJECT]');
- * // Iterate over pages of elements
- * $pagedResponse = $instanceAdminClient->listInstanceConfigOperations($formattedParent);
- * foreach ($pagedResponse->iteratePages() as $page) {
- * foreach ($page as $element) {
- * // doSomethingWith($element);
- * }
- * }
- * // Alternatively:
- * // Iterate through all elements
- * $pagedResponse = $instanceAdminClient->listInstanceConfigOperations($formattedParent);
- * foreach ($pagedResponse->iterateAllElements() as $element) {
- * // doSomethingWith($element);
- * }
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The project of the instance configuration operations.
- * Values are of the form `projects/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type string $filter
- * An expression that filters the list of returned operations.
- *
- * A filter expression consists of a field name, a
- * comparison operator, and a value for filtering.
- * The value must be a string, a number, or a boolean. The comparison operator
- * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
- * Colon `:` is the contains operator. Filter rules are not case sensitive.
- *
- * The following fields in the [Operation][google.longrunning.Operation]
- * are eligible for filtering:
- *
- * * `name` - The name of the long-running operation
- * * `done` - False if the operation is in progress, else true.
- * * `metadata.@type` - the type of metadata. For example, the type string
- * for
- * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]
- * is
- * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`.
- * * `metadata.` - any field in metadata.value.
- * `metadata.@type` must be specified first, if filtering on metadata
- * fields.
- * * `error` - Error associated with the long-running operation.
- * * `response.@type` - the type of response.
- * * `response.` - any field in response.value.
- *
- * You can combine multiple expressions by enclosing each expression in
- * parentheses. By default, expressions are combined with AND logic. However,
- * you can specify AND, OR, and NOT logic explicitly.
- *
- * Here are a few examples:
- *
- * * `done:true` - The operation is complete.
- * * `(metadata.@type=` \
- * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata)
- * AND` \
- * `(metadata.instance_config.name:custom-config) AND` \
- * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \
- * `(error:*)` - Return operations where:
- * * The operation's metadata type is
- * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata].
- * * The instance configuration name contains "custom-config".
- * * The operation started before 2021-03-28T14:50:00Z.
- * * The operation resulted in an error.
- * @type int $pageSize
- * The maximum number of resources contained in the underlying API
- * response. The API may return fewer values in a page, even if
- * there are additional values to be retrieved.
- * @type string $pageToken
- * A page token is used to specify a page of values to be returned.
- * If no page token is specified (the default), the first page
- * of values will be returned. Any page token used here must have
- * been generated by a previous call to the API.
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\PagedListResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function listInstanceConfigOperations(
- $parent,
- array $optionalArgs = []
- ) {
- $request = new ListInstanceConfigOperationsRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['filter'])) {
- $request->setFilter($optionalArgs['filter']);
- }
-
- if (isset($optionalArgs['pageSize'])) {
- $request->setPageSize($optionalArgs['pageSize']);
- }
-
- if (isset($optionalArgs['pageToken'])) {
- $request->setPageToken($optionalArgs['pageToken']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->getPagedListResponse(
- 'ListInstanceConfigOperations',
- $optionalArgs,
- ListInstanceConfigOperationsResponse::class,
- $request
- );
- }
-
- /**
- * Lists the supported instance configurations for a given project.
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $formattedParent = $instanceAdminClient->projectName('[PROJECT]');
- * // Iterate over pages of elements
- * $pagedResponse = $instanceAdminClient->listInstanceConfigs($formattedParent);
- * foreach ($pagedResponse->iteratePages() as $page) {
- * foreach ($page as $element) {
- * // doSomethingWith($element);
- * }
- * }
- * // Alternatively:
- * // Iterate through all elements
- * $pagedResponse = $instanceAdminClient->listInstanceConfigs($formattedParent);
- * foreach ($pagedResponse->iterateAllElements() as $element) {
- * // doSomethingWith($element);
- * }
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The name of the project for which a list of supported instance
- * configurations is requested. Values are of the form
- * `projects/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type int $pageSize
- * The maximum number of resources contained in the underlying API
- * response. The API may return fewer values in a page, even if
- * there are additional values to be retrieved.
- * @type string $pageToken
- * A page token is used to specify a page of values to be returned.
- * If no page token is specified (the default), the first page
- * of values will be returned. Any page token used here must have
- * been generated by a previous call to the API.
- * @type RetrySettings|array $retrySettings
- * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
- * associative array of retry settings parameters. See the documentation on
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\PagedListResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function listInstanceConfigs($parent, array $optionalArgs = [])
- {
- $request = new ListInstanceConfigsRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['pageSize'])) {
- $request->setPageSize($optionalArgs['pageSize']);
- }
-
- if (isset($optionalArgs['pageToken'])) {
- $request->setPageToken($optionalArgs['pageToken']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->getPagedListResponse(
- 'ListInstanceConfigs',
- $optionalArgs,
- ListInstanceConfigsResponse::class,
- $request
- );
- }
-
- /**
- * Lists instance partition [long-running
- * operations][google.longrunning.Operation] in the given instance.
- * An instance partition operation has a name of the form
- * `projects//instances//instancePartitions//operations/`.
- * The long-running operation
- * [metadata][google.longrunning.Operation.metadata] field type
- * `metadata.type_url` describes the type of the metadata. Operations returned
- * include those that have completed/failed/canceled within the last 7 days,
- * and pending operations. Operations returned are ordered by
- * `operation.metadata.value.start_time` in descending order starting from the
- * most recently started operation.
- *
- * Authorization requires `spanner.instancePartitionOperations.list`
- * permission on the resource
- * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent].
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $formattedParent = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]');
- * // Iterate over pages of elements
- * $pagedResponse = $instanceAdminClient->listInstancePartitionOperations($formattedParent);
- * foreach ($pagedResponse->iteratePages() as $page) {
- * foreach ($page as $element) {
- * // doSomethingWith($element);
- * }
- * }
- * // Alternatively:
- * // Iterate through all elements
- * $pagedResponse = $instanceAdminClient->listInstancePartitionOperations($formattedParent);
- * foreach ($pagedResponse->iterateAllElements() as $element) {
- * // doSomethingWith($element);
- * }
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The parent instance of the instance partition operations.
- * Values are of the form `projects//instances/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type string $filter
- * Optional. An expression that filters the list of returned operations.
- *
- * A filter expression consists of a field name, a
- * comparison operator, and a value for filtering.
- * The value must be a string, a number, or a boolean. The comparison operator
- * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
- * Colon `:` is the contains operator. Filter rules are not case sensitive.
- *
- * The following fields in the [Operation][google.longrunning.Operation]
- * are eligible for filtering:
- *
- * * `name` - The name of the long-running operation
- * * `done` - False if the operation is in progress, else true.
- * * `metadata.@type` - the type of metadata. For example, the type string
- * for
- * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]
- * is
- * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`.
- * * `metadata.` - any field in metadata.value.
- * `metadata.@type` must be specified first, if filtering on metadata
- * fields.
- * * `error` - Error associated with the long-running operation.
- * * `response.@type` - the type of response.
- * * `response.` - any field in response.value.
- *
- * You can combine multiple expressions by enclosing each expression in
- * parentheses. By default, expressions are combined with AND logic. However,
- * you can specify AND, OR, and NOT logic explicitly.
- *
- * Here are a few examples:
- *
- * * `done:true` - The operation is complete.
- * * `(metadata.@type=` \
- * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata)
- * AND` \
- * `(metadata.instance_partition.name:custom-instance-partition) AND` \
- * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \
- * `(error:*)` - Return operations where:
- * * The operation's metadata type is
- * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata].
- * * The instance partition name contains "custom-instance-partition".
- * * The operation started before 2021-03-28T14:50:00Z.
- * * The operation resulted in an error.
- * @type int $pageSize
- * The maximum number of resources contained in the underlying API
- * response. The API may return fewer values in a page, even if
- * there are additional values to be retrieved.
- * @type string $pageToken
- * A page token is used to specify a page of values to be returned.
- * If no page token is specified (the default), the first page
- * of values will be returned. Any page token used here must have
- * been generated by a previous call to the API.
- * @type Timestamp $instancePartitionDeadline
- * Optional. Deadline used while retrieving metadata for instance partition
- * operations. Instance partitions whose operation metadata cannot be
- * retrieved within this deadline will be added to
- * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in
- * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse].
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\PagedListResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function listInstancePartitionOperations(
- $parent,
- array $optionalArgs = []
- ) {
- $request = new ListInstancePartitionOperationsRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['filter'])) {
- $request->setFilter($optionalArgs['filter']);
- }
-
- if (isset($optionalArgs['pageSize'])) {
- $request->setPageSize($optionalArgs['pageSize']);
- }
-
- if (isset($optionalArgs['pageToken'])) {
- $request->setPageToken($optionalArgs['pageToken']);
- }
-
- if (isset($optionalArgs['instancePartitionDeadline'])) {
- $request->setInstancePartitionDeadline(
- $optionalArgs['instancePartitionDeadline']
- );
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->getPagedListResponse(
- 'ListInstancePartitionOperations',
- $optionalArgs,
- ListInstancePartitionOperationsResponse::class,
- $request
- );
- }
-
- /**
- * Lists all instance partitions for the given instance.
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $formattedParent = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]');
- * // Iterate over pages of elements
- * $pagedResponse = $instanceAdminClient->listInstancePartitions($formattedParent);
- * foreach ($pagedResponse->iteratePages() as $page) {
- * foreach ($page as $element) {
- * // doSomethingWith($element);
- * }
- * }
- * // Alternatively:
- * // Iterate through all elements
- * $pagedResponse = $instanceAdminClient->listInstancePartitions($formattedParent);
- * foreach ($pagedResponse->iterateAllElements() as $element) {
- * // doSomethingWith($element);
- * }
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The instance whose instance partitions should be listed. Values
- * are of the form `projects//instances/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type int $pageSize
- * The maximum number of resources contained in the underlying API
- * response. The API may return fewer values in a page, even if
- * there are additional values to be retrieved.
- * @type string $pageToken
- * A page token is used to specify a page of values to be returned.
- * If no page token is specified (the default), the first page
- * of values will be returned. Any page token used here must have
- * been generated by a previous call to the API.
- * @type Timestamp $instancePartitionDeadline
- * Optional. Deadline used while retrieving metadata for instance partitions.
- * Instance partitions whose metadata cannot be retrieved within this deadline
- * will be added to
- * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable]
- * in
- * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse].
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\PagedListResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function listInstancePartitions($parent, array $optionalArgs = [])
- {
- $request = new ListInstancePartitionsRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['pageSize'])) {
- $request->setPageSize($optionalArgs['pageSize']);
- }
-
- if (isset($optionalArgs['pageToken'])) {
- $request->setPageToken($optionalArgs['pageToken']);
- }
-
- if (isset($optionalArgs['instancePartitionDeadline'])) {
- $request->setInstancePartitionDeadline(
- $optionalArgs['instancePartitionDeadline']
- );
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->getPagedListResponse(
- 'ListInstancePartitions',
- $optionalArgs,
- ListInstancePartitionsResponse::class,
- $request
- );
- }
-
- /**
- * Lists all instances in the given project.
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $formattedParent = $instanceAdminClient->projectName('[PROJECT]');
- * // Iterate over pages of elements
- * $pagedResponse = $instanceAdminClient->listInstances($formattedParent);
- * foreach ($pagedResponse->iteratePages() as $page) {
- * foreach ($page as $element) {
- * // doSomethingWith($element);
- * }
- * }
- * // Alternatively:
- * // Iterate through all elements
- * $pagedResponse = $instanceAdminClient->listInstances($formattedParent);
- * foreach ($pagedResponse->iterateAllElements() as $element) {
- * // doSomethingWith($element);
- * }
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param string $parent Required. The name of the project for which a list of instances is
- * requested. Values are of the form `projects/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type int $pageSize
- * The maximum number of resources contained in the underlying API
- * response. The API may return fewer values in a page, even if
- * there are additional values to be retrieved.
- * @type string $pageToken
- * A page token is used to specify a page of values to be returned.
- * If no page token is specified (the default), the first page
- * of values will be returned. Any page token used here must have
- * been generated by a previous call to the API.
- * @type string $filter
- * An expression for filtering the results of the request. Filter rules are
- * case insensitive. The fields eligible for filtering are:
- *
- * * `name`
- * * `display_name`
- * * `labels.key` where key is the name of a label
- *
- * Some examples of using filters are:
- *
- * * `name:*` --> The instance has a name.
- * * `name:Howl` --> The instance's name contains the string "howl".
- * * `name:HOWL` --> Equivalent to above.
- * * `NAME:howl` --> Equivalent to above.
- * * `labels.env:*` --> The instance has the label "env".
- * * `labels.env:dev` --> The instance has the label "env" and the value of
- * the label contains the string "dev".
- * * `name:howl labels.env:dev` --> The instance's name contains "howl" and
- * it has the label "env" with its value
- * containing "dev".
- * @type Timestamp $instanceDeadline
- * Deadline used while retrieving metadata for instances.
- * Instances whose metadata cannot be retrieved within this deadline will be
- * added to
- * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable]
- * in
- * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse].
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\PagedListResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function listInstances($parent, array $optionalArgs = [])
- {
- $request = new ListInstancesRequest();
- $requestParamHeaders = [];
- $request->setParent($parent);
- $requestParamHeaders['parent'] = $parent;
- if (isset($optionalArgs['pageSize'])) {
- $request->setPageSize($optionalArgs['pageSize']);
- }
-
- if (isset($optionalArgs['pageToken'])) {
- $request->setPageToken($optionalArgs['pageToken']);
- }
-
- if (isset($optionalArgs['filter'])) {
- $request->setFilter($optionalArgs['filter']);
- }
-
- if (isset($optionalArgs['instanceDeadline'])) {
- $request->setInstanceDeadline($optionalArgs['instanceDeadline']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->getPagedListResponse(
- 'ListInstances',
- $optionalArgs,
- ListInstancesResponse::class,
- $request
- );
- }
-
- /**
- * Moves an instance to the target instance configuration. You can use the
- * returned [long-running operation][google.longrunning.Operation] to track
- * the progress of moving the instance.
- *
- * `MoveInstance` returns `FAILED_PRECONDITION` if the instance meets any of
- * the following criteria:
- *
- * * Is undergoing a move to a different instance configuration
- * * Has backups
- * * Has an ongoing update
- * * Contains any CMEK-enabled databases
- * * Is a free trial instance
- *
- * While the operation is pending:
- *
- * * All other attempts to modify the instance, including changes to its
- * compute capacity, are rejected.
- * * The following database and backup admin operations are rejected:
- *
- * * `DatabaseAdmin.CreateDatabase`
- * * `DatabaseAdmin.UpdateDatabaseDdl` (disabled if default_leader is
- * specified in the request.)
- * * `DatabaseAdmin.RestoreDatabase`
- * * `DatabaseAdmin.CreateBackup`
- * * `DatabaseAdmin.CopyBackup`
- *
- * * Both the source and target instance configurations are subject to
- * hourly compute and storage charges.
- * * The instance might experience higher read-write latencies and a higher
- * transaction abort rate. However, moving an instance doesn't cause any
- * downtime.
- *
- * The returned [long-running operation][google.longrunning.Operation] has
- * a name of the format
- * `/operations/` and can be used to track
- * the move instance operation. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [MoveInstanceMetadata][google.spanner.admin.instance.v1.MoveInstanceMetadata].
- * The [response][google.longrunning.Operation.response] field type is
- * [Instance][google.spanner.admin.instance.v1.Instance],
- * if successful.
- * Cancelling the operation sets its metadata's
- * [cancel_time][google.spanner.admin.instance.v1.MoveInstanceMetadata.cancel_time].
- * Cancellation is not immediate because it involves moving any data
- * previously moved to the target instance configuration back to the original
- * instance configuration. You can use this operation to track the progress of
- * the cancellation. Upon successful completion of the cancellation, the
- * operation terminates with `CANCELLED` status.
- *
- * If not cancelled, upon completion of the returned operation:
- *
- * * The instance successfully moves to the target instance
- * configuration.
- * * You are billed for compute and storage in target instance
- * configuration.
- *
- * Authorization requires the `spanner.instances.update` permission on
- * the resource [instance][google.spanner.admin.instance.v1.Instance].
- *
- * For more details, see
- * [Move an instance](https://cloud.google.com/spanner/docs/move-instance).
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $formattedName = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]');
- * $formattedTargetConfig = $instanceAdminClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]');
- * $operationResponse = $instanceAdminClient->moveInstance($formattedName, $formattedTargetConfig);
- * $operationResponse->pollUntilComplete();
- * if ($operationResponse->operationSucceeded()) {
- * $result = $operationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $operationResponse->getError();
- * // handleError($error)
- * }
- * // Alternatively:
- * // start the operation, keep the operation name, and resume later
- * $operationResponse = $instanceAdminClient->moveInstance($formattedName, $formattedTargetConfig);
- * $operationName = $operationResponse->getName();
- * // ... do other work
- * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'moveInstance');
- * while (!$newOperationResponse->isDone()) {
- * // ... do other work
- * $newOperationResponse->reload();
- * }
- * if ($newOperationResponse->operationSucceeded()) {
- * $result = $newOperationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $newOperationResponse->getError();
- * // handleError($error)
- * }
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param string $name Required. The instance to move.
- * Values are of the form `projects//instances/`.
- * @param string $targetConfig Required. The target instance configuration where to move the instance.
- * Values are of the form `projects//instanceConfigs/`.
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\OperationResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function moveInstance($name, $targetConfig, array $optionalArgs = [])
- {
- $request = new MoveInstanceRequest();
- $requestParamHeaders = [];
- $request->setName($name);
- $request->setTargetConfig($targetConfig);
- $requestParamHeaders['name'] = $name;
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startOperationsCall(
- 'MoveInstance',
- $optionalArgs,
- $request,
- $this->getOperationsClient()
- )->wait();
- }
-
- /**
- * Sets the access control policy on an instance resource. Replaces any
- * existing policy.
- *
- * Authorization requires `spanner.instances.setIamPolicy` on
- * [resource][google.iam.v1.SetIamPolicyRequest.resource].
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $resource = 'resource';
- * $policy = new Policy();
- * $response = $instanceAdminClient->setIamPolicy($resource, $policy);
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param string $resource REQUIRED: The resource for which the policy is being specified.
- * See the operation documentation for the appropriate value for this field.
- * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of
- * the policy is limited to a few 10s of KB. An empty policy is a
- * valid policy but certain Cloud Platform services (such as Projects)
- * might reject them.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type FieldMask $updateMask
- * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
- * the fields in the mask will be modified. If no mask is provided, the
- * following default mask is used:
- *
- * `paths: "bindings, etag"`
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Iam\V1\Policy
- *
- * @throws ApiException if the remote call fails
- */
- public function setIamPolicy($resource, $policy, array $optionalArgs = [])
- {
- $request = new SetIamPolicyRequest();
- $requestParamHeaders = [];
- $request->setResource($resource);
- $request->setPolicy($policy);
- $requestParamHeaders['resource'] = $resource;
- if (isset($optionalArgs['updateMask'])) {
- $request->setUpdateMask($optionalArgs['updateMask']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'SetIamPolicy',
- Policy::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Returns permissions that the caller has on the specified instance resource.
- *
- * Attempting this RPC on a non-existent Cloud Spanner instance resource will
- * result in a NOT_FOUND error if the user has `spanner.instances.list`
- * permission on the containing Google Cloud Project. Otherwise returns an
- * empty set of permissions.
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $resource = 'resource';
- * $permissions = [];
- * $response = $instanceAdminClient->testIamPermissions($resource, $permissions);
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param string $resource REQUIRED: The resource for which the policy detail is being requested.
- * See the operation documentation for the appropriate value for this field.
- * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with
- * wildcards (such as '*' or 'storage.*') are not allowed. For more
- * information see
- * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function testIamPermissions(
- $resource,
- $permissions,
- array $optionalArgs = []
- ) {
- $request = new TestIamPermissionsRequest();
- $requestParamHeaders = [];
- $request->setResource($resource);
- $request->setPermissions($permissions);
- $requestParamHeaders['resource'] = $resource;
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'TestIamPermissions',
- TestIamPermissionsResponse::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Updates an instance, and begins allocating or releasing resources
- * as requested. The returned [long-running
- * operation][google.longrunning.Operation] can be used to track the
- * progress of updating the instance. If the named instance does not
- * exist, returns `NOT_FOUND`.
- *
- * Immediately upon completion of this request:
- *
- * * For resource types for which a decrease in the instance's allocation
- * has been requested, billing is based on the newly-requested level.
- *
- * Until completion of the returned operation:
- *
- * * Cancelling the operation sets its metadata's
- * [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time],
- * and begins restoring resources to their pre-request values. The
- * operation is guaranteed to succeed at undoing all resource changes,
- * after which point it terminates with a `CANCELLED` status.
- * * All other attempts to modify the instance are rejected.
- * * Reading the instance via the API continues to give the pre-request
- * resource levels.
- *
- * Upon completion of the returned operation:
- *
- * * Billing begins for all successfully-allocated resources (some types
- * may have lower than the requested levels).
- * * All newly-reserved resources are available for serving the instance's
- * tables.
- * * The instance's new resource levels are readable via the API.
- *
- * The returned [long-running operation][google.longrunning.Operation] will
- * have a name of the format `/operations/` and
- * can be used to track the instance modification. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata].
- * The [response][google.longrunning.Operation.response] field type is
- * [Instance][google.spanner.admin.instance.v1.Instance], if successful.
- *
- * Authorization requires `spanner.instances.update` permission on
- * the resource [name][google.spanner.admin.instance.v1.Instance.name].
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $instance = new Instance();
- * $fieldMask = new FieldMask();
- * $operationResponse = $instanceAdminClient->updateInstance($instance, $fieldMask);
- * $operationResponse->pollUntilComplete();
- * if ($operationResponse->operationSucceeded()) {
- * $result = $operationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $operationResponse->getError();
- * // handleError($error)
- * }
- * // Alternatively:
- * // start the operation, keep the operation name, and resume later
- * $operationResponse = $instanceAdminClient->updateInstance($instance, $fieldMask);
- * $operationName = $operationResponse->getName();
- * // ... do other work
- * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'updateInstance');
- * while (!$newOperationResponse->isDone()) {
- * // ... do other work
- * $newOperationResponse->reload();
- * }
- * if ($newOperationResponse->operationSucceeded()) {
- * $result = $newOperationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $newOperationResponse->getError();
- * // handleError($error)
- * }
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param Instance $instance Required. The instance to update, which must always include the instance
- * name. Otherwise, only fields mentioned in
- * [field_mask][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask]
- * need be included.
- * @param FieldMask $fieldMask Required. A mask specifying which fields in
- * [Instance][google.spanner.admin.instance.v1.Instance] should be updated.
- * The field mask must always be specified; this prevents any future fields in
- * [Instance][google.spanner.admin.instance.v1.Instance] from being erased
- * accidentally by clients that do not know about them.
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\OperationResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function updateInstance(
- $instance,
- $fieldMask,
- array $optionalArgs = []
- ) {
- $request = new UpdateInstanceRequest();
- $requestParamHeaders = [];
- $request->setInstance($instance);
- $request->setFieldMask($fieldMask);
- $requestParamHeaders['instance.name'] = $instance->getName();
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startOperationsCall(
- 'UpdateInstance',
- $optionalArgs,
- $request,
- $this->getOperationsClient()
- )->wait();
- }
-
- /**
- * Updates an instance configuration. The returned
- * [long-running operation][google.longrunning.Operation] can be used to track
- * the progress of updating the instance. If the named instance configuration
- * does not exist, returns `NOT_FOUND`.
- *
- * Only user-managed configurations can be updated.
- *
- * Immediately after the request returns:
- *
- * * The instance configuration's
- * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling]
- * field is set to true.
- *
- * While the operation is pending:
- *
- * * Cancelling the operation sets its metadata's
- * [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.cancel_time].
- * The operation is guaranteed to succeed at undoing all changes, after
- * which point it terminates with a `CANCELLED` status.
- * * All other attempts to modify the instance configuration are rejected.
- * * Reading the instance configuration via the API continues to give the
- * pre-request values.
- *
- * Upon completion of the returned operation:
- *
- * * Creating instances using the instance configuration uses the new
- * values.
- * * The new values of the instance configuration are readable via the API.
- * * The instance configuration's
- * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling]
- * field becomes false.
- *
- * The returned [long-running operation][google.longrunning.Operation] will
- * have a name of the format
- * `/operations/` and can be used to track
- * the instance configuration modification. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata].
- * The [response][google.longrunning.Operation.response] field type is
- * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if
- * successful.
- *
- * Authorization requires `spanner.instanceConfigs.update` permission on
- * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name].
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $instanceConfig = new InstanceConfig();
- * $updateMask = new FieldMask();
- * $operationResponse = $instanceAdminClient->updateInstanceConfig($instanceConfig, $updateMask);
- * $operationResponse->pollUntilComplete();
- * if ($operationResponse->operationSucceeded()) {
- * $result = $operationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $operationResponse->getError();
- * // handleError($error)
- * }
- * // Alternatively:
- * // start the operation, keep the operation name, and resume later
- * $operationResponse = $instanceAdminClient->updateInstanceConfig($instanceConfig, $updateMask);
- * $operationName = $operationResponse->getName();
- * // ... do other work
- * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'updateInstanceConfig');
- * while (!$newOperationResponse->isDone()) {
- * // ... do other work
- * $newOperationResponse->reload();
- * }
- * if ($newOperationResponse->operationSucceeded()) {
- * $result = $newOperationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $newOperationResponse->getError();
- * // handleError($error)
- * }
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param InstanceConfig $instanceConfig Required. The user instance configuration to update, which must always
- * include the instance configuration name. Otherwise, only fields mentioned
- * in
- * [update_mask][google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask]
- * need be included. To prevent conflicts of concurrent updates,
- * [etag][google.spanner.admin.instance.v1.InstanceConfig.reconciling] can
- * be used.
- * @param FieldMask $updateMask Required. A mask specifying which fields in
- * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] should be
- * updated. The field mask must always be specified; this prevents any future
- * fields in [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig]
- * from being erased accidentally by clients that do not know about them. Only
- * display_name and labels can be updated.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type bool $validateOnly
- * An option to validate, but not actually execute, a request,
- * and provide the same response.
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\OperationResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function updateInstanceConfig(
- $instanceConfig,
- $updateMask,
- array $optionalArgs = []
- ) {
- $request = new UpdateInstanceConfigRequest();
- $requestParamHeaders = [];
- $request->setInstanceConfig($instanceConfig);
- $request->setUpdateMask($updateMask);
- $requestParamHeaders[
- 'instance_config.name'
- ] = $instanceConfig->getName();
- if (isset($optionalArgs['validateOnly'])) {
- $request->setValidateOnly($optionalArgs['validateOnly']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startOperationsCall(
- 'UpdateInstanceConfig',
- $optionalArgs,
- $request,
- $this->getOperationsClient()
- )->wait();
- }
-
- /**
- * Updates an instance partition, and begins allocating or releasing resources
- * as requested. The returned [long-running
- * operation][google.longrunning.Operation] can be used to track the
- * progress of updating the instance partition. If the named instance
- * partition does not exist, returns `NOT_FOUND`.
- *
- * Immediately upon completion of this request:
- *
- * * For resource types for which a decrease in the instance partition's
- * allocation has been requested, billing is based on the newly-requested
- * level.
- *
- * Until completion of the returned operation:
- *
- * * Cancelling the operation sets its metadata's
- * [cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time],
- * and begins restoring resources to their pre-request values. The
- * operation is guaranteed to succeed at undoing all resource changes,
- * after which point it terminates with a `CANCELLED` status.
- * * All other attempts to modify the instance partition are rejected.
- * * Reading the instance partition via the API continues to give the
- * pre-request resource levels.
- *
- * Upon completion of the returned operation:
- *
- * * Billing begins for all successfully-allocated resources (some types
- * may have lower than the requested levels).
- * * All newly-reserved resources are available for serving the instance
- * partition's tables.
- * * The instance partition's new resource levels are readable via the API.
- *
- * The returned [long-running operation][google.longrunning.Operation] will
- * have a name of the format
- * `/operations/` and can be used to
- * track the instance partition modification. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata].
- * The [response][google.longrunning.Operation.response] field type is
- * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if
- * successful.
- *
- * Authorization requires `spanner.instancePartitions.update` permission on
- * the resource
- * [name][google.spanner.admin.instance.v1.InstancePartition.name].
- *
- * Sample code:
- * ```
- * $instanceAdminClient = new InstanceAdminClient();
- * try {
- * $instancePartition = new InstancePartition();
- * $fieldMask = new FieldMask();
- * $operationResponse = $instanceAdminClient->updateInstancePartition($instancePartition, $fieldMask);
- * $operationResponse->pollUntilComplete();
- * if ($operationResponse->operationSucceeded()) {
- * $result = $operationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $operationResponse->getError();
- * // handleError($error)
- * }
- * // Alternatively:
- * // start the operation, keep the operation name, and resume later
- * $operationResponse = $instanceAdminClient->updateInstancePartition($instancePartition, $fieldMask);
- * $operationName = $operationResponse->getName();
- * // ... do other work
- * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'updateInstancePartition');
- * while (!$newOperationResponse->isDone()) {
- * // ... do other work
- * $newOperationResponse->reload();
- * }
- * if ($newOperationResponse->operationSucceeded()) {
- * $result = $newOperationResponse->getResult();
- * // doSomethingWith($result)
- * } else {
- * $error = $newOperationResponse->getError();
- * // handleError($error)
- * }
- * } finally {
- * $instanceAdminClient->close();
- * }
- * ```
- *
- * @param InstancePartition $instancePartition Required. The instance partition to update, which must always include the
- * instance partition name. Otherwise, only fields mentioned in
- * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask]
- * need be included.
- * @param FieldMask $fieldMask Required. A mask specifying which fields in
- * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
- * should be updated. The field mask must always be specified; this prevents
- * any future fields in
- * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
- * from being erased accidentally by clients that do not know about them.
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\OperationResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function updateInstancePartition(
- $instancePartition,
- $fieldMask,
- array $optionalArgs = []
- ) {
- $request = new UpdateInstancePartitionRequest();
- $requestParamHeaders = [];
- $request->setInstancePartition($instancePartition);
- $request->setFieldMask($fieldMask);
- $requestParamHeaders[
- 'instance_partition.name'
- ] = $instancePartition->getName();
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startOperationsCall(
- 'UpdateInstancePartition',
- $optionalArgs,
- $request,
- $this->getOperationsClient()
- )->wait();
- }
-}
diff --git a/Spanner/src/Admin/Instance/V1/GetInstanceConfigRequest.php b/Spanner/src/Admin/Instance/V1/GetInstanceConfigRequest.php
index d245b4f87aa5..c0d299ac0b80 100644
--- a/Spanner/src/Admin/Instance/V1/GetInstanceConfigRequest.php
+++ b/Spanner/src/Admin/Instance/V1/GetInstanceConfigRequest.php
@@ -22,7 +22,7 @@ class GetInstanceConfigRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $name = '';
+ protected $name = '';
/**
* @param string $name Required. The name of the requested instance configuration. Values are of
diff --git a/Spanner/src/Admin/Instance/V1/GetInstancePartitionRequest.php b/Spanner/src/Admin/Instance/V1/GetInstancePartitionRequest.php
index 960eefa5e295..e703503feb23 100644
--- a/Spanner/src/Admin/Instance/V1/GetInstancePartitionRequest.php
+++ b/Spanner/src/Admin/Instance/V1/GetInstancePartitionRequest.php
@@ -23,7 +23,7 @@ class GetInstancePartitionRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $name = '';
+ protected $name = '';
/**
* @param string $name Required. The name of the requested instance partition. Values are of
diff --git a/Spanner/src/Admin/Instance/V1/GetInstanceRequest.php b/Spanner/src/Admin/Instance/V1/GetInstanceRequest.php
index d16760cd5c65..6f054759ba44 100644
--- a/Spanner/src/Admin/Instance/V1/GetInstanceRequest.php
+++ b/Spanner/src/Admin/Instance/V1/GetInstanceRequest.php
@@ -22,7 +22,7 @@ class GetInstanceRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $name = '';
+ protected $name = '';
/**
* If field_mask is present, specifies the subset of
* [Instance][google.spanner.admin.instance.v1.Instance] fields that should be
@@ -31,7 +31,7 @@ class GetInstanceRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.FieldMask field_mask = 2;
*/
- private $field_mask = null;
+ protected $field_mask = null;
/**
* @param string $name Required. The name of the requested instance. Values are of the form
diff --git a/Spanner/src/Admin/Instance/V1/Instance.php b/Spanner/src/Admin/Instance/V1/Instance.php
index 27cafab2cc74..04ec9c6386d7 100644
--- a/Spanner/src/Admin/Instance/V1/Instance.php
+++ b/Spanner/src/Admin/Instance/V1/Instance.php
@@ -23,7 +23,7 @@ class Instance extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $name = '';
+ protected $name = '';
/**
* Required. The name of the instance's configuration. Values are of the form
* `projects//instanceConfigs/`. See
@@ -32,14 +32,14 @@ class Instance extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $config = '';
+ protected $config = '';
/**
* Required. The descriptive name for this instance as it appears in UIs.
* Must be unique per project and between 4 and 30 characters in length.
*
* Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED];
*/
- private $display_name = '';
+ protected $display_name = '';
/**
* The number of nodes allocated to this instance. At most, one of either
* `node_count` or `processing_units` should be present in the message.
@@ -58,7 +58,7 @@ class Instance extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field int32 node_count = 5;
*/
- private $node_count = 0;
+ protected $node_count = 0;
/**
* The number of processing units allocated to this instance. At most, one of
* either `processing_units` or `node_count` should be present in the message.
@@ -79,7 +79,7 @@ class Instance extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field int32 processing_units = 9;
*/
- private $processing_units = 0;
+ protected $processing_units = 0;
/**
* Output only. Lists the compute capacity per ReplicaSelection. A replica
* selection identifies a set of replicas with common properties. Replicas
@@ -96,7 +96,7 @@ class Instance extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig autoscaling_config = 17 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $autoscaling_config = null;
+ protected $autoscaling_config = null;
/**
* Output only. The current instance state. For
* [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance],
@@ -106,7 +106,7 @@ class Instance extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.instance.v1.Instance.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $state = 0;
+ protected $state = 0;
/**
* Cloud Labels are a flexible and lightweight mechanism for organizing cloud
* resources into groups that reflect a customer's organizational needs and
@@ -141,7 +141,7 @@ class Instance extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp create_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $create_time = null;
+ protected $create_time = null;
/**
* Output only. The time at which the instance was most recently updated.
*
diff --git a/Spanner/src/Admin/Instance/V1/InstanceAdminGrpcClient.php b/Spanner/src/Admin/Instance/V1/InstanceAdminGrpcClient.php
deleted file mode 100644
index aa03f20e91b5..000000000000
--- a/Spanner/src/Admin/Instance/V1/InstanceAdminGrpcClient.php
+++ /dev/null
@@ -1,460 +0,0 @@
-_simpleRequest('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstanceConfigs',
- $argument,
- ['\Google\Cloud\Spanner\Admin\Instance\V1\ListInstanceConfigsResponse', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Gets information about a particular instance configuration.
- * @param \Google\Cloud\Spanner\Admin\Instance\V1\GetInstanceConfigRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function GetInstanceConfig(\Google\Cloud\Spanner\Admin\Instance\V1\GetInstanceConfigRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.instance.v1.InstanceAdmin/GetInstanceConfig',
- $argument,
- ['\Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Creates an instance config and begins preparing it to be used. The
- * returned [long-running operation][google.longrunning.Operation]
- * can be used to track the progress of preparing the new
- * instance config. The instance config name is assigned by the caller. If the
- * named instance config already exists, `CreateInstanceConfig` returns
- * `ALREADY_EXISTS`.
- *
- * Immediately after the request returns:
- *
- * * The instance config is readable via the API, with all requested
- * attributes. The instance config's
- * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling]
- * field is set to true. Its state is `CREATING`.
- *
- * While the operation is pending:
- *
- * * Cancelling the operation renders the instance config immediately
- * unreadable via the API.
- * * Except for deleting the creating resource, all other attempts to modify
- * the instance config are rejected.
- *
- * Upon completion of the returned operation:
- *
- * * Instances can be created using the instance configuration.
- * * The instance config's
- * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling]
- * field becomes false. Its state becomes `READY`.
- *
- * The returned [long-running operation][google.longrunning.Operation] will
- * have a name of the format
- * `/operations/` and can be used to track
- * creation of the instance config. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata].
- * The [response][google.longrunning.Operation.response] field type is
- * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if
- * successful.
- *
- * Authorization requires `spanner.instanceConfigs.create` permission on
- * the resource
- * [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.parent].
- * @param \Google\Cloud\Spanner\Admin\Instance\V1\CreateInstanceConfigRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function CreateInstanceConfig(\Google\Cloud\Spanner\Admin\Instance\V1\CreateInstanceConfigRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.instance.v1.InstanceAdmin/CreateInstanceConfig',
- $argument,
- ['\Google\LongRunning\Operation', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Updates an instance config. The returned
- * [long-running operation][google.longrunning.Operation] can be used to track
- * the progress of updating the instance. If the named instance config does
- * not exist, returns `NOT_FOUND`.
- *
- * Only user managed configurations can be updated.
- *
- * Immediately after the request returns:
- *
- * * The instance config's
- * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling]
- * field is set to true.
- *
- * While the operation is pending:
- *
- * * Cancelling the operation sets its metadata's
- * [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.cancel_time].
- * The operation is guaranteed to succeed at undoing all changes, after
- * which point it terminates with a `CANCELLED` status.
- * * All other attempts to modify the instance config are rejected.
- * * Reading the instance config via the API continues to give the
- * pre-request values.
- *
- * Upon completion of the returned operation:
- *
- * * Creating instances using the instance configuration uses the new
- * values.
- * * The instance config's new values are readable via the API.
- * * The instance config's
- * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling]
- * field becomes false.
- *
- * The returned [long-running operation][google.longrunning.Operation] will
- * have a name of the format
- * `/operations/` and can be used to track
- * the instance config modification. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata].
- * The [response][google.longrunning.Operation.response] field type is
- * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if
- * successful.
- *
- * Authorization requires `spanner.instanceConfigs.update` permission on
- * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name].
- * @param \Google\Cloud\Spanner\Admin\Instance\V1\UpdateInstanceConfigRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function UpdateInstanceConfig(\Google\Cloud\Spanner\Admin\Instance\V1\UpdateInstanceConfigRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstanceConfig',
- $argument,
- ['\Google\LongRunning\Operation', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Deletes the instance config. Deletion is only allowed when no
- * instances are using the configuration. If any instances are using
- * the config, returns `FAILED_PRECONDITION`.
- *
- * Only user managed configurations can be deleted.
- *
- * Authorization requires `spanner.instanceConfigs.delete` permission on
- * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name].
- * @param \Google\Cloud\Spanner\Admin\Instance\V1\DeleteInstanceConfigRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function DeleteInstanceConfig(\Google\Cloud\Spanner\Admin\Instance\V1\DeleteInstanceConfigRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstanceConfig',
- $argument,
- ['\Google\Protobuf\GPBEmpty', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Lists the user-managed instance config [long-running
- * operations][google.longrunning.Operation] in the given project. An instance
- * config operation has a name of the form
- * `projects//instanceConfigs//operations/`.
- * The long-running operation
- * [metadata][google.longrunning.Operation.metadata] field type
- * `metadata.type_url` describes the type of the metadata. Operations returned
- * include those that have completed/failed/canceled within the last 7 days,
- * and pending operations. Operations returned are ordered by
- * `operation.metadata.value.start_time` in descending order starting
- * from the most recently started operation.
- * @param \Google\Cloud\Spanner\Admin\Instance\V1\ListInstanceConfigOperationsRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function ListInstanceConfigOperations(\Google\Cloud\Spanner\Admin\Instance\V1\ListInstanceConfigOperationsRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstanceConfigOperations',
- $argument,
- ['\Google\Cloud\Spanner\Admin\Instance\V1\ListInstanceConfigOperationsResponse', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Lists all instances in the given project.
- * @param \Google\Cloud\Spanner\Admin\Instance\V1\ListInstancesRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function ListInstances(\Google\Cloud\Spanner\Admin\Instance\V1\ListInstancesRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstances',
- $argument,
- ['\Google\Cloud\Spanner\Admin\Instance\V1\ListInstancesResponse', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Gets information about a particular instance.
- * @param \Google\Cloud\Spanner\Admin\Instance\V1\GetInstanceRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function GetInstance(\Google\Cloud\Spanner\Admin\Instance\V1\GetInstanceRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.instance.v1.InstanceAdmin/GetInstance',
- $argument,
- ['\Google\Cloud\Spanner\Admin\Instance\V1\Instance', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Creates an instance and begins preparing it to begin serving. The
- * returned [long-running operation][google.longrunning.Operation]
- * can be used to track the progress of preparing the new
- * instance. The instance name is assigned by the caller. If the
- * named instance already exists, `CreateInstance` returns
- * `ALREADY_EXISTS`.
- *
- * Immediately upon completion of this request:
- *
- * * The instance is readable via the API, with all requested attributes
- * but no allocated resources. Its state is `CREATING`.
- *
- * Until completion of the returned operation:
- *
- * * Cancelling the operation renders the instance immediately unreadable
- * via the API.
- * * The instance can be deleted.
- * * All other attempts to modify the instance are rejected.
- *
- * Upon completion of the returned operation:
- *
- * * Billing for all successfully-allocated resources begins (some types
- * may have lower than the requested levels).
- * * Databases can be created in the instance.
- * * The instance's allocated resource levels are readable via the API.
- * * The instance's state becomes `READY`.
- *
- * The returned [long-running operation][google.longrunning.Operation] will
- * have a name of the format `/operations/` and
- * can be used to track creation of the instance. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata].
- * The [response][google.longrunning.Operation.response] field type is
- * [Instance][google.spanner.admin.instance.v1.Instance], if successful.
- * @param \Google\Cloud\Spanner\Admin\Instance\V1\CreateInstanceRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function CreateInstance(\Google\Cloud\Spanner\Admin\Instance\V1\CreateInstanceRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.instance.v1.InstanceAdmin/CreateInstance',
- $argument,
- ['\Google\LongRunning\Operation', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Updates an instance, and begins allocating or releasing resources
- * as requested. The returned [long-running
- * operation][google.longrunning.Operation] can be used to track the
- * progress of updating the instance. If the named instance does not
- * exist, returns `NOT_FOUND`.
- *
- * Immediately upon completion of this request:
- *
- * * For resource types for which a decrease in the instance's allocation
- * has been requested, billing is based on the newly-requested level.
- *
- * Until completion of the returned operation:
- *
- * * Cancelling the operation sets its metadata's
- * [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time],
- * and begins restoring resources to their pre-request values. The
- * operation is guaranteed to succeed at undoing all resource changes,
- * after which point it terminates with a `CANCELLED` status.
- * * All other attempts to modify the instance are rejected.
- * * Reading the instance via the API continues to give the pre-request
- * resource levels.
- *
- * Upon completion of the returned operation:
- *
- * * Billing begins for all successfully-allocated resources (some types
- * may have lower than the requested levels).
- * * All newly-reserved resources are available for serving the instance's
- * tables.
- * * The instance's new resource levels are readable via the API.
- *
- * The returned [long-running operation][google.longrunning.Operation] will
- * have a name of the format `/operations/` and
- * can be used to track the instance modification. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata].
- * The [response][google.longrunning.Operation.response] field type is
- * [Instance][google.spanner.admin.instance.v1.Instance], if successful.
- *
- * Authorization requires `spanner.instances.update` permission on
- * the resource [name][google.spanner.admin.instance.v1.Instance.name].
- * @param \Google\Cloud\Spanner\Admin\Instance\V1\UpdateInstanceRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function UpdateInstance(\Google\Cloud\Spanner\Admin\Instance\V1\UpdateInstanceRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstance',
- $argument,
- ['\Google\LongRunning\Operation', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Deletes an instance.
- *
- * Immediately upon completion of the request:
- *
- * * Billing ceases for all of the instance's reserved resources.
- *
- * Soon afterward:
- *
- * * The instance and *all of its databases* immediately and
- * irrevocably disappear from the API. All data in the databases
- * is permanently deleted.
- * @param \Google\Cloud\Spanner\Admin\Instance\V1\DeleteInstanceRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function DeleteInstance(\Google\Cloud\Spanner\Admin\Instance\V1\DeleteInstanceRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstance',
- $argument,
- ['\Google\Protobuf\GPBEmpty', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Sets the access control policy on an instance resource. Replaces any
- * existing policy.
- *
- * Authorization requires `spanner.instances.setIamPolicy` on
- * [resource][google.iam.v1.SetIamPolicyRequest.resource].
- * @param \Google\Cloud\Iam\V1\SetIamPolicyRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function SetIamPolicy(\Google\Cloud\Iam\V1\SetIamPolicyRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.instance.v1.InstanceAdmin/SetIamPolicy',
- $argument,
- ['\Google\Cloud\Iam\V1\Policy', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Gets the access control policy for an instance resource. Returns an empty
- * policy if an instance exists but does not have a policy set.
- *
- * Authorization requires `spanner.instances.getIamPolicy` on
- * [resource][google.iam.v1.GetIamPolicyRequest.resource].
- * @param \Google\Cloud\Iam\V1\GetIamPolicyRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function GetIamPolicy(\Google\Cloud\Iam\V1\GetIamPolicyRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.instance.v1.InstanceAdmin/GetIamPolicy',
- $argument,
- ['\Google\Cloud\Iam\V1\Policy', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Returns permissions that the caller has on the specified instance resource.
- *
- * Attempting this RPC on a non-existent Cloud Spanner instance resource will
- * result in a NOT_FOUND error if the user has `spanner.instances.list`
- * permission on the containing Google Cloud Project. Otherwise returns an
- * empty set of permissions.
- * @param \Google\Cloud\Iam\V1\TestIamPermissionsRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function TestIamPermissions(\Google\Cloud\Iam\V1\TestIamPermissionsRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.admin.instance.v1.InstanceAdmin/TestIamPermissions',
- $argument,
- ['\Google\Cloud\Iam\V1\TestIamPermissionsResponse', 'decode'],
- $metadata, $options);
- }
-
-}
diff --git a/Spanner/src/Admin/Instance/V1/InstanceConfig.php b/Spanner/src/Admin/Instance/V1/InstanceConfig.php
index 73b4e0350fee..8335fa12e998 100644
--- a/Spanner/src/Admin/Instance/V1/InstanceConfig.php
+++ b/Spanner/src/Admin/Instance/V1/InstanceConfig.php
@@ -24,20 +24,20 @@ class InstanceConfig extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1;
*/
- private $name = '';
+ protected $name = '';
/**
* The name of this instance configuration as it appears in UIs.
*
* Generated from protobuf field string display_name = 2;
*/
- private $display_name = '';
+ protected $display_name = '';
/**
* Output only. Whether this instance configuration is a Google-managed or
* user-managed configuration.
*
* Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.Type config_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $config_type = 0;
+ protected $config_type = 0;
/**
* The geographic placement of nodes in this instance configuration and their
* replication properties.
@@ -60,7 +60,7 @@ class InstanceConfig extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string base_config = 7 [(.google.api.resource_reference) = {
*/
- private $base_config = '';
+ protected $base_config = '';
/**
* Cloud Labels are a flexible and lightweight mechanism for organizing cloud
* resources into groups that reflect a customer's organizational needs and
@@ -99,7 +99,7 @@ class InstanceConfig extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string etag = 9;
*/
- private $etag = '';
+ protected $etag = '';
/**
* Allowed values of the "default_leader" schema option for databases in
* instances that use this instance configuration.
@@ -114,14 +114,14 @@ class InstanceConfig extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bool reconciling = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $reconciling = false;
+ protected $reconciling = false;
/**
* Output only. The current instance configuration state. Applicable only for
* `USER_MANAGED` configurations.
*
* Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.State state = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $state = 0;
+ protected $state = 0;
/**
* Constructor.
diff --git a/Spanner/src/Admin/Instance/V1/InstanceConfig_State.php b/Spanner/src/Admin/Instance/V1/InstanceConfig_State.php
deleted file mode 100644
index e881bb0b827e..000000000000
--- a/Spanner/src/Admin/Instance/V1/InstanceConfig_State.php
+++ /dev/null
@@ -1,16 +0,0 @@
-string name = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $name = '';
+ protected $name = '';
/**
* Required. The name of the instance partition's configuration. Values are of
* the form `projects//instanceConfigs/`. See also
@@ -35,33 +35,33 @@ class InstancePartition extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $config = '';
+ protected $config = '';
/**
* Required. The descriptive name for this instance partition as it appears in
* UIs. Must be unique per project and between 4 and 30 characters in length.
*
* Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED];
*/
- private $display_name = '';
+ protected $display_name = '';
/**
* Output only. The current instance partition state.
*
* Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $state = 0;
+ protected $state = 0;
/**
* Output only. The time at which the instance partition was created.
*
* Generated from protobuf field .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $create_time = null;
+ protected $create_time = null;
/**
* Output only. The time at which the instance partition was most recently
* updated.
*
* Generated from protobuf field .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $update_time = null;
+ protected $update_time = null;
/**
* Output only. The names of the databases that reference this
* instance partition. Referencing databases should share the parent instance.
@@ -94,7 +94,7 @@ class InstancePartition extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string etag = 12;
*/
- private $etag = '';
+ protected $etag = '';
protected $compute_capacity;
/**
diff --git a/Spanner/src/Admin/Instance/V1/Instance_State.php b/Spanner/src/Admin/Instance/V1/Instance_State.php
deleted file mode 100644
index b53e838f3a22..000000000000
--- a/Spanner/src/Admin/Instance/V1/Instance_State.php
+++ /dev/null
@@ -1,16 +0,0 @@
-string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* An expression that filters the list of returned operations.
* A filter expression consists of a field name, a
@@ -64,14 +64,14 @@ class ListInstanceConfigOperationsRequest extends \Google\Protobuf\Internal\Mess
*
* Generated from protobuf field string filter = 2;
*/
- private $filter = '';
+ protected $filter = '';
/**
* Number of operations to be returned in the response. If 0 or
* less, defaults to the server's maximum allowed page size.
*
* Generated from protobuf field int32 page_size = 3;
*/
- private $page_size = 0;
+ protected $page_size = 0;
/**
* If non-empty, `page_token` should contain a
* [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse.next_page_token]
@@ -81,7 +81,7 @@ class ListInstanceConfigOperationsRequest extends \Google\Protobuf\Internal\Mess
*
* Generated from protobuf field string page_token = 4;
*/
- private $page_token = '';
+ protected $page_token = '';
/**
* @param string $parent Required. The project of the instance configuration operations.
diff --git a/Spanner/src/Admin/Instance/V1/ListInstanceConfigOperationsResponse.php b/Spanner/src/Admin/Instance/V1/ListInstanceConfigOperationsResponse.php
index 10d805eb3e32..7f1b94df9792 100644
--- a/Spanner/src/Admin/Instance/V1/ListInstanceConfigOperationsResponse.php
+++ b/Spanner/src/Admin/Instance/V1/ListInstanceConfigOperationsResponse.php
@@ -33,7 +33,7 @@ class ListInstanceConfigOperationsResponse extends \Google\Protobuf\Internal\Mes
*
* Generated from protobuf field string next_page_token = 2;
*/
- private $next_page_token = '';
+ protected $next_page_token = '';
/**
* Constructor.
diff --git a/Spanner/src/Admin/Instance/V1/ListInstanceConfigsRequest.php b/Spanner/src/Admin/Instance/V1/ListInstanceConfigsRequest.php
index dbcafba1d48a..8a0b73a6192b 100644
--- a/Spanner/src/Admin/Instance/V1/ListInstanceConfigsRequest.php
+++ b/Spanner/src/Admin/Instance/V1/ListInstanceConfigsRequest.php
@@ -23,14 +23,14 @@ class ListInstanceConfigsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Number of instance configurations to be returned in the response. If 0 or
* less, defaults to the server's maximum allowed page size.
*
* Generated from protobuf field int32 page_size = 2;
*/
- private $page_size = 0;
+ protected $page_size = 0;
/**
* If non-empty, `page_token` should contain a
* [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigsResponse.next_page_token]
@@ -39,7 +39,7 @@ class ListInstanceConfigsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string page_token = 3;
*/
- private $page_token = '';
+ protected $page_token = '';
/**
* @param string $parent Required. The name of the project for which a list of supported instance
diff --git a/Spanner/src/Admin/Instance/V1/ListInstanceConfigsResponse.php b/Spanner/src/Admin/Instance/V1/ListInstanceConfigsResponse.php
index 6c94a0bd4e28..73241c4da20d 100644
--- a/Spanner/src/Admin/Instance/V1/ListInstanceConfigsResponse.php
+++ b/Spanner/src/Admin/Instance/V1/ListInstanceConfigsResponse.php
@@ -29,7 +29,7 @@ class ListInstanceConfigsResponse extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string next_page_token = 2;
*/
- private $next_page_token = '';
+ protected $next_page_token = '';
/**
* Constructor.
diff --git a/Spanner/src/Admin/Instance/V1/ListInstancePartitionOperationsRequest.php b/Spanner/src/Admin/Instance/V1/ListInstancePartitionOperationsRequest.php
index 3f66a1028928..a5dfe05b950b 100644
--- a/Spanner/src/Admin/Instance/V1/ListInstancePartitionOperationsRequest.php
+++ b/Spanner/src/Admin/Instance/V1/ListInstancePartitionOperationsRequest.php
@@ -22,7 +22,7 @@ class ListInstancePartitionOperationsRequest extends \Google\Protobuf\Internal\M
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Optional. An expression that filters the list of returned operations.
* A filter expression consists of a field name, a
@@ -64,14 +64,14 @@ class ListInstancePartitionOperationsRequest extends \Google\Protobuf\Internal\M
*
* Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $filter = '';
+ protected $filter = '';
/**
* Optional. Number of operations to be returned in the response. If 0 or
* less, defaults to the server's maximum allowed page size.
*
* Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $page_size = 0;
+ protected $page_size = 0;
/**
* Optional. If non-empty, `page_token` should contain a
* [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token]
@@ -81,7 +81,7 @@ class ListInstancePartitionOperationsRequest extends \Google\Protobuf\Internal\M
*
* Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $page_token = '';
+ protected $page_token = '';
/**
* Optional. Deadline used while retrieving metadata for instance partition
* operations. Instance partitions whose operation metadata cannot be
@@ -91,7 +91,7 @@ class ListInstancePartitionOperationsRequest extends \Google\Protobuf\Internal\M
*
* Generated from protobuf field .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $instance_partition_deadline = null;
+ protected $instance_partition_deadline = null;
/**
* @param string $parent Required. The parent instance of the instance partition operations.
diff --git a/Spanner/src/Admin/Instance/V1/ListInstancePartitionOperationsResponse.php b/Spanner/src/Admin/Instance/V1/ListInstancePartitionOperationsResponse.php
index 8ed281a554bf..44acc94c32aa 100644
--- a/Spanner/src/Admin/Instance/V1/ListInstancePartitionOperationsResponse.php
+++ b/Spanner/src/Admin/Instance/V1/ListInstancePartitionOperationsResponse.php
@@ -33,7 +33,7 @@ class ListInstancePartitionOperationsResponse extends \Google\Protobuf\Internal\
*
* Generated from protobuf field string next_page_token = 2;
*/
- private $next_page_token = '';
+ protected $next_page_token = '';
/**
* The list of unreachable instance partitions.
* It includes the names of instance partitions whose operation metadata could
diff --git a/Spanner/src/Admin/Instance/V1/ListInstancePartitionsRequest.php b/Spanner/src/Admin/Instance/V1/ListInstancePartitionsRequest.php
index 877be2da98d1..aa607b0405c0 100644
--- a/Spanner/src/Admin/Instance/V1/ListInstancePartitionsRequest.php
+++ b/Spanner/src/Admin/Instance/V1/ListInstancePartitionsRequest.php
@@ -22,14 +22,14 @@ class ListInstancePartitionsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Number of instance partitions to be returned in the response. If 0 or less,
* defaults to the server's maximum allowed page size.
*
* Generated from protobuf field int32 page_size = 2;
*/
- private $page_size = 0;
+ protected $page_size = 0;
/**
* If non-empty, `page_token` should contain a
* [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token]
@@ -38,7 +38,7 @@ class ListInstancePartitionsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string page_token = 3;
*/
- private $page_token = '';
+ protected $page_token = '';
/**
* Optional. Deadline used while retrieving metadata for instance partitions.
* Instance partitions whose metadata cannot be retrieved within this deadline
@@ -49,7 +49,7 @@ class ListInstancePartitionsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $instance_partition_deadline = null;
+ protected $instance_partition_deadline = null;
/**
* @param string $parent Required. The instance whose instance partitions should be listed. Values
diff --git a/Spanner/src/Admin/Instance/V1/ListInstancePartitionsResponse.php b/Spanner/src/Admin/Instance/V1/ListInstancePartitionsResponse.php
index 916ce4a772ff..17a9ccba92b2 100644
--- a/Spanner/src/Admin/Instance/V1/ListInstancePartitionsResponse.php
+++ b/Spanner/src/Admin/Instance/V1/ListInstancePartitionsResponse.php
@@ -29,7 +29,7 @@ class ListInstancePartitionsResponse extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string next_page_token = 2;
*/
- private $next_page_token = '';
+ protected $next_page_token = '';
/**
* The list of unreachable instance partitions.
* It includes the names of instance partitions whose metadata could
diff --git a/Spanner/src/Admin/Instance/V1/ListInstancesRequest.php b/Spanner/src/Admin/Instance/V1/ListInstancesRequest.php
index 4c551b16fec6..acf67c1d3534 100644
--- a/Spanner/src/Admin/Instance/V1/ListInstancesRequest.php
+++ b/Spanner/src/Admin/Instance/V1/ListInstancesRequest.php
@@ -22,14 +22,14 @@ class ListInstancesRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $parent = '';
+ protected $parent = '';
/**
* Number of instances to be returned in the response. If 0 or less, defaults
* to the server's maximum allowed page size.
*
* Generated from protobuf field int32 page_size = 2;
*/
- private $page_size = 0;
+ protected $page_size = 0;
/**
* If non-empty, `page_token` should contain a
* [next_page_token][google.spanner.admin.instance.v1.ListInstancesResponse.next_page_token]
@@ -38,7 +38,7 @@ class ListInstancesRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string page_token = 3;
*/
- private $page_token = '';
+ protected $page_token = '';
/**
* An expression for filtering the results of the request. Filter rules are
* case insensitive. The fields eligible for filtering are:
@@ -59,7 +59,7 @@ class ListInstancesRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string filter = 4;
*/
- private $filter = '';
+ protected $filter = '';
/**
* Deadline used while retrieving metadata for instances.
* Instances whose metadata cannot be retrieved within this deadline will be
@@ -70,7 +70,7 @@ class ListInstancesRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp instance_deadline = 5;
*/
- private $instance_deadline = null;
+ protected $instance_deadline = null;
/**
* @param string $parent Required. The name of the project for which a list of instances is
diff --git a/Spanner/src/Admin/Instance/V1/ListInstancesResponse.php b/Spanner/src/Admin/Instance/V1/ListInstancesResponse.php
index 238ee34febe6..cc134da2aac1 100644
--- a/Spanner/src/Admin/Instance/V1/ListInstancesResponse.php
+++ b/Spanner/src/Admin/Instance/V1/ListInstancesResponse.php
@@ -29,7 +29,7 @@ class ListInstancesResponse extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string next_page_token = 2;
*/
- private $next_page_token = '';
+ protected $next_page_token = '';
/**
* The list of unreachable instances.
* It includes the names of instances whose metadata could not be retrieved
diff --git a/Spanner/src/Admin/Instance/V1/OperationProgress.php b/Spanner/src/Admin/Instance/V1/OperationProgress.php
index c0e737b86467..e6b2e6c751d6 100644
--- a/Spanner/src/Admin/Instance/V1/OperationProgress.php
+++ b/Spanner/src/Admin/Instance/V1/OperationProgress.php
@@ -22,20 +22,20 @@ class OperationProgress extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field int32 progress_percent = 1;
*/
- private $progress_percent = 0;
+ protected $progress_percent = 0;
/**
* Time the request was received.
*
* Generated from protobuf field .google.protobuf.Timestamp start_time = 2;
*/
- private $start_time = null;
+ protected $start_time = null;
/**
* If set, the time at which this operation failed or was completed
* successfully.
*
* Generated from protobuf field .google.protobuf.Timestamp end_time = 3;
*/
- private $end_time = null;
+ protected $end_time = null;
/**
* Constructor.
diff --git a/Spanner/src/Admin/Instance/V1/ReplicaInfo.php b/Spanner/src/Admin/Instance/V1/ReplicaInfo.php
index 858d005c5bc3..634aae3a12c4 100644
--- a/Spanner/src/Admin/Instance/V1/ReplicaInfo.php
+++ b/Spanner/src/Admin/Instance/V1/ReplicaInfo.php
@@ -18,13 +18,13 @@ class ReplicaInfo extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string location = 1;
*/
- private $location = '';
+ protected $location = '';
/**
* The type of replica.
*
* Generated from protobuf field .google.spanner.admin.instance.v1.ReplicaInfo.ReplicaType type = 2;
*/
- private $type = 0;
+ protected $type = 0;
/**
* If true, this location is designated as the default leader location where
* leader replicas are placed. See the [region types
@@ -33,7 +33,7 @@ class ReplicaInfo extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bool default_leader_location = 3;
*/
- private $default_leader_location = false;
+ protected $default_leader_location = false;
/**
* Constructor.
diff --git a/Spanner/src/Admin/Instance/V1/ReplicaInfo_ReplicaType.php b/Spanner/src/Admin/Instance/V1/ReplicaInfo_ReplicaType.php
deleted file mode 100644
index 05b3e6d0daed..000000000000
--- a/Spanner/src/Admin/Instance/V1/ReplicaInfo_ReplicaType.php
+++ /dev/null
@@ -1,16 +0,0 @@
-.google.spanner.admin.instance.v1.InstanceConfig instance_config = 1;
*/
- private $instance_config = null;
+ protected $instance_config = null;
/**
* The progress of the
* [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig]
@@ -29,13 +29,13 @@ class UpdateInstanceConfigMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.instance.v1.OperationProgress progress = 2;
*/
- private $progress = null;
+ protected $progress = null;
/**
* The time at which this operation was cancelled.
*
* Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3;
*/
- private $cancel_time = null;
+ protected $cancel_time = null;
/**
* Constructor.
diff --git a/Spanner/src/Admin/Instance/V1/UpdateInstanceConfigRequest.php b/Spanner/src/Admin/Instance/V1/UpdateInstanceConfigRequest.php
index 29962464c2b5..799fc558ceaa 100644
--- a/Spanner/src/Admin/Instance/V1/UpdateInstanceConfigRequest.php
+++ b/Spanner/src/Admin/Instance/V1/UpdateInstanceConfigRequest.php
@@ -27,7 +27,7 @@ class UpdateInstanceConfigRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $instance_config = null;
+ protected $instance_config = null;
/**
* Required. A mask specifying which fields in
* [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] should be
@@ -38,14 +38,14 @@ class UpdateInstanceConfigRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $update_mask = null;
+ protected $update_mask = null;
/**
* An option to validate, but not actually execute, a request,
* and provide the same response.
*
* Generated from protobuf field bool validate_only = 3;
*/
- private $validate_only = false;
+ protected $validate_only = false;
/**
* @param \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $instanceConfig Required. The user instance configuration to update, which must always
diff --git a/Spanner/src/Admin/Instance/V1/UpdateInstanceMetadata.php b/Spanner/src/Admin/Instance/V1/UpdateInstanceMetadata.php
index a679660b4d0f..75231230c5bc 100644
--- a/Spanner/src/Admin/Instance/V1/UpdateInstanceMetadata.php
+++ b/Spanner/src/Admin/Instance/V1/UpdateInstanceMetadata.php
@@ -21,7 +21,7 @@ class UpdateInstanceMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1;
*/
- private $instance = null;
+ protected $instance = null;
/**
* The time at which
* [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance]
@@ -29,7 +29,7 @@ class UpdateInstanceMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp start_time = 2;
*/
- private $start_time = null;
+ protected $start_time = null;
/**
* The time at which this operation was cancelled. If set, this operation is
* in the process of undoing itself (which is guaranteed to succeed) and
@@ -37,19 +37,19 @@ class UpdateInstanceMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3;
*/
- private $cancel_time = null;
+ protected $cancel_time = null;
/**
* The time at which this operation failed or was completed successfully.
*
* Generated from protobuf field .google.protobuf.Timestamp end_time = 4;
*/
- private $end_time = null;
+ protected $end_time = null;
/**
* The expected fulfillment period of this update operation.
*
* Generated from protobuf field .google.spanner.admin.instance.v1.FulfillmentPeriod expected_fulfillment_period = 5;
*/
- private $expected_fulfillment_period = 0;
+ protected $expected_fulfillment_period = 0;
/**
* Constructor.
diff --git a/Spanner/src/Admin/Instance/V1/UpdateInstancePartitionMetadata.php b/Spanner/src/Admin/Instance/V1/UpdateInstancePartitionMetadata.php
index f136c262b2de..7d36e9dc23bd 100644
--- a/Spanner/src/Admin/Instance/V1/UpdateInstancePartitionMetadata.php
+++ b/Spanner/src/Admin/Instance/V1/UpdateInstancePartitionMetadata.php
@@ -21,7 +21,7 @@ class UpdateInstancePartitionMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1;
*/
- private $instance_partition = null;
+ protected $instance_partition = null;
/**
* The time at which
* [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition]
@@ -29,7 +29,7 @@ class UpdateInstancePartitionMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp start_time = 2;
*/
- private $start_time = null;
+ protected $start_time = null;
/**
* The time at which this operation was cancelled. If set, this operation is
* in the process of undoing itself (which is guaranteed to succeed) and
@@ -37,13 +37,13 @@ class UpdateInstancePartitionMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3;
*/
- private $cancel_time = null;
+ protected $cancel_time = null;
/**
* The time at which this operation failed or was completed successfully.
*
* Generated from protobuf field .google.protobuf.Timestamp end_time = 4;
*/
- private $end_time = null;
+ protected $end_time = null;
/**
* Constructor.
diff --git a/Spanner/src/Admin/Instance/V1/UpdateInstancePartitionRequest.php b/Spanner/src/Admin/Instance/V1/UpdateInstancePartitionRequest.php
index e58ea51519e3..8cab2a4ee3fa 100644
--- a/Spanner/src/Admin/Instance/V1/UpdateInstancePartitionRequest.php
+++ b/Spanner/src/Admin/Instance/V1/UpdateInstancePartitionRequest.php
@@ -24,7 +24,7 @@ class UpdateInstancePartitionRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $instance_partition = null;
+ protected $instance_partition = null;
/**
* Required. A mask specifying which fields in
* [InstancePartition][google.spanner.admin.instance.v1.InstancePartition]
@@ -35,7 +35,7 @@ class UpdateInstancePartitionRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $field_mask = null;
+ protected $field_mask = null;
/**
* @param \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $instancePartition Required. The instance partition to update, which must always include the
diff --git a/Spanner/src/Admin/Instance/V1/UpdateInstanceRequest.php b/Spanner/src/Admin/Instance/V1/UpdateInstanceRequest.php
index c45c97a6052d..f787f2e812ec 100644
--- a/Spanner/src/Admin/Instance/V1/UpdateInstanceRequest.php
+++ b/Spanner/src/Admin/Instance/V1/UpdateInstanceRequest.php
@@ -24,7 +24,7 @@ class UpdateInstanceRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $instance = null;
+ protected $instance = null;
/**
* Required. A mask specifying which fields in
* [Instance][google.spanner.admin.instance.v1.Instance] should be updated.
@@ -34,7 +34,7 @@ class UpdateInstanceRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $field_mask = null;
+ protected $field_mask = null;
/**
* @param \Google\Cloud\Spanner\Admin\Instance\V1\Instance $instance Required. The instance to update, which must always include the instance
diff --git a/Spanner/src/V1/BatchCreateSessionsRequest.php b/Spanner/src/V1/BatchCreateSessionsRequest.php
index 29eccb7710cc..f76a48fe2104 100644
--- a/Spanner/src/V1/BatchCreateSessionsRequest.php
+++ b/Spanner/src/V1/BatchCreateSessionsRequest.php
@@ -21,13 +21,13 @@ class BatchCreateSessionsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $database = '';
+ protected $database = '';
/**
* Parameters to be applied to each created session.
*
* Generated from protobuf field .google.spanner.v1.Session session_template = 2;
*/
- private $session_template = null;
+ protected $session_template = null;
/**
* Required. The number of sessions to be created in this batch call.
* The API may return fewer than the requested number of sessions. If a
@@ -38,7 +38,7 @@ class BatchCreateSessionsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field int32 session_count = 3 [(.google.api.field_behavior) = REQUIRED];
*/
- private $session_count = 0;
+ protected $session_count = 0;
/**
* @param string $database Required. The database in which the new sessions are created. Please see
diff --git a/Spanner/src/V1/BatchWriteRequest.php b/Spanner/src/V1/BatchWriteRequest.php
index 514f30f40654..d5467dbbe1e9 100644
--- a/Spanner/src/V1/BatchWriteRequest.php
+++ b/Spanner/src/V1/BatchWriteRequest.php
@@ -20,13 +20,13 @@ class BatchWriteRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $session = '';
+ protected $session = '';
/**
* Common options for this request.
*
* Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 3;
*/
- private $request_options = null;
+ protected $request_options = null;
/**
* Required. The groups of mutations to be applied.
*
@@ -48,7 +48,7 @@ class BatchWriteRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bool exclude_txn_from_change_streams = 5 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $exclude_txn_from_change_streams = false;
+ protected $exclude_txn_from_change_streams = false;
/**
* @param string $session Required. The session in which the batch request is to be run. Please see
diff --git a/Spanner/src/V1/BatchWriteRequest/MutationGroup.php b/Spanner/src/V1/BatchWriteRequest/MutationGroup.php
index 22d04c7f4b91..5a73e8bd786a 100644
--- a/Spanner/src/V1/BatchWriteRequest/MutationGroup.php
+++ b/Spanner/src/V1/BatchWriteRequest/MutationGroup.php
@@ -67,6 +67,4 @@ public function setMutations($var)
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(MutationGroup::class, \Google\Cloud\Spanner\V1\BatchWriteRequest_MutationGroup::class);
diff --git a/Spanner/src/V1/BatchWriteResponse.php b/Spanner/src/V1/BatchWriteResponse.php
index f5aab11e6437..efcb9bc2ddb9 100644
--- a/Spanner/src/V1/BatchWriteResponse.php
+++ b/Spanner/src/V1/BatchWriteResponse.php
@@ -27,14 +27,14 @@ class BatchWriteResponse extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.rpc.Status status = 2;
*/
- private $status = null;
+ protected $status = null;
/**
* The commit timestamp of the transaction that applied this batch.
* Present if `status` is `OK`, absent otherwise.
*
* Generated from protobuf field .google.protobuf.Timestamp commit_timestamp = 3;
*/
- private $commit_timestamp = null;
+ protected $commit_timestamp = null;
/**
* Constructor.
diff --git a/Spanner/src/V1/BeginTransactionRequest.php b/Spanner/src/V1/BeginTransactionRequest.php
index 8e65dbc9c804..43f37b91fc39 100644
--- a/Spanner/src/V1/BeginTransactionRequest.php
+++ b/Spanner/src/V1/BeginTransactionRequest.php
@@ -21,13 +21,13 @@ class BeginTransactionRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $session = '';
+ protected $session = '';
/**
* Required. Options for the new transaction.
*
* Generated from protobuf field .google.spanner.v1.TransactionOptions options = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $options = null;
+ protected $options = null;
/**
* Common options for this request.
* Priority is ignored for this request. Setting the priority in this
diff --git a/Spanner/src/V1/Client/SpannerClient.php b/Spanner/src/V1/Client/SpannerClient.php
index 599de9deb370..159136a71c2b 100644
--- a/Spanner/src/V1/Client/SpannerClient.php
+++ b/Spanner/src/V1/Client/SpannerClient.php
@@ -1,6 +1,6 @@
int64 mutation_count = 1;
*/
- private $mutation_count = 0;
+ protected $mutation_count = 0;
/**
* Constructor.
@@ -89,6 +89,4 @@ public function setMutationCount($var)
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(CommitStats::class, \Google\Cloud\Spanner\V1\CommitResponse_CommitStats::class);
diff --git a/Spanner/src/V1/CommitResponse_CommitStats.php b/Spanner/src/V1/CommitResponse_CommitStats.php
deleted file mode 100644
index fb24d1a6a1f7..000000000000
--- a/Spanner/src/V1/CommitResponse_CommitStats.php
+++ /dev/null
@@ -1,16 +0,0 @@
-string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $database = '';
+ protected $database = '';
/**
* Required. The session to create.
*
* Generated from protobuf field .google.spanner.v1.Session session = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $session = null;
+ protected $session = null;
/**
* @param string $database Required. The database in which the new session is created. Please see
diff --git a/Spanner/src/V1/DeleteSessionRequest.php b/Spanner/src/V1/DeleteSessionRequest.php
index 40c61a458a81..0bf9497d1ccc 100644
--- a/Spanner/src/V1/DeleteSessionRequest.php
+++ b/Spanner/src/V1/DeleteSessionRequest.php
@@ -20,7 +20,7 @@ class DeleteSessionRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $name = '';
+ protected $name = '';
/**
* @param string $name Required. The name of the session to delete. Please see
diff --git a/Spanner/src/V1/DirectedReadOptions/ExcludeReplicas.php b/Spanner/src/V1/DirectedReadOptions/ExcludeReplicas.php
index 913c6fba2724..c9be8f05e62c 100644
--- a/Spanner/src/V1/DirectedReadOptions/ExcludeReplicas.php
+++ b/Spanner/src/V1/DirectedReadOptions/ExcludeReplicas.php
@@ -66,6 +66,4 @@ public function setReplicaSelections($var)
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(ExcludeReplicas::class, \Google\Cloud\Spanner\V1\DirectedReadOptions_ExcludeReplicas::class);
diff --git a/Spanner/src/V1/DirectedReadOptions/IncludeReplicas.php b/Spanner/src/V1/DirectedReadOptions/IncludeReplicas.php
index d9219874a781..de69639290ae 100644
--- a/Spanner/src/V1/DirectedReadOptions/IncludeReplicas.php
+++ b/Spanner/src/V1/DirectedReadOptions/IncludeReplicas.php
@@ -29,7 +29,7 @@ class IncludeReplicas extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bool auto_failover_disabled = 2;
*/
- private $auto_failover_disabled = false;
+ protected $auto_failover_disabled = false;
/**
* Constructor.
@@ -108,6 +108,4 @@ public function setAutoFailoverDisabled($var)
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(IncludeReplicas::class, \Google\Cloud\Spanner\V1\DirectedReadOptions_IncludeReplicas::class);
diff --git a/Spanner/src/V1/DirectedReadOptions/ReplicaSelection.php b/Spanner/src/V1/DirectedReadOptions/ReplicaSelection.php
index 837065c7c621..0115f982f1ef 100644
--- a/Spanner/src/V1/DirectedReadOptions/ReplicaSelection.php
+++ b/Spanner/src/V1/DirectedReadOptions/ReplicaSelection.php
@@ -34,13 +34,13 @@ class ReplicaSelection extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string location = 1;
*/
- private $location = '';
+ protected $location = '';
/**
* The type of replica.
*
* Generated from protobuf field .google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type type = 2;
*/
- private $type = 0;
+ protected $type = 0;
/**
* Constructor.
@@ -113,6 +113,4 @@ public function setType($var)
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(ReplicaSelection::class, \Google\Cloud\Spanner\V1\DirectedReadOptions_ReplicaSelection::class);
diff --git a/Spanner/src/V1/DirectedReadOptions/ReplicaSelection/Type.php b/Spanner/src/V1/DirectedReadOptions/ReplicaSelection/Type.php
index 94b7d304ad1b..39d4c5781d6c 100644
--- a/Spanner/src/V1/DirectedReadOptions/ReplicaSelection/Type.php
+++ b/Spanner/src/V1/DirectedReadOptions/ReplicaSelection/Type.php
@@ -59,6 +59,4 @@ public static function value($name)
}
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(Type::class, \Google\Cloud\Spanner\V1\DirectedReadOptions_ReplicaSelection_Type::class);
diff --git a/Spanner/src/V1/ExecuteBatchDmlRequest.php b/Spanner/src/V1/ExecuteBatchDmlRequest.php
index f41278e12801..ce0243d0d79d 100644
--- a/Spanner/src/V1/ExecuteBatchDmlRequest.php
+++ b/Spanner/src/V1/ExecuteBatchDmlRequest.php
@@ -20,7 +20,7 @@ class ExecuteBatchDmlRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $session = '';
+ protected $session = '';
/**
* Required. The transaction to use. Must be a read-write transaction.
* To protect against replays, single-use transactions are not supported. The
@@ -29,7 +29,7 @@ class ExecuteBatchDmlRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $transaction = null;
+ protected $transaction = null;
/**
* Required. The list of statements to execute in this batch. Statements are
* executed serially, such that the effects of statement `i` are visible to
@@ -51,13 +51,13 @@ class ExecuteBatchDmlRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field int64 seqno = 4 [(.google.api.field_behavior) = REQUIRED];
*/
- private $seqno = 0;
+ protected $seqno = 0;
/**
* Common options for this request.
*
* Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 5;
*/
- private $request_options = null;
+ protected $request_options = null;
/**
* Constructor.
diff --git a/Spanner/src/V1/ExecuteBatchDmlRequest/Statement.php b/Spanner/src/V1/ExecuteBatchDmlRequest/Statement.php
index 169686a5f930..cd8aa6d8066e 100644
--- a/Spanner/src/V1/ExecuteBatchDmlRequest/Statement.php
+++ b/Spanner/src/V1/ExecuteBatchDmlRequest/Statement.php
@@ -20,7 +20,7 @@ class Statement extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string sql = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $sql = '';
+ protected $sql = '';
/**
* Parameter names and values that bind to placeholders in the DML string.
* A parameter placeholder consists of the `@` character followed by the
@@ -33,7 +33,7 @@ class Statement extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Struct params = 2;
*/
- private $params = null;
+ protected $params = null;
/**
* It is not always possible for Cloud Spanner to infer the right SQL type
* from a JSON value. For example, values of type `BYTES` and values
@@ -203,6 +203,4 @@ public function setParamTypes($var)
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(Statement::class, \Google\Cloud\Spanner\V1\ExecuteBatchDmlRequest_Statement::class);
diff --git a/Spanner/src/V1/ExecuteBatchDmlRequest_Statement.php b/Spanner/src/V1/ExecuteBatchDmlRequest_Statement.php
deleted file mode 100644
index 0e0a5ea61dc8..000000000000
--- a/Spanner/src/V1/ExecuteBatchDmlRequest_Statement.php
+++ /dev/null
@@ -1,16 +0,0 @@
-string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $session = '';
+ protected $session = '';
/**
* The transaction to use.
* For queries, if none is provided, the default is a temporary read-only
@@ -33,13 +33,13 @@ class ExecuteSqlRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2;
*/
- private $transaction = null;
+ protected $transaction = null;
/**
* Required. The SQL string.
*
* Generated from protobuf field string sql = 3 [(.google.api.field_behavior) = REQUIRED];
*/
- private $sql = '';
+ protected $sql = '';
/**
* Parameter names and values that bind to placeholders in the SQL string.
* A parameter placeholder consists of the `@` character followed by the
@@ -53,7 +53,7 @@ class ExecuteSqlRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Struct params = 4;
*/
- private $params = null;
+ protected $params = null;
/**
* It is not always possible for Cloud Spanner to infer the right SQL type
* from a JSON value. For example, values of type `BYTES` and values
@@ -77,7 +77,7 @@ class ExecuteSqlRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bytes resume_token = 6;
*/
- private $resume_token = '';
+ protected $resume_token = '';
/**
* Used to control the amount of debugging information returned in
* [ResultSetStats][google.spanner.v1.ResultSetStats]. If
@@ -88,7 +88,7 @@ class ExecuteSqlRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.v1.ExecuteSqlRequest.QueryMode query_mode = 7;
*/
- private $query_mode = 0;
+ protected $query_mode = 0;
/**
* If present, results will be restricted to the specified partition
* previously created using PartitionQuery(). There must be an exact
@@ -97,7 +97,7 @@ class ExecuteSqlRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bytes partition_token = 8;
*/
- private $partition_token = '';
+ protected $partition_token = '';
/**
* A per-transaction sequence number used to identify this request. This field
* makes each request idempotent such that if the request is received multiple
@@ -110,25 +110,25 @@ class ExecuteSqlRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field int64 seqno = 9;
*/
- private $seqno = 0;
+ protected $seqno = 0;
/**
* Query optimizer configuration to use for the given query.
*
* Generated from protobuf field .google.spanner.v1.ExecuteSqlRequest.QueryOptions query_options = 10;
*/
- private $query_options = null;
+ protected $query_options = null;
/**
* Common options for this request.
*
* Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 11;
*/
- private $request_options = null;
+ protected $request_options = null;
/**
* Directed read options for this request.
*
* Generated from protobuf field .google.spanner.v1.DirectedReadOptions directed_read_options = 15;
*/
- private $directed_read_options = null;
+ protected $directed_read_options = null;
/**
* If this is for a partitioned query and this field is set to `true`, the
* request is executed with Spanner Data Boost independent compute resources.
@@ -137,7 +137,7 @@ class ExecuteSqlRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bool data_boost_enabled = 16;
*/
- private $data_boost_enabled = false;
+ protected $data_boost_enabled = false;
/**
* Constructor.
diff --git a/Spanner/src/V1/ExecuteSqlRequest/QueryMode.php b/Spanner/src/V1/ExecuteSqlRequest/QueryMode.php
index 43c3ed48f97b..bfd9e0a4d034 100644
--- a/Spanner/src/V1/ExecuteSqlRequest/QueryMode.php
+++ b/Spanner/src/V1/ExecuteSqlRequest/QueryMode.php
@@ -79,6 +79,4 @@ public static function value($name)
}
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(QueryMode::class, \Google\Cloud\Spanner\V1\ExecuteSqlRequest_QueryMode::class);
diff --git a/Spanner/src/V1/ExecuteSqlRequest/QueryOptions.php b/Spanner/src/V1/ExecuteSqlRequest/QueryOptions.php
index a96e6b519184..ad1c411054c4 100644
--- a/Spanner/src/V1/ExecuteSqlRequest/QueryOptions.php
+++ b/Spanner/src/V1/ExecuteSqlRequest/QueryOptions.php
@@ -35,7 +35,7 @@ class QueryOptions extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string optimizer_version = 1;
*/
- private $optimizer_version = '';
+ protected $optimizer_version = '';
/**
* An option to control the selection of optimizer statistics package.
* This parameter allows individual queries to use a different query
@@ -58,7 +58,7 @@ class QueryOptions extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string optimizer_statistics_package = 2;
*/
- private $optimizer_statistics_package = '';
+ protected $optimizer_statistics_package = '';
/**
* Constructor.
@@ -227,6 +227,4 @@ public function setOptimizerStatisticsPackage($var)
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(QueryOptions::class, \Google\Cloud\Spanner\V1\ExecuteSqlRequest_QueryOptions::class);
diff --git a/Spanner/src/V1/ExecuteSqlRequest_QueryMode.php b/Spanner/src/V1/ExecuteSqlRequest_QueryMode.php
deleted file mode 100644
index 839429aafee0..000000000000
--- a/Spanner/src/V1/ExecuteSqlRequest_QueryMode.php
+++ /dev/null
@@ -1,16 +0,0 @@
-databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]');
- * $sessionCount = 0;
- * $response = $spannerClient->batchCreateSessions($formattedDatabase, $sessionCount);
- * } finally {
- * $spannerClient->close();
- * }
- * ```
- *
- * Many parameters require resource names to be formatted in a particular way. To
- * assist with these names, this class includes a format method for each type of
- * name, and additionally a parseName method to extract the individual identifiers
- * contained within formatted names that are returned by the API.
- *
- * @deprecated Please use the new service client {@see \Google\Cloud\Spanner\V1\Client\SpannerClient}.
- */
-class SpannerGapicClient
-{
- use GapicClientTrait;
-
- /** The name of the service. */
- const SERVICE_NAME = 'google.spanner.v1.Spanner';
-
- /**
- * The default address of the service.
- *
- * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead.
- */
- const SERVICE_ADDRESS = 'spanner.googleapis.com';
-
- /** The address template of the service. */
- private const SERVICE_ADDRESS_TEMPLATE = 'spanner.UNIVERSE_DOMAIN';
-
- /** The default port of the service. */
- const DEFAULT_SERVICE_PORT = 443;
-
- /** The name of the code generator, to be included in the agent header. */
- const CODEGEN_NAME = 'gapic';
-
- /** The default scopes required by the service. */
- public static $serviceScopes = [
- 'https://www.googleapis.com/auth/cloud-platform',
- 'https://www.googleapis.com/auth/spanner.data',
- ];
-
- private static $databaseNameTemplate;
-
- private static $sessionNameTemplate;
-
- private static $pathTemplateMap;
-
- private static function getClientDefaults()
- {
- return [
- 'serviceName' => self::SERVICE_NAME,
- 'apiEndpoint' =>
- self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT,
- 'clientConfig' =>
- __DIR__ . '/../resources/spanner_client_config.json',
- 'descriptorsConfigPath' =>
- __DIR__ . '/../resources/spanner_descriptor_config.php',
- 'gcpApiConfigPath' =>
- __DIR__ . '/../resources/spanner_grpc_config.json',
- 'credentialsConfig' => [
- 'defaultScopes' => self::$serviceScopes,
- ],
- 'transportConfig' => [
- 'rest' => [
- 'restClientConfigPath' =>
- __DIR__ .
- '/../resources/spanner_rest_client_config.php',
- ],
- ],
- ];
- }
-
- private static function getDatabaseNameTemplate()
- {
- if (self::$databaseNameTemplate == null) {
- self::$databaseNameTemplate = new PathTemplate(
- 'projects/{project}/instances/{instance}/databases/{database}'
- );
- }
-
- return self::$databaseNameTemplate;
- }
-
- private static function getSessionNameTemplate()
- {
- if (self::$sessionNameTemplate == null) {
- self::$sessionNameTemplate = new PathTemplate(
- 'projects/{project}/instances/{instance}/databases/{database}/sessions/{session}'
- );
- }
-
- return self::$sessionNameTemplate;
- }
-
- private static function getPathTemplateMap()
- {
- if (self::$pathTemplateMap == null) {
- self::$pathTemplateMap = [
- 'database' => self::getDatabaseNameTemplate(),
- 'session' => self::getSessionNameTemplate(),
- ];
- }
-
- return self::$pathTemplateMap;
- }
-
- /**
- * Formats a string containing the fully-qualified path to represent a database
- * resource.
- *
- * @param string $project
- * @param string $instance
- * @param string $database
- *
- * @return string The formatted database resource.
- */
- public static function databaseName($project, $instance, $database)
- {
- return self::getDatabaseNameTemplate()->render([
- 'project' => $project,
- 'instance' => $instance,
- 'database' => $database,
- ]);
- }
-
- /**
- * Formats a string containing the fully-qualified path to represent a session
- * resource.
- *
- * @param string $project
- * @param string $instance
- * @param string $database
- * @param string $session
- *
- * @return string The formatted session resource.
- */
- public static function sessionName($project, $instance, $database, $session)
- {
- return self::getSessionNameTemplate()->render([
- 'project' => $project,
- 'instance' => $instance,
- 'database' => $database,
- 'session' => $session,
- ]);
- }
-
- /**
- * Parses a formatted name string and returns an associative array of the components in the name.
- * The following name formats are supported:
- * Template: Pattern
- * - database: projects/{project}/instances/{instance}/databases/{database}
- * - session: projects/{project}/instances/{instance}/databases/{database}/sessions/{session}
- *
- * The optional $template argument can be supplied to specify a particular pattern,
- * and must match one of the templates listed above. If no $template argument is
- * provided, or if the $template argument does not match one of the templates
- * listed, then parseName will check each of the supported templates, and return
- * the first match.
- *
- * @param string $formattedName The formatted name string
- * @param string $template Optional name of template to match
- *
- * @return array An associative array from name component IDs to component values.
- *
- * @throws ValidationException If $formattedName could not be matched.
- */
- public static function parseName($formattedName, $template = null)
- {
- $templateMap = self::getPathTemplateMap();
- if ($template) {
- if (!isset($templateMap[$template])) {
- throw new ValidationException(
- "Template name $template does not exist"
- );
- }
-
- return $templateMap[$template]->match($formattedName);
- }
-
- foreach ($templateMap as $templateName => $pathTemplate) {
- try {
- return $pathTemplate->match($formattedName);
- } catch (ValidationException $ex) {
- // Swallow the exception to continue trying other path templates
- }
- }
-
- throw new ValidationException(
- "Input did not match any known format. Input: $formattedName"
- );
- }
-
- /**
- * Constructor.
- *
- * @param array $options {
- * Optional. Options for configuring the service API wrapper.
- *
- * @type string $apiEndpoint
- * The address of the API remote host. May optionally include the port, formatted
- * as ":". Default 'spanner.googleapis.com:443'.
- * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
- * The credentials to be used by the client to authorize API calls. This option
- * accepts either a path to a credentials file, or a decoded credentials file as a
- * PHP array.
- * *Advanced usage*: In addition, this option can also accept a pre-constructed
- * {@see \Google\Auth\FetchAuthTokenInterface} object or
- * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these
- * objects are provided, any settings in $credentialsConfig will be ignored.
- * @type array $credentialsConfig
- * Options used to configure credentials, including auth token caching, for the
- * client. For a full list of supporting configuration options, see
- * {@see \Google\ApiCore\CredentialsWrapper::build()} .
- * @type bool $disableRetries
- * Determines whether or not retries defined by the client configuration should be
- * disabled. Defaults to `false`.
- * @type string|array $clientConfig
- * Client method configuration, including retry settings. This option can be either
- * a path to a JSON file, or a PHP array containing the decoded JSON data. By
- * default this settings points to the default client config file, which is
- * provided in the resources folder.
- * @type string|TransportInterface $transport
- * The transport used for executing network requests. May be either the string
- * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system.
- * *Advanced usage*: Additionally, it is possible to pass in an already
- * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note
- * that when this object is provided, any settings in $transportConfig, and any
- * $apiEndpoint setting, will be ignored.
- * @type array $transportConfig
- * Configuration options that will be used to construct the transport. Options for
- * each supported transport type should be passed in a key for that transport. For
- * example:
- * $transportConfig = [
- * 'grpc' => [...],
- * 'rest' => [...],
- * ];
- * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and
- * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the
- * supported options.
- * @type callable $clientCertSource
- * A callable which returns the client cert as a string. This can be used to
- * provide a certificate and private key to the transport layer for mTLS.
- * }
- *
- * @throws ValidationException
- */
- public function __construct(array $options = [])
- {
- $clientOptions = $this->buildClientOptions($options);
- $this->setClientOptions($clientOptions);
- }
-
- /**
- * Creates multiple new sessions.
- *
- * This API can be used to initialize a session cache on the clients.
- * See https://goo.gl/TgSFN2 for best practices on session cache management.
- *
- * Sample code:
- * ```
- * $spannerClient = new SpannerClient();
- * try {
- * $formattedDatabase = $spannerClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]');
- * $sessionCount = 0;
- * $response = $spannerClient->batchCreateSessions($formattedDatabase, $sessionCount);
- * } finally {
- * $spannerClient->close();
- * }
- * ```
- *
- * @param string $database Required. The database in which the new sessions are created.
- * @param int $sessionCount Required. The number of sessions to be created in this batch call.
- * The API may return fewer than the requested number of sessions. If a
- * specific number of sessions are desired, the client can make additional
- * calls to BatchCreateSessions (adjusting
- * [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count]
- * as necessary).
- * @param array $optionalArgs {
- * Optional.
- *
- * @type Session $sessionTemplate
- * Parameters to be applied to each created session.
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Spanner\V1\BatchCreateSessionsResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function batchCreateSessions(
- $database,
- $sessionCount,
- array $optionalArgs = []
- ) {
- $request = new BatchCreateSessionsRequest();
- $requestParamHeaders = [];
- $request->setDatabase($database);
- $request->setSessionCount($sessionCount);
- $requestParamHeaders['database'] = $database;
- if (isset($optionalArgs['sessionTemplate'])) {
- $request->setSessionTemplate($optionalArgs['sessionTemplate']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'BatchCreateSessions',
- BatchCreateSessionsResponse::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Batches the supplied mutation groups in a collection of efficient
- * transactions. All mutations in a group are committed atomically. However,
- * mutations across groups can be committed non-atomically in an unspecified
- * order and thus, they must be independent of each other. Partial failure is
- * possible, i.e., some groups may have been committed successfully, while
- * some may have failed. The results of individual batches are streamed into
- * the response as the batches are applied.
- *
- * BatchWrite requests are not replay protected, meaning that each mutation
- * group may be applied more than once. Replays of non-idempotent mutations
- * may have undesirable effects. For example, replays of an insert mutation
- * may produce an already exists error or if you use generated or commit
- * timestamp-based keys, it may result in additional rows being added to the
- * mutation's table. We recommend structuring your mutation groups to be
- * idempotent to avoid this issue.
- *
- * Sample code:
- * ```
- * $spannerClient = new SpannerClient();
- * try {
- * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]');
- * $mutationGroups = [];
- * // Read all responses until the stream is complete
- * $stream = $spannerClient->batchWrite($formattedSession, $mutationGroups);
- * foreach ($stream->readAll() as $element) {
- * // doSomethingWith($element);
- * }
- * } finally {
- * $spannerClient->close();
- * }
- * ```
- *
- * @param string $session Required. The session in which the batch request is to be run.
- * @param MutationGroup[] $mutationGroups Required. The groups of mutations to be applied.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type RequestOptions $requestOptions
- * Common options for this request.
- * @type bool $excludeTxnFromChangeStreams
- * Optional. When `exclude_txn_from_change_streams` is set to `true`:
- * * Mutations from all transactions in this batch write operation will not
- * be recorded in change streams with DDL option `allow_txn_exclusion=true`
- * that are tracking columns modified by these transactions.
- * * Mutations from all transactions in this batch write operation will be
- * recorded in change streams with DDL option `allow_txn_exclusion=false or
- * not set` that are tracking columns modified by these transactions.
- *
- * When `exclude_txn_from_change_streams` is set to `false` or not set,
- * mutations from all transactions in this batch write operation will be
- * recorded in all change streams that are tracking columns modified by these
- * transactions.
- * @type int $timeoutMillis
- * Timeout to use for this call.
- * }
- *
- * @return \Google\ApiCore\ServerStream
- *
- * @throws ApiException if the remote call fails
- */
- public function batchWrite(
- $session,
- $mutationGroups,
- array $optionalArgs = []
- ) {
- $request = new BatchWriteRequest();
- $requestParamHeaders = [];
- $request->setSession($session);
- $request->setMutationGroups($mutationGroups);
- $requestParamHeaders['session'] = $session;
- if (isset($optionalArgs['requestOptions'])) {
- $request->setRequestOptions($optionalArgs['requestOptions']);
- }
-
- if (isset($optionalArgs['excludeTxnFromChangeStreams'])) {
- $request->setExcludeTxnFromChangeStreams(
- $optionalArgs['excludeTxnFromChangeStreams']
- );
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'BatchWrite',
- BatchWriteResponse::class,
- $optionalArgs,
- $request,
- Call::SERVER_STREAMING_CALL
- );
- }
-
- /**
- * Begins a new transaction. This step can often be skipped:
- * [Read][google.spanner.v1.Spanner.Read],
- * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and
- * [Commit][google.spanner.v1.Spanner.Commit] can begin a new transaction as a
- * side-effect.
- *
- * Sample code:
- * ```
- * $spannerClient = new SpannerClient();
- * try {
- * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]');
- * $options = new TransactionOptions();
- * $response = $spannerClient->beginTransaction($formattedSession, $options);
- * } finally {
- * $spannerClient->close();
- * }
- * ```
- *
- * @param string $session Required. The session in which the transaction runs.
- * @param TransactionOptions $options Required. Options for the new transaction.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type RequestOptions $requestOptions
- * Common options for this request.
- * Priority is ignored for this request. Setting the priority in this
- * request_options struct will not do anything. To set the priority for a
- * transaction, set it on the reads and writes that are part of this
- * transaction instead.
- * @type Mutation $mutationKey
- * Optional. Required for read-write transactions on a multiplexed session
- * that commit mutations but do not perform any reads or queries. Clients
- * should randomly select one of the mutations from the mutation set and send
- * it as a part of this request.
- * This feature is not yet supported and will result in an UNIMPLEMENTED
- * error.
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Spanner\V1\Transaction
- *
- * @throws ApiException if the remote call fails
- */
- public function beginTransaction(
- $session,
- $options,
- array $optionalArgs = []
- ) {
- $request = new BeginTransactionRequest();
- $requestParamHeaders = [];
- $request->setSession($session);
- $request->setOptions($options);
- $requestParamHeaders['session'] = $session;
- if (isset($optionalArgs['requestOptions'])) {
- $request->setRequestOptions($optionalArgs['requestOptions']);
- }
-
- if (isset($optionalArgs['mutationKey'])) {
- $request->setMutationKey($optionalArgs['mutationKey']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'BeginTransaction',
- Transaction::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Commits a transaction. The request includes the mutations to be
- * applied to rows in the database.
- *
- * `Commit` might return an `ABORTED` error. This can occur at any time;
- * commonly, the cause is conflicts with concurrent
- * transactions. However, it can also happen for a variety of other
- * reasons. If `Commit` returns `ABORTED`, the caller should re-attempt
- * the transaction from the beginning, re-using the same session.
- *
- * On very rare occasions, `Commit` might return `UNKNOWN`. This can happen,
- * for example, if the client job experiences a 1+ hour networking failure.
- * At that point, Cloud Spanner has lost track of the transaction outcome and
- * we recommend that you perform another read from the database to see the
- * state of things as they are now.
- *
- * Sample code:
- * ```
- * $spannerClient = new SpannerClient();
- * try {
- * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]');
- * $mutations = [];
- * $response = $spannerClient->commit($formattedSession, $mutations);
- * } finally {
- * $spannerClient->close();
- * }
- * ```
- *
- * @param string $session Required. The session in which the transaction to be committed is running.
- * @param Mutation[] $mutations The mutations to be executed when this transaction commits. All
- * mutations are applied atomically, in the order they appear in
- * this list.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type string $transactionId
- * Commit a previously-started transaction.
- * @type TransactionOptions $singleUseTransaction
- * Execute mutations in a temporary transaction. Note that unlike
- * commit of a previously-started transaction, commit with a
- * temporary transaction is non-idempotent. That is, if the
- * `CommitRequest` is sent to Cloud Spanner more than once (for
- * instance, due to retries in the application, or in the
- * transport library), it is possible that the mutations are
- * executed more than once. If this is undesirable, use
- * [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction] and
- * [Commit][google.spanner.v1.Spanner.Commit] instead.
- * @type bool $returnCommitStats
- * If `true`, then statistics related to the transaction will be included in
- * the [CommitResponse][google.spanner.v1.CommitResponse.commit_stats].
- * Default value is `false`.
- * @type Duration $maxCommitDelay
- * Optional. The amount of latency this request is willing to incur in order
- * to improve throughput. If this field is not set, Spanner assumes requests
- * are relatively latency sensitive and automatically determines an
- * appropriate delay time. You can specify a batching delay value between 0
- * and 500 ms.
- * @type RequestOptions $requestOptions
- * Common options for this request.
- * @type MultiplexedSessionPrecommitToken $precommitToken
- * Optional. If the read-write transaction was executed on a multiplexed
- * session, the precommit token with the highest sequence number received in
- * this transaction attempt, should be included here. Failing to do so will
- * result in a FailedPrecondition error.
- * This feature is not yet supported and will result in an UNIMPLEMENTED
- * error.
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Spanner\V1\CommitResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function commit($session, $mutations, array $optionalArgs = [])
- {
- $request = new CommitRequest();
- $requestParamHeaders = [];
- $request->setSession($session);
- $request->setMutations($mutations);
- $requestParamHeaders['session'] = $session;
- if (isset($optionalArgs['transactionId'])) {
- $request->setTransactionId($optionalArgs['transactionId']);
- }
-
- if (isset($optionalArgs['singleUseTransaction'])) {
- $request->setSingleUseTransaction(
- $optionalArgs['singleUseTransaction']
- );
- }
-
- if (isset($optionalArgs['returnCommitStats'])) {
- $request->setReturnCommitStats($optionalArgs['returnCommitStats']);
- }
-
- if (isset($optionalArgs['maxCommitDelay'])) {
- $request->setMaxCommitDelay($optionalArgs['maxCommitDelay']);
- }
-
- if (isset($optionalArgs['requestOptions'])) {
- $request->setRequestOptions($optionalArgs['requestOptions']);
- }
-
- if (isset($optionalArgs['precommitToken'])) {
- $request->setPrecommitToken($optionalArgs['precommitToken']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'Commit',
- CommitResponse::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Creates a new session. A session can be used to perform
- * transactions that read and/or modify data in a Cloud Spanner database.
- * Sessions are meant to be reused for many consecutive
- * transactions.
- *
- * Sessions can only execute one transaction at a time. To execute
- * multiple concurrent read-write/write-only transactions, create
- * multiple sessions. Note that standalone reads and queries use a
- * transaction internally, and count toward the one transaction
- * limit.
- *
- * Active sessions use additional server resources, so it is a good idea to
- * delete idle and unneeded sessions.
- * Aside from explicit deletes, Cloud Spanner may delete sessions for which no
- * operations are sent for more than an hour. If a session is deleted,
- * requests to it return `NOT_FOUND`.
- *
- * Idle sessions can be kept alive by sending a trivial SQL query
- * periodically, e.g., `"SELECT 1"`.
- *
- * Sample code:
- * ```
- * $spannerClient = new SpannerClient();
- * try {
- * $formattedDatabase = $spannerClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]');
- * $response = $spannerClient->createSession($formattedDatabase);
- * } finally {
- * $spannerClient->close();
- * }
- * ```
- *
- * @param string $database Required. The database in which the new session is created.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type Session $session
- * Required. The session to create.
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Spanner\V1\Session
- *
- * @throws ApiException if the remote call fails
- */
- public function createSession($database, array $optionalArgs = [])
- {
- $request = new CreateSessionRequest();
- $requestParamHeaders = [];
- $request->setDatabase($database);
- $requestParamHeaders['database'] = $database;
- if (isset($optionalArgs['session'])) {
- $request->setSession($optionalArgs['session']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'CreateSession',
- Session::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Ends a session, releasing server resources associated with it. This will
- * asynchronously trigger cancellation of any operations that are running with
- * this session.
- *
- * Sample code:
- * ```
- * $spannerClient = new SpannerClient();
- * try {
- * $formattedName = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]');
- * $spannerClient->deleteSession($formattedName);
- * } finally {
- * $spannerClient->close();
- * }
- * ```
- *
- * @param string $name Required. The name of the session to delete.
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @throws ApiException if the remote call fails
- */
- public function deleteSession($name, array $optionalArgs = [])
- {
- $request = new DeleteSessionRequest();
- $requestParamHeaders = [];
- $request->setName($name);
- $requestParamHeaders['name'] = $name;
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'DeleteSession',
- GPBEmpty::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Executes a batch of SQL DML statements. This method allows many statements
- * to be run with lower latency than submitting them sequentially with
- * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql].
- *
- * Statements are executed in sequential order. A request can succeed even if
- * a statement fails. The
- * [ExecuteBatchDmlResponse.status][google.spanner.v1.ExecuteBatchDmlResponse.status]
- * field in the response provides information about the statement that failed.
- * Clients must inspect this field to determine whether an error occurred.
- *
- * Execution stops after the first failed statement; the remaining statements
- * are not executed.
- *
- * Sample code:
- * ```
- * $spannerClient = new SpannerClient();
- * try {
- * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]');
- * $transaction = new TransactionSelector();
- * $statements = [];
- * $seqno = 0;
- * $response = $spannerClient->executeBatchDml($formattedSession, $transaction, $statements, $seqno);
- * } finally {
- * $spannerClient->close();
- * }
- * ```
- *
- * @param string $session Required. The session in which the DML statements should be performed.
- * @param TransactionSelector $transaction Required. The transaction to use. Must be a read-write transaction.
- *
- * To protect against replays, single-use transactions are not supported. The
- * caller must either supply an existing transaction ID or begin a new
- * transaction.
- * @param Statement[] $statements Required. The list of statements to execute in this batch. Statements are
- * executed serially, such that the effects of statement `i` are visible to
- * statement `i+1`. Each statement must be a DML statement. Execution stops at
- * the first failed statement; the remaining statements are not executed.
- *
- * Callers must provide at least one statement.
- * @param int $seqno Required. A per-transaction sequence number used to identify this request.
- * This field makes each request idempotent such that if the request is
- * received multiple times, at most one will succeed.
- *
- * The sequence number must be monotonically increasing within the
- * transaction. If a request arrives for the first time with an out-of-order
- * sequence number, the transaction may be aborted. Replays of previously
- * handled requests will yield the same response as the first execution.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type RequestOptions $requestOptions
- * Common options for this request.
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Spanner\V1\ExecuteBatchDmlResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function executeBatchDml(
- $session,
- $transaction,
- $statements,
- $seqno,
- array $optionalArgs = []
- ) {
- $request = new ExecuteBatchDmlRequest();
- $requestParamHeaders = [];
- $request->setSession($session);
- $request->setTransaction($transaction);
- $request->setStatements($statements);
- $request->setSeqno($seqno);
- $requestParamHeaders['session'] = $session;
- if (isset($optionalArgs['requestOptions'])) {
- $request->setRequestOptions($optionalArgs['requestOptions']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'ExecuteBatchDml',
- ExecuteBatchDmlResponse::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Executes an SQL statement, returning all results in a single reply. This
- * method cannot be used to return a result set larger than 10 MiB;
- * if the query yields more data than that, the query fails with
- * a `FAILED_PRECONDITION` error.
- *
- * Operations inside read-write transactions might return `ABORTED`. If
- * this occurs, the application should restart the transaction from
- * the beginning. See [Transaction][google.spanner.v1.Transaction] for more
- * details.
- *
- * Larger result sets can be fetched in streaming fashion by calling
- * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql]
- * instead.
- *
- * Sample code:
- * ```
- * $spannerClient = new SpannerClient();
- * try {
- * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]');
- * $sql = 'sql';
- * $response = $spannerClient->executeSql($formattedSession, $sql);
- * } finally {
- * $spannerClient->close();
- * }
- * ```
- *
- * @param string $session Required. The session in which the SQL query should be performed.
- * @param string $sql Required. The SQL string.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type TransactionSelector $transaction
- * The transaction to use.
- *
- * For queries, if none is provided, the default is a temporary read-only
- * transaction with strong concurrency.
- *
- * Standard DML statements require a read-write transaction. To protect
- * against replays, single-use transactions are not supported. The caller
- * must either supply an existing transaction ID or begin a new transaction.
- *
- * Partitioned DML requires an existing Partitioned DML transaction ID.
- * @type Struct $params
- * Parameter names and values that bind to placeholders in the SQL string.
- *
- * A parameter placeholder consists of the `@` character followed by the
- * parameter name (for example, `@firstName`). Parameter names must conform
- * to the naming requirements of identifiers as specified at
- * https://cloud.google.com/spanner/docs/lexical#identifiers.
- *
- * Parameters can appear anywhere that a literal value is expected. The same
- * parameter name can be used more than once, for example:
- *
- * `"WHERE id > @msg_id AND id < @msg_id + 100"`
- *
- * It is an error to execute a SQL statement with unbound parameters.
- * @type array $paramTypes
- * It is not always possible for Cloud Spanner to infer the right SQL type
- * from a JSON value. For example, values of type `BYTES` and values
- * of type `STRING` both appear in
- * [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings.
- *
- * In these cases, `param_types` can be used to specify the exact
- * SQL type for some or all of the SQL statement parameters. See the
- * definition of [Type][google.spanner.v1.Type] for more information
- * about SQL types.
- * @type string $resumeToken
- * If this request is resuming a previously interrupted SQL statement
- * execution, `resume_token` should be copied from the last
- * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the
- * interruption. Doing this enables the new SQL statement execution to resume
- * where the last one left off. The rest of the request parameters must
- * exactly match the request that yielded this token.
- * @type int $queryMode
- * Used to control the amount of debugging information returned in
- * [ResultSetStats][google.spanner.v1.ResultSetStats]. If
- * [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is
- * set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only
- * be set to
- * [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL].
- * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryMode}
- * @type string $partitionToken
- * If present, results will be restricted to the specified partition
- * previously created using PartitionQuery(). There must be an exact
- * match for the values of fields common to this message and the
- * PartitionQueryRequest message used to create this partition_token.
- * @type int $seqno
- * A per-transaction sequence number used to identify this request. This field
- * makes each request idempotent such that if the request is received multiple
- * times, at most one will succeed.
- *
- * The sequence number must be monotonically increasing within the
- * transaction. If a request arrives for the first time with an out-of-order
- * sequence number, the transaction may be aborted. Replays of previously
- * handled requests will yield the same response as the first execution.
- *
- * Required for DML statements. Ignored for queries.
- * @type QueryOptions $queryOptions
- * Query optimizer configuration to use for the given query.
- * @type RequestOptions $requestOptions
- * Common options for this request.
- * @type DirectedReadOptions $directedReadOptions
- * Directed read options for this request.
- * @type bool $dataBoostEnabled
- * If this is for a partitioned query and this field is set to `true`, the
- * request is executed with Spanner Data Boost independent compute resources.
- *
- * If the field is set to `true` but the request does not set
- * `partition_token`, the API returns an `INVALID_ARGUMENT` error.
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Spanner\V1\ResultSet
- *
- * @throws ApiException if the remote call fails
- */
- public function executeSql($session, $sql, array $optionalArgs = [])
- {
- $request = new ExecuteSqlRequest();
- $requestParamHeaders = [];
- $request->setSession($session);
- $request->setSql($sql);
- $requestParamHeaders['session'] = $session;
- if (isset($optionalArgs['transaction'])) {
- $request->setTransaction($optionalArgs['transaction']);
- }
-
- if (isset($optionalArgs['params'])) {
- $request->setParams($optionalArgs['params']);
- }
-
- if (isset($optionalArgs['paramTypes'])) {
- $request->setParamTypes($optionalArgs['paramTypes']);
- }
-
- if (isset($optionalArgs['resumeToken'])) {
- $request->setResumeToken($optionalArgs['resumeToken']);
- }
-
- if (isset($optionalArgs['queryMode'])) {
- $request->setQueryMode($optionalArgs['queryMode']);
- }
-
- if (isset($optionalArgs['partitionToken'])) {
- $request->setPartitionToken($optionalArgs['partitionToken']);
- }
-
- if (isset($optionalArgs['seqno'])) {
- $request->setSeqno($optionalArgs['seqno']);
- }
-
- if (isset($optionalArgs['queryOptions'])) {
- $request->setQueryOptions($optionalArgs['queryOptions']);
- }
-
- if (isset($optionalArgs['requestOptions'])) {
- $request->setRequestOptions($optionalArgs['requestOptions']);
- }
-
- if (isset($optionalArgs['directedReadOptions'])) {
- $request->setDirectedReadOptions(
- $optionalArgs['directedReadOptions']
- );
- }
-
- if (isset($optionalArgs['dataBoostEnabled'])) {
- $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'ExecuteSql',
- ResultSet::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the
- * result set as a stream. Unlike
- * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there is no limit on
- * the size of the returned result set. However, no individual row in the
- * result set can exceed 100 MiB, and no column value can exceed 10 MiB.
- *
- * Sample code:
- * ```
- * $spannerClient = new SpannerClient();
- * try {
- * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]');
- * $sql = 'sql';
- * // Read all responses until the stream is complete
- * $stream = $spannerClient->executeStreamingSql($formattedSession, $sql);
- * foreach ($stream->readAll() as $element) {
- * // doSomethingWith($element);
- * }
- * } finally {
- * $spannerClient->close();
- * }
- * ```
- *
- * @param string $session Required. The session in which the SQL query should be performed.
- * @param string $sql Required. The SQL string.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type TransactionSelector $transaction
- * The transaction to use.
- *
- * For queries, if none is provided, the default is a temporary read-only
- * transaction with strong concurrency.
- *
- * Standard DML statements require a read-write transaction. To protect
- * against replays, single-use transactions are not supported. The caller
- * must either supply an existing transaction ID or begin a new transaction.
- *
- * Partitioned DML requires an existing Partitioned DML transaction ID.
- * @type Struct $params
- * Parameter names and values that bind to placeholders in the SQL string.
- *
- * A parameter placeholder consists of the `@` character followed by the
- * parameter name (for example, `@firstName`). Parameter names must conform
- * to the naming requirements of identifiers as specified at
- * https://cloud.google.com/spanner/docs/lexical#identifiers.
- *
- * Parameters can appear anywhere that a literal value is expected. The same
- * parameter name can be used more than once, for example:
- *
- * `"WHERE id > @msg_id AND id < @msg_id + 100"`
- *
- * It is an error to execute a SQL statement with unbound parameters.
- * @type array $paramTypes
- * It is not always possible for Cloud Spanner to infer the right SQL type
- * from a JSON value. For example, values of type `BYTES` and values
- * of type `STRING` both appear in
- * [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings.
- *
- * In these cases, `param_types` can be used to specify the exact
- * SQL type for some or all of the SQL statement parameters. See the
- * definition of [Type][google.spanner.v1.Type] for more information
- * about SQL types.
- * @type string $resumeToken
- * If this request is resuming a previously interrupted SQL statement
- * execution, `resume_token` should be copied from the last
- * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the
- * interruption. Doing this enables the new SQL statement execution to resume
- * where the last one left off. The rest of the request parameters must
- * exactly match the request that yielded this token.
- * @type int $queryMode
- * Used to control the amount of debugging information returned in
- * [ResultSetStats][google.spanner.v1.ResultSetStats]. If
- * [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is
- * set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only
- * be set to
- * [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL].
- * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryMode}
- * @type string $partitionToken
- * If present, results will be restricted to the specified partition
- * previously created using PartitionQuery(). There must be an exact
- * match for the values of fields common to this message and the
- * PartitionQueryRequest message used to create this partition_token.
- * @type int $seqno
- * A per-transaction sequence number used to identify this request. This field
- * makes each request idempotent such that if the request is received multiple
- * times, at most one will succeed.
- *
- * The sequence number must be monotonically increasing within the
- * transaction. If a request arrives for the first time with an out-of-order
- * sequence number, the transaction may be aborted. Replays of previously
- * handled requests will yield the same response as the first execution.
- *
- * Required for DML statements. Ignored for queries.
- * @type QueryOptions $queryOptions
- * Query optimizer configuration to use for the given query.
- * @type RequestOptions $requestOptions
- * Common options for this request.
- * @type DirectedReadOptions $directedReadOptions
- * Directed read options for this request.
- * @type bool $dataBoostEnabled
- * If this is for a partitioned query and this field is set to `true`, the
- * request is executed with Spanner Data Boost independent compute resources.
- *
- * If the field is set to `true` but the request does not set
- * `partition_token`, the API returns an `INVALID_ARGUMENT` error.
- * @type int $timeoutMillis
- * Timeout to use for this call.
- * }
- *
- * @return \Google\ApiCore\ServerStream
- *
- * @throws ApiException if the remote call fails
- */
- public function executeStreamingSql(
- $session,
- $sql,
- array $optionalArgs = []
- ) {
- $request = new ExecuteSqlRequest();
- $requestParamHeaders = [];
- $request->setSession($session);
- $request->setSql($sql);
- $requestParamHeaders['session'] = $session;
- if (isset($optionalArgs['transaction'])) {
- $request->setTransaction($optionalArgs['transaction']);
- }
-
- if (isset($optionalArgs['params'])) {
- $request->setParams($optionalArgs['params']);
- }
-
- if (isset($optionalArgs['paramTypes'])) {
- $request->setParamTypes($optionalArgs['paramTypes']);
- }
-
- if (isset($optionalArgs['resumeToken'])) {
- $request->setResumeToken($optionalArgs['resumeToken']);
- }
-
- if (isset($optionalArgs['queryMode'])) {
- $request->setQueryMode($optionalArgs['queryMode']);
- }
-
- if (isset($optionalArgs['partitionToken'])) {
- $request->setPartitionToken($optionalArgs['partitionToken']);
- }
-
- if (isset($optionalArgs['seqno'])) {
- $request->setSeqno($optionalArgs['seqno']);
- }
-
- if (isset($optionalArgs['queryOptions'])) {
- $request->setQueryOptions($optionalArgs['queryOptions']);
- }
-
- if (isset($optionalArgs['requestOptions'])) {
- $request->setRequestOptions($optionalArgs['requestOptions']);
- }
-
- if (isset($optionalArgs['directedReadOptions'])) {
- $request->setDirectedReadOptions(
- $optionalArgs['directedReadOptions']
- );
- }
-
- if (isset($optionalArgs['dataBoostEnabled'])) {
- $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'ExecuteStreamingSql',
- PartialResultSet::class,
- $optionalArgs,
- $request,
- Call::SERVER_STREAMING_CALL
- );
- }
-
- /**
- * Gets a session. Returns `NOT_FOUND` if the session does not exist.
- * This is mainly useful for determining whether a session is still
- * alive.
- *
- * Sample code:
- * ```
- * $spannerClient = new SpannerClient();
- * try {
- * $formattedName = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]');
- * $response = $spannerClient->getSession($formattedName);
- * } finally {
- * $spannerClient->close();
- * }
- * ```
- *
- * @param string $name Required. The name of the session to retrieve.
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Spanner\V1\Session
- *
- * @throws ApiException if the remote call fails
- */
- public function getSession($name, array $optionalArgs = [])
- {
- $request = new GetSessionRequest();
- $requestParamHeaders = [];
- $request->setName($name);
- $requestParamHeaders['name'] = $name;
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'GetSession',
- Session::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Lists all sessions in a given database.
- *
- * Sample code:
- * ```
- * $spannerClient = new SpannerClient();
- * try {
- * $formattedDatabase = $spannerClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]');
- * // Iterate over pages of elements
- * $pagedResponse = $spannerClient->listSessions($formattedDatabase);
- * foreach ($pagedResponse->iteratePages() as $page) {
- * foreach ($page as $element) {
- * // doSomethingWith($element);
- * }
- * }
- * // Alternatively:
- * // Iterate through all elements
- * $pagedResponse = $spannerClient->listSessions($formattedDatabase);
- * foreach ($pagedResponse->iterateAllElements() as $element) {
- * // doSomethingWith($element);
- * }
- * } finally {
- * $spannerClient->close();
- * }
- * ```
- *
- * @param string $database Required. The database in which to list sessions.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type int $pageSize
- * The maximum number of resources contained in the underlying API
- * response. The API may return fewer values in a page, even if
- * there are additional values to be retrieved.
- * @type string $pageToken
- * A page token is used to specify a page of values to be returned.
- * If no page token is specified (the default), the first page
- * of values will be returned. Any page token used here must have
- * been generated by a previous call to the API.
- * @type string $filter
- * An expression for filtering the results of the request. Filter rules are
- * case insensitive. The fields eligible for filtering are:
- *
- * * `labels.key` where key is the name of a label
- *
- * Some examples of using filters are:
- *
- * * `labels.env:*` --> The session has the label "env".
- * * `labels.env:dev` --> The session has the label "env" and the value of
- * the label contains the string "dev".
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\ApiCore\PagedListResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function listSessions($database, array $optionalArgs = [])
- {
- $request = new ListSessionsRequest();
- $requestParamHeaders = [];
- $request->setDatabase($database);
- $requestParamHeaders['database'] = $database;
- if (isset($optionalArgs['pageSize'])) {
- $request->setPageSize($optionalArgs['pageSize']);
- }
-
- if (isset($optionalArgs['pageToken'])) {
- $request->setPageToken($optionalArgs['pageToken']);
- }
-
- if (isset($optionalArgs['filter'])) {
- $request->setFilter($optionalArgs['filter']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->getPagedListResponse(
- 'ListSessions',
- $optionalArgs,
- ListSessionsResponse::class,
- $request
- );
- }
-
- /**
- * Creates a set of partition tokens that can be used to execute a query
- * operation in parallel. Each of the returned partition tokens can be used
- * by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to
- * specify a subset of the query result to read. The same session and
- * read-only transaction must be used by the PartitionQueryRequest used to
- * create the partition tokens and the ExecuteSqlRequests that use the
- * partition tokens.
- *
- * Partition tokens become invalid when the session used to create them
- * is deleted, is idle for too long, begins a new transaction, or becomes too
- * old. When any of these happen, it is not possible to resume the query, and
- * the whole operation must be restarted from the beginning.
- *
- * Sample code:
- * ```
- * $spannerClient = new SpannerClient();
- * try {
- * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]');
- * $sql = 'sql';
- * $response = $spannerClient->partitionQuery($formattedSession, $sql);
- * } finally {
- * $spannerClient->close();
- * }
- * ```
- *
- * @param string $session Required. The session used to create the partitions.
- * @param string $sql Required. The query request to generate partitions for. The request will
- * fail if the query is not root partitionable. For a query to be root
- * partitionable, it needs to satisfy a few conditions. For example, if the
- * query execution plan contains a distributed union operator, then it must be
- * the first operator in the plan. For more information about other
- * conditions, see [Read data in
- * parallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel).
- *
- * The query request must not contain DML commands, such as INSERT, UPDATE, or
- * DELETE. Use
- * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] with a
- * PartitionedDml transaction for large, partition-friendly DML operations.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type TransactionSelector $transaction
- * Read only snapshot transactions are supported, read/write and single use
- * transactions are not.
- * @type Struct $params
- * Parameter names and values that bind to placeholders in the SQL string.
- *
- * A parameter placeholder consists of the `@` character followed by the
- * parameter name (for example, `@firstName`). Parameter names can contain
- * letters, numbers, and underscores.
- *
- * Parameters can appear anywhere that a literal value is expected. The same
- * parameter name can be used more than once, for example:
- *
- * `"WHERE id > @msg_id AND id < @msg_id + 100"`
- *
- * It is an error to execute a SQL statement with unbound parameters.
- * @type array $paramTypes
- * It is not always possible for Cloud Spanner to infer the right SQL type
- * from a JSON value. For example, values of type `BYTES` and values
- * of type `STRING` both appear in
- * [params][google.spanner.v1.PartitionQueryRequest.params] as JSON strings.
- *
- * In these cases, `param_types` can be used to specify the exact
- * SQL type for some or all of the SQL query parameters. See the
- * definition of [Type][google.spanner.v1.Type] for more information
- * about SQL types.
- * @type PartitionOptions $partitionOptions
- * Additional options that affect how many partitions are created.
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Spanner\V1\PartitionResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function partitionQuery($session, $sql, array $optionalArgs = [])
- {
- $request = new PartitionQueryRequest();
- $requestParamHeaders = [];
- $request->setSession($session);
- $request->setSql($sql);
- $requestParamHeaders['session'] = $session;
- if (isset($optionalArgs['transaction'])) {
- $request->setTransaction($optionalArgs['transaction']);
- }
-
- if (isset($optionalArgs['params'])) {
- $request->setParams($optionalArgs['params']);
- }
-
- if (isset($optionalArgs['paramTypes'])) {
- $request->setParamTypes($optionalArgs['paramTypes']);
- }
-
- if (isset($optionalArgs['partitionOptions'])) {
- $request->setPartitionOptions($optionalArgs['partitionOptions']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'PartitionQuery',
- PartitionResponse::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Creates a set of partition tokens that can be used to execute a read
- * operation in parallel. Each of the returned partition tokens can be used
- * by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a
- * subset of the read result to read. The same session and read-only
- * transaction must be used by the PartitionReadRequest used to create the
- * partition tokens and the ReadRequests that use the partition tokens. There
- * are no ordering guarantees on rows returned among the returned partition
- * tokens, or even within each individual StreamingRead call issued with a
- * partition_token.
- *
- * Partition tokens become invalid when the session used to create them
- * is deleted, is idle for too long, begins a new transaction, or becomes too
- * old. When any of these happen, it is not possible to resume the read, and
- * the whole operation must be restarted from the beginning.
- *
- * Sample code:
- * ```
- * $spannerClient = new SpannerClient();
- * try {
- * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]');
- * $table = 'table';
- * $keySet = new KeySet();
- * $response = $spannerClient->partitionRead($formattedSession, $table, $keySet);
- * } finally {
- * $spannerClient->close();
- * }
- * ```
- *
- * @param string $session Required. The session used to create the partitions.
- * @param string $table Required. The name of the table in the database to be read.
- * @param KeySet $keySet Required. `key_set` identifies the rows to be yielded. `key_set` names the
- * primary keys of the rows in
- * [table][google.spanner.v1.PartitionReadRequest.table] to be yielded, unless
- * [index][google.spanner.v1.PartitionReadRequest.index] is present. If
- * [index][google.spanner.v1.PartitionReadRequest.index] is present, then
- * [key_set][google.spanner.v1.PartitionReadRequest.key_set] instead names
- * index keys in [index][google.spanner.v1.PartitionReadRequest.index].
- *
- * It is not an error for the `key_set` to name rows that do not
- * exist in the database. Read yields nothing for nonexistent rows.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type TransactionSelector $transaction
- * Read only snapshot transactions are supported, read/write and single use
- * transactions are not.
- * @type string $index
- * If non-empty, the name of an index on
- * [table][google.spanner.v1.PartitionReadRequest.table]. This index is used
- * instead of the table primary key when interpreting
- * [key_set][google.spanner.v1.PartitionReadRequest.key_set] and sorting
- * result rows. See [key_set][google.spanner.v1.PartitionReadRequest.key_set]
- * for further information.
- * @type string[] $columns
- * The columns of [table][google.spanner.v1.PartitionReadRequest.table] to be
- * returned for each row matching this request.
- * @type PartitionOptions $partitionOptions
- * Additional options that affect how many partitions are created.
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Spanner\V1\PartitionResponse
- *
- * @throws ApiException if the remote call fails
- */
- public function partitionRead(
- $session,
- $table,
- $keySet,
- array $optionalArgs = []
- ) {
- $request = new PartitionReadRequest();
- $requestParamHeaders = [];
- $request->setSession($session);
- $request->setTable($table);
- $request->setKeySet($keySet);
- $requestParamHeaders['session'] = $session;
- if (isset($optionalArgs['transaction'])) {
- $request->setTransaction($optionalArgs['transaction']);
- }
-
- if (isset($optionalArgs['index'])) {
- $request->setIndex($optionalArgs['index']);
- }
-
- if (isset($optionalArgs['columns'])) {
- $request->setColumns($optionalArgs['columns']);
- }
-
- if (isset($optionalArgs['partitionOptions'])) {
- $request->setPartitionOptions($optionalArgs['partitionOptions']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'PartitionRead',
- PartitionResponse::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Reads rows from the database using key lookups and scans, as a
- * simple key/value style alternative to
- * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be
- * used to return a result set larger than 10 MiB; if the read matches more
- * data than that, the read fails with a `FAILED_PRECONDITION`
- * error.
- *
- * Reads inside read-write transactions might return `ABORTED`. If
- * this occurs, the application should restart the transaction from
- * the beginning. See [Transaction][google.spanner.v1.Transaction] for more
- * details.
- *
- * Larger result sets can be yielded in streaming fashion by calling
- * [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead.
- *
- * Sample code:
- * ```
- * $spannerClient = new SpannerClient();
- * try {
- * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]');
- * $table = 'table';
- * $columns = [];
- * $keySet = new KeySet();
- * $response = $spannerClient->read($formattedSession, $table, $columns, $keySet);
- * } finally {
- * $spannerClient->close();
- * }
- * ```
- *
- * @param string $session Required. The session in which the read should be performed.
- * @param string $table Required. The name of the table in the database to be read.
- * @param string[] $columns Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be
- * returned for each row matching this request.
- * @param KeySet $keySet Required. `key_set` identifies the rows to be yielded. `key_set` names the
- * primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to
- * be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present.
- * If [index][google.spanner.v1.ReadRequest.index] is present, then
- * [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys
- * in [index][google.spanner.v1.ReadRequest.index].
- *
- * If the [partition_token][google.spanner.v1.ReadRequest.partition_token]
- * field is empty, rows are yielded in table primary key order (if
- * [index][google.spanner.v1.ReadRequest.index] is empty) or index key order
- * (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the
- * [partition_token][google.spanner.v1.ReadRequest.partition_token] field is
- * not empty, rows will be yielded in an unspecified order.
- *
- * It is not an error for the `key_set` to name rows that do not
- * exist in the database. Read yields nothing for nonexistent rows.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type TransactionSelector $transaction
- * The transaction to use. If none is provided, the default is a
- * temporary read-only transaction with strong concurrency.
- * @type string $index
- * If non-empty, the name of an index on
- * [table][google.spanner.v1.ReadRequest.table]. This index is used instead of
- * the table primary key when interpreting
- * [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows.
- * See [key_set][google.spanner.v1.ReadRequest.key_set] for further
- * information.
- * @type int $limit
- * If greater than zero, only the first `limit` rows are yielded. If `limit`
- * is zero, the default is no limit. A limit cannot be specified if
- * `partition_token` is set.
- * @type string $resumeToken
- * If this request is resuming a previously interrupted read,
- * `resume_token` should be copied from the last
- * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the
- * interruption. Doing this enables the new read to resume where the last read
- * left off. The rest of the request parameters must exactly match the request
- * that yielded this token.
- * @type string $partitionToken
- * If present, results will be restricted to the specified partition
- * previously created using PartitionRead(). There must be an exact
- * match for the values of fields common to this message and the
- * PartitionReadRequest message used to create this partition_token.
- * @type RequestOptions $requestOptions
- * Common options for this request.
- * @type DirectedReadOptions $directedReadOptions
- * Directed read options for this request.
- * @type bool $dataBoostEnabled
- * If this is for a partitioned read and this field is set to `true`, the
- * request is executed with Spanner Data Boost independent compute resources.
- *
- * If the field is set to `true` but the request does not set
- * `partition_token`, the API returns an `INVALID_ARGUMENT` error.
- * @type int $orderBy
- * Optional. Order for the returned rows.
- *
- * By default, Spanner will return result rows in primary key order except for
- * PartitionRead requests. For applications that do not require rows to be
- * returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting
- * `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval,
- * resulting in lower latencies in certain cases (e.g. bulk point lookups).
- * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\OrderBy}
- * @type int $lockHint
- * Optional. Lock Hint for the request, it can only be used with read-write
- * transactions.
- * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\LockHint}
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @return \Google\Cloud\Spanner\V1\ResultSet
- *
- * @throws ApiException if the remote call fails
- */
- public function read(
- $session,
- $table,
- $columns,
- $keySet,
- array $optionalArgs = []
- ) {
- $request = new ReadRequest();
- $requestParamHeaders = [];
- $request->setSession($session);
- $request->setTable($table);
- $request->setColumns($columns);
- $request->setKeySet($keySet);
- $requestParamHeaders['session'] = $session;
- if (isset($optionalArgs['transaction'])) {
- $request->setTransaction($optionalArgs['transaction']);
- }
-
- if (isset($optionalArgs['index'])) {
- $request->setIndex($optionalArgs['index']);
- }
-
- if (isset($optionalArgs['limit'])) {
- $request->setLimit($optionalArgs['limit']);
- }
-
- if (isset($optionalArgs['resumeToken'])) {
- $request->setResumeToken($optionalArgs['resumeToken']);
- }
-
- if (isset($optionalArgs['partitionToken'])) {
- $request->setPartitionToken($optionalArgs['partitionToken']);
- }
-
- if (isset($optionalArgs['requestOptions'])) {
- $request->setRequestOptions($optionalArgs['requestOptions']);
- }
-
- if (isset($optionalArgs['directedReadOptions'])) {
- $request->setDirectedReadOptions(
- $optionalArgs['directedReadOptions']
- );
- }
-
- if (isset($optionalArgs['dataBoostEnabled'])) {
- $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']);
- }
-
- if (isset($optionalArgs['orderBy'])) {
- $request->setOrderBy($optionalArgs['orderBy']);
- }
-
- if (isset($optionalArgs['lockHint'])) {
- $request->setLockHint($optionalArgs['lockHint']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'Read',
- ResultSet::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Rolls back a transaction, releasing any locks it holds. It is a good
- * idea to call this for any transaction that includes one or more
- * [Read][google.spanner.v1.Spanner.Read] or
- * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and ultimately
- * decides not to commit.
- *
- * `Rollback` returns `OK` if it successfully aborts the transaction, the
- * transaction was already aborted, or the transaction is not
- * found. `Rollback` never returns `ABORTED`.
- *
- * Sample code:
- * ```
- * $spannerClient = new SpannerClient();
- * try {
- * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]');
- * $transactionId = '...';
- * $spannerClient->rollback($formattedSession, $transactionId);
- * } finally {
- * $spannerClient->close();
- * }
- * ```
- *
- * @param string $session Required. The session in which the transaction to roll back is running.
- * @param string $transactionId Required. The transaction to roll back.
- * @param array $optionalArgs {
- * Optional.
- *
- * @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
- * {@see RetrySettings} for example usage.
- * }
- *
- * @throws ApiException if the remote call fails
- */
- public function rollback($session, $transactionId, array $optionalArgs = [])
- {
- $request = new RollbackRequest();
- $requestParamHeaders = [];
- $request->setSession($session);
- $request->setTransactionId($transactionId);
- $requestParamHeaders['session'] = $session;
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'Rollback',
- GPBEmpty::class,
- $optionalArgs,
- $request
- )->wait();
- }
-
- /**
- * Like [Read][google.spanner.v1.Spanner.Read], except returns the result set
- * as a stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no
- * limit on the size of the returned result set. However, no individual row in
- * the result set can exceed 100 MiB, and no column value can exceed
- * 10 MiB.
- *
- * Sample code:
- * ```
- * $spannerClient = new SpannerClient();
- * try {
- * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]');
- * $table = 'table';
- * $columns = [];
- * $keySet = new KeySet();
- * // Read all responses until the stream is complete
- * $stream = $spannerClient->streamingRead($formattedSession, $table, $columns, $keySet);
- * foreach ($stream->readAll() as $element) {
- * // doSomethingWith($element);
- * }
- * } finally {
- * $spannerClient->close();
- * }
- * ```
- *
- * @param string $session Required. The session in which the read should be performed.
- * @param string $table Required. The name of the table in the database to be read.
- * @param string[] $columns Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be
- * returned for each row matching this request.
- * @param KeySet $keySet Required. `key_set` identifies the rows to be yielded. `key_set` names the
- * primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to
- * be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present.
- * If [index][google.spanner.v1.ReadRequest.index] is present, then
- * [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys
- * in [index][google.spanner.v1.ReadRequest.index].
- *
- * If the [partition_token][google.spanner.v1.ReadRequest.partition_token]
- * field is empty, rows are yielded in table primary key order (if
- * [index][google.spanner.v1.ReadRequest.index] is empty) or index key order
- * (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the
- * [partition_token][google.spanner.v1.ReadRequest.partition_token] field is
- * not empty, rows will be yielded in an unspecified order.
- *
- * It is not an error for the `key_set` to name rows that do not
- * exist in the database. Read yields nothing for nonexistent rows.
- * @param array $optionalArgs {
- * Optional.
- *
- * @type TransactionSelector $transaction
- * The transaction to use. If none is provided, the default is a
- * temporary read-only transaction with strong concurrency.
- * @type string $index
- * If non-empty, the name of an index on
- * [table][google.spanner.v1.ReadRequest.table]. This index is used instead of
- * the table primary key when interpreting
- * [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows.
- * See [key_set][google.spanner.v1.ReadRequest.key_set] for further
- * information.
- * @type int $limit
- * If greater than zero, only the first `limit` rows are yielded. If `limit`
- * is zero, the default is no limit. A limit cannot be specified if
- * `partition_token` is set.
- * @type string $resumeToken
- * If this request is resuming a previously interrupted read,
- * `resume_token` should be copied from the last
- * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the
- * interruption. Doing this enables the new read to resume where the last read
- * left off. The rest of the request parameters must exactly match the request
- * that yielded this token.
- * @type string $partitionToken
- * If present, results will be restricted to the specified partition
- * previously created using PartitionRead(). There must be an exact
- * match for the values of fields common to this message and the
- * PartitionReadRequest message used to create this partition_token.
- * @type RequestOptions $requestOptions
- * Common options for this request.
- * @type DirectedReadOptions $directedReadOptions
- * Directed read options for this request.
- * @type bool $dataBoostEnabled
- * If this is for a partitioned read and this field is set to `true`, the
- * request is executed with Spanner Data Boost independent compute resources.
- *
- * If the field is set to `true` but the request does not set
- * `partition_token`, the API returns an `INVALID_ARGUMENT` error.
- * @type int $orderBy
- * Optional. Order for the returned rows.
- *
- * By default, Spanner will return result rows in primary key order except for
- * PartitionRead requests. For applications that do not require rows to be
- * returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting
- * `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval,
- * resulting in lower latencies in certain cases (e.g. bulk point lookups).
- * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\OrderBy}
- * @type int $lockHint
- * Optional. Lock Hint for the request, it can only be used with read-write
- * transactions.
- * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\LockHint}
- * @type int $timeoutMillis
- * Timeout to use for this call.
- * }
- *
- * @return \Google\ApiCore\ServerStream
- *
- * @throws ApiException if the remote call fails
- */
- public function streamingRead(
- $session,
- $table,
- $columns,
- $keySet,
- array $optionalArgs = []
- ) {
- $request = new ReadRequest();
- $requestParamHeaders = [];
- $request->setSession($session);
- $request->setTable($table);
- $request->setColumns($columns);
- $request->setKeySet($keySet);
- $requestParamHeaders['session'] = $session;
- if (isset($optionalArgs['transaction'])) {
- $request->setTransaction($optionalArgs['transaction']);
- }
-
- if (isset($optionalArgs['index'])) {
- $request->setIndex($optionalArgs['index']);
- }
-
- if (isset($optionalArgs['limit'])) {
- $request->setLimit($optionalArgs['limit']);
- }
-
- if (isset($optionalArgs['resumeToken'])) {
- $request->setResumeToken($optionalArgs['resumeToken']);
- }
-
- if (isset($optionalArgs['partitionToken'])) {
- $request->setPartitionToken($optionalArgs['partitionToken']);
- }
-
- if (isset($optionalArgs['requestOptions'])) {
- $request->setRequestOptions($optionalArgs['requestOptions']);
- }
-
- if (isset($optionalArgs['directedReadOptions'])) {
- $request->setDirectedReadOptions(
- $optionalArgs['directedReadOptions']
- );
- }
-
- if (isset($optionalArgs['dataBoostEnabled'])) {
- $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']);
- }
-
- if (isset($optionalArgs['orderBy'])) {
- $request->setOrderBy($optionalArgs['orderBy']);
- }
-
- if (isset($optionalArgs['lockHint'])) {
- $request->setLockHint($optionalArgs['lockHint']);
- }
-
- $requestParams = new RequestParamsHeaderDescriptor(
- $requestParamHeaders
- );
- $optionalArgs['headers'] = isset($optionalArgs['headers'])
- ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
- : $requestParams->getHeader();
- return $this->startCall(
- 'StreamingRead',
- PartialResultSet::class,
- $optionalArgs,
- $request,
- Call::SERVER_STREAMING_CALL
- );
- }
-}
diff --git a/Spanner/src/V1/GetSessionRequest.php b/Spanner/src/V1/GetSessionRequest.php
index 219e54335c98..3e1ca94c5883 100644
--- a/Spanner/src/V1/GetSessionRequest.php
+++ b/Spanner/src/V1/GetSessionRequest.php
@@ -20,7 +20,7 @@ class GetSessionRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $name = '';
+ protected $name = '';
/**
* @param string $name Required. The name of the session to retrieve. Please see
diff --git a/Spanner/src/V1/KeySet.php b/Spanner/src/V1/KeySet.php
index a956a41f8513..29121208ba59 100644
--- a/Spanner/src/V1/KeySet.php
+++ b/Spanner/src/V1/KeySet.php
@@ -43,7 +43,7 @@ class KeySet extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bool all = 3;
*/
- private $all = false;
+ protected $all = false;
/**
* Constructor.
diff --git a/Spanner/src/V1/ListSessionsRequest.php b/Spanner/src/V1/ListSessionsRequest.php
index e7329c5e4965..d3fd205fce8d 100644
--- a/Spanner/src/V1/ListSessionsRequest.php
+++ b/Spanner/src/V1/ListSessionsRequest.php
@@ -20,14 +20,14 @@ class ListSessionsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $database = '';
+ protected $database = '';
/**
* Number of sessions to be returned in the response. If 0 or less, defaults
* to the server's maximum allowed page size.
*
* Generated from protobuf field int32 page_size = 2;
*/
- private $page_size = 0;
+ protected $page_size = 0;
/**
* If non-empty, `page_token` should contain a
* [next_page_token][google.spanner.v1.ListSessionsResponse.next_page_token]
@@ -36,7 +36,7 @@ class ListSessionsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string page_token = 3;
*/
- private $page_token = '';
+ protected $page_token = '';
/**
* An expression for filtering the results of the request. Filter rules are
* case insensitive. The fields eligible for filtering are:
@@ -48,7 +48,7 @@ class ListSessionsRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string filter = 4;
*/
- private $filter = '';
+ protected $filter = '';
/**
* @param string $database Required. The database in which to list sessions. Please see
diff --git a/Spanner/src/V1/ListSessionsResponse.php b/Spanner/src/V1/ListSessionsResponse.php
index 7edc5e274f64..0d8cff32a984 100644
--- a/Spanner/src/V1/ListSessionsResponse.php
+++ b/Spanner/src/V1/ListSessionsResponse.php
@@ -28,7 +28,7 @@ class ListSessionsResponse extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string next_page_token = 2;
*/
- private $next_page_token = '';
+ protected $next_page_token = '';
/**
* Constructor.
diff --git a/Spanner/src/V1/Mutation/Delete.php b/Spanner/src/V1/Mutation/Delete.php
index 87497e39b097..205a4cfd6c7d 100644
--- a/Spanner/src/V1/Mutation/Delete.php
+++ b/Spanner/src/V1/Mutation/Delete.php
@@ -20,7 +20,7 @@ class Delete extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string table = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $table = '';
+ protected $table = '';
/**
* Required. The primary keys of the rows within [table][google.spanner.v1.Mutation.Delete.table] to delete. The
* primary keys must be specified in the order in which they appear in the
@@ -31,7 +31,7 @@ class Delete extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.v1.KeySet key_set = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $key_set = null;
+ protected $key_set = null;
/**
* Constructor.
@@ -129,6 +129,4 @@ public function setKeySet($var)
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(Delete::class, \Google\Cloud\Spanner\V1\Mutation_Delete::class);
diff --git a/Spanner/src/V1/Mutation/Write.php b/Spanner/src/V1/Mutation/Write.php
index a77397b49a31..74a612a2b61d 100644
--- a/Spanner/src/V1/Mutation/Write.php
+++ b/Spanner/src/V1/Mutation/Write.php
@@ -21,7 +21,7 @@ class Write extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string table = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $table = '';
+ protected $table = '';
/**
* The names of the columns in [table][google.spanner.v1.Mutation.Write.table] to be written.
* The list of columns must contain enough columns to allow
@@ -174,6 +174,4 @@ public function setValues($var)
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(Write::class, \Google\Cloud\Spanner\V1\Mutation_Write::class);
diff --git a/Spanner/src/V1/Mutation_Delete.php b/Spanner/src/V1/Mutation_Delete.php
deleted file mode 100644
index d02ffef898a6..000000000000
--- a/Spanner/src/V1/Mutation_Delete.php
+++ /dev/null
@@ -1,16 +0,0 @@
-bytes partition_token = 1;
*/
- private $partition_token = '';
+ protected $partition_token = '';
/**
* Constructor.
diff --git a/Spanner/src/V1/PartitionOptions.php b/Spanner/src/V1/PartitionOptions.php
index 89530cdb9f1e..fa726b5f9161 100644
--- a/Spanner/src/V1/PartitionOptions.php
+++ b/Spanner/src/V1/PartitionOptions.php
@@ -25,7 +25,7 @@ class PartitionOptions extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field int64 partition_size_bytes = 1;
*/
- private $partition_size_bytes = 0;
+ protected $partition_size_bytes = 0;
/**
* **Note:** This hint is currently ignored by PartitionQuery and
* PartitionRead requests.
@@ -37,7 +37,7 @@ class PartitionOptions extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field int64 max_partitions = 2;
*/
- private $max_partitions = 0;
+ protected $max_partitions = 0;
/**
* Constructor.
diff --git a/Spanner/src/V1/PartitionQueryRequest.php b/Spanner/src/V1/PartitionQueryRequest.php
index fe99ae2a25bb..98df014e6b07 100644
--- a/Spanner/src/V1/PartitionQueryRequest.php
+++ b/Spanner/src/V1/PartitionQueryRequest.php
@@ -20,14 +20,14 @@ class PartitionQueryRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $session = '';
+ protected $session = '';
/**
* Read only snapshot transactions are supported, read/write and single use
* transactions are not.
*
* Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2;
*/
- private $transaction = null;
+ protected $transaction = null;
/**
* Required. The query request to generate partitions for. The request will
* fail if the query is not root partitionable. For a query to be root
@@ -43,7 +43,7 @@ class PartitionQueryRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string sql = 3 [(.google.api.field_behavior) = REQUIRED];
*/
- private $sql = '';
+ protected $sql = '';
/**
* Parameter names and values that bind to placeholders in the SQL string.
* A parameter placeholder consists of the `@` character followed by the
@@ -56,7 +56,7 @@ class PartitionQueryRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Struct params = 4;
*/
- private $params = null;
+ protected $params = null;
/**
* It is not always possible for Cloud Spanner to infer the right SQL type
* from a JSON value. For example, values of type `BYTES` and values
@@ -75,7 +75,7 @@ class PartitionQueryRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.v1.PartitionOptions partition_options = 6;
*/
- private $partition_options = null;
+ protected $partition_options = null;
/**
* Constructor.
diff --git a/Spanner/src/V1/PartitionReadRequest.php b/Spanner/src/V1/PartitionReadRequest.php
index 64657d72bcd1..abf0b47074e2 100644
--- a/Spanner/src/V1/PartitionReadRequest.php
+++ b/Spanner/src/V1/PartitionReadRequest.php
@@ -20,20 +20,20 @@ class PartitionReadRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $session = '';
+ protected $session = '';
/**
* Read only snapshot transactions are supported, read/write and single use
* transactions are not.
*
* Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2;
*/
- private $transaction = null;
+ protected $transaction = null;
/**
* Required. The name of the table in the database to be read.
*
* Generated from protobuf field string table = 3 [(.google.api.field_behavior) = REQUIRED];
*/
- private $table = '';
+ protected $table = '';
/**
* If non-empty, the name of an index on
* [table][google.spanner.v1.PartitionReadRequest.table]. This index is used
@@ -44,7 +44,7 @@ class PartitionReadRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string index = 4;
*/
- private $index = '';
+ protected $index = '';
/**
* The columns of [table][google.spanner.v1.PartitionReadRequest.table] to be
* returned for each row matching this request.
@@ -65,13 +65,13 @@ class PartitionReadRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.v1.KeySet key_set = 6 [(.google.api.field_behavior) = REQUIRED];
*/
- private $key_set = null;
+ protected $key_set = null;
/**
* Additional options that affect how many partitions are created.
*
* Generated from protobuf field .google.spanner.v1.PartitionOptions partition_options = 9;
*/
- private $partition_options = null;
+ protected $partition_options = null;
/**
* Constructor.
diff --git a/Spanner/src/V1/PartitionResponse.php b/Spanner/src/V1/PartitionResponse.php
index e60b8bbae38c..f73e1179d2df 100644
--- a/Spanner/src/V1/PartitionResponse.php
+++ b/Spanner/src/V1/PartitionResponse.php
@@ -27,7 +27,7 @@ class PartitionResponse extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.v1.Transaction transaction = 2;
*/
- private $transaction = null;
+ protected $transaction = null;
/**
* Constructor.
diff --git a/Spanner/src/V1/PlanNode.php b/Spanner/src/V1/PlanNode.php
index e19b7fc47938..9137384574bb 100644
--- a/Spanner/src/V1/PlanNode.php
+++ b/Spanner/src/V1/PlanNode.php
@@ -20,7 +20,7 @@ class PlanNode extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field int32 index = 1;
*/
- private $index = 0;
+ protected $index = 0;
/**
* Used to determine the type of node. May be needed for visualizing
* different kinds of nodes differently. For example, If the node is a
@@ -30,13 +30,13 @@ class PlanNode extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.v1.PlanNode.Kind kind = 2;
*/
- private $kind = 0;
+ protected $kind = 0;
/**
* The display name for the node.
*
* Generated from protobuf field string display_name = 3;
*/
- private $display_name = '';
+ protected $display_name = '';
/**
* List of child node `index`es and their relationship to this parent.
*
@@ -48,7 +48,7 @@ class PlanNode extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.v1.PlanNode.ShortRepresentation short_representation = 5;
*/
- private $short_representation = null;
+ protected $short_representation = null;
/**
* Attributes relevant to the node contained in a group of key-value pairs.
* For example, a Parameter Reference node could have the following
@@ -60,7 +60,7 @@ class PlanNode extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Struct metadata = 6;
*/
- private $metadata = null;
+ protected $metadata = null;
/**
* The execution statistics associated with the node, contained in a group of
* key-value pairs. Only present if the plan was returned as a result of a
@@ -69,7 +69,7 @@ class PlanNode extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Struct execution_stats = 7;
*/
- private $execution_stats = null;
+ protected $execution_stats = null;
/**
* Constructor.
diff --git a/Spanner/src/V1/PlanNode/ChildLink.php b/Spanner/src/V1/PlanNode/ChildLink.php
index 5da7b08010f6..ada6b260cb01 100644
--- a/Spanner/src/V1/PlanNode/ChildLink.php
+++ b/Spanner/src/V1/PlanNode/ChildLink.php
@@ -21,7 +21,7 @@ class ChildLink extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field int32 child_index = 1;
*/
- private $child_index = 0;
+ protected $child_index = 0;
/**
* The type of the link. For example, in Hash Joins this could be used to
* distinguish between the build child and the probe child, or in the case
@@ -30,7 +30,7 @@ class ChildLink extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string type = 2;
*/
- private $type = '';
+ protected $type = '';
/**
* Only present if the child node is [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] and corresponds
* to an output variable of the parent node. The field carries the name of
@@ -43,7 +43,7 @@ class ChildLink extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string variable = 3;
*/
- private $variable = '';
+ protected $variable = '';
/**
* Constructor.
@@ -174,6 +174,4 @@ public function setVariable($var)
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(ChildLink::class, \Google\Cloud\Spanner\V1\PlanNode_ChildLink::class);
diff --git a/Spanner/src/V1/PlanNode/Kind.php b/Spanner/src/V1/PlanNode/Kind.php
index 78081c797e03..ce60b0eadc0d 100644
--- a/Spanner/src/V1/PlanNode/Kind.php
+++ b/Spanner/src/V1/PlanNode/Kind.php
@@ -65,6 +65,4 @@ public static function value($name)
}
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(Kind::class, \Google\Cloud\Spanner\V1\PlanNode_Kind::class);
diff --git a/Spanner/src/V1/PlanNode/ShortRepresentation.php b/Spanner/src/V1/PlanNode/ShortRepresentation.php
index 700c523a9c0f..30993ae031c7 100644
--- a/Spanner/src/V1/PlanNode/ShortRepresentation.php
+++ b/Spanner/src/V1/PlanNode/ShortRepresentation.php
@@ -21,7 +21,7 @@ class ShortRepresentation extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string description = 1;
*/
- private $description = '';
+ protected $description = '';
/**
* A mapping of (subquery variable name) -> (subquery node id) for cases
* where the `description` string of this node references a `SCALAR`
@@ -116,6 +116,4 @@ public function setSubqueries($var)
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(ShortRepresentation::class, \Google\Cloud\Spanner\V1\PlanNode_ShortRepresentation::class);
diff --git a/Spanner/src/V1/PlanNode_ChildLink.php b/Spanner/src/V1/PlanNode_ChildLink.php
deleted file mode 100644
index 6654ad37e08e..000000000000
--- a/Spanner/src/V1/PlanNode_ChildLink.php
+++ /dev/null
@@ -1,16 +0,0 @@
-string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $session = '';
+ protected $session = '';
/**
* The transaction to use. If none is provided, the default is a
* temporary read-only transaction with strong concurrency.
*
* Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2;
*/
- private $transaction = null;
+ protected $transaction = null;
/**
* Required. The name of the table in the database to be read.
*
* Generated from protobuf field string table = 3 [(.google.api.field_behavior) = REQUIRED];
*/
- private $table = '';
+ protected $table = '';
/**
* If non-empty, the name of an index on
* [table][google.spanner.v1.ReadRequest.table]. This index is used instead of
@@ -45,7 +45,7 @@ class ReadRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string index = 4;
*/
- private $index = '';
+ protected $index = '';
/**
* Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be
* returned for each row matching this request.
@@ -71,7 +71,7 @@ class ReadRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.v1.KeySet key_set = 6 [(.google.api.field_behavior) = REQUIRED];
*/
- private $key_set = null;
+ protected $key_set = null;
/**
* If greater than zero, only the first `limit` rows are yielded. If `limit`
* is zero, the default is no limit. A limit cannot be specified if
@@ -79,7 +79,7 @@ class ReadRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field int64 limit = 8;
*/
- private $limit = 0;
+ protected $limit = 0;
/**
* If this request is resuming a previously interrupted read,
* `resume_token` should be copied from the last
@@ -90,7 +90,7 @@ class ReadRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bytes resume_token = 9;
*/
- private $resume_token = '';
+ protected $resume_token = '';
/**
* If present, results will be restricted to the specified partition
* previously created using PartitionRead(). There must be an exact
@@ -99,19 +99,19 @@ class ReadRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bytes partition_token = 10;
*/
- private $partition_token = '';
+ protected $partition_token = '';
/**
* Common options for this request.
*
* Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 11;
*/
- private $request_options = null;
+ protected $request_options = null;
/**
* Directed read options for this request.
*
* Generated from protobuf field .google.spanner.v1.DirectedReadOptions directed_read_options = 14;
*/
- private $directed_read_options = null;
+ protected $directed_read_options = null;
/**
* If this is for a partitioned read and this field is set to `true`, the
* request is executed with Spanner Data Boost independent compute resources.
@@ -120,7 +120,7 @@ class ReadRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bool data_boost_enabled = 15;
*/
- private $data_boost_enabled = false;
+ protected $data_boost_enabled = false;
/**
* Optional. Order for the returned rows.
* By default, Spanner will return result rows in primary key order except for
@@ -131,14 +131,14 @@ class ReadRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.v1.ReadRequest.OrderBy order_by = 16 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $order_by = 0;
+ protected $order_by = 0;
/**
* Optional. Lock Hint for the request, it can only be used with read-write
* transactions.
*
* Generated from protobuf field .google.spanner.v1.ReadRequest.LockHint lock_hint = 17 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $lock_hint = 0;
+ protected $lock_hint = 0;
/**
* Constructor.
diff --git a/Spanner/src/V1/ReadRequest/LockHint.php b/Spanner/src/V1/ReadRequest/LockHint.php
index c0e38b196dbf..5e1b4d9d2b3f 100644
--- a/Spanner/src/V1/ReadRequest/LockHint.php
+++ b/Spanner/src/V1/ReadRequest/LockHint.php
@@ -90,6 +90,4 @@ public static function value($name)
}
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(LockHint::class, \Google\Cloud\Spanner\V1\ReadRequest_LockHint::class);
diff --git a/Spanner/src/V1/ReadRequest/OrderBy.php b/Spanner/src/V1/ReadRequest/OrderBy.php
index 4a229a9738f2..062f5ec846e3 100644
--- a/Spanner/src/V1/ReadRequest/OrderBy.php
+++ b/Spanner/src/V1/ReadRequest/OrderBy.php
@@ -62,6 +62,4 @@ public static function value($name)
}
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(OrderBy::class, \Google\Cloud\Spanner\V1\ReadRequest_OrderBy::class);
diff --git a/Spanner/src/V1/RequestOptions.php b/Spanner/src/V1/RequestOptions.php
index 0b8217f4b287..1b2cd281d004 100644
--- a/Spanner/src/V1/RequestOptions.php
+++ b/Spanner/src/V1/RequestOptions.php
@@ -20,7 +20,7 @@ class RequestOptions extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.v1.RequestOptions.Priority priority = 1;
*/
- private $priority = 0;
+ protected $priority = 0;
/**
* A per-request tag which can be applied to queries or reads, used for
* statistics collection.
@@ -35,7 +35,7 @@ class RequestOptions extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string request_tag = 2;
*/
- private $request_tag = '';
+ protected $request_tag = '';
/**
* A tag used for statistics collection about this transaction.
* Both request_tag and transaction_tag can be specified for a read or query
@@ -51,7 +51,7 @@ class RequestOptions extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string transaction_tag = 3;
*/
- private $transaction_tag = '';
+ protected $transaction_tag = '';
/**
* Constructor.
diff --git a/Spanner/src/V1/RequestOptions/Priority.php b/Spanner/src/V1/RequestOptions/Priority.php
index b8d614f98da5..06147292d32c 100644
--- a/Spanner/src/V1/RequestOptions/Priority.php
+++ b/Spanner/src/V1/RequestOptions/Priority.php
@@ -79,6 +79,4 @@ public static function value($name)
}
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(Priority::class, \Google\Cloud\Spanner\V1\RequestOptions_Priority::class);
diff --git a/Spanner/src/V1/RequestOptions_Priority.php b/Spanner/src/V1/RequestOptions_Priority.php
deleted file mode 100644
index 0eb2ae34000b..000000000000
--- a/Spanner/src/V1/RequestOptions_Priority.php
+++ /dev/null
@@ -1,16 +0,0 @@
-.google.spanner.v1.StructType row_type = 1;
*/
- private $row_type = null;
+ protected $row_type = null;
/**
* If the read or SQL query began a transaction as a side-effect, the
* information about the new transaction is yielded here.
*
* Generated from protobuf field .google.spanner.v1.Transaction transaction = 2;
*/
- private $transaction = null;
+ protected $transaction = null;
/**
* A SQL query can be parameterized. In PLAN mode, these parameters can be
* undeclared. This indicates the field names and types for those undeclared
@@ -47,7 +47,7 @@ class ResultSetMetadata extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.v1.StructType undeclared_parameters = 3;
*/
- private $undeclared_parameters = null;
+ protected $undeclared_parameters = null;
/**
* Constructor.
diff --git a/Spanner/src/V1/ResultSetStats.php b/Spanner/src/V1/ResultSetStats.php
index 8668c1211e06..e39cc1952951 100644
--- a/Spanner/src/V1/ResultSetStats.php
+++ b/Spanner/src/V1/ResultSetStats.php
@@ -20,7 +20,7 @@ class ResultSetStats extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.v1.QueryPlan query_plan = 1;
*/
- private $query_plan = null;
+ protected $query_plan = null;
/**
* Aggregated statistics from the execution of the query. Only present when
* the query is profiled. For example, a query could return the statistics as
@@ -33,7 +33,7 @@ class ResultSetStats extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Struct query_stats = 2;
*/
- private $query_stats = null;
+ protected $query_stats = null;
protected $row_count;
/**
diff --git a/Spanner/src/V1/RollbackRequest.php b/Spanner/src/V1/RollbackRequest.php
index 9f7a3a2d89fb..23129ad2e295 100644
--- a/Spanner/src/V1/RollbackRequest.php
+++ b/Spanner/src/V1/RollbackRequest.php
@@ -20,13 +20,13 @@ class RollbackRequest extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
- private $session = '';
+ protected $session = '';
/**
* Required. The transaction to roll back.
*
* Generated from protobuf field bytes transaction_id = 2 [(.google.api.field_behavior) = REQUIRED];
*/
- private $transaction_id = '';
+ protected $transaction_id = '';
/**
* @param string $session Required. The session in which the transaction to roll back is running. Please see
diff --git a/Spanner/src/V1/Session.php b/Spanner/src/V1/Session.php
index 0a273127adae..772272bb851a 100644
--- a/Spanner/src/V1/Session.php
+++ b/Spanner/src/V1/Session.php
@@ -20,7 +20,7 @@ class Session extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $name = '';
+ protected $name = '';
/**
* The labels for the session.
* * Label keys must be between 1 and 63 characters long and must conform to
@@ -38,20 +38,20 @@ class Session extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $create_time = null;
+ protected $create_time = null;
/**
* Output only. The approximate timestamp when the session is last used. It is
* typically earlier than the actual last use time.
*
* Generated from protobuf field .google.protobuf.Timestamp approximate_last_use_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
*/
- private $approximate_last_use_time = null;
+ protected $approximate_last_use_time = null;
/**
* The database role which created this session.
*
* Generated from protobuf field string creator_role = 5;
*/
- private $creator_role = '';
+ protected $creator_role = '';
/**
* Optional. If true, specifies a multiplexed session. A multiplexed session
* may be used for multiple, concurrent read-only operations but can not be
@@ -63,7 +63,7 @@ class Session extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bool multiplexed = 6 [(.google.api.field_behavior) = OPTIONAL];
*/
- private $multiplexed = false;
+ protected $multiplexed = false;
/**
* Constructor.
diff --git a/Spanner/src/V1/SpannerClient.php b/Spanner/src/V1/SpannerClient.php
deleted file mode 100644
index 220b1b5ec6a6..000000000000
--- a/Spanner/src/V1/SpannerClient.php
+++ /dev/null
@@ -1,52 +0,0 @@
-_simpleRequest('/google.spanner.v1.Spanner/CreateSession',
- $argument,
- ['\Google\Cloud\Spanner\V1\Session', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Creates multiple new sessions.
- *
- * This API can be used to initialize a session cache on the clients.
- * See https://goo.gl/TgSFN2 for best practices on session cache management.
- * @param \Google\Cloud\Spanner\V1\BatchCreateSessionsRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function BatchCreateSessions(\Google\Cloud\Spanner\V1\BatchCreateSessionsRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.v1.Spanner/BatchCreateSessions',
- $argument,
- ['\Google\Cloud\Spanner\V1\BatchCreateSessionsResponse', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Gets a session. Returns `NOT_FOUND` if the session does not exist.
- * This is mainly useful for determining whether a session is still
- * alive.
- * @param \Google\Cloud\Spanner\V1\GetSessionRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function GetSession(\Google\Cloud\Spanner\V1\GetSessionRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.v1.Spanner/GetSession',
- $argument,
- ['\Google\Cloud\Spanner\V1\Session', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Lists all sessions in a given database.
- * @param \Google\Cloud\Spanner\V1\ListSessionsRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function ListSessions(\Google\Cloud\Spanner\V1\ListSessionsRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.v1.Spanner/ListSessions',
- $argument,
- ['\Google\Cloud\Spanner\V1\ListSessionsResponse', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Ends a session, releasing server resources associated with it. This will
- * asynchronously trigger cancellation of any operations that are running with
- * this session.
- * @param \Google\Cloud\Spanner\V1\DeleteSessionRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function DeleteSession(\Google\Cloud\Spanner\V1\DeleteSessionRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.v1.Spanner/DeleteSession',
- $argument,
- ['\Google\Protobuf\GPBEmpty', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Executes an SQL statement, returning all results in a single reply. This
- * method cannot be used to return a result set larger than 10 MiB;
- * if the query yields more data than that, the query fails with
- * a `FAILED_PRECONDITION` error.
- *
- * Operations inside read-write transactions might return `ABORTED`. If
- * this occurs, the application should restart the transaction from
- * the beginning. See [Transaction][google.spanner.v1.Transaction] for more details.
- *
- * Larger result sets can be fetched in streaming fashion by calling
- * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] instead.
- * @param \Google\Cloud\Spanner\V1\ExecuteSqlRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function ExecuteSql(\Google\Cloud\Spanner\V1\ExecuteSqlRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.v1.Spanner/ExecuteSql',
- $argument,
- ['\Google\Cloud\Spanner\V1\ResultSet', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the result
- * set as a stream. Unlike [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there
- * is no limit on the size of the returned result set. However, no
- * individual row in the result set can exceed 100 MiB, and no
- * column value can exceed 10 MiB.
- * @param \Google\Cloud\Spanner\V1\ExecuteSqlRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\ServerStreamingCall
- */
- public function ExecuteStreamingSql(\Google\Cloud\Spanner\V1\ExecuteSqlRequest $argument,
- $metadata = [], $options = []) {
- return $this->_serverStreamRequest('/google.spanner.v1.Spanner/ExecuteStreamingSql',
- $argument,
- ['\Google\Cloud\Spanner\V1\PartialResultSet', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Executes a batch of SQL DML statements. This method allows many statements
- * to be run with lower latency than submitting them sequentially with
- * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql].
- *
- * Statements are executed in sequential order. A request can succeed even if
- * a statement fails. The [ExecuteBatchDmlResponse.status][google.spanner.v1.ExecuteBatchDmlResponse.status] field in the
- * response provides information about the statement that failed. Clients must
- * inspect this field to determine whether an error occurred.
- *
- * Execution stops after the first failed statement; the remaining statements
- * are not executed.
- * @param \Google\Cloud\Spanner\V1\ExecuteBatchDmlRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function ExecuteBatchDml(\Google\Cloud\Spanner\V1\ExecuteBatchDmlRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.v1.Spanner/ExecuteBatchDml',
- $argument,
- ['\Google\Cloud\Spanner\V1\ExecuteBatchDmlResponse', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Reads rows from the database using key lookups and scans, as a
- * simple key/value style alternative to
- * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be used to
- * return a result set larger than 10 MiB; if the read matches more
- * data than that, the read fails with a `FAILED_PRECONDITION`
- * error.
- *
- * Reads inside read-write transactions might return `ABORTED`. If
- * this occurs, the application should restart the transaction from
- * the beginning. See [Transaction][google.spanner.v1.Transaction] for more details.
- *
- * Larger result sets can be yielded in streaming fashion by calling
- * [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead.
- * @param \Google\Cloud\Spanner\V1\ReadRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function Read(\Google\Cloud\Spanner\V1\ReadRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.v1.Spanner/Read',
- $argument,
- ['\Google\Cloud\Spanner\V1\ResultSet', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Like [Read][google.spanner.v1.Spanner.Read], except returns the result set as a
- * stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no limit on the
- * size of the returned result set. However, no individual row in
- * the result set can exceed 100 MiB, and no column value can exceed
- * 10 MiB.
- * @param \Google\Cloud\Spanner\V1\ReadRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\ServerStreamingCall
- */
- public function StreamingRead(\Google\Cloud\Spanner\V1\ReadRequest $argument,
- $metadata = [], $options = []) {
- return $this->_serverStreamRequest('/google.spanner.v1.Spanner/StreamingRead',
- $argument,
- ['\Google\Cloud\Spanner\V1\PartialResultSet', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Begins a new transaction. This step can often be skipped:
- * [Read][google.spanner.v1.Spanner.Read], [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and
- * [Commit][google.spanner.v1.Spanner.Commit] can begin a new transaction as a
- * side-effect.
- * @param \Google\Cloud\Spanner\V1\BeginTransactionRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function BeginTransaction(\Google\Cloud\Spanner\V1\BeginTransactionRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.v1.Spanner/BeginTransaction',
- $argument,
- ['\Google\Cloud\Spanner\V1\Transaction', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Commits a transaction. The request includes the mutations to be
- * applied to rows in the database.
- *
- * `Commit` might return an `ABORTED` error. This can occur at any time;
- * commonly, the cause is conflicts with concurrent
- * transactions. However, it can also happen for a variety of other
- * reasons. If `Commit` returns `ABORTED`, the caller should re-attempt
- * the transaction from the beginning, re-using the same session.
- *
- * On very rare occasions, `Commit` might return `UNKNOWN`. This can happen,
- * for example, if the client job experiences a 1+ hour networking failure.
- * At that point, Cloud Spanner has lost track of the transaction outcome and
- * we recommend that you perform another read from the database to see the
- * state of things as they are now.
- * @param \Google\Cloud\Spanner\V1\CommitRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function Commit(\Google\Cloud\Spanner\V1\CommitRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.v1.Spanner/Commit',
- $argument,
- ['\Google\Cloud\Spanner\V1\CommitResponse', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Rolls back a transaction, releasing any locks it holds. It is a good
- * idea to call this for any transaction that includes one or more
- * [Read][google.spanner.v1.Spanner.Read] or [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and
- * ultimately decides not to commit.
- *
- * `Rollback` returns `OK` if it successfully aborts the transaction, the
- * transaction was already aborted, or the transaction is not
- * found. `Rollback` never returns `ABORTED`.
- * @param \Google\Cloud\Spanner\V1\RollbackRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function Rollback(\Google\Cloud\Spanner\V1\RollbackRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.v1.Spanner/Rollback',
- $argument,
- ['\Google\Protobuf\GPBEmpty', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Creates a set of partition tokens that can be used to execute a query
- * operation in parallel. Each of the returned partition tokens can be used
- * by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to specify a subset
- * of the query result to read. The same session and read-only transaction
- * must be used by the PartitionQueryRequest used to create the
- * partition tokens and the ExecuteSqlRequests that use the partition tokens.
- *
- * Partition tokens become invalid when the session used to create them
- * is deleted, is idle for too long, begins a new transaction, or becomes too
- * old. When any of these happen, it is not possible to resume the query, and
- * the whole operation must be restarted from the beginning.
- * @param \Google\Cloud\Spanner\V1\PartitionQueryRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function PartitionQuery(\Google\Cloud\Spanner\V1\PartitionQueryRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.v1.Spanner/PartitionQuery',
- $argument,
- ['\Google\Cloud\Spanner\V1\PartitionResponse', 'decode'],
- $metadata, $options);
- }
-
- /**
- * Creates a set of partition tokens that can be used to execute a read
- * operation in parallel. Each of the returned partition tokens can be used
- * by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a subset of the read
- * result to read. The same session and read-only transaction must be used by
- * the PartitionReadRequest used to create the partition tokens and the
- * ReadRequests that use the partition tokens. There are no ordering
- * guarantees on rows returned among the returned partition tokens, or even
- * within each individual StreamingRead call issued with a partition_token.
- *
- * Partition tokens become invalid when the session used to create them
- * is deleted, is idle for too long, begins a new transaction, or becomes too
- * old. When any of these happen, it is not possible to resume the read, and
- * the whole operation must be restarted from the beginning.
- * @param \Google\Cloud\Spanner\V1\PartitionReadRequest $argument input argument
- * @param array $metadata metadata
- * @param array $options call options
- * @return \Grpc\UnaryCall
- */
- public function PartitionRead(\Google\Cloud\Spanner\V1\PartitionReadRequest $argument,
- $metadata = [], $options = []) {
- return $this->_simpleRequest('/google.spanner.v1.Spanner/PartitionRead',
- $argument,
- ['\Google\Cloud\Spanner\V1\PartitionResponse', 'decode'],
- $metadata, $options);
- }
-
-}
diff --git a/Spanner/src/V1/StructType/Field.php b/Spanner/src/V1/StructType/Field.php
index 1ba9900e6011..5302c7521086 100644
--- a/Spanner/src/V1/StructType/Field.php
+++ b/Spanner/src/V1/StructType/Field.php
@@ -26,13 +26,13 @@ class Field extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string name = 1;
*/
- private $name = '';
+ protected $name = '';
/**
* The type of the field.
*
* Generated from protobuf field .google.spanner.v1.Type type = 2;
*/
- private $type = null;
+ protected $type = null;
/**
* Constructor.
@@ -133,6 +133,4 @@ public function setType($var)
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(Field::class, \Google\Cloud\Spanner\V1\StructType_Field::class);
diff --git a/Spanner/src/V1/StructType_Field.php b/Spanner/src/V1/StructType_Field.php
deleted file mode 100644
index 61e68ce4d6fb..000000000000
--- a/Spanner/src/V1/StructType_Field.php
+++ /dev/null
@@ -1,16 +0,0 @@
-bool exclude_txn_from_change_streams = 5;
*/
- private $exclude_txn_from_change_streams = false;
+ protected $exclude_txn_from_change_streams = false;
protected $mode;
/**
diff --git a/Spanner/src/V1/TransactionOptions/PBReadOnly.php b/Spanner/src/V1/TransactionOptions/PBReadOnly.php
index bf4ce66fba43..c6310726aed4 100644
--- a/Spanner/src/V1/TransactionOptions/PBReadOnly.php
+++ b/Spanner/src/V1/TransactionOptions/PBReadOnly.php
@@ -22,7 +22,7 @@ class PBReadOnly extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field bool return_read_timestamp = 6;
*/
- private $return_read_timestamp = false;
+ protected $return_read_timestamp = false;
protected $timestamp_bound;
/**
@@ -349,7 +349,7 @@ public function getTimestampBound()
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(PBReadOnly::class, \Google\Cloud\Spanner\V1\TransactionOptions_ReadOnly::class);
+// Adding a class alias for backwards compatibility with the "readonly" keyword.
+class_alias(PBReadOnly::class, __NAMESPACE__ . '\ReadOnly');
diff --git a/Spanner/src/V1/TransactionOptions/PartitionedDml.php b/Spanner/src/V1/TransactionOptions/PartitionedDml.php
index 06d0e4b25c62..524e582cb398 100644
--- a/Spanner/src/V1/TransactionOptions/PartitionedDml.php
+++ b/Spanner/src/V1/TransactionOptions/PartitionedDml.php
@@ -31,6 +31,4 @@ public function __construct($data = NULL) {
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(PartitionedDml::class, \Google\Cloud\Spanner\V1\TransactionOptions_PartitionedDml::class);
diff --git a/Spanner/src/V1/TransactionOptions/ReadWrite/ReadLockMode.php b/Spanner/src/V1/TransactionOptions/ReadWrite/ReadLockMode.php
index 75b8922f96cb..45bdbaa5fc10 100644
--- a/Spanner/src/V1/TransactionOptions/ReadWrite/ReadLockMode.php
+++ b/Spanner/src/V1/TransactionOptions/ReadWrite/ReadLockMode.php
@@ -65,6 +65,4 @@ public static function value($name)
}
}
-// Adding a class alias for backwards compatibility with the previous class name.
-class_alias(ReadLockMode::class, \Google\Cloud\Spanner\V1\TransactionOptions_ReadWrite_ReadLockMode::class);
diff --git a/Spanner/src/V1/TransactionOptions_PartitionedDml.php b/Spanner/src/V1/TransactionOptions_PartitionedDml.php
deleted file mode 100644
index 642aa426c8ff..000000000000
--- a/Spanner/src/V1/TransactionOptions_PartitionedDml.php
+++ /dev/null
@@ -1,16 +0,0 @@
-.google.spanner.v1.TypeCode code = 1 [(.google.api.field_behavior) = REQUIRED];
*/
- private $code = 0;
+ protected $code = 0;
/**
* If [code][google.spanner.v1.Type.code] ==
* [ARRAY][google.spanner.v1.TypeCode.ARRAY], then `array_element_type` is the
@@ -29,7 +29,7 @@ class Type extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.v1.Type array_element_type = 2;
*/
- private $array_element_type = null;
+ protected $array_element_type = null;
/**
* If [code][google.spanner.v1.Type.code] ==
* [STRUCT][google.spanner.v1.TypeCode.STRUCT], then `struct_type` provides
@@ -37,7 +37,7 @@ class Type extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.v1.StructType struct_type = 3;
*/
- private $struct_type = null;
+ protected $struct_type = null;
/**
* The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that
* disambiguates SQL type that Spanner will use to represent values of this
@@ -50,7 +50,7 @@ class Type extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field .google.spanner.v1.TypeAnnotationCode type_annotation = 4;
*/
- private $type_annotation = 0;
+ protected $type_annotation = 0;
/**
* If [code][google.spanner.v1.Type.code] ==
* [PROTO][google.spanner.v1.TypeCode.PROTO] or
@@ -60,7 +60,7 @@ class Type extends \Google\Protobuf\Internal\Message
*
* Generated from protobuf field string proto_type_fqn = 5;
*/
- private $proto_type_fqn = '';
+ protected $proto_type_fqn = '';
/**
* Constructor.