├── VERSION ├── metadata ├── V1 │ ├── Keys.php │ ├── Type.php │ ├── Spanner.php │ ├── Location.php │ ├── Mutation.php │ ├── QueryPlan.php │ ├── ResultSet.php │ ├── ChangeStream.php │ ├── Transaction.php │ └── CommitResponse.php └── Admin │ ├── Database │ └── V1 │ │ ├── Backup.php │ │ ├── Common.php │ │ ├── BackupSchedule.php │ │ └── SpannerDatabaseAdmin.php │ └── Instance │ └── V1 │ ├── Common.php │ └── SpannerInstanceAdmin.php ├── .gitattributes ├── SECURITY.md ├── phpstan.neon.dist ├── CONTRIBUTING.md ├── src ├── V1 │ ├── TransactionOptions │ │ ├── PartitionedDml.php │ │ ├── IsolationLevel.php │ │ └── ReadWrite │ │ │ └── ReadLockMode.php │ ├── Tablet │ │ └── Role.php │ ├── DirectedReadOptions │ │ ├── ReplicaSelection │ │ │ └── Type.php │ │ └── ExcludeReplicas.php │ ├── KeyRecipe │ │ └── Part │ │ │ ├── Order.php │ │ │ └── NullOrder.php │ ├── ReadRequest │ │ └── OrderBy.php │ ├── BatchCreateSessionsResponse.php │ ├── PlanNode │ │ └── Kind.php │ ├── ChangeStreamRecord │ │ ├── DataChangeRecord │ │ │ ├── ModType.php │ │ │ └── ValueCaptureType.php │ │ ├── PartitionEventRecord │ │ │ ├── MoveInEvent.php │ │ │ └── MoveOutEvent.php │ │ └── HeartbeatRecord.php │ ├── Partition.php │ ├── BatchWriteRequest │ │ └── MutationGroup.php │ ├── GetSessionRequest.php │ ├── DeleteSessionRequest.php │ ├── ExecuteSqlRequest │ │ └── QueryMode.php │ ├── RequestOptions │ │ └── Priority.php │ ├── QueryAdvisorResult.php │ ├── RoutingHint │ │ └── SkippedTablet.php │ └── TypeAnnotationCode.php ├── Admin │ ├── Database │ │ └── V1 │ │ │ ├── FullBackupSpec.php │ │ │ ├── InternalUpdateGraphOperationResponse.php │ │ │ ├── AddSplitPointsResponse.php │ │ │ ├── IncrementalBackupSpec.php │ │ │ ├── RestoreSourceType.php │ │ │ ├── DatabaseDialect.php │ │ │ ├── Backup │ │ │ └── State.php │ │ │ ├── CreateDatabaseMetadata.php │ │ │ ├── BackupScheduleSpec.php │ │ │ ├── EncryptionInfo │ │ │ └── Type.php │ │ │ ├── BackupInstancePartition.php │ │ │ ├── SplitPoints │ │ │ └── Key.php │ │ │ ├── DropDatabaseRequest.php │ │ │ ├── Database │ │ │ └── State.php │ │ │ ├── DatabaseRole.php │ │ │ ├── RestoreDatabaseEncryptionConfig │ │ │ └── EncryptionType.php │ │ │ ├── CreateBackupEncryptionConfig │ │ │ └── EncryptionType.php │ │ │ ├── CopyBackupEncryptionConfig │ │ │ └── EncryptionType.php │ │ │ ├── GetBackupRequest.php │ │ │ ├── GetDatabaseRequest.php │ │ │ ├── DeleteBackupRequest.php │ │ │ ├── GetDatabaseDdlRequest.php │ │ │ ├── GetBackupScheduleRequest.php │ │ │ └── DeleteBackupScheduleRequest.php │ └── Instance │ │ └── V1 │ │ ├── MoveInstanceResponse.php │ │ ├── InstanceConfig │ │ ├── Type.php │ │ ├── State.php │ │ ├── QuorumType.php │ │ └── FreeInstanceAvailability.php │ │ ├── FulfillmentPeriod.php │ │ ├── ReplicaSelection.php │ │ ├── Instance │ │ ├── State.php │ │ ├── Edition.php │ │ ├── InstanceType.php │ │ └── DefaultBackupScheduleType.php │ │ ├── InstancePartition │ │ └── State.php │ │ ├── FreeInstanceMetadata │ │ └── ExpireBehavior.php │ │ ├── DeleteInstanceRequest.php │ │ ├── ReplicaInfo │ │ └── ReplicaType.php │ │ ├── GetInstanceConfigRequest.php │ │ └── GetInstancePartitionRequest.php ├── TypeAnnotationInterface.php ├── Batch │ ├── PartitionInterface.php │ └── PartitionTrait.php ├── ValueInterface.php ├── MutationGroup.php ├── Timestamp.php ├── TransactionalReadInterface.php ├── CommitTimestamp.php ├── Snapshot.php ├── PgOid.php ├── Bytes.php ├── PgJsonb.php ├── PgNumeric.php ├── IntervalParsingState.php ├── Numeric.php ├── SnapshotTrait.php └── Proto.php ├── CODE_OF_CONDUCT.md └── composer.json /VERSION: -------------------------------------------------------------------------------- 1 | 2.2.0 2 | -------------------------------------------------------------------------------- /metadata/V1/Keys.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-spanner/HEAD/metadata/V1/Keys.php -------------------------------------------------------------------------------- /metadata/V1/Type.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-spanner/HEAD/metadata/V1/Type.php -------------------------------------------------------------------------------- /metadata/V1/Spanner.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-spanner/HEAD/metadata/V1/Spanner.php -------------------------------------------------------------------------------- /metadata/V1/Location.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-spanner/HEAD/metadata/V1/Location.php -------------------------------------------------------------------------------- /metadata/V1/Mutation.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-spanner/HEAD/metadata/V1/Mutation.php -------------------------------------------------------------------------------- /metadata/V1/QueryPlan.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-spanner/HEAD/metadata/V1/QueryPlan.php -------------------------------------------------------------------------------- /metadata/V1/ResultSet.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-spanner/HEAD/metadata/V1/ResultSet.php -------------------------------------------------------------------------------- /metadata/V1/ChangeStream.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-spanner/HEAD/metadata/V1/ChangeStream.php -------------------------------------------------------------------------------- /metadata/V1/Transaction.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-spanner/HEAD/metadata/V1/Transaction.php -------------------------------------------------------------------------------- /metadata/V1/CommitResponse.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-spanner/HEAD/metadata/V1/CommitResponse.php -------------------------------------------------------------------------------- /metadata/Admin/Database/V1/Backup.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-spanner/HEAD/metadata/Admin/Database/V1/Backup.php -------------------------------------------------------------------------------- /metadata/Admin/Database/V1/Common.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-spanner/HEAD/metadata/Admin/Database/V1/Common.php -------------------------------------------------------------------------------- /metadata/Admin/Instance/V1/Common.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-spanner/HEAD/metadata/Admin/Instance/V1/Common.php -------------------------------------------------------------------------------- /metadata/Admin/Database/V1/BackupSchedule.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-spanner/HEAD/metadata/Admin/Database/V1/BackupSchedule.php -------------------------------------------------------------------------------- /metadata/Admin/Database/V1/SpannerDatabaseAdmin.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-spanner/HEAD/metadata/Admin/Database/V1/SpannerDatabaseAdmin.php -------------------------------------------------------------------------------- /metadata/Admin/Instance/V1/SpannerInstanceAdmin.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/google-cloud-php-spanner/HEAD/metadata/Admin/Instance/V1/SpannerInstanceAdmin.php -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | /*.xml.dist export-ignore 2 | /tests export-ignore 3 | /.github export-ignore 4 | /samples export-ignore 5 | /.OwlBot.yaml export-ignore 6 | /owlbot.py export-ignore 7 | /src/**/gapic_metadata.json export-ignore 8 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). 4 | 5 | The Google Security Team will respond within 5 working days of your report on g.co/vulnz. 6 | 7 | We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. 8 | -------------------------------------------------------------------------------- /phpstan.neon.dist: -------------------------------------------------------------------------------- 1 | parameters: 2 | level: 3 3 | treatPhpDocTypesAsCertain: false 4 | excludePaths: 5 | # Ignore classes not compatible with Monolog2 6 | - src/V1/* 7 | - src/*/*/V1/* 8 | ignoreErrors: 9 | - 10 | identifier: new.static # Ignore this error because changing it would be a breaking change. 11 | includes: 12 | - ../dev/vendor/phpstan/phpstan/conf/bleedingEdge.neon 13 | 14 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | 3 | We'd love to accept your patches and contributions to this project. We accept 4 | and review pull requests against the main 5 | [Google Cloud PHP](https://github.com/googleapis/google-cloud-php) 6 | repository, which contains all of our client libraries. You will also need to 7 | sign a Contributor License Agreement. For more details about how to contribute, 8 | see the 9 | [CONTRIBUTING.md](https://github.com/googleapis/google-cloud-php/blob/main/CONTRIBUTING.md) 10 | file in the main Google Cloud PHP repository. 11 | -------------------------------------------------------------------------------- /src/V1/TransactionOptions/PartitionedDml.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.TransactionOptions.PartitionedDml 15 | */ 16 | class PartitionedDml extends \Google\Protobuf\Internal\Message 17 | { 18 | 19 | /** 20 | * Constructor. 21 | * 22 | * @param array $data { 23 | * Optional. Data for populating the Message object. 24 | * 25 | * } 26 | */ 27 | public function __construct($data = NULL) { 28 | \GPBMetadata\Google\Spanner\V1\Transaction::initOnce(); 29 | parent::__construct($data); 30 | } 31 | 32 | } 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/FullBackupSpec.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.FullBackupSpec 17 | */ 18 | class FullBackupSpec extends \Google\Protobuf\Internal\Message 19 | { 20 | 21 | /** 22 | * Constructor. 23 | * 24 | * @param array $data { 25 | * Optional. Data for populating the Message object. 26 | * 27 | * } 28 | */ 29 | public function __construct($data = NULL) { 30 | \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); 31 | parent::__construct($data); 32 | } 33 | 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/TypeAnnotationInterface.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.InternalUpdateGraphOperationResponse 15 | */ 16 | class InternalUpdateGraphOperationResponse extends \Google\Protobuf\Internal\Message 17 | { 18 | 19 | /** 20 | * Constructor. 21 | * 22 | * @param array $data { 23 | * Optional. Data for populating the Message object. 24 | * 25 | * } 26 | */ 27 | public function __construct($data = NULL) { 28 | \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); 29 | parent::__construct($data); 30 | } 31 | 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/Admin/Instance/V1/MoveInstanceResponse.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.instance.v1.MoveInstanceResponse 16 | */ 17 | class MoveInstanceResponse extends \Google\Protobuf\Internal\Message 18 | { 19 | 20 | /** 21 | * Constructor. 22 | * 23 | * @param array $data { 24 | * Optional. Data for populating the Message object. 25 | * 26 | * } 27 | */ 28 | public function __construct($data = NULL) { 29 | \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); 30 | parent::__construct($data); 31 | } 32 | 33 | } 34 | 35 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/AddSplitPointsResponse.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.AddSplitPointsResponse 16 | */ 17 | class AddSplitPointsResponse extends \Google\Protobuf\Internal\Message 18 | { 19 | 20 | /** 21 | * Constructor. 22 | * 23 | * @param array $data { 24 | * Optional. Data for populating the Message object. 25 | * 26 | * } 27 | */ 28 | public function __construct($data = NULL) { 29 | \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); 30 | parent::__construct($data); 31 | } 32 | 33 | } 34 | 35 | -------------------------------------------------------------------------------- /src/Batch/PartitionInterface.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.IncrementalBackupSpec 20 | */ 21 | class IncrementalBackupSpec extends \Google\Protobuf\Internal\Message 22 | { 23 | 24 | /** 25 | * Constructor. 26 | * 27 | * @param array $data { 28 | * Optional. Data for populating the Message object. 29 | * 30 | * } 31 | */ 32 | public function __construct($data = NULL) { 33 | \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); 34 | parent::__construct($data); 35 | } 36 | 37 | } 38 | 39 | -------------------------------------------------------------------------------- /src/MutationGroup.php: -------------------------------------------------------------------------------- 1 | mapper = new ValueMapper($returnInt64AsObject); 40 | } 41 | 42 | public function toArray(): array 43 | { 44 | return ['mutations' => $this->mutationData]; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/RestoreSourceType.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.RestoreSourceType 13 | */ 14 | class RestoreSourceType 15 | { 16 | /** 17 | * No restore associated. 18 | * 19 | * Generated from protobuf enum TYPE_UNSPECIFIED = 0; 20 | */ 21 | const TYPE_UNSPECIFIED = 0; 22 | /** 23 | * A backup was used as the source of the restore. 24 | * 25 | * Generated from protobuf enum BACKUP = 1; 26 | */ 27 | const BACKUP = 1; 28 | 29 | private static $valueToName = [ 30 | self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', 31 | self::BACKUP => 'BACKUP', 32 | ]; 33 | 34 | public static function name($value) 35 | { 36 | if (!isset(self::$valueToName[$value])) { 37 | throw new UnexpectedValueException(sprintf( 38 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 39 | } 40 | return self::$valueToName[$value]; 41 | } 42 | 43 | 44 | public static function value($name) 45 | { 46 | $const = __CLASS__ . '::' . strtoupper($name); 47 | if (!defined($const)) { 48 | throw new UnexpectedValueException(sprintf( 49 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 50 | } 51 | return constant($const); 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /src/Batch/PartitionTrait.php: -------------------------------------------------------------------------------- 1 | token(); 34 | * ``` 35 | * 36 | * @return string 37 | */ 38 | public function token(): string 39 | { 40 | return $this->token; 41 | } 42 | 43 | /** 44 | * Returns the partition options. 45 | * 46 | * Example: 47 | * ``` 48 | * $options = $partition->options(); 49 | * ``` 50 | * 51 | * @return array 52 | */ 53 | public function options(): array 54 | { 55 | return $this->options; 56 | } 57 | 58 | /** 59 | * Cast the partition to a string. 60 | * 61 | * @access private 62 | * @return string 63 | */ 64 | public function __toString() 65 | { 66 | return $this->serialize(); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/V1/Tablet/Role.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.Tablet.Role 13 | */ 14 | class Role 15 | { 16 | /** 17 | * Not specified. 18 | * 19 | * Generated from protobuf enum ROLE_UNSPECIFIED = 0; 20 | */ 21 | const ROLE_UNSPECIFIED = 0; 22 | /** 23 | * The tablet can perform reads and (if elected leader) writes. 24 | * 25 | * Generated from protobuf enum READ_WRITE = 1; 26 | */ 27 | const READ_WRITE = 1; 28 | /** 29 | * The tablet can only perform reads. 30 | * 31 | * Generated from protobuf enum READ_ONLY = 2; 32 | */ 33 | const READ_ONLY = 2; 34 | 35 | private static $valueToName = [ 36 | self::ROLE_UNSPECIFIED => 'ROLE_UNSPECIFIED', 37 | self::READ_WRITE => 'READ_WRITE', 38 | self::READ_ONLY => 'READ_ONLY', 39 | ]; 40 | 41 | public static function name($value) 42 | { 43 | if (!isset(self::$valueToName[$value])) { 44 | throw new UnexpectedValueException(sprintf( 45 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 46 | } 47 | return self::$valueToName[$value]; 48 | } 49 | 50 | 51 | public static function value($name) 52 | { 53 | $const = __CLASS__ . '::' . strtoupper($name); 54 | if (!defined($const)) { 55 | throw new UnexpectedValueException(sprintf( 56 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 57 | } 58 | return constant($const); 59 | } 60 | } 61 | 62 | 63 | -------------------------------------------------------------------------------- /src/V1/DirectedReadOptions/ReplicaSelection/Type.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type 13 | */ 14 | class Type 15 | { 16 | /** 17 | * Not specified. 18 | * 19 | * Generated from protobuf enum TYPE_UNSPECIFIED = 0; 20 | */ 21 | const TYPE_UNSPECIFIED = 0; 22 | /** 23 | * Read-write replicas support both reads and writes. 24 | * 25 | * Generated from protobuf enum READ_WRITE = 1; 26 | */ 27 | const READ_WRITE = 1; 28 | /** 29 | * Read-only replicas only support reads (not writes). 30 | * 31 | * Generated from protobuf enum READ_ONLY = 2; 32 | */ 33 | const READ_ONLY = 2; 34 | 35 | private static $valueToName = [ 36 | self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', 37 | self::READ_WRITE => 'READ_WRITE', 38 | self::READ_ONLY => 'READ_ONLY', 39 | ]; 40 | 41 | public static function name($value) 42 | { 43 | if (!isset(self::$valueToName[$value])) { 44 | throw new UnexpectedValueException(sprintf( 45 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 46 | } 47 | return self::$valueToName[$value]; 48 | } 49 | 50 | 51 | public static function value($name) 52 | { 53 | $const = __CLASS__ . '::' . strtoupper($name); 54 | if (!defined($const)) { 55 | throw new UnexpectedValueException(sprintf( 56 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 57 | } 58 | return constant($const); 59 | } 60 | } 61 | 62 | 63 | -------------------------------------------------------------------------------- /src/V1/KeyRecipe/Part/Order.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.KeyRecipe.Part.Order 13 | */ 14 | class Order 15 | { 16 | /** 17 | * Default value, equivalent to `ASCENDING`. 18 | * 19 | * Generated from protobuf enum ORDER_UNSPECIFIED = 0; 20 | */ 21 | const ORDER_UNSPECIFIED = 0; 22 | /** 23 | * The key is ascending - corresponds to `ASC` in the schema definition. 24 | * 25 | * Generated from protobuf enum ASCENDING = 1; 26 | */ 27 | const ASCENDING = 1; 28 | /** 29 | * The key is descending - corresponds to `DESC` in the schema definition. 30 | * 31 | * Generated from protobuf enum DESCENDING = 2; 32 | */ 33 | const DESCENDING = 2; 34 | 35 | private static $valueToName = [ 36 | self::ORDER_UNSPECIFIED => 'ORDER_UNSPECIFIED', 37 | self::ASCENDING => 'ASCENDING', 38 | self::DESCENDING => 'DESCENDING', 39 | ]; 40 | 41 | public static function name($value) 42 | { 43 | if (!isset(self::$valueToName[$value])) { 44 | throw new UnexpectedValueException(sprintf( 45 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 46 | } 47 | return self::$valueToName[$value]; 48 | } 49 | 50 | 51 | public static function value($name) 52 | { 53 | $const = __CLASS__ . '::' . strtoupper($name); 54 | if (!defined($const)) { 55 | throw new UnexpectedValueException(sprintf( 56 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 57 | } 58 | return constant($const); 59 | } 60 | } 61 | 62 | 63 | -------------------------------------------------------------------------------- /src/Timestamp.php: -------------------------------------------------------------------------------- 1 | 'my-project']); 36 | * 37 | * $timestamp = $spanner->timestamp(new \DateTime('2003-02-05 11:15:02.421827Z')); 38 | * ``` 39 | * 40 | * ``` 41 | * // Timestamps can be cast to strings. 42 | * echo (string) $timestamp; 43 | * ``` 44 | */ 45 | class Timestamp extends CoreTimestamp implements ValueInterface 46 | { 47 | /** 48 | * Get the type. 49 | * 50 | * Example: 51 | * ``` 52 | * $type = $timestamp->type(); 53 | * ``` 54 | * 55 | * @return int 56 | */ 57 | public function type(): int 58 | { 59 | return Database::TYPE_TIMESTAMP; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/DatabaseDialect.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.DatabaseDialect 13 | */ 14 | class DatabaseDialect 15 | { 16 | /** 17 | * Default value. This value will create a database with the 18 | * GOOGLE_STANDARD_SQL dialect. 19 | * 20 | * Generated from protobuf enum DATABASE_DIALECT_UNSPECIFIED = 0; 21 | */ 22 | const DATABASE_DIALECT_UNSPECIFIED = 0; 23 | /** 24 | * GoogleSQL supported SQL. 25 | * 26 | * Generated from protobuf enum GOOGLE_STANDARD_SQL = 1; 27 | */ 28 | const GOOGLE_STANDARD_SQL = 1; 29 | /** 30 | * PostgreSQL supported SQL. 31 | * 32 | * Generated from protobuf enum POSTGRESQL = 2; 33 | */ 34 | const POSTGRESQL = 2; 35 | 36 | private static $valueToName = [ 37 | self::DATABASE_DIALECT_UNSPECIFIED => 'DATABASE_DIALECT_UNSPECIFIED', 38 | self::GOOGLE_STANDARD_SQL => 'GOOGLE_STANDARD_SQL', 39 | self::POSTGRESQL => 'POSTGRESQL', 40 | ]; 41 | 42 | public static function name($value) 43 | { 44 | if (!isset(self::$valueToName[$value])) { 45 | throw new UnexpectedValueException(sprintf( 46 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 47 | } 48 | return self::$valueToName[$value]; 49 | } 50 | 51 | 52 | public static function value($name) 53 | { 54 | $const = __CLASS__ . '::' . strtoupper($name); 55 | if (!defined($const)) { 56 | throw new UnexpectedValueException(sprintf( 57 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 58 | } 59 | return constant($const); 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /src/Admin/Instance/V1/InstanceConfig/Type.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.instance.v1.InstanceConfig.Type 13 | */ 14 | class Type 15 | { 16 | /** 17 | * Unspecified. 18 | * 19 | * Generated from protobuf enum TYPE_UNSPECIFIED = 0; 20 | */ 21 | const TYPE_UNSPECIFIED = 0; 22 | /** 23 | * Google-managed configuration. 24 | * 25 | * Generated from protobuf enum GOOGLE_MANAGED = 1; 26 | */ 27 | const GOOGLE_MANAGED = 1; 28 | /** 29 | * User-managed configuration. 30 | * 31 | * Generated from protobuf enum USER_MANAGED = 2; 32 | */ 33 | const USER_MANAGED = 2; 34 | 35 | private static $valueToName = [ 36 | self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', 37 | self::GOOGLE_MANAGED => 'GOOGLE_MANAGED', 38 | self::USER_MANAGED => 'USER_MANAGED', 39 | ]; 40 | 41 | public static function name($value) 42 | { 43 | if (!isset(self::$valueToName[$value])) { 44 | throw new UnexpectedValueException(sprintf( 45 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 46 | } 47 | return self::$valueToName[$value]; 48 | } 49 | 50 | 51 | public static function value($name) 52 | { 53 | $const = __CLASS__ . '::' . strtoupper($name); 54 | if (!defined($const)) { 55 | throw new UnexpectedValueException(sprintf( 56 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 57 | } 58 | return constant($const); 59 | } 60 | } 61 | 62 | // Adding a class alias for backwards compatibility with the previous class name. 63 | class_alias(Type::class, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig_Type::class); 64 | 65 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, 4 | and in the interest of fostering an open and welcoming community, 5 | we pledge to respect all people who contribute through reporting issues, 6 | posting feature requests, updating documentation, 7 | submitting pull requests or patches, and other activities. 8 | 9 | We are committed to making participation in this project 10 | a harassment-free experience for everyone, 11 | regardless of level of experience, gender, gender identity and expression, 12 | sexual orientation, disability, personal appearance, 13 | body size, race, ethnicity, age, religion, or nationality. 14 | 15 | Examples of unacceptable behavior by participants include: 16 | 17 | * The use of sexualized language or imagery 18 | * Personal attacks 19 | * Trolling or insulting/derogatory comments 20 | * Public or private harassment 21 | * Publishing other's private information, 22 | such as physical or electronic 23 | addresses, without explicit permission 24 | * Other unethical or unprofessional conduct. 25 | 26 | Project maintainers have the right and responsibility to remove, edit, or reject 27 | comments, commits, code, wiki edits, issues, and other contributions 28 | that are not aligned to this Code of Conduct. 29 | By adopting this Code of Conduct, 30 | project maintainers commit themselves to fairly and consistently 31 | applying these principles to every aspect of managing this project. 32 | Project maintainers who do not follow or enforce the Code of Conduct 33 | may be permanently removed from the project team. 34 | 35 | This code of conduct applies both within project spaces and in public spaces 36 | when an individual is representing the project or its community. 37 | 38 | Instances of abusive, harassing, or otherwise unacceptable behavior 39 | may be reported by opening an issue 40 | or contacting one or more of the project maintainers. 41 | 42 | This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, 43 | available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) -------------------------------------------------------------------------------- /src/Admin/Database/V1/Backup/State.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.Backup.State 13 | */ 14 | class State 15 | { 16 | /** 17 | * Not specified. 18 | * 19 | * Generated from protobuf enum STATE_UNSPECIFIED = 0; 20 | */ 21 | const STATE_UNSPECIFIED = 0; 22 | /** 23 | * The pending backup is still being created. Operations on the 24 | * backup may fail with `FAILED_PRECONDITION` in this state. 25 | * 26 | * Generated from protobuf enum CREATING = 1; 27 | */ 28 | const CREATING = 1; 29 | /** 30 | * The backup is complete and ready for use. 31 | * 32 | * Generated from protobuf enum READY = 2; 33 | */ 34 | const READY = 2; 35 | 36 | private static $valueToName = [ 37 | self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', 38 | self::CREATING => 'CREATING', 39 | self::READY => 'READY', 40 | ]; 41 | 42 | public static function name($value) 43 | { 44 | if (!isset(self::$valueToName[$value])) { 45 | throw new UnexpectedValueException(sprintf( 46 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 47 | } 48 | return self::$valueToName[$value]; 49 | } 50 | 51 | 52 | public static function value($name) 53 | { 54 | $const = __CLASS__ . '::' . strtoupper($name); 55 | if (!defined($const)) { 56 | throw new UnexpectedValueException(sprintf( 57 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 58 | } 59 | return constant($const); 60 | } 61 | } 62 | 63 | // Adding a class alias for backwards compatibility with the previous class name. 64 | class_alias(State::class, \Google\Cloud\Spanner\Admin\Database\V1\Backup_State::class); 65 | 66 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/CreateDatabaseMetadata.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.CreateDatabaseMetadata 16 | */ 17 | class CreateDatabaseMetadata extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * The database being created. 21 | * 22 | * Generated from protobuf field string database = 1 [(.google.api.resource_reference) = { 23 | */ 24 | protected $database = ''; 25 | 26 | /** 27 | * Constructor. 28 | * 29 | * @param array $data { 30 | * Optional. Data for populating the Message object. 31 | * 32 | * @type string $database 33 | * The database being created. 34 | * } 35 | */ 36 | public function __construct($data = NULL) { 37 | \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); 38 | parent::__construct($data); 39 | } 40 | 41 | /** 42 | * The database being created. 43 | * 44 | * Generated from protobuf field string database = 1 [(.google.api.resource_reference) = { 45 | * @return string 46 | */ 47 | public function getDatabase() 48 | { 49 | return $this->database; 50 | } 51 | 52 | /** 53 | * The database being created. 54 | * 55 | * Generated from protobuf field string database = 1 [(.google.api.resource_reference) = { 56 | * @param string $var 57 | * @return $this 58 | */ 59 | public function setDatabase($var) 60 | { 61 | GPBUtil::checkString($var, True); 62 | $this->database = $var; 63 | 64 | return $this; 65 | } 66 | 67 | } 68 | 69 | -------------------------------------------------------------------------------- /src/Admin/Instance/V1/InstanceConfig/State.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.instance.v1.InstanceConfig.State 13 | */ 14 | class State 15 | { 16 | /** 17 | * Not specified. 18 | * 19 | * Generated from protobuf enum STATE_UNSPECIFIED = 0; 20 | */ 21 | const STATE_UNSPECIFIED = 0; 22 | /** 23 | * The instance configuration is still being created. 24 | * 25 | * Generated from protobuf enum CREATING = 1; 26 | */ 27 | const CREATING = 1; 28 | /** 29 | * The instance configuration is fully created and ready to be used to 30 | * create instances. 31 | * 32 | * Generated from protobuf enum READY = 2; 33 | */ 34 | const READY = 2; 35 | 36 | private static $valueToName = [ 37 | self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', 38 | self::CREATING => 'CREATING', 39 | self::READY => 'READY', 40 | ]; 41 | 42 | public static function name($value) 43 | { 44 | if (!isset(self::$valueToName[$value])) { 45 | throw new UnexpectedValueException(sprintf( 46 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 47 | } 48 | return self::$valueToName[$value]; 49 | } 50 | 51 | 52 | public static function value($name) 53 | { 54 | $const = __CLASS__ . '::' . strtoupper($name); 55 | if (!defined($const)) { 56 | throw new UnexpectedValueException(sprintf( 57 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 58 | } 59 | return constant($const); 60 | } 61 | } 62 | 63 | // Adding a class alias for backwards compatibility with the previous class name. 64 | class_alias(State::class, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig_State::class); 65 | 66 | -------------------------------------------------------------------------------- /src/V1/ReadRequest/OrderBy.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.ReadRequest.OrderBy 13 | */ 14 | class OrderBy 15 | { 16 | /** 17 | * Default value. 18 | * `ORDER_BY_UNSPECIFIED` is equivalent to `ORDER_BY_PRIMARY_KEY`. 19 | * 20 | * Generated from protobuf enum ORDER_BY_UNSPECIFIED = 0; 21 | */ 22 | const ORDER_BY_UNSPECIFIED = 0; 23 | /** 24 | * Read rows are returned in primary key order. 25 | * In the event that this option is used in conjunction with the 26 | * `partition_token` field, the API returns an `INVALID_ARGUMENT` error. 27 | * 28 | * Generated from protobuf enum ORDER_BY_PRIMARY_KEY = 1; 29 | */ 30 | const ORDER_BY_PRIMARY_KEY = 1; 31 | /** 32 | * Read rows are returned in any order. 33 | * 34 | * Generated from protobuf enum ORDER_BY_NO_ORDER = 2; 35 | */ 36 | const ORDER_BY_NO_ORDER = 2; 37 | 38 | private static $valueToName = [ 39 | self::ORDER_BY_UNSPECIFIED => 'ORDER_BY_UNSPECIFIED', 40 | self::ORDER_BY_PRIMARY_KEY => 'ORDER_BY_PRIMARY_KEY', 41 | self::ORDER_BY_NO_ORDER => 'ORDER_BY_NO_ORDER', 42 | ]; 43 | 44 | public static function name($value) 45 | { 46 | if (!isset(self::$valueToName[$value])) { 47 | throw new UnexpectedValueException(sprintf( 48 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 49 | } 50 | return self::$valueToName[$value]; 51 | } 52 | 53 | 54 | public static function value($name) 55 | { 56 | $const = __CLASS__ . '::' . strtoupper($name); 57 | if (!defined($const)) { 58 | throw new UnexpectedValueException(sprintf( 59 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 60 | } 61 | return constant($const); 62 | } 63 | } 64 | 65 | 66 | -------------------------------------------------------------------------------- /src/Admin/Instance/V1/FulfillmentPeriod.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.instance.v1.FulfillmentPeriod 13 | */ 14 | class FulfillmentPeriod 15 | { 16 | /** 17 | * Not specified. 18 | * 19 | * Generated from protobuf enum FULFILLMENT_PERIOD_UNSPECIFIED = 0; 20 | */ 21 | const FULFILLMENT_PERIOD_UNSPECIFIED = 0; 22 | /** 23 | * Normal fulfillment period. The operation is expected to complete within 24 | * minutes. 25 | * 26 | * Generated from protobuf enum FULFILLMENT_PERIOD_NORMAL = 1; 27 | */ 28 | const FULFILLMENT_PERIOD_NORMAL = 1; 29 | /** 30 | * Extended fulfillment period. It can take up to an hour for the operation 31 | * to complete. 32 | * 33 | * Generated from protobuf enum FULFILLMENT_PERIOD_EXTENDED = 2; 34 | */ 35 | const FULFILLMENT_PERIOD_EXTENDED = 2; 36 | 37 | private static $valueToName = [ 38 | self::FULFILLMENT_PERIOD_UNSPECIFIED => 'FULFILLMENT_PERIOD_UNSPECIFIED', 39 | self::FULFILLMENT_PERIOD_NORMAL => 'FULFILLMENT_PERIOD_NORMAL', 40 | self::FULFILLMENT_PERIOD_EXTENDED => 'FULFILLMENT_PERIOD_EXTENDED', 41 | ]; 42 | 43 | public static function name($value) 44 | { 45 | if (!isset(self::$valueToName[$value])) { 46 | throw new UnexpectedValueException(sprintf( 47 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 48 | } 49 | return self::$valueToName[$value]; 50 | } 51 | 52 | 53 | public static function value($name) 54 | { 55 | $const = __CLASS__ . '::' . strtoupper($name); 56 | if (!defined($const)) { 57 | throw new UnexpectedValueException(sprintf( 58 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 59 | } 60 | return constant($const); 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /src/Admin/Instance/V1/ReplicaSelection.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.instance.v1.ReplicaSelection 15 | */ 16 | class ReplicaSelection extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Required. Name of the location of the replicas (e.g., "us-central1"). 20 | * 21 | * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED]; 22 | */ 23 | protected $location = ''; 24 | 25 | /** 26 | * Constructor. 27 | * 28 | * @param array $data { 29 | * Optional. Data for populating the Message object. 30 | * 31 | * @type string $location 32 | * Required. Name of the location of the replicas (e.g., "us-central1"). 33 | * } 34 | */ 35 | public function __construct($data = NULL) { 36 | \GPBMetadata\Google\Spanner\Admin\Instance\V1\Common::initOnce(); 37 | parent::__construct($data); 38 | } 39 | 40 | /** 41 | * Required. Name of the location of the replicas (e.g., "us-central1"). 42 | * 43 | * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED]; 44 | * @return string 45 | */ 46 | public function getLocation() 47 | { 48 | return $this->location; 49 | } 50 | 51 | /** 52 | * Required. Name of the location of the replicas (e.g., "us-central1"). 53 | * 54 | * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED]; 55 | * @param string $var 56 | * @return $this 57 | */ 58 | public function setLocation($var) 59 | { 60 | GPBUtil::checkString($var, True); 61 | $this->location = $var; 62 | 63 | return $this; 64 | } 65 | 66 | } 67 | 68 | -------------------------------------------------------------------------------- /src/Admin/Instance/V1/Instance/State.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.instance.v1.Instance.State 13 | */ 14 | class State 15 | { 16 | /** 17 | * Not specified. 18 | * 19 | * Generated from protobuf enum STATE_UNSPECIFIED = 0; 20 | */ 21 | const STATE_UNSPECIFIED = 0; 22 | /** 23 | * The instance is still being created. Resources may not be 24 | * available yet, and operations such as database creation may not 25 | * work. 26 | * 27 | * Generated from protobuf enum CREATING = 1; 28 | */ 29 | const CREATING = 1; 30 | /** 31 | * The instance is fully created and ready to do work such as 32 | * creating databases. 33 | * 34 | * Generated from protobuf enum READY = 2; 35 | */ 36 | const READY = 2; 37 | 38 | private static $valueToName = [ 39 | self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', 40 | self::CREATING => 'CREATING', 41 | self::READY => 'READY', 42 | ]; 43 | 44 | public static function name($value) 45 | { 46 | if (!isset(self::$valueToName[$value])) { 47 | throw new UnexpectedValueException(sprintf( 48 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 49 | } 50 | return self::$valueToName[$value]; 51 | } 52 | 53 | 54 | public static function value($name) 55 | { 56 | $const = __CLASS__ . '::' . strtoupper($name); 57 | if (!defined($const)) { 58 | throw new UnexpectedValueException(sprintf( 59 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 60 | } 61 | return constant($const); 62 | } 63 | } 64 | 65 | // Adding a class alias for backwards compatibility with the previous class name. 66 | class_alias(State::class, \Google\Cloud\Spanner\Admin\Instance\V1\Instance_State::class); 67 | 68 | -------------------------------------------------------------------------------- /src/V1/BatchCreateSessionsResponse.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.BatchCreateSessionsResponse 16 | */ 17 | class BatchCreateSessionsResponse extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * The freshly created sessions. 21 | * 22 | * Generated from protobuf field repeated .google.spanner.v1.Session session = 1; 23 | */ 24 | private $session; 25 | 26 | /** 27 | * Constructor. 28 | * 29 | * @param array $data { 30 | * Optional. Data for populating the Message object. 31 | * 32 | * @type array<\Google\Cloud\Spanner\V1\Session>|\Google\Protobuf\Internal\RepeatedField $session 33 | * The freshly created sessions. 34 | * } 35 | */ 36 | public function __construct($data = NULL) { 37 | \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); 38 | parent::__construct($data); 39 | } 40 | 41 | /** 42 | * The freshly created sessions. 43 | * 44 | * Generated from protobuf field repeated .google.spanner.v1.Session session = 1; 45 | * @return \Google\Protobuf\Internal\RepeatedField 46 | */ 47 | public function getSession() 48 | { 49 | return $this->session; 50 | } 51 | 52 | /** 53 | * The freshly created sessions. 54 | * 55 | * Generated from protobuf field repeated .google.spanner.v1.Session session = 1; 56 | * @param array<\Google\Cloud\Spanner\V1\Session>|\Google\Protobuf\Internal\RepeatedField $var 57 | * @return $this 58 | */ 59 | public function setSession($var) 60 | { 61 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Session::class); 62 | $this->session = $arr; 63 | 64 | return $this; 65 | } 66 | 67 | } 68 | 69 | -------------------------------------------------------------------------------- /src/V1/KeyRecipe/Part/NullOrder.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.KeyRecipe.Part.NullOrder 15 | */ 16 | class NullOrder 17 | { 18 | /** 19 | * Default value. This value is unused. 20 | * 21 | * Generated from protobuf enum NULL_ORDER_UNSPECIFIED = 0; 22 | */ 23 | const NULL_ORDER_UNSPECIFIED = 0; 24 | /** 25 | * NULL values sort before any non-NULL values. 26 | * 27 | * Generated from protobuf enum NULLS_FIRST = 1; 28 | */ 29 | const NULLS_FIRST = 1; 30 | /** 31 | * NULL values sort after any non-NULL values. 32 | * 33 | * Generated from protobuf enum NULLS_LAST = 2; 34 | */ 35 | const NULLS_LAST = 2; 36 | /** 37 | * The column does not support NULL values. 38 | * 39 | * Generated from protobuf enum NOT_NULL = 3; 40 | */ 41 | const NOT_NULL = 3; 42 | 43 | private static $valueToName = [ 44 | self::NULL_ORDER_UNSPECIFIED => 'NULL_ORDER_UNSPECIFIED', 45 | self::NULLS_FIRST => 'NULLS_FIRST', 46 | self::NULLS_LAST => 'NULLS_LAST', 47 | self::NOT_NULL => 'NOT_NULL', 48 | ]; 49 | 50 | public static function name($value) 51 | { 52 | if (!isset(self::$valueToName[$value])) { 53 | throw new UnexpectedValueException(sprintf( 54 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 55 | } 56 | return self::$valueToName[$value]; 57 | } 58 | 59 | 60 | public static function value($name) 61 | { 62 | $const = __CLASS__ . '::' . strtoupper($name); 63 | if (!defined($const)) { 64 | throw new UnexpectedValueException(sprintf( 65 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 66 | } 67 | return constant($const); 68 | } 69 | } 70 | 71 | 72 | -------------------------------------------------------------------------------- /src/V1/PlanNode/Kind.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.PlanNode.Kind 14 | */ 15 | class Kind 16 | { 17 | /** 18 | * Not specified. 19 | * 20 | * Generated from protobuf enum KIND_UNSPECIFIED = 0; 21 | */ 22 | const KIND_UNSPECIFIED = 0; 23 | /** 24 | * Denotes a Relational operator node in the expression tree. Relational 25 | * operators represent iterative processing of rows during query execution. 26 | * For example, a `TableScan` operation that reads rows from a table. 27 | * 28 | * Generated from protobuf enum RELATIONAL = 1; 29 | */ 30 | const RELATIONAL = 1; 31 | /** 32 | * Denotes a Scalar node in the expression tree. Scalar nodes represent 33 | * non-iterable entities in the query plan. For example, constants or 34 | * arithmetic operators appearing inside predicate expressions or references 35 | * to column names. 36 | * 37 | * Generated from protobuf enum SCALAR = 2; 38 | */ 39 | const SCALAR = 2; 40 | 41 | private static $valueToName = [ 42 | self::KIND_UNSPECIFIED => 'KIND_UNSPECIFIED', 43 | self::RELATIONAL => 'RELATIONAL', 44 | self::SCALAR => 'SCALAR', 45 | ]; 46 | 47 | public static function name($value) 48 | { 49 | if (!isset(self::$valueToName[$value])) { 50 | throw new UnexpectedValueException(sprintf( 51 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 52 | } 53 | return self::$valueToName[$value]; 54 | } 55 | 56 | 57 | public static function value($name) 58 | { 59 | $const = __CLASS__ . '::' . strtoupper($name); 60 | if (!defined($const)) { 61 | throw new UnexpectedValueException(sprintf( 62 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 63 | } 64 | return constant($const); 65 | } 66 | } 67 | 68 | 69 | -------------------------------------------------------------------------------- /src/TransactionalReadInterface.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.instance.v1.InstancePartition.State 13 | */ 14 | class State 15 | { 16 | /** 17 | * Not specified. 18 | * 19 | * Generated from protobuf enum STATE_UNSPECIFIED = 0; 20 | */ 21 | const STATE_UNSPECIFIED = 0; 22 | /** 23 | * The instance partition is still being created. Resources may not be 24 | * available yet, and operations such as creating placements using this 25 | * instance partition may not work. 26 | * 27 | * Generated from protobuf enum CREATING = 1; 28 | */ 29 | const CREATING = 1; 30 | /** 31 | * The instance partition is fully created and ready to do work such as 32 | * creating placements and using in databases. 33 | * 34 | * Generated from protobuf enum READY = 2; 35 | */ 36 | const READY = 2; 37 | 38 | private static $valueToName = [ 39 | self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', 40 | self::CREATING => 'CREATING', 41 | self::READY => 'READY', 42 | ]; 43 | 44 | public static function name($value) 45 | { 46 | if (!isset(self::$valueToName[$value])) { 47 | throw new UnexpectedValueException(sprintf( 48 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 49 | } 50 | return self::$valueToName[$value]; 51 | } 52 | 53 | 54 | public static function value($name) 55 | { 56 | $const = __CLASS__ . '::' . strtoupper($name); 57 | if (!defined($const)) { 58 | throw new UnexpectedValueException(sprintf( 59 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 60 | } 61 | return constant($const); 62 | } 63 | } 64 | 65 | // Adding a class alias for backwards compatibility with the previous class name. 66 | class_alias(State::class, \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition_State::class); 67 | 68 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/BackupScheduleSpec.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.BackupScheduleSpec 15 | */ 16 | class BackupScheduleSpec extends \Google\Protobuf\Internal\Message 17 | { 18 | protected $schedule_spec; 19 | 20 | /** 21 | * Constructor. 22 | * 23 | * @param array $data { 24 | * Optional. Data for populating the Message object. 25 | * 26 | * @type \Google\Cloud\Spanner\Admin\Database\V1\CrontabSpec $cron_spec 27 | * Cron style schedule specification. 28 | * } 29 | */ 30 | public function __construct($data = NULL) { 31 | \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); 32 | parent::__construct($data); 33 | } 34 | 35 | /** 36 | * Cron style schedule specification. 37 | * 38 | * Generated from protobuf field .google.spanner.admin.database.v1.CrontabSpec cron_spec = 1; 39 | * @return \Google\Cloud\Spanner\Admin\Database\V1\CrontabSpec|null 40 | */ 41 | public function getCronSpec() 42 | { 43 | return $this->readOneof(1); 44 | } 45 | 46 | public function hasCronSpec() 47 | { 48 | return $this->hasOneof(1); 49 | } 50 | 51 | /** 52 | * Cron style schedule specification. 53 | * 54 | * Generated from protobuf field .google.spanner.admin.database.v1.CrontabSpec cron_spec = 1; 55 | * @param \Google\Cloud\Spanner\Admin\Database\V1\CrontabSpec $var 56 | * @return $this 57 | */ 58 | public function setCronSpec($var) 59 | { 60 | GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\CrontabSpec::class); 61 | $this->writeOneof(1, $var); 62 | 63 | return $this; 64 | } 65 | 66 | /** 67 | * @return string 68 | */ 69 | public function getScheduleSpec() 70 | { 71 | return $this->whichOneof("schedule_spec"); 72 | } 73 | 74 | } 75 | 76 | -------------------------------------------------------------------------------- /src/Admin/Instance/V1/Instance/Edition.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.instance.v1.Instance.Edition 14 | */ 15 | class Edition 16 | { 17 | /** 18 | * Edition not specified. 19 | * 20 | * Generated from protobuf enum EDITION_UNSPECIFIED = 0; 21 | */ 22 | const EDITION_UNSPECIFIED = 0; 23 | /** 24 | * Standard edition. 25 | * 26 | * Generated from protobuf enum STANDARD = 1; 27 | */ 28 | const STANDARD = 1; 29 | /** 30 | * Enterprise edition. 31 | * 32 | * Generated from protobuf enum ENTERPRISE = 2; 33 | */ 34 | const ENTERPRISE = 2; 35 | /** 36 | * Enterprise Plus edition. 37 | * 38 | * Generated from protobuf enum ENTERPRISE_PLUS = 3; 39 | */ 40 | const ENTERPRISE_PLUS = 3; 41 | 42 | private static $valueToName = [ 43 | self::EDITION_UNSPECIFIED => 'EDITION_UNSPECIFIED', 44 | self::STANDARD => 'STANDARD', 45 | self::ENTERPRISE => 'ENTERPRISE', 46 | self::ENTERPRISE_PLUS => 'ENTERPRISE_PLUS', 47 | ]; 48 | 49 | public static function name($value) 50 | { 51 | if (!isset(self::$valueToName[$value])) { 52 | throw new UnexpectedValueException(sprintf( 53 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 54 | } 55 | return self::$valueToName[$value]; 56 | } 57 | 58 | 59 | public static function value($name) 60 | { 61 | $const = __CLASS__ . '::' . strtoupper($name); 62 | if (!defined($const)) { 63 | throw new UnexpectedValueException(sprintf( 64 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 65 | } 66 | return constant($const); 67 | } 68 | } 69 | 70 | // Adding a class alias for backwards compatibility with the previous class name. 71 | class_alias(Edition::class, \Google\Cloud\Spanner\Admin\Instance\V1\Instance_Edition::class); 72 | 73 | -------------------------------------------------------------------------------- /src/V1/ChangeStreamRecord/DataChangeRecord/ModType.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.ChangeStreamRecord.DataChangeRecord.ModType 17 | */ 18 | class ModType 19 | { 20 | /** 21 | * Not specified. 22 | * 23 | * Generated from protobuf enum MOD_TYPE_UNSPECIFIED = 0; 24 | */ 25 | const MOD_TYPE_UNSPECIFIED = 0; 26 | /** 27 | * Indicates data was inserted. 28 | * 29 | * Generated from protobuf enum INSERT = 10; 30 | */ 31 | const INSERT = 10; 32 | /** 33 | * Indicates existing data was updated. 34 | * 35 | * Generated from protobuf enum UPDATE = 20; 36 | */ 37 | const UPDATE = 20; 38 | /** 39 | * Indicates existing data was deleted. 40 | * 41 | * Generated from protobuf enum DELETE = 30; 42 | */ 43 | const DELETE = 30; 44 | 45 | private static $valueToName = [ 46 | self::MOD_TYPE_UNSPECIFIED => 'MOD_TYPE_UNSPECIFIED', 47 | self::INSERT => 'INSERT', 48 | self::UPDATE => 'UPDATE', 49 | self::DELETE => 'DELETE', 50 | ]; 51 | 52 | public static function name($value) 53 | { 54 | if (!isset(self::$valueToName[$value])) { 55 | throw new UnexpectedValueException(sprintf( 56 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 57 | } 58 | return self::$valueToName[$value]; 59 | } 60 | 61 | 62 | public static function value($name) 63 | { 64 | $const = __CLASS__ . '::' . strtoupper($name); 65 | if (!defined($const)) { 66 | throw new UnexpectedValueException(sprintf( 67 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 68 | } 69 | return constant($const); 70 | } 71 | } 72 | 73 | 74 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "google/cloud-spanner", 3 | "description": "Cloud Spanner Client for PHP", 4 | "license": "Apache-2.0", 5 | "minimum-stability": "stable", 6 | "require": { 7 | "php": "^8.1", 8 | "ext-grpc": "*", 9 | "google/cloud-core": "^1.68", 10 | "google/gax": "^1.40.0" 11 | }, 12 | "require-dev": { 13 | "phpunit/phpunit": "^9.6", 14 | "phpspec/prophecy-phpunit": "^2.1", 15 | "squizlabs/php_codesniffer": "3.*", 16 | "phpdocumentor/reflection": "^5.3.3||^6.0", 17 | "phpdocumentor/reflection-docblock": "^5.3", 18 | "erusev/parsedown": "^1.6", 19 | "google/cloud-pubsub": "^2.0", 20 | "dg/bypass-finals": "^1.7", 21 | "dms/phpunit-arraysubset-asserts": "^0.5.0", 22 | "symfony/process": "^6.4" 23 | }, 24 | "suggest": { 25 | "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions.", 26 | "brick/math": "Perform arithmetic on NUMERIC values." 27 | }, 28 | "extra": { 29 | "component": { 30 | "id": "cloud-spanner", 31 | "target": "googleapis/google-cloud-php-spanner.git", 32 | "path": "Spanner", 33 | "entry": "src/SpannerClient.php" 34 | } 35 | }, 36 | "autoload": { 37 | "psr-4": { 38 | "Google\\Cloud\\Spanner\\": "src", 39 | "GPBMetadata\\Google\\Spanner\\": "metadata" 40 | } 41 | }, 42 | "autoload-dev": { 43 | "psr-4": { 44 | "Google\\Cloud\\Spanner\\Tests\\": "tests", 45 | "Testing\\Data\\": "tests/data/generated/Testing/Data", 46 | "GPBMetadata\\Data\\": "tests/data/generated/GPBMetadata/Data" 47 | } 48 | }, 49 | "scripts": { 50 | "test-unit": [ 51 | "vendor/bin/phpunit --testdox --stop-on-failure" 52 | ], 53 | "test-snippets": [ 54 | "vendor/bin/phpunit -c phpunit-snippets.xml.dist --testdox --stop-on-failure" 55 | ], 56 | "test-system": [ 57 | "Composer\\Config::disableProcessTimeout", 58 | "vendor/bin/phpunit -c phpunit-system.xml.dist --testdox --stop-on-failure" 59 | ], 60 | "test-all": [ 61 | "@test-unit", 62 | "@test-snippets", 63 | "@test-system" 64 | ] 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/Admin/Instance/V1/FreeInstanceMetadata/ExpireBehavior.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.instance.v1.FreeInstanceMetadata.ExpireBehavior 13 | */ 14 | class ExpireBehavior 15 | { 16 | /** 17 | * Not specified. 18 | * 19 | * Generated from protobuf enum EXPIRE_BEHAVIOR_UNSPECIFIED = 0; 20 | */ 21 | const EXPIRE_BEHAVIOR_UNSPECIFIED = 0; 22 | /** 23 | * When the free instance expires, upgrade the instance to a provisioned 24 | * instance. 25 | * 26 | * Generated from protobuf enum FREE_TO_PROVISIONED = 1; 27 | */ 28 | const FREE_TO_PROVISIONED = 1; 29 | /** 30 | * When the free instance expires, disable the instance, and delete it 31 | * after the grace period passes if it has not been upgraded. 32 | * 33 | * Generated from protobuf enum REMOVE_AFTER_GRACE_PERIOD = 2; 34 | */ 35 | const REMOVE_AFTER_GRACE_PERIOD = 2; 36 | 37 | private static $valueToName = [ 38 | self::EXPIRE_BEHAVIOR_UNSPECIFIED => 'EXPIRE_BEHAVIOR_UNSPECIFIED', 39 | self::FREE_TO_PROVISIONED => 'FREE_TO_PROVISIONED', 40 | self::REMOVE_AFTER_GRACE_PERIOD => 'REMOVE_AFTER_GRACE_PERIOD', 41 | ]; 42 | 43 | public static function name($value) 44 | { 45 | if (!isset(self::$valueToName[$value])) { 46 | throw new UnexpectedValueException(sprintf( 47 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 48 | } 49 | return self::$valueToName[$value]; 50 | } 51 | 52 | 53 | public static function value($name) 54 | { 55 | $const = __CLASS__ . '::' . strtoupper($name); 56 | if (!defined($const)) { 57 | throw new UnexpectedValueException(sprintf( 58 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 59 | } 60 | return constant($const); 61 | } 62 | } 63 | 64 | // Adding a class alias for backwards compatibility with the previous class name. 65 | class_alias(ExpireBehavior::class, \Google\Cloud\Spanner\Admin\Instance\V1\FreeInstanceMetadata_ExpireBehavior::class); 66 | 67 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/EncryptionInfo/Type.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.EncryptionInfo.Type 13 | */ 14 | class Type 15 | { 16 | /** 17 | * Encryption type was not specified, though data at rest remains encrypted. 18 | * 19 | * Generated from protobuf enum TYPE_UNSPECIFIED = 0; 20 | */ 21 | const TYPE_UNSPECIFIED = 0; 22 | /** 23 | * The data is encrypted at rest with a key that is 24 | * fully managed by Google. No key version or status will be populated. 25 | * This is the default state. 26 | * 27 | * Generated from protobuf enum GOOGLE_DEFAULT_ENCRYPTION = 1; 28 | */ 29 | const GOOGLE_DEFAULT_ENCRYPTION = 1; 30 | /** 31 | * The data is encrypted at rest with a key that is 32 | * managed by the customer. The active version of the key. `kms_key_version` 33 | * will be populated, and `encryption_status` may be populated. 34 | * 35 | * Generated from protobuf enum CUSTOMER_MANAGED_ENCRYPTION = 2; 36 | */ 37 | const CUSTOMER_MANAGED_ENCRYPTION = 2; 38 | 39 | private static $valueToName = [ 40 | self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', 41 | self::GOOGLE_DEFAULT_ENCRYPTION => 'GOOGLE_DEFAULT_ENCRYPTION', 42 | self::CUSTOMER_MANAGED_ENCRYPTION => 'CUSTOMER_MANAGED_ENCRYPTION', 43 | ]; 44 | 45 | public static function name($value) 46 | { 47 | if (!isset(self::$valueToName[$value])) { 48 | throw new UnexpectedValueException(sprintf( 49 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 50 | } 51 | return self::$valueToName[$value]; 52 | } 53 | 54 | 55 | public static function value($name) 56 | { 57 | $const = __CLASS__ . '::' . strtoupper($name); 58 | if (!defined($const)) { 59 | throw new UnexpectedValueException(sprintf( 60 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 61 | } 62 | return constant($const); 63 | } 64 | } 65 | 66 | // Adding a class alias for backwards compatibility with the previous class name. 67 | class_alias(Type::class, \Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo_Type::class); 68 | 69 | -------------------------------------------------------------------------------- /src/Admin/Instance/V1/Instance/InstanceType.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.instance.v1.Instance.InstanceType 16 | */ 17 | class InstanceType 18 | { 19 | /** 20 | * Not specified. 21 | * 22 | * Generated from protobuf enum INSTANCE_TYPE_UNSPECIFIED = 0; 23 | */ 24 | const INSTANCE_TYPE_UNSPECIFIED = 0; 25 | /** 26 | * Provisioned instances have dedicated resources, standard usage limits and 27 | * support. 28 | * 29 | * Generated from protobuf enum PROVISIONED = 1; 30 | */ 31 | const PROVISIONED = 1; 32 | /** 33 | * Free instances provide no guarantee for dedicated resources, 34 | * [node_count, processing_units] should be 0. They come 35 | * with stricter usage limits and limited support. 36 | * 37 | * Generated from protobuf enum FREE_INSTANCE = 2; 38 | */ 39 | const FREE_INSTANCE = 2; 40 | 41 | private static $valueToName = [ 42 | self::INSTANCE_TYPE_UNSPECIFIED => 'INSTANCE_TYPE_UNSPECIFIED', 43 | self::PROVISIONED => 'PROVISIONED', 44 | self::FREE_INSTANCE => 'FREE_INSTANCE', 45 | ]; 46 | 47 | public static function name($value) 48 | { 49 | if (!isset(self::$valueToName[$value])) { 50 | throw new UnexpectedValueException(sprintf( 51 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 52 | } 53 | return self::$valueToName[$value]; 54 | } 55 | 56 | 57 | public static function value($name) 58 | { 59 | $const = __CLASS__ . '::' . strtoupper($name); 60 | if (!defined($const)) { 61 | throw new UnexpectedValueException(sprintf( 62 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 63 | } 64 | return constant($const); 65 | } 66 | } 67 | 68 | // Adding a class alias for backwards compatibility with the previous class name. 69 | class_alias(InstanceType::class, \Google\Cloud\Spanner\Admin\Instance\V1\Instance_InstanceType::class); 70 | 71 | -------------------------------------------------------------------------------- /src/V1/Partition.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.Partition 16 | */ 17 | class Partition extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * This token can be passed to `Read`, `StreamingRead`, `ExecuteSql`, or 21 | * `ExecuteStreamingSql` requests to restrict the results to those identified 22 | * by this partition token. 23 | * 24 | * Generated from protobuf field bytes partition_token = 1; 25 | */ 26 | protected $partition_token = ''; 27 | 28 | /** 29 | * Constructor. 30 | * 31 | * @param array $data { 32 | * Optional. Data for populating the Message object. 33 | * 34 | * @type string $partition_token 35 | * This token can be passed to `Read`, `StreamingRead`, `ExecuteSql`, or 36 | * `ExecuteStreamingSql` requests to restrict the results to those identified 37 | * by this partition token. 38 | * } 39 | */ 40 | public function __construct($data = NULL) { 41 | \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); 42 | parent::__construct($data); 43 | } 44 | 45 | /** 46 | * This token can be passed to `Read`, `StreamingRead`, `ExecuteSql`, or 47 | * `ExecuteStreamingSql` requests to restrict the results to those identified 48 | * by this partition token. 49 | * 50 | * Generated from protobuf field bytes partition_token = 1; 51 | * @return string 52 | */ 53 | public function getPartitionToken() 54 | { 55 | return $this->partition_token; 56 | } 57 | 58 | /** 59 | * This token can be passed to `Read`, `StreamingRead`, `ExecuteSql`, or 60 | * `ExecuteStreamingSql` requests to restrict the results to those identified 61 | * by this partition token. 62 | * 63 | * Generated from protobuf field bytes partition_token = 1; 64 | * @param string $var 65 | * @return $this 66 | */ 67 | public function setPartitionToken($var) 68 | { 69 | GPBUtil::checkString($var, False); 70 | $this->partition_token = $var; 71 | 72 | return $this; 73 | } 74 | 75 | } 76 | 77 | -------------------------------------------------------------------------------- /src/V1/BatchWriteRequest/MutationGroup.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.BatchWriteRequest.MutationGroup 17 | */ 18 | class MutationGroup extends \Google\Protobuf\Internal\Message 19 | { 20 | /** 21 | * Required. The mutations in this group. 22 | * 23 | * Generated from protobuf field repeated .google.spanner.v1.Mutation mutations = 1 [(.google.api.field_behavior) = REQUIRED]; 24 | */ 25 | private $mutations; 26 | 27 | /** 28 | * Constructor. 29 | * 30 | * @param array $data { 31 | * Optional. Data for populating the Message object. 32 | * 33 | * @type array<\Google\Cloud\Spanner\V1\Mutation>|\Google\Protobuf\Internal\RepeatedField $mutations 34 | * Required. The mutations in this group. 35 | * } 36 | */ 37 | public function __construct($data = NULL) { 38 | \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); 39 | parent::__construct($data); 40 | } 41 | 42 | /** 43 | * Required. The mutations in this group. 44 | * 45 | * Generated from protobuf field repeated .google.spanner.v1.Mutation mutations = 1 [(.google.api.field_behavior) = REQUIRED]; 46 | * @return \Google\Protobuf\Internal\RepeatedField 47 | */ 48 | public function getMutations() 49 | { 50 | return $this->mutations; 51 | } 52 | 53 | /** 54 | * Required. The mutations in this group. 55 | * 56 | * Generated from protobuf field repeated .google.spanner.v1.Mutation mutations = 1 [(.google.api.field_behavior) = REQUIRED]; 57 | * @param array<\Google\Cloud\Spanner\V1\Mutation>|\Google\Protobuf\Internal\RepeatedField $var 58 | * @return $this 59 | */ 60 | public function setMutations($var) 61 | { 62 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Mutation::class); 63 | $this->mutations = $arr; 64 | 65 | return $this; 66 | } 67 | 68 | } 69 | 70 | 71 | -------------------------------------------------------------------------------- /src/V1/DirectedReadOptions/ExcludeReplicas.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.DirectedReadOptions.ExcludeReplicas 16 | */ 17 | class ExcludeReplicas extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * The directed read replica selector. 21 | * 22 | * Generated from protobuf field repeated .google.spanner.v1.DirectedReadOptions.ReplicaSelection replica_selections = 1; 23 | */ 24 | private $replica_selections; 25 | 26 | /** 27 | * Constructor. 28 | * 29 | * @param array $data { 30 | * Optional. Data for populating the Message object. 31 | * 32 | * @type array<\Google\Cloud\Spanner\V1\DirectedReadOptions\ReplicaSelection>|\Google\Protobuf\Internal\RepeatedField $replica_selections 33 | * The directed read replica selector. 34 | * } 35 | */ 36 | public function __construct($data = NULL) { 37 | \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); 38 | parent::__construct($data); 39 | } 40 | 41 | /** 42 | * The directed read replica selector. 43 | * 44 | * Generated from protobuf field repeated .google.spanner.v1.DirectedReadOptions.ReplicaSelection replica_selections = 1; 45 | * @return \Google\Protobuf\Internal\RepeatedField 46 | */ 47 | public function getReplicaSelections() 48 | { 49 | return $this->replica_selections; 50 | } 51 | 52 | /** 53 | * The directed read replica selector. 54 | * 55 | * Generated from protobuf field repeated .google.spanner.v1.DirectedReadOptions.ReplicaSelection replica_selections = 1; 56 | * @param array<\Google\Cloud\Spanner\V1\DirectedReadOptions\ReplicaSelection>|\Google\Protobuf\Internal\RepeatedField $var 57 | * @return $this 58 | */ 59 | public function setReplicaSelections($var) 60 | { 61 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\DirectedReadOptions\ReplicaSelection::class); 62 | $this->replica_selections = $arr; 63 | 64 | return $this; 65 | } 66 | 67 | } 68 | 69 | 70 | -------------------------------------------------------------------------------- /src/V1/GetSessionRequest.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.GetSessionRequest 15 | */ 16 | class GetSessionRequest extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Required. The name of the session to retrieve. 20 | * 21 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 22 | */ 23 | protected $name = ''; 24 | 25 | /** 26 | * @param string $name Required. The name of the session to retrieve. Please see 27 | * {@see SpannerClient::sessionName()} for help formatting this field. 28 | * 29 | * @return \Google\Cloud\Spanner\V1\GetSessionRequest 30 | * 31 | * @experimental 32 | */ 33 | public static function build(string $name): self 34 | { 35 | return (new self()) 36 | ->setName($name); 37 | } 38 | 39 | /** 40 | * Constructor. 41 | * 42 | * @param array $data { 43 | * Optional. Data for populating the Message object. 44 | * 45 | * @type string $name 46 | * Required. The name of the session to retrieve. 47 | * } 48 | */ 49 | public function __construct($data = NULL) { 50 | \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); 51 | parent::__construct($data); 52 | } 53 | 54 | /** 55 | * Required. The name of the session to retrieve. 56 | * 57 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 58 | * @return string 59 | */ 60 | public function getName() 61 | { 62 | return $this->name; 63 | } 64 | 65 | /** 66 | * Required. The name of the session to retrieve. 67 | * 68 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 69 | * @param string $var 70 | * @return $this 71 | */ 72 | public function setName($var) 73 | { 74 | GPBUtil::checkString($var, True); 75 | $this->name = $var; 76 | 77 | return $this; 78 | } 79 | 80 | } 81 | 82 | -------------------------------------------------------------------------------- /src/V1/DeleteSessionRequest.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.DeleteSessionRequest 15 | */ 16 | class DeleteSessionRequest extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Required. The name of the session to delete. 20 | * 21 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 22 | */ 23 | protected $name = ''; 24 | 25 | /** 26 | * @param string $name Required. The name of the session to delete. Please see 27 | * {@see SpannerClient::sessionName()} for help formatting this field. 28 | * 29 | * @return \Google\Cloud\Spanner\V1\DeleteSessionRequest 30 | * 31 | * @experimental 32 | */ 33 | public static function build(string $name): self 34 | { 35 | return (new self()) 36 | ->setName($name); 37 | } 38 | 39 | /** 40 | * Constructor. 41 | * 42 | * @param array $data { 43 | * Optional. Data for populating the Message object. 44 | * 45 | * @type string $name 46 | * Required. The name of the session to delete. 47 | * } 48 | */ 49 | public function __construct($data = NULL) { 50 | \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); 51 | parent::__construct($data); 52 | } 53 | 54 | /** 55 | * Required. The name of the session to delete. 56 | * 57 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 58 | * @return string 59 | */ 60 | public function getName() 61 | { 62 | return $this->name; 63 | } 64 | 65 | /** 66 | * Required. The name of the session to delete. 67 | * 68 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 69 | * @param string $var 70 | * @return $this 71 | */ 72 | public function setName($var) 73 | { 74 | GPBUtil::checkString($var, True); 75 | $this->name = $var; 76 | 77 | return $this; 78 | } 79 | 80 | } 81 | 82 | -------------------------------------------------------------------------------- /src/CommitTimestamp.php: -------------------------------------------------------------------------------- 1 | 'my-project']); 45 | * $database = $spanner->connect('my-instance', 'my-database'); 46 | * 47 | * $database->insert('myTable', [ 48 | * 'id' => $id, 49 | * 'commitTimestamp' => $spanner->commitTimestamp() 50 | * ]); 51 | * ``` 52 | */ 53 | class CommitTimestamp implements ValueInterface 54 | { 55 | const SPECIAL_VALUE = 'spanner.commit_timestamp()'; 56 | 57 | /** 58 | * @access private 59 | */ 60 | public function type(): int 61 | { 62 | return Database::TYPE_TIMESTAMP; 63 | } 64 | 65 | /** 66 | * @access private 67 | */ 68 | public function get(): string 69 | { 70 | return self::SPECIAL_VALUE; 71 | } 72 | 73 | /** 74 | * @access private 75 | */ 76 | public function formatAsString(): string 77 | { 78 | return self::SPECIAL_VALUE; 79 | } 80 | 81 | /** 82 | * @access private 83 | */ 84 | public function __toString() 85 | { 86 | return self::SPECIAL_VALUE; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/BackupInstancePartition.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.BackupInstancePartition 15 | */ 16 | class BackupInstancePartition extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * A unique identifier for the instance partition. Values are of the form 20 | * `projects//instances//instancePartitions/` 21 | * 22 | * Generated from protobuf field string instance_partition = 1 [(.google.api.resource_reference) = { 23 | */ 24 | protected $instance_partition = ''; 25 | 26 | /** 27 | * Constructor. 28 | * 29 | * @param array $data { 30 | * Optional. Data for populating the Message object. 31 | * 32 | * @type string $instance_partition 33 | * A unique identifier for the instance partition. Values are of the form 34 | * `projects//instances//instancePartitions/` 35 | * } 36 | */ 37 | public function __construct($data = NULL) { 38 | \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); 39 | parent::__construct($data); 40 | } 41 | 42 | /** 43 | * A unique identifier for the instance partition. Values are of the form 44 | * `projects//instances//instancePartitions/` 45 | * 46 | * Generated from protobuf field string instance_partition = 1 [(.google.api.resource_reference) = { 47 | * @return string 48 | */ 49 | public function getInstancePartition() 50 | { 51 | return $this->instance_partition; 52 | } 53 | 54 | /** 55 | * A unique identifier for the instance partition. Values are of the form 56 | * `projects//instances//instancePartitions/` 57 | * 58 | * Generated from protobuf field string instance_partition = 1 [(.google.api.resource_reference) = { 59 | * @param string $var 60 | * @return $this 61 | */ 62 | public function setInstancePartition($var) 63 | { 64 | GPBUtil::checkString($var, True); 65 | $this->instance_partition = $var; 66 | 67 | return $this; 68 | } 69 | 70 | } 71 | 72 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/SplitPoints/Key.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.SplitPoints.Key 15 | */ 16 | class Key extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Required. The column values making up the split key. 20 | * 21 | * Generated from protobuf field .google.protobuf.ListValue key_parts = 1 [(.google.api.field_behavior) = REQUIRED]; 22 | */ 23 | protected $key_parts = null; 24 | 25 | /** 26 | * Constructor. 27 | * 28 | * @param array $data { 29 | * Optional. Data for populating the Message object. 30 | * 31 | * @type \Google\Protobuf\ListValue $key_parts 32 | * Required. The column values making up the split key. 33 | * } 34 | */ 35 | public function __construct($data = NULL) { 36 | \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); 37 | parent::__construct($data); 38 | } 39 | 40 | /** 41 | * Required. The column values making up the split key. 42 | * 43 | * Generated from protobuf field .google.protobuf.ListValue key_parts = 1 [(.google.api.field_behavior) = REQUIRED]; 44 | * @return \Google\Protobuf\ListValue|null 45 | */ 46 | public function getKeyParts() 47 | { 48 | return $this->key_parts; 49 | } 50 | 51 | public function hasKeyParts() 52 | { 53 | return isset($this->key_parts); 54 | } 55 | 56 | public function clearKeyParts() 57 | { 58 | unset($this->key_parts); 59 | } 60 | 61 | /** 62 | * Required. The column values making up the split key. 63 | * 64 | * Generated from protobuf field .google.protobuf.ListValue key_parts = 1 [(.google.api.field_behavior) = REQUIRED]; 65 | * @param \Google\Protobuf\ListValue $var 66 | * @return $this 67 | */ 68 | public function setKeyParts($var) 69 | { 70 | GPBUtil::checkMessage($var, \Google\Protobuf\ListValue::class); 71 | $this->key_parts = $var; 72 | 73 | return $this; 74 | } 75 | 76 | } 77 | 78 | // Adding a class alias for backwards compatibility with the previous class name. 79 | class_alias(Key::class, \Google\Cloud\Spanner\Admin\Database\V1\SplitPoints_Key::class); 80 | 81 | -------------------------------------------------------------------------------- /src/Snapshot.php: -------------------------------------------------------------------------------- 1 | 'my-project']); 33 | * 34 | * $database = $spanner->connect('my-instance', 'my-database'); 35 | * $transaction = $database->snapshot(); 36 | * ``` 37 | */ 38 | class Snapshot implements TransactionalReadInterface 39 | { 40 | use SnapshotTrait; 41 | 42 | /** 43 | * @param Operation $operation The Operation instance. 44 | * @param SessionCache $session The session to use for spanner interactions. 45 | * @param array $options [optional] { 46 | * Configuration Options. 47 | * 48 | * @type string $id The Transaction ID. If no ID is provided, 49 | * the Transaction will be a Single-Use Transaction. 50 | * @type Timestamp $readTimestamp The read timestamp. 51 | * @type array $directedReadOptions Directed read options. 52 | * {@see \Google\Cloud\Spanner\V1\DirectedReadOptions} 53 | * If using the `replicaSelection::type` setting, utilize the constants available in 54 | * {@see \Google\Cloud\Spanner\V1\DirectedReadOptions\ReplicaSelection\Type} to set a value. 55 | * @type array $transactonOptions 56 | * } 57 | * @throws \InvalidArgumentException if a tag is specified as this is a read-only transaction. 58 | */ 59 | public function __construct(Operation $operation, SessionCache $session, array $options = []) 60 | { 61 | if (isset($options['tag'])) { 62 | throw new \InvalidArgumentException( 63 | 'Cannot set a transaction tag on a read-only transaction.' 64 | ); 65 | } 66 | $this->initialize($operation, $session, $options); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/Admin/Instance/V1/Instance/DefaultBackupScheduleType.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.instance.v1.Instance.DefaultBackupScheduleType 16 | */ 17 | class DefaultBackupScheduleType 18 | { 19 | /** 20 | * Not specified. 21 | * 22 | * Generated from protobuf enum DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIED = 0; 23 | */ 24 | const DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIED = 0; 25 | /** 26 | * A default backup schedule isn't created automatically when a new database 27 | * is created in the instance. 28 | * 29 | * Generated from protobuf enum NONE = 1; 30 | */ 31 | const NONE = 1; 32 | /** 33 | * A default backup schedule is created automatically when a new database 34 | * is created in the instance. The default backup schedule creates a full 35 | * backup every 24 hours. These full backups are retained for 7 days. 36 | * You can edit or delete the default backup schedule once it's created. 37 | * 38 | * Generated from protobuf enum AUTOMATIC = 2; 39 | */ 40 | const AUTOMATIC = 2; 41 | 42 | private static $valueToName = [ 43 | self::DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIED => 'DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIED', 44 | self::NONE => 'NONE', 45 | self::AUTOMATIC => 'AUTOMATIC', 46 | ]; 47 | 48 | public static function name($value) 49 | { 50 | if (!isset(self::$valueToName[$value])) { 51 | throw new UnexpectedValueException(sprintf( 52 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 53 | } 54 | return self::$valueToName[$value]; 55 | } 56 | 57 | 58 | public static function value($name) 59 | { 60 | $const = __CLASS__ . '::' . strtoupper($name); 61 | if (!defined($const)) { 62 | throw new UnexpectedValueException(sprintf( 63 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 64 | } 65 | return constant($const); 66 | } 67 | } 68 | 69 | // Adding a class alias for backwards compatibility with the previous class name. 70 | class_alias(DefaultBackupScheduleType::class, \Google\Cloud\Spanner\Admin\Instance\V1\Instance_DefaultBackupScheduleType::class); 71 | 72 | -------------------------------------------------------------------------------- /src/PgOid.php: -------------------------------------------------------------------------------- 1 | 'my-project']); 32 | * $pgOid = $spanner->pgOid('123'); 33 | * ``` 34 | */ 35 | class PgOid implements ValueInterface, TypeAnnotationInterface 36 | { 37 | private string|null $value; 38 | 39 | /** 40 | * @param string|null $value The OID value. 41 | */ 42 | public function __construct(string|null $value) 43 | { 44 | $this->value = $value; 45 | } 46 | 47 | /** 48 | * Get the underlying value. 49 | * 50 | * @return string|null 51 | */ 52 | public function get(): string|null 53 | { 54 | return $this->value; 55 | } 56 | 57 | /** 58 | * Get the type. 59 | * 60 | * @access private 61 | * @return int 62 | */ 63 | public function type(): int 64 | { 65 | return ValueMapper::TYPE_INT64; 66 | } 67 | 68 | /** 69 | * Get the type annotation code. 70 | * This is to be used along type, to differentiate the value from TypeCode::INT64. 71 | * 72 | * @access private 73 | * @return int 74 | */ 75 | public function typeAnnotation(): int 76 | { 77 | return TypeAnnotationCode::PG_OID; 78 | } 79 | 80 | /** 81 | * Format the value as a string. 82 | * 83 | * @return string 84 | */ 85 | public function formatAsString(): string 86 | { 87 | return (string) $this->value; 88 | } 89 | 90 | /** 91 | * Format the value as a string. 92 | * 93 | * @return string 94 | */ 95 | public function __toString() 96 | { 97 | return (string) $this->value; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/DropDatabaseRequest.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.DropDatabaseRequest 16 | */ 17 | class DropDatabaseRequest extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * Required. The database to be dropped. 21 | * 22 | * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 23 | */ 24 | protected $database = ''; 25 | 26 | /** 27 | * @param string $database Required. The database to be dropped. Please see 28 | * {@see DatabaseAdminClient::databaseName()} for help formatting this field. 29 | * 30 | * @return \Google\Cloud\Spanner\Admin\Database\V1\DropDatabaseRequest 31 | * 32 | * @experimental 33 | */ 34 | public static function build(string $database): self 35 | { 36 | return (new self()) 37 | ->setDatabase($database); 38 | } 39 | 40 | /** 41 | * Constructor. 42 | * 43 | * @param array $data { 44 | * Optional. Data for populating the Message object. 45 | * 46 | * @type string $database 47 | * Required. The database to be dropped. 48 | * } 49 | */ 50 | public function __construct($data = NULL) { 51 | \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); 52 | parent::__construct($data); 53 | } 54 | 55 | /** 56 | * Required. The database to be dropped. 57 | * 58 | * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 59 | * @return string 60 | */ 61 | public function getDatabase() 62 | { 63 | return $this->database; 64 | } 65 | 66 | /** 67 | * Required. The database to be dropped. 68 | * 69 | * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 70 | * @param string $var 71 | * @return $this 72 | */ 73 | public function setDatabase($var) 74 | { 75 | GPBUtil::checkString($var, True); 76 | $this->database = $var; 77 | 78 | return $this; 79 | } 80 | 81 | } 82 | 83 | -------------------------------------------------------------------------------- /src/V1/ExecuteSqlRequest/QueryMode.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.ExecuteSqlRequest.QueryMode 13 | */ 14 | class QueryMode 15 | { 16 | /** 17 | * The default mode. Only the statement results are returned. 18 | * 19 | * Generated from protobuf enum NORMAL = 0; 20 | */ 21 | const NORMAL = 0; 22 | /** 23 | * This mode returns only the query plan, without any results or 24 | * execution statistics information. 25 | * 26 | * Generated from protobuf enum PLAN = 1; 27 | */ 28 | const PLAN = 1; 29 | /** 30 | * This mode returns the query plan, overall execution statistics, 31 | * operator level execution statistics along with the results. This has a 32 | * performance overhead compared to the other modes. It isn't recommended 33 | * to use this mode for production traffic. 34 | * 35 | * Generated from protobuf enum PROFILE = 2; 36 | */ 37 | const PROFILE = 2; 38 | /** 39 | * This mode returns the overall (but not operator-level) execution 40 | * statistics along with the results. 41 | * 42 | * Generated from protobuf enum WITH_STATS = 3; 43 | */ 44 | const WITH_STATS = 3; 45 | /** 46 | * This mode returns the query plan, overall (but not operator-level) 47 | * execution statistics along with the results. 48 | * 49 | * Generated from protobuf enum WITH_PLAN_AND_STATS = 4; 50 | */ 51 | const WITH_PLAN_AND_STATS = 4; 52 | 53 | private static $valueToName = [ 54 | self::NORMAL => 'NORMAL', 55 | self::PLAN => 'PLAN', 56 | self::PROFILE => 'PROFILE', 57 | self::WITH_STATS => 'WITH_STATS', 58 | self::WITH_PLAN_AND_STATS => 'WITH_PLAN_AND_STATS', 59 | ]; 60 | 61 | public static function name($value) 62 | { 63 | if (!isset(self::$valueToName[$value])) { 64 | throw new UnexpectedValueException(sprintf( 65 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 66 | } 67 | return self::$valueToName[$value]; 68 | } 69 | 70 | 71 | public static function value($name) 72 | { 73 | $const = __CLASS__ . '::' . strtoupper($name); 74 | if (!defined($const)) { 75 | throw new UnexpectedValueException(sprintf( 76 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 77 | } 78 | return constant($const); 79 | } 80 | } 81 | 82 | 83 | -------------------------------------------------------------------------------- /src/V1/ChangeStreamRecord/DataChangeRecord/ValueCaptureType.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.ChangeStreamRecord.DataChangeRecord.ValueCaptureType 14 | */ 15 | class ValueCaptureType 16 | { 17 | /** 18 | * Not specified. 19 | * 20 | * Generated from protobuf enum VALUE_CAPTURE_TYPE_UNSPECIFIED = 0; 21 | */ 22 | const VALUE_CAPTURE_TYPE_UNSPECIFIED = 0; 23 | /** 24 | * Records both old and new values of the modified watched columns. 25 | * 26 | * Generated from protobuf enum OLD_AND_NEW_VALUES = 10; 27 | */ 28 | const OLD_AND_NEW_VALUES = 10; 29 | /** 30 | * Records only new values of the modified watched columns. 31 | * 32 | * Generated from protobuf enum NEW_VALUES = 20; 33 | */ 34 | const NEW_VALUES = 20; 35 | /** 36 | * Records new values of all watched columns, including modified and 37 | * unmodified columns. 38 | * 39 | * Generated from protobuf enum NEW_ROW = 30; 40 | */ 41 | const NEW_ROW = 30; 42 | /** 43 | * Records the new values of all watched columns, including modified and 44 | * unmodified columns. Also records the old values of the modified 45 | * columns. 46 | * 47 | * Generated from protobuf enum NEW_ROW_AND_OLD_VALUES = 40; 48 | */ 49 | const NEW_ROW_AND_OLD_VALUES = 40; 50 | 51 | private static $valueToName = [ 52 | self::VALUE_CAPTURE_TYPE_UNSPECIFIED => 'VALUE_CAPTURE_TYPE_UNSPECIFIED', 53 | self::OLD_AND_NEW_VALUES => 'OLD_AND_NEW_VALUES', 54 | self::NEW_VALUES => 'NEW_VALUES', 55 | self::NEW_ROW => 'NEW_ROW', 56 | self::NEW_ROW_AND_OLD_VALUES => 'NEW_ROW_AND_OLD_VALUES', 57 | ]; 58 | 59 | public static function name($value) 60 | { 61 | if (!isset(self::$valueToName[$value])) { 62 | throw new UnexpectedValueException(sprintf( 63 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 64 | } 65 | return self::$valueToName[$value]; 66 | } 67 | 68 | 69 | public static function value($name) 70 | { 71 | $const = __CLASS__ . '::' . strtoupper($name); 72 | if (!defined($const)) { 73 | throw new UnexpectedValueException(sprintf( 74 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 75 | } 76 | return constant($const); 77 | } 78 | } 79 | 80 | 81 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/Database/State.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.Database.State 13 | */ 14 | class State 15 | { 16 | /** 17 | * Not specified. 18 | * 19 | * Generated from protobuf enum STATE_UNSPECIFIED = 0; 20 | */ 21 | const STATE_UNSPECIFIED = 0; 22 | /** 23 | * The database is still being created. Operations on the database may fail 24 | * with `FAILED_PRECONDITION` in this state. 25 | * 26 | * Generated from protobuf enum CREATING = 1; 27 | */ 28 | const CREATING = 1; 29 | /** 30 | * The database is fully created and ready for use. 31 | * 32 | * Generated from protobuf enum READY = 2; 33 | */ 34 | const READY = 2; 35 | /** 36 | * The database is fully created and ready for use, but is still 37 | * being optimized for performance and cannot handle full load. 38 | * In this state, the database still references the backup 39 | * it was restore from, preventing the backup 40 | * from being deleted. When optimizations are complete, the full performance 41 | * of the database will be restored, and the database will transition to 42 | * `READY` state. 43 | * 44 | * Generated from protobuf enum READY_OPTIMIZING = 3; 45 | */ 46 | const READY_OPTIMIZING = 3; 47 | 48 | private static $valueToName = [ 49 | self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', 50 | self::CREATING => 'CREATING', 51 | self::READY => 'READY', 52 | self::READY_OPTIMIZING => 'READY_OPTIMIZING', 53 | ]; 54 | 55 | public static function name($value) 56 | { 57 | if (!isset(self::$valueToName[$value])) { 58 | throw new UnexpectedValueException(sprintf( 59 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 60 | } 61 | return self::$valueToName[$value]; 62 | } 63 | 64 | 65 | public static function value($name) 66 | { 67 | $const = __CLASS__ . '::' . strtoupper($name); 68 | if (!defined($const)) { 69 | throw new UnexpectedValueException(sprintf( 70 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 71 | } 72 | return constant($const); 73 | } 74 | } 75 | 76 | // Adding a class alias for backwards compatibility with the previous class name. 77 | class_alias(State::class, \Google\Cloud\Spanner\Admin\Database\V1\Database_State::class); 78 | 79 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/DatabaseRole.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.DatabaseRole 15 | */ 16 | class DatabaseRole extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Required. The name of the database role. Values are of the form 20 | * `projects//instances//databases//databaseRoles/` 21 | * where `` is as specified in the `CREATE ROLE` DDL statement. 22 | * 23 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; 24 | */ 25 | protected $name = ''; 26 | 27 | /** 28 | * Constructor. 29 | * 30 | * @param array $data { 31 | * Optional. Data for populating the Message object. 32 | * 33 | * @type string $name 34 | * Required. The name of the database role. Values are of the form 35 | * `projects//instances//databases//databaseRoles/` 36 | * where `` is as specified in the `CREATE ROLE` DDL statement. 37 | * } 38 | */ 39 | public function __construct($data = NULL) { 40 | \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); 41 | parent::__construct($data); 42 | } 43 | 44 | /** 45 | * Required. The name of the database role. Values are of the form 46 | * `projects//instances//databases//databaseRoles/` 47 | * where `` is as specified in the `CREATE ROLE` DDL statement. 48 | * 49 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; 50 | * @return string 51 | */ 52 | public function getName() 53 | { 54 | return $this->name; 55 | } 56 | 57 | /** 58 | * Required. The name of the database role. Values are of the form 59 | * `projects//instances//databases//databaseRoles/` 60 | * where `` is as specified in the `CREATE ROLE` DDL statement. 61 | * 62 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; 63 | * @param string $var 64 | * @return $this 65 | */ 66 | public function setName($var) 67 | { 68 | GPBUtil::checkString($var, True); 69 | $this->name = $var; 70 | 71 | return $this; 72 | } 73 | 74 | } 75 | 76 | -------------------------------------------------------------------------------- /src/Admin/Instance/V1/InstanceConfig/QuorumType.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.instance.v1.InstanceConfig.QuorumType 13 | */ 14 | class QuorumType 15 | { 16 | /** 17 | * Quorum type not specified. 18 | * 19 | * Generated from protobuf enum QUORUM_TYPE_UNSPECIFIED = 0; 20 | */ 21 | const QUORUM_TYPE_UNSPECIFIED = 0; 22 | /** 23 | * An instance configuration tagged with `REGION` quorum type forms a write 24 | * quorum in a single region. 25 | * 26 | * Generated from protobuf enum REGION = 1; 27 | */ 28 | const REGION = 1; 29 | /** 30 | * An instance configuration tagged with the `DUAL_REGION` quorum type forms 31 | * a write quorum with exactly two read-write regions in a multi-region 32 | * configuration. 33 | * This instance configuration requires failover in the event of 34 | * regional failures. 35 | * 36 | * Generated from protobuf enum DUAL_REGION = 2; 37 | */ 38 | const DUAL_REGION = 2; 39 | /** 40 | * An instance configuration tagged with the `MULTI_REGION` quorum type 41 | * forms a write quorum from replicas that are spread across more than one 42 | * region in a multi-region configuration. 43 | * 44 | * Generated from protobuf enum MULTI_REGION = 3; 45 | */ 46 | const MULTI_REGION = 3; 47 | 48 | private static $valueToName = [ 49 | self::QUORUM_TYPE_UNSPECIFIED => 'QUORUM_TYPE_UNSPECIFIED', 50 | self::REGION => 'REGION', 51 | self::DUAL_REGION => 'DUAL_REGION', 52 | self::MULTI_REGION => 'MULTI_REGION', 53 | ]; 54 | 55 | public static function name($value) 56 | { 57 | if (!isset(self::$valueToName[$value])) { 58 | throw new UnexpectedValueException(sprintf( 59 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 60 | } 61 | return self::$valueToName[$value]; 62 | } 63 | 64 | 65 | public static function value($name) 66 | { 67 | $const = __CLASS__ . '::' . strtoupper($name); 68 | if (!defined($const)) { 69 | throw new UnexpectedValueException(sprintf( 70 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 71 | } 72 | return constant($const); 73 | } 74 | } 75 | 76 | // Adding a class alias for backwards compatibility with the previous class name. 77 | class_alias(QuorumType::class, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig_QuorumType::class); 78 | 79 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/RestoreDatabaseEncryptionConfig/EncryptionType.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.EncryptionType 13 | */ 14 | class EncryptionType 15 | { 16 | /** 17 | * Unspecified. Do not use. 18 | * 19 | * Generated from protobuf enum ENCRYPTION_TYPE_UNSPECIFIED = 0; 20 | */ 21 | const ENCRYPTION_TYPE_UNSPECIFIED = 0; 22 | /** 23 | * This is the default option when 24 | * [encryption_config][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig] 25 | * is not specified. 26 | * 27 | * Generated from protobuf enum USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION = 1; 28 | */ 29 | const USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION = 1; 30 | /** 31 | * Use Google default encryption. 32 | * 33 | * Generated from protobuf enum GOOGLE_DEFAULT_ENCRYPTION = 2; 34 | */ 35 | const GOOGLE_DEFAULT_ENCRYPTION = 2; 36 | /** 37 | * Use customer managed encryption. If specified, `kms_key_name` must 38 | * must contain a valid Cloud KMS key. 39 | * 40 | * Generated from protobuf enum CUSTOMER_MANAGED_ENCRYPTION = 3; 41 | */ 42 | const CUSTOMER_MANAGED_ENCRYPTION = 3; 43 | 44 | private static $valueToName = [ 45 | self::ENCRYPTION_TYPE_UNSPECIFIED => 'ENCRYPTION_TYPE_UNSPECIFIED', 46 | self::USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION => 'USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION', 47 | self::GOOGLE_DEFAULT_ENCRYPTION => 'GOOGLE_DEFAULT_ENCRYPTION', 48 | self::CUSTOMER_MANAGED_ENCRYPTION => 'CUSTOMER_MANAGED_ENCRYPTION', 49 | ]; 50 | 51 | public static function name($value) 52 | { 53 | if (!isset(self::$valueToName[$value])) { 54 | throw new UnexpectedValueException(sprintf( 55 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 56 | } 57 | return self::$valueToName[$value]; 58 | } 59 | 60 | 61 | public static function value($name) 62 | { 63 | $const = __CLASS__ . '::' . strtoupper($name); 64 | if (!defined($const)) { 65 | throw new UnexpectedValueException(sprintf( 66 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 67 | } 68 | return constant($const); 69 | } 70 | } 71 | 72 | // Adding a class alias for backwards compatibility with the previous class name. 73 | class_alias(EncryptionType::class, \Google\Cloud\Spanner\Admin\Database\V1\RestoreDatabaseEncryptionConfig_EncryptionType::class); 74 | 75 | -------------------------------------------------------------------------------- /src/Bytes.php: -------------------------------------------------------------------------------- 1 | 'my-project']); 32 | * 33 | * $bytes = $spanner->bytes('hello world'); 34 | * ``` 35 | * 36 | * ``` 37 | * // Byte instances can be cast to base64-encoded strings. 38 | * echo (string) $bytes; 39 | * ``` 40 | */ 41 | class Bytes implements ValueInterface 42 | { 43 | /** 44 | * @var string|resource|StreamInterface 45 | */ 46 | private mixed $value; 47 | 48 | /** 49 | * @param string|resource|StreamInterface $value The bytes value. 50 | */ 51 | public function __construct(mixed $value) 52 | { 53 | $this->value = Utils::streamFor($value); 54 | } 55 | 56 | /** 57 | * Get the bytes as a stream. 58 | * 59 | * Example: 60 | * ``` 61 | * $stream = $bytes->get(); 62 | * ``` 63 | * 64 | * @return StreamInterface 65 | */ 66 | public function get(): StreamInterface 67 | { 68 | return $this->value; 69 | } 70 | 71 | /** 72 | * Get the type. 73 | * 74 | * Example: 75 | * ``` 76 | * echo $bytes->type(); 77 | * ``` 78 | * 79 | * @return int 80 | */ 81 | public function type(): int 82 | { 83 | return Database::TYPE_BYTES; 84 | } 85 | 86 | /** 87 | * Format the value as a string. 88 | * 89 | * Example: 90 | * ``` 91 | * echo $bytes->formatAsString(); 92 | * ``` 93 | * 94 | * @return string 95 | */ 96 | public function formatAsString(): string 97 | { 98 | return base64_encode((string) $this->value); 99 | } 100 | 101 | /** 102 | * Format the value as a string. 103 | * 104 | * @return string 105 | * @access private 106 | */ 107 | public function __toString() 108 | { 109 | return $this->formatAsString(); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/CreateBackupEncryptionConfig/EncryptionType.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.CreateBackupEncryptionConfig.EncryptionType 13 | */ 14 | class EncryptionType 15 | { 16 | /** 17 | * Unspecified. Do not use. 18 | * 19 | * Generated from protobuf enum ENCRYPTION_TYPE_UNSPECIFIED = 0; 20 | */ 21 | const ENCRYPTION_TYPE_UNSPECIFIED = 0; 22 | /** 23 | * Use the same encryption configuration as the database. This is the 24 | * default option when 25 | * [encryption_config][google.spanner.admin.database.v1.CreateBackupEncryptionConfig] 26 | * is empty. For example, if the database is using 27 | * `Customer_Managed_Encryption`, the backup will be using the same Cloud 28 | * KMS key as the database. 29 | * 30 | * Generated from protobuf enum USE_DATABASE_ENCRYPTION = 1; 31 | */ 32 | const USE_DATABASE_ENCRYPTION = 1; 33 | /** 34 | * Use Google default encryption. 35 | * 36 | * Generated from protobuf enum GOOGLE_DEFAULT_ENCRYPTION = 2; 37 | */ 38 | const GOOGLE_DEFAULT_ENCRYPTION = 2; 39 | /** 40 | * Use customer managed encryption. If specified, `kms_key_name` 41 | * must contain a valid Cloud KMS key. 42 | * 43 | * Generated from protobuf enum CUSTOMER_MANAGED_ENCRYPTION = 3; 44 | */ 45 | const CUSTOMER_MANAGED_ENCRYPTION = 3; 46 | 47 | private static $valueToName = [ 48 | self::ENCRYPTION_TYPE_UNSPECIFIED => 'ENCRYPTION_TYPE_UNSPECIFIED', 49 | self::USE_DATABASE_ENCRYPTION => 'USE_DATABASE_ENCRYPTION', 50 | self::GOOGLE_DEFAULT_ENCRYPTION => 'GOOGLE_DEFAULT_ENCRYPTION', 51 | self::CUSTOMER_MANAGED_ENCRYPTION => 'CUSTOMER_MANAGED_ENCRYPTION', 52 | ]; 53 | 54 | public static function name($value) 55 | { 56 | if (!isset(self::$valueToName[$value])) { 57 | throw new UnexpectedValueException(sprintf( 58 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 59 | } 60 | return self::$valueToName[$value]; 61 | } 62 | 63 | 64 | public static function value($name) 65 | { 66 | $const = __CLASS__ . '::' . strtoupper($name); 67 | if (!defined($const)) { 68 | throw new UnexpectedValueException(sprintf( 69 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 70 | } 71 | return constant($const); 72 | } 73 | } 74 | 75 | // Adding a class alias for backwards compatibility with the previous class name. 76 | class_alias(EncryptionType::class, \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig_EncryptionType::class); 77 | 78 | -------------------------------------------------------------------------------- /src/V1/RequestOptions/Priority.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.RequestOptions.Priority 26 | */ 27 | class Priority 28 | { 29 | /** 30 | * `PRIORITY_UNSPECIFIED` is equivalent to `PRIORITY_HIGH`. 31 | * 32 | * Generated from protobuf enum PRIORITY_UNSPECIFIED = 0; 33 | */ 34 | const PRIORITY_UNSPECIFIED = 0; 35 | /** 36 | * This specifies that the request is low priority. 37 | * 38 | * Generated from protobuf enum PRIORITY_LOW = 1; 39 | */ 40 | const PRIORITY_LOW = 1; 41 | /** 42 | * This specifies that the request is medium priority. 43 | * 44 | * Generated from protobuf enum PRIORITY_MEDIUM = 2; 45 | */ 46 | const PRIORITY_MEDIUM = 2; 47 | /** 48 | * This specifies that the request is high priority. 49 | * 50 | * Generated from protobuf enum PRIORITY_HIGH = 3; 51 | */ 52 | const PRIORITY_HIGH = 3; 53 | 54 | private static $valueToName = [ 55 | self::PRIORITY_UNSPECIFIED => 'PRIORITY_UNSPECIFIED', 56 | self::PRIORITY_LOW => 'PRIORITY_LOW', 57 | self::PRIORITY_MEDIUM => 'PRIORITY_MEDIUM', 58 | self::PRIORITY_HIGH => 'PRIORITY_HIGH', 59 | ]; 60 | 61 | public static function name($value) 62 | { 63 | if (!isset(self::$valueToName[$value])) { 64 | throw new UnexpectedValueException(sprintf( 65 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 66 | } 67 | return self::$valueToName[$value]; 68 | } 69 | 70 | 71 | public static function value($name) 72 | { 73 | $const = __CLASS__ . '::' . strtoupper($name); 74 | if (!defined($const)) { 75 | throw new UnexpectedValueException(sprintf( 76 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 77 | } 78 | return constant($const); 79 | } 80 | } 81 | 82 | 83 | -------------------------------------------------------------------------------- /src/Admin/Instance/V1/InstanceConfig/FreeInstanceAvailability.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.instance.v1.InstanceConfig.FreeInstanceAvailability 14 | */ 15 | class FreeInstanceAvailability 16 | { 17 | /** 18 | * Not specified. 19 | * 20 | * Generated from protobuf enum FREE_INSTANCE_AVAILABILITY_UNSPECIFIED = 0; 21 | */ 22 | const FREE_INSTANCE_AVAILABILITY_UNSPECIFIED = 0; 23 | /** 24 | * Indicates that free instances are available to be created in this 25 | * instance configuration. 26 | * 27 | * Generated from protobuf enum AVAILABLE = 1; 28 | */ 29 | const AVAILABLE = 1; 30 | /** 31 | * Indicates that free instances are not supported in this instance 32 | * configuration. 33 | * 34 | * Generated from protobuf enum UNSUPPORTED = 2; 35 | */ 36 | const UNSUPPORTED = 2; 37 | /** 38 | * Indicates that free instances are currently not available to be created 39 | * in this instance configuration. 40 | * 41 | * Generated from protobuf enum DISABLED = 3; 42 | */ 43 | const DISABLED = 3; 44 | /** 45 | * Indicates that additional free instances cannot be created in this 46 | * instance configuration because the project has reached its limit of free 47 | * instances. 48 | * 49 | * Generated from protobuf enum QUOTA_EXCEEDED = 4; 50 | */ 51 | const QUOTA_EXCEEDED = 4; 52 | 53 | private static $valueToName = [ 54 | self::FREE_INSTANCE_AVAILABILITY_UNSPECIFIED => 'FREE_INSTANCE_AVAILABILITY_UNSPECIFIED', 55 | self::AVAILABLE => 'AVAILABLE', 56 | self::UNSUPPORTED => 'UNSUPPORTED', 57 | self::DISABLED => 'DISABLED', 58 | self::QUOTA_EXCEEDED => 'QUOTA_EXCEEDED', 59 | ]; 60 | 61 | public static function name($value) 62 | { 63 | if (!isset(self::$valueToName[$value])) { 64 | throw new UnexpectedValueException(sprintf( 65 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 66 | } 67 | return self::$valueToName[$value]; 68 | } 69 | 70 | 71 | public static function value($name) 72 | { 73 | $const = __CLASS__ . '::' . strtoupper($name); 74 | if (!defined($const)) { 75 | throw new UnexpectedValueException(sprintf( 76 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 77 | } 78 | return constant($const); 79 | } 80 | } 81 | 82 | // Adding a class alias for backwards compatibility with the previous class name. 83 | class_alias(FreeInstanceAvailability::class, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig_FreeInstanceAvailability::class); 84 | 85 | -------------------------------------------------------------------------------- /src/PgJsonb.php: -------------------------------------------------------------------------------- 1 | 'my-project']); 34 | * $pgJsonb = $spanner->pgJsonb('{}'); 35 | * ``` 36 | */ 37 | class PgJsonb implements ValueInterface, TypeAnnotationInterface 38 | { 39 | use JsonTrait; 40 | 41 | private string|null $value; 42 | 43 | public function __construct(string|array|JsonSerializable|null $value) 44 | { 45 | // null shouldn't be casted to an empty string 46 | if (!is_null($value)) { 47 | if (is_array($value) || $value instanceof JsonSerializable) { 48 | $value = self::jsonEncode($value); 49 | } else { 50 | $value = (string) $value; 51 | } 52 | } 53 | $this->value = $value; 54 | } 55 | 56 | /** 57 | * Get the underlying value. 58 | * 59 | * @return string|null 60 | */ 61 | public function get(): string|null 62 | { 63 | return $this->value; 64 | } 65 | 66 | /** 67 | * Get the type. 68 | * 69 | * @access private 70 | * @return int 71 | */ 72 | public function type(): int 73 | { 74 | return ValueMapper::TYPE_JSON; 75 | } 76 | 77 | /** 78 | * Get the type annotation code. 79 | * This is to be used along type, to differentiate the value from TypeCode::JSON. 80 | * 81 | * @access private 82 | * @return int 83 | */ 84 | public function typeAnnotation(): int 85 | { 86 | return TypeAnnotationCode::PG_JSONB; 87 | } 88 | 89 | /** 90 | * Format the value as a string. 91 | * 92 | * @return string 93 | */ 94 | public function formatAsString(): string 95 | { 96 | return (string) $this->value; 97 | } 98 | 99 | /** 100 | * Format the value as a string. 101 | * 102 | * @return string 103 | */ 104 | public function __toString() 105 | { 106 | return (string) $this->value; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/PgNumeric.php: -------------------------------------------------------------------------------- 1 | 'my-project']); 35 | * 36 | * $pgNumeric = $spanner->pgNumeric('99999999999999999999999999999999999999.000000999999999'); 37 | * ``` 38 | */ 39 | class PgNumeric implements ValueInterface, TypeAnnotationInterface 40 | { 41 | private string|null $value; 42 | 43 | /** 44 | * @param string|int|float|null $value The PG_NUMERIC value. 45 | */ 46 | public function __construct(string|int|float|null $value) 47 | { 48 | // null shouldn't be casted to an empty string 49 | $value = is_null($value) ? $value : (string) $value; 50 | $this->value = $value; 51 | } 52 | 53 | /** 54 | * Get the underlying value. 55 | * 56 | * @return string|null 57 | */ 58 | public function get(): string|null 59 | { 60 | return $this->value; 61 | } 62 | 63 | /** 64 | * Get the type. 65 | * 66 | * @access private 67 | * @return int 68 | */ 69 | public function type(): int 70 | { 71 | return ValueMapper::TYPE_NUMERIC; 72 | } 73 | 74 | /** 75 | * Get the type annotation code. 76 | * This is to be used along type, to differentiate the value from TypeCode::NUMERIC. 77 | * 78 | * @access private 79 | * @return int 80 | */ 81 | public function typeAnnotation(): int 82 | { 83 | return TypeAnnotationCode::PG_NUMERIC; 84 | } 85 | 86 | /** 87 | * Format the value as a string. 88 | * 89 | * @return string 90 | */ 91 | public function formatAsString(): string 92 | { 93 | return (string) $this->value; 94 | } 95 | 96 | /** 97 | * Format the value as a string. 98 | * 99 | * @return string 100 | */ 101 | public function __toString() 102 | { 103 | return (string) $this->value; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /src/IntervalParsingState.php: -------------------------------------------------------------------------------- 1 | afterP = array_fill_keys(['Y', 'M', 'D', 'T'], true); 66 | $this->afterY = array_fill_keys(['M', 'D', 'T'], true); 67 | $this->afterMonth = array_fill_keys(['D', 'T'], true); 68 | $this->afterD = array_fill_keys(['T'], true); 69 | $this->afterT = array_fill_keys(['H', 'M', 'S'], true); 70 | $this->afterH = array_fill_keys(['M', 'S'], true); 71 | $this->afterMins = array_fill_keys(['S'], true); 72 | $this->nextAllowed = array_fill_keys(['P'], true); 73 | } 74 | 75 | /** 76 | * Returns the index of the first occurrence of needles on the string 77 | */ 78 | public static function indexOfAny(string $text, array $nextAllowed, int $start = 0): int 79 | { 80 | $splitString = str_split($text); 81 | foreach (array_splice($splitString, $start) as $index => $letter) { 82 | if (array_key_exists($letter, $nextAllowed)) { 83 | return $index + $start; 84 | } 85 | } 86 | 87 | return -1; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/CopyBackupEncryptionConfig/EncryptionType.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.CopyBackupEncryptionConfig.EncryptionType 13 | */ 14 | class EncryptionType 15 | { 16 | /** 17 | * Unspecified. Do not use. 18 | * 19 | * Generated from protobuf enum ENCRYPTION_TYPE_UNSPECIFIED = 0; 20 | */ 21 | const ENCRYPTION_TYPE_UNSPECIFIED = 0; 22 | /** 23 | * This is the default option for 24 | * [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup] 25 | * when 26 | * [encryption_config][google.spanner.admin.database.v1.CopyBackupEncryptionConfig] 27 | * is not specified. For example, if the source backup is using 28 | * `Customer_Managed_Encryption`, the backup will be using the same Cloud 29 | * KMS key as the source backup. 30 | * 31 | * Generated from protobuf enum USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION = 1; 32 | */ 33 | const USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION = 1; 34 | /** 35 | * Use Google default encryption. 36 | * 37 | * Generated from protobuf enum GOOGLE_DEFAULT_ENCRYPTION = 2; 38 | */ 39 | const GOOGLE_DEFAULT_ENCRYPTION = 2; 40 | /** 41 | * Use customer managed encryption. If specified, either `kms_key_name` or 42 | * `kms_key_names` must contain valid Cloud KMS key(s). 43 | * 44 | * Generated from protobuf enum CUSTOMER_MANAGED_ENCRYPTION = 3; 45 | */ 46 | const CUSTOMER_MANAGED_ENCRYPTION = 3; 47 | 48 | private static $valueToName = [ 49 | self::ENCRYPTION_TYPE_UNSPECIFIED => 'ENCRYPTION_TYPE_UNSPECIFIED', 50 | self::USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION => 'USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION', 51 | self::GOOGLE_DEFAULT_ENCRYPTION => 'GOOGLE_DEFAULT_ENCRYPTION', 52 | self::CUSTOMER_MANAGED_ENCRYPTION => 'CUSTOMER_MANAGED_ENCRYPTION', 53 | ]; 54 | 55 | public static function name($value) 56 | { 57 | if (!isset(self::$valueToName[$value])) { 58 | throw new UnexpectedValueException(sprintf( 59 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 60 | } 61 | return self::$valueToName[$value]; 62 | } 63 | 64 | 65 | public static function value($name) 66 | { 67 | $const = __CLASS__ . '::' . strtoupper($name); 68 | if (!defined($const)) { 69 | throw new UnexpectedValueException(sprintf( 70 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 71 | } 72 | return constant($const); 73 | } 74 | } 75 | 76 | // Adding a class alias for backwards compatibility with the previous class name. 77 | class_alias(EncryptionType::class, \Google\Cloud\Spanner\Admin\Database\V1\CopyBackupEncryptionConfig_EncryptionType::class); 78 | 79 | -------------------------------------------------------------------------------- /src/Admin/Instance/V1/DeleteInstanceRequest.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.instance.v1.DeleteInstanceRequest 16 | */ 17 | class DeleteInstanceRequest extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * Required. The name of the instance to be deleted. Values are of the form 21 | * `projects//instances/` 22 | * 23 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 24 | */ 25 | protected $name = ''; 26 | 27 | /** 28 | * @param string $name Required. The name of the instance to be deleted. Values are of the form 29 | * `projects//instances/` 30 | * Please see {@see InstanceAdminClient::instanceName()} for help formatting this field. 31 | * 32 | * @return \Google\Cloud\Spanner\Admin\Instance\V1\DeleteInstanceRequest 33 | * 34 | * @experimental 35 | */ 36 | public static function build(string $name): self 37 | { 38 | return (new self()) 39 | ->setName($name); 40 | } 41 | 42 | /** 43 | * Constructor. 44 | * 45 | * @param array $data { 46 | * Optional. Data for populating the Message object. 47 | * 48 | * @type string $name 49 | * Required. The name of the instance to be deleted. Values are of the form 50 | * `projects//instances/` 51 | * } 52 | */ 53 | public function __construct($data = NULL) { 54 | \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); 55 | parent::__construct($data); 56 | } 57 | 58 | /** 59 | * Required. The name of the instance to be deleted. Values are of the form 60 | * `projects//instances/` 61 | * 62 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 63 | * @return string 64 | */ 65 | public function getName() 66 | { 67 | return $this->name; 68 | } 69 | 70 | /** 71 | * Required. The name of the instance to be deleted. Values are of the form 72 | * `projects//instances/` 73 | * 74 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 75 | * @param string $var 76 | * @return $this 77 | */ 78 | public function setName($var) 79 | { 80 | GPBUtil::checkString($var, True); 81 | $this->name = $var; 82 | 83 | return $this; 84 | } 85 | 86 | } 87 | 88 | -------------------------------------------------------------------------------- /src/Admin/Instance/V1/ReplicaInfo/ReplicaType.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.instance.v1.ReplicaInfo.ReplicaType 15 | */ 16 | class ReplicaType 17 | { 18 | /** 19 | * Not specified. 20 | * 21 | * Generated from protobuf enum TYPE_UNSPECIFIED = 0; 22 | */ 23 | const TYPE_UNSPECIFIED = 0; 24 | /** 25 | * Read-write replicas support both reads and writes. These replicas: 26 | * * Maintain a full copy of your data. 27 | * * Serve reads. 28 | * * Can vote whether to commit a write. 29 | * * Participate in leadership election. 30 | * * Are eligible to become a leader. 31 | * 32 | * Generated from protobuf enum READ_WRITE = 1; 33 | */ 34 | const READ_WRITE = 1; 35 | /** 36 | * Read-only replicas only support reads (not writes). Read-only replicas: 37 | * * Maintain a full copy of your data. 38 | * * Serve reads. 39 | * * Do not participate in voting to commit writes. 40 | * * Are not eligible to become a leader. 41 | * 42 | * Generated from protobuf enum READ_ONLY = 2; 43 | */ 44 | const READ_ONLY = 2; 45 | /** 46 | * Witness replicas don't support reads but do participate in voting to 47 | * commit writes. Witness replicas: 48 | * * Do not maintain a full copy of data. 49 | * * Do not serve reads. 50 | * * Vote whether to commit writes. 51 | * * Participate in leader election but are not eligible to become leader. 52 | * 53 | * Generated from protobuf enum WITNESS = 3; 54 | */ 55 | const WITNESS = 3; 56 | 57 | private static $valueToName = [ 58 | self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', 59 | self::READ_WRITE => 'READ_WRITE', 60 | self::READ_ONLY => 'READ_ONLY', 61 | self::WITNESS => 'WITNESS', 62 | ]; 63 | 64 | public static function name($value) 65 | { 66 | if (!isset(self::$valueToName[$value])) { 67 | throw new UnexpectedValueException(sprintf( 68 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 69 | } 70 | return self::$valueToName[$value]; 71 | } 72 | 73 | 74 | public static function value($name) 75 | { 76 | $const = __CLASS__ . '::' . strtoupper($name); 77 | if (!defined($const)) { 78 | throw new UnexpectedValueException(sprintf( 79 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 80 | } 81 | return constant($const); 82 | } 83 | } 84 | 85 | // Adding a class alias for backwards compatibility with the previous class name. 86 | class_alias(ReplicaType::class, \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo_ReplicaType::class); 87 | 88 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/GetBackupRequest.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.GetBackupRequest 16 | */ 17 | class GetBackupRequest extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * Required. Name of the backup. 21 | * Values are of the form 22 | * `projects//instances//backups/`. 23 | * 24 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 25 | */ 26 | protected $name = ''; 27 | 28 | /** 29 | * @param string $name Required. Name of the backup. 30 | * Values are of the form 31 | * `projects//instances//backups/`. Please see 32 | * {@see DatabaseAdminClient::backupName()} for help formatting this field. 33 | * 34 | * @return \Google\Cloud\Spanner\Admin\Database\V1\GetBackupRequest 35 | * 36 | * @experimental 37 | */ 38 | public static function build(string $name): self 39 | { 40 | return (new self()) 41 | ->setName($name); 42 | } 43 | 44 | /** 45 | * Constructor. 46 | * 47 | * @param array $data { 48 | * Optional. Data for populating the Message object. 49 | * 50 | * @type string $name 51 | * Required. Name of the backup. 52 | * Values are of the form 53 | * `projects//instances//backups/`. 54 | * } 55 | */ 56 | public function __construct($data = NULL) { 57 | \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); 58 | parent::__construct($data); 59 | } 60 | 61 | /** 62 | * Required. Name of the backup. 63 | * Values are of the form 64 | * `projects//instances//backups/`. 65 | * 66 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 67 | * @return string 68 | */ 69 | public function getName() 70 | { 71 | return $this->name; 72 | } 73 | 74 | /** 75 | * Required. Name of the backup. 76 | * Values are of the form 77 | * `projects//instances//backups/`. 78 | * 79 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 80 | * @param string $var 81 | * @return $this 82 | */ 83 | public function setName($var) 84 | { 85 | GPBUtil::checkString($var, True); 86 | $this->name = $var; 87 | 88 | return $this; 89 | } 90 | 91 | } 92 | 93 | -------------------------------------------------------------------------------- /src/V1/QueryAdvisorResult.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.QueryAdvisorResult 15 | */ 16 | class QueryAdvisorResult extends \Google\Protobuf\Internal\Message 17 | { 18 | /** 19 | * Optional. Index Recommendation for a query. This is an optional field and 20 | * the recommendation will only be available when the recommendation 21 | * guarantees significant improvement in query performance. 22 | * 23 | * Generated from protobuf field repeated .google.spanner.v1.QueryAdvisorResult.IndexAdvice index_advice = 1 [(.google.api.field_behavior) = OPTIONAL]; 24 | */ 25 | private $index_advice; 26 | 27 | /** 28 | * Constructor. 29 | * 30 | * @param array $data { 31 | * Optional. Data for populating the Message object. 32 | * 33 | * @type array<\Google\Cloud\Spanner\V1\QueryAdvisorResult\IndexAdvice>|\Google\Protobuf\Internal\RepeatedField $index_advice 34 | * Optional. Index Recommendation for a query. This is an optional field and 35 | * the recommendation will only be available when the recommendation 36 | * guarantees significant improvement in query performance. 37 | * } 38 | */ 39 | public function __construct($data = NULL) { 40 | \GPBMetadata\Google\Spanner\V1\QueryPlan::initOnce(); 41 | parent::__construct($data); 42 | } 43 | 44 | /** 45 | * Optional. Index Recommendation for a query. This is an optional field and 46 | * the recommendation will only be available when the recommendation 47 | * guarantees significant improvement in query performance. 48 | * 49 | * Generated from protobuf field repeated .google.spanner.v1.QueryAdvisorResult.IndexAdvice index_advice = 1 [(.google.api.field_behavior) = OPTIONAL]; 50 | * @return \Google\Protobuf\Internal\RepeatedField 51 | */ 52 | public function getIndexAdvice() 53 | { 54 | return $this->index_advice; 55 | } 56 | 57 | /** 58 | * Optional. Index Recommendation for a query. This is an optional field and 59 | * the recommendation will only be available when the recommendation 60 | * guarantees significant improvement in query performance. 61 | * 62 | * Generated from protobuf field repeated .google.spanner.v1.QueryAdvisorResult.IndexAdvice index_advice = 1 [(.google.api.field_behavior) = OPTIONAL]; 63 | * @param array<\Google\Cloud\Spanner\V1\QueryAdvisorResult\IndexAdvice>|\Google\Protobuf\Internal\RepeatedField $var 64 | * @return $this 65 | */ 66 | public function setIndexAdvice($var) 67 | { 68 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\QueryAdvisorResult\IndexAdvice::class); 69 | $this->index_advice = $arr; 70 | 71 | return $this; 72 | } 73 | 74 | } 75 | 76 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/GetDatabaseRequest.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.GetDatabaseRequest 16 | */ 17 | class GetDatabaseRequest extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * Required. The name of the requested database. Values are of the form 21 | * `projects//instances//databases/`. 22 | * 23 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 24 | */ 25 | protected $name = ''; 26 | 27 | /** 28 | * @param string $name Required. The name of the requested database. Values are of the form 29 | * `projects//instances//databases/`. Please see 30 | * {@see DatabaseAdminClient::databaseName()} for help formatting this field. 31 | * 32 | * @return \Google\Cloud\Spanner\Admin\Database\V1\GetDatabaseRequest 33 | * 34 | * @experimental 35 | */ 36 | public static function build(string $name): self 37 | { 38 | return (new self()) 39 | ->setName($name); 40 | } 41 | 42 | /** 43 | * Constructor. 44 | * 45 | * @param array $data { 46 | * Optional. Data for populating the Message object. 47 | * 48 | * @type string $name 49 | * Required. The name of the requested database. Values are of the form 50 | * `projects//instances//databases/`. 51 | * } 52 | */ 53 | public function __construct($data = NULL) { 54 | \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); 55 | parent::__construct($data); 56 | } 57 | 58 | /** 59 | * Required. The name of the requested database. Values are of the form 60 | * `projects//instances//databases/`. 61 | * 62 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 63 | * @return string 64 | */ 65 | public function getName() 66 | { 67 | return $this->name; 68 | } 69 | 70 | /** 71 | * Required. The name of the requested database. Values are of the form 72 | * `projects//instances//databases/`. 73 | * 74 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 75 | * @param string $var 76 | * @return $this 77 | */ 78 | public function setName($var) 79 | { 80 | GPBUtil::checkString($var, True); 81 | $this->name = $var; 82 | 83 | return $this; 84 | } 85 | 86 | } 87 | 88 | -------------------------------------------------------------------------------- /src/Numeric.php: -------------------------------------------------------------------------------- 1 | 'my-project']); 33 | * 34 | * $numeric = $spanner->numeric('99999999999999999999999999999999999999.999999999'); 35 | * ``` 36 | */ 37 | class Numeric implements ValueInterface 38 | { 39 | /** 40 | * @var string 41 | */ 42 | private $value; 43 | 44 | /** 45 | * @param string|int|float $value The NUMERIC value. 46 | * @throws \InvalidArgumentException 47 | */ 48 | public function __construct($value) 49 | { 50 | $value = (string) $value; 51 | /** 52 | * This type supports fixed 38 digits of precision and 9 digits of scale. 53 | * This number can be optionally prefixed with a plus or minus sign. 54 | */ 55 | $decimalPattern = '/^[-+]?([0-9]{1,38})?(\.([0-9]{1,9})?)?$/'; 56 | $scientificPattern = '/^[0-9]\.[0-9]{1,37}[Ee][-+][0-9]{1,2}$/'; 57 | if (!preg_match($decimalPattern, $value) && !preg_match($scientificPattern, $value)) { 58 | throw new \InvalidArgumentException( 59 | 'Numeric type only allows fixed 38 decimal digits and 9 decimal digits of scale.' 60 | ); 61 | } 62 | $this->value = $value; 63 | } 64 | 65 | /** 66 | * Get the underlying value. 67 | * 68 | * @return string 69 | */ 70 | public function get(): string 71 | { 72 | return $this->value; 73 | } 74 | 75 | /** 76 | * Get the type. 77 | * 78 | * @return int 79 | */ 80 | public function type(): int 81 | { 82 | return ValueMapper::TYPE_NUMERIC; 83 | } 84 | 85 | /** 86 | * Format the value as a string. 87 | * 88 | * @return string 89 | */ 90 | public function formatAsString(): string 91 | { 92 | return $this->value; 93 | } 94 | 95 | /** 96 | * Format the value as a string. 97 | * 98 | * @return string 99 | */ 100 | public function __toString() 101 | { 102 | return $this->value; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/DeleteBackupRequest.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.DeleteBackupRequest 16 | */ 17 | class DeleteBackupRequest extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * Required. Name of the backup to delete. 21 | * Values are of the form 22 | * `projects//instances//backups/`. 23 | * 24 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 25 | */ 26 | protected $name = ''; 27 | 28 | /** 29 | * @param string $name Required. Name of the backup to delete. 30 | * Values are of the form 31 | * `projects//instances//backups/`. Please see 32 | * {@see DatabaseAdminClient::backupName()} for help formatting this field. 33 | * 34 | * @return \Google\Cloud\Spanner\Admin\Database\V1\DeleteBackupRequest 35 | * 36 | * @experimental 37 | */ 38 | public static function build(string $name): self 39 | { 40 | return (new self()) 41 | ->setName($name); 42 | } 43 | 44 | /** 45 | * Constructor. 46 | * 47 | * @param array $data { 48 | * Optional. Data for populating the Message object. 49 | * 50 | * @type string $name 51 | * Required. Name of the backup to delete. 52 | * Values are of the form 53 | * `projects//instances//backups/`. 54 | * } 55 | */ 56 | public function __construct($data = NULL) { 57 | \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); 58 | parent::__construct($data); 59 | } 60 | 61 | /** 62 | * Required. Name of the backup to delete. 63 | * Values are of the form 64 | * `projects//instances//backups/`. 65 | * 66 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 67 | * @return string 68 | */ 69 | public function getName() 70 | { 71 | return $this->name; 72 | } 73 | 74 | /** 75 | * Required. Name of the backup to delete. 76 | * Values are of the form 77 | * `projects//instances//backups/`. 78 | * 79 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 80 | * @param string $var 81 | * @return $this 82 | */ 83 | public function setName($var) 84 | { 85 | GPBUtil::checkString($var, True); 86 | $this->name = $var; 87 | 88 | return $this; 89 | } 90 | 91 | } 92 | 93 | -------------------------------------------------------------------------------- /src/Admin/Instance/V1/GetInstanceConfigRequest.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.instance.v1.GetInstanceConfigRequest 16 | */ 17 | class GetInstanceConfigRequest extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * Required. The name of the requested instance configuration. Values are of 21 | * the form `projects//instanceConfigs/`. 22 | * 23 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 24 | */ 25 | protected $name = ''; 26 | 27 | /** 28 | * @param string $name Required. The name of the requested instance configuration. Values are of 29 | * the form `projects//instanceConfigs/`. Please see 30 | * {@see InstanceAdminClient::instanceConfigName()} for help formatting this field. 31 | * 32 | * @return \Google\Cloud\Spanner\Admin\Instance\V1\GetInstanceConfigRequest 33 | * 34 | * @experimental 35 | */ 36 | public static function build(string $name): self 37 | { 38 | return (new self()) 39 | ->setName($name); 40 | } 41 | 42 | /** 43 | * Constructor. 44 | * 45 | * @param array $data { 46 | * Optional. Data for populating the Message object. 47 | * 48 | * @type string $name 49 | * Required. The name of the requested instance configuration. Values are of 50 | * the form `projects//instanceConfigs/`. 51 | * } 52 | */ 53 | public function __construct($data = NULL) { 54 | \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); 55 | parent::__construct($data); 56 | } 57 | 58 | /** 59 | * Required. The name of the requested instance configuration. Values are of 60 | * the form `projects//instanceConfigs/`. 61 | * 62 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 63 | * @return string 64 | */ 65 | public function getName() 66 | { 67 | return $this->name; 68 | } 69 | 70 | /** 71 | * Required. The name of the requested instance configuration. Values are of 72 | * the form `projects//instanceConfigs/`. 73 | * 74 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 75 | * @param string $var 76 | * @return $this 77 | */ 78 | public function setName($var) 79 | { 80 | GPBUtil::checkString($var, True); 81 | $this->name = $var; 82 | 83 | return $this; 84 | } 85 | 86 | } 87 | 88 | -------------------------------------------------------------------------------- /src/V1/ChangeStreamRecord/PartitionEventRecord/MoveInEvent.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.ChangeStreamRecord.PartitionEventRecord.MoveInEvent 24 | */ 25 | class MoveInEvent extends \Google\Protobuf\Internal\Message 26 | { 27 | /** 28 | * An unique partition identifier describing the source change stream 29 | * partition that recorded changes for the key range that is moving 30 | * into this partition. 31 | * 32 | * Generated from protobuf field string source_partition_token = 1; 33 | */ 34 | protected $source_partition_token = ''; 35 | 36 | /** 37 | * Constructor. 38 | * 39 | * @param array $data { 40 | * Optional. Data for populating the Message object. 41 | * 42 | * @type string $source_partition_token 43 | * An unique partition identifier describing the source change stream 44 | * partition that recorded changes for the key range that is moving 45 | * into this partition. 46 | * } 47 | */ 48 | public function __construct($data = NULL) { 49 | \GPBMetadata\Google\Spanner\V1\ChangeStream::initOnce(); 50 | parent::__construct($data); 51 | } 52 | 53 | /** 54 | * An unique partition identifier describing the source change stream 55 | * partition that recorded changes for the key range that is moving 56 | * into this partition. 57 | * 58 | * Generated from protobuf field string source_partition_token = 1; 59 | * @return string 60 | */ 61 | public function getSourcePartitionToken() 62 | { 63 | return $this->source_partition_token; 64 | } 65 | 66 | /** 67 | * An unique partition identifier describing the source change stream 68 | * partition that recorded changes for the key range that is moving 69 | * into this partition. 70 | * 71 | * Generated from protobuf field string source_partition_token = 1; 72 | * @param string $var 73 | * @return $this 74 | */ 75 | public function setSourcePartitionToken($var) 76 | { 77 | GPBUtil::checkString($var, True); 78 | $this->source_partition_token = $var; 79 | 80 | return $this; 81 | } 82 | 83 | } 84 | 85 | 86 | -------------------------------------------------------------------------------- /src/V1/TransactionOptions/IsolationLevel.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.TransactionOptions.IsolationLevel 15 | */ 16 | class IsolationLevel 17 | { 18 | /** 19 | * Default value. 20 | * If the value is not specified, the `SERIALIZABLE` isolation level is 21 | * used. 22 | * 23 | * Generated from protobuf enum ISOLATION_LEVEL_UNSPECIFIED = 0; 24 | */ 25 | const ISOLATION_LEVEL_UNSPECIFIED = 0; 26 | /** 27 | * All transactions appear as if they executed in a serial order, even if 28 | * some of the reads, writes, and other operations of distinct transactions 29 | * actually occurred in parallel. Spanner assigns commit timestamps that 30 | * reflect the order of committed transactions to implement this property. 31 | * Spanner offers a stronger guarantee than serializability called external 32 | * consistency. For more information, see 33 | * [TrueTime and external 34 | * consistency](https://cloud.google.com/spanner/docs/true-time-external-consistency#serializability). 35 | * 36 | * Generated from protobuf enum SERIALIZABLE = 1; 37 | */ 38 | const SERIALIZABLE = 1; 39 | /** 40 | * All reads performed during the transaction observe a consistent snapshot 41 | * of the database, and the transaction is only successfully committed in 42 | * the absence of conflicts between its updates and any concurrent updates 43 | * that have occurred since that snapshot. Consequently, in contrast to 44 | * `SERIALIZABLE` transactions, only write-write conflicts are detected in 45 | * snapshot transactions. 46 | * This isolation level does not support read-only and partitioned DML 47 | * transactions. 48 | * When `REPEATABLE_READ` is specified on a read-write transaction, the 49 | * locking semantics default to `OPTIMISTIC`. 50 | * 51 | * Generated from protobuf enum REPEATABLE_READ = 2; 52 | */ 53 | const REPEATABLE_READ = 2; 54 | 55 | private static $valueToName = [ 56 | self::ISOLATION_LEVEL_UNSPECIFIED => 'ISOLATION_LEVEL_UNSPECIFIED', 57 | self::SERIALIZABLE => 'SERIALIZABLE', 58 | self::REPEATABLE_READ => 'REPEATABLE_READ', 59 | ]; 60 | 61 | public static function name($value) 62 | { 63 | if (!isset(self::$valueToName[$value])) { 64 | throw new UnexpectedValueException(sprintf( 65 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 66 | } 67 | return self::$valueToName[$value]; 68 | } 69 | 70 | 71 | public static function value($name) 72 | { 73 | $const = __CLASS__ . '::' . strtoupper($name); 74 | if (!defined($const)) { 75 | throw new UnexpectedValueException(sprintf( 76 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 77 | } 78 | return constant($const); 79 | } 80 | } 81 | 82 | 83 | -------------------------------------------------------------------------------- /src/V1/RoutingHint/SkippedTablet.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.RoutingHint.SkippedTablet 16 | */ 17 | class SkippedTablet extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * The tablet UID of the tablet that was skipped. See `Tablet.tablet_uid`. 21 | * 22 | * Generated from protobuf field uint64 tablet_uid = 1; 23 | */ 24 | protected $tablet_uid = 0; 25 | /** 26 | * The incarnation of the tablet that was skipped. See `Tablet.incarnation`. 27 | * 28 | * Generated from protobuf field bytes incarnation = 2; 29 | */ 30 | protected $incarnation = ''; 31 | 32 | /** 33 | * Constructor. 34 | * 35 | * @param array $data { 36 | * Optional. Data for populating the Message object. 37 | * 38 | * @type int|string $tablet_uid 39 | * The tablet UID of the tablet that was skipped. See `Tablet.tablet_uid`. 40 | * @type string $incarnation 41 | * The incarnation of the tablet that was skipped. See `Tablet.incarnation`. 42 | * } 43 | */ 44 | public function __construct($data = NULL) { 45 | \GPBMetadata\Google\Spanner\V1\Location::initOnce(); 46 | parent::__construct($data); 47 | } 48 | 49 | /** 50 | * The tablet UID of the tablet that was skipped. See `Tablet.tablet_uid`. 51 | * 52 | * Generated from protobuf field uint64 tablet_uid = 1; 53 | * @return int|string 54 | */ 55 | public function getTabletUid() 56 | { 57 | return $this->tablet_uid; 58 | } 59 | 60 | /** 61 | * The tablet UID of the tablet that was skipped. See `Tablet.tablet_uid`. 62 | * 63 | * Generated from protobuf field uint64 tablet_uid = 1; 64 | * @param int|string $var 65 | * @return $this 66 | */ 67 | public function setTabletUid($var) 68 | { 69 | GPBUtil::checkUint64($var); 70 | $this->tablet_uid = $var; 71 | 72 | return $this; 73 | } 74 | 75 | /** 76 | * The incarnation of the tablet that was skipped. See `Tablet.incarnation`. 77 | * 78 | * Generated from protobuf field bytes incarnation = 2; 79 | * @return string 80 | */ 81 | public function getIncarnation() 82 | { 83 | return $this->incarnation; 84 | } 85 | 86 | /** 87 | * The incarnation of the tablet that was skipped. See `Tablet.incarnation`. 88 | * 89 | * Generated from protobuf field bytes incarnation = 2; 90 | * @param string $var 91 | * @return $this 92 | */ 93 | public function setIncarnation($var) 94 | { 95 | GPBUtil::checkString($var, False); 96 | $this->incarnation = $var; 97 | 98 | return $this; 99 | } 100 | 101 | } 102 | 103 | 104 | -------------------------------------------------------------------------------- /src/V1/TransactionOptions/ReadWrite/ReadLockMode.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.TransactionOptions.ReadWrite.ReadLockMode 14 | */ 15 | class ReadLockMode 16 | { 17 | /** 18 | * Default value. 19 | * * If isolation level is 20 | * [REPEATABLE_READ][google.spanner.v1.TransactionOptions.IsolationLevel.REPEATABLE_READ], 21 | * then it is an error to specify `read_lock_mode`. Locking semantics 22 | * default to `OPTIMISTIC`. No validation checks are done for reads, 23 | * except to validate that the data that was served at the snapshot time 24 | * is unchanged at commit time in the following cases: 25 | * 1. reads done as part of queries that use `SELECT FOR UPDATE` 26 | * 2. reads done as part of statements with a `LOCK_SCANNED_RANGES` 27 | * hint 28 | * 3. reads done as part of DML statements 29 | * * At all other isolation levels, if `read_lock_mode` is the default 30 | * value, then pessimistic read locks are used. 31 | * 32 | * Generated from protobuf enum READ_LOCK_MODE_UNSPECIFIED = 0; 33 | */ 34 | const READ_LOCK_MODE_UNSPECIFIED = 0; 35 | /** 36 | * Pessimistic lock mode. 37 | * Read locks are acquired immediately on read. 38 | * Semantics described only applies to 39 | * [SERIALIZABLE][google.spanner.v1.TransactionOptions.IsolationLevel.SERIALIZABLE] 40 | * isolation. 41 | * 42 | * Generated from protobuf enum PESSIMISTIC = 1; 43 | */ 44 | const PESSIMISTIC = 1; 45 | /** 46 | * Optimistic lock mode. 47 | * Locks for reads within the transaction are not acquired on read. 48 | * Instead the locks are acquired on a commit to validate that 49 | * read/queried data has not changed since the transaction started. 50 | * Semantics described only applies to 51 | * [SERIALIZABLE][google.spanner.v1.TransactionOptions.IsolationLevel.SERIALIZABLE] 52 | * isolation. 53 | * 54 | * Generated from protobuf enum OPTIMISTIC = 2; 55 | */ 56 | const OPTIMISTIC = 2; 57 | 58 | private static $valueToName = [ 59 | self::READ_LOCK_MODE_UNSPECIFIED => 'READ_LOCK_MODE_UNSPECIFIED', 60 | self::PESSIMISTIC => 'PESSIMISTIC', 61 | self::OPTIMISTIC => 'OPTIMISTIC', 62 | ]; 63 | 64 | public static function name($value) 65 | { 66 | if (!isset(self::$valueToName[$value])) { 67 | throw new UnexpectedValueException(sprintf( 68 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 69 | } 70 | return self::$valueToName[$value]; 71 | } 72 | 73 | 74 | public static function value($name) 75 | { 76 | $const = __CLASS__ . '::' . strtoupper($name); 77 | if (!defined($const)) { 78 | throw new UnexpectedValueException(sprintf( 79 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 80 | } 81 | return constant($const); 82 | } 83 | } 84 | 85 | 86 | -------------------------------------------------------------------------------- /src/V1/ChangeStreamRecord/HeartbeatRecord.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.ChangeStreamRecord.HeartbeatRecord 17 | */ 18 | class HeartbeatRecord extends \Google\Protobuf\Internal\Message 19 | { 20 | /** 21 | * Indicates the timestamp at which the query has returned all the records 22 | * in the change stream partition with timestamp <= heartbeat timestamp. 23 | * The heartbeat timestamp will not be the same as the timestamps of other 24 | * record types in the same partition. 25 | * 26 | * Generated from protobuf field .google.protobuf.Timestamp timestamp = 1; 27 | */ 28 | protected $timestamp = null; 29 | 30 | /** 31 | * Constructor. 32 | * 33 | * @param array $data { 34 | * Optional. Data for populating the Message object. 35 | * 36 | * @type \Google\Protobuf\Timestamp $timestamp 37 | * Indicates the timestamp at which the query has returned all the records 38 | * in the change stream partition with timestamp <= heartbeat timestamp. 39 | * The heartbeat timestamp will not be the same as the timestamps of other 40 | * record types in the same partition. 41 | * } 42 | */ 43 | public function __construct($data = NULL) { 44 | \GPBMetadata\Google\Spanner\V1\ChangeStream::initOnce(); 45 | parent::__construct($data); 46 | } 47 | 48 | /** 49 | * Indicates the timestamp at which the query has returned all the records 50 | * in the change stream partition with timestamp <= heartbeat timestamp. 51 | * The heartbeat timestamp will not be the same as the timestamps of other 52 | * record types in the same partition. 53 | * 54 | * Generated from protobuf field .google.protobuf.Timestamp timestamp = 1; 55 | * @return \Google\Protobuf\Timestamp|null 56 | */ 57 | public function getTimestamp() 58 | { 59 | return $this->timestamp; 60 | } 61 | 62 | public function hasTimestamp() 63 | { 64 | return isset($this->timestamp); 65 | } 66 | 67 | public function clearTimestamp() 68 | { 69 | unset($this->timestamp); 70 | } 71 | 72 | /** 73 | * Indicates the timestamp at which the query has returned all the records 74 | * in the change stream partition with timestamp <= heartbeat timestamp. 75 | * The heartbeat timestamp will not be the same as the timestamps of other 76 | * record types in the same partition. 77 | * 78 | * Generated from protobuf field .google.protobuf.Timestamp timestamp = 1; 79 | * @param \Google\Protobuf\Timestamp $var 80 | * @return $this 81 | */ 82 | public function setTimestamp($var) 83 | { 84 | GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); 85 | $this->timestamp = $var; 86 | 87 | return $this; 88 | } 89 | 90 | } 91 | 92 | 93 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/GetDatabaseDdlRequest.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.GetDatabaseDdlRequest 16 | */ 17 | class GetDatabaseDdlRequest extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * Required. The database whose schema we wish to get. 21 | * Values are of the form 22 | * `projects//instances//databases/` 23 | * 24 | * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 25 | */ 26 | protected $database = ''; 27 | 28 | /** 29 | * @param string $database Required. The database whose schema we wish to get. 30 | * Values are of the form 31 | * `projects//instances//databases/` 32 | * Please see {@see DatabaseAdminClient::databaseName()} for help formatting this field. 33 | * 34 | * @return \Google\Cloud\Spanner\Admin\Database\V1\GetDatabaseDdlRequest 35 | * 36 | * @experimental 37 | */ 38 | public static function build(string $database): self 39 | { 40 | return (new self()) 41 | ->setDatabase($database); 42 | } 43 | 44 | /** 45 | * Constructor. 46 | * 47 | * @param array $data { 48 | * Optional. Data for populating the Message object. 49 | * 50 | * @type string $database 51 | * Required. The database whose schema we wish to get. 52 | * Values are of the form 53 | * `projects//instances//databases/` 54 | * } 55 | */ 56 | public function __construct($data = NULL) { 57 | \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); 58 | parent::__construct($data); 59 | } 60 | 61 | /** 62 | * Required. The database whose schema we wish to get. 63 | * Values are of the form 64 | * `projects//instances//databases/` 65 | * 66 | * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 67 | * @return string 68 | */ 69 | public function getDatabase() 70 | { 71 | return $this->database; 72 | } 73 | 74 | /** 75 | * Required. The database whose schema we wish to get. 76 | * Values are of the form 77 | * `projects//instances//databases/` 78 | * 79 | * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 80 | * @param string $var 81 | * @return $this 82 | */ 83 | public function setDatabase($var) 84 | { 85 | GPBUtil::checkString($var, True); 86 | $this->database = $var; 87 | 88 | return $this; 89 | } 90 | 91 | } 92 | 93 | -------------------------------------------------------------------------------- /src/V1/TypeAnnotationCode.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.TypeAnnotationCode 17 | */ 18 | class TypeAnnotationCode 19 | { 20 | /** 21 | * Not specified. 22 | * 23 | * Generated from protobuf enum TYPE_ANNOTATION_CODE_UNSPECIFIED = 0; 24 | */ 25 | const TYPE_ANNOTATION_CODE_UNSPECIFIED = 0; 26 | /** 27 | * PostgreSQL compatible NUMERIC type. This annotation needs to be applied to 28 | * [Type][google.spanner.v1.Type] instances having 29 | * [NUMERIC][google.spanner.v1.TypeCode.NUMERIC] type code to specify that 30 | * values of this type should be treated as PostgreSQL NUMERIC values. 31 | * Currently this annotation is always needed for 32 | * [NUMERIC][google.spanner.v1.TypeCode.NUMERIC] when a client interacts with 33 | * PostgreSQL-enabled Spanner databases. 34 | * 35 | * Generated from protobuf enum PG_NUMERIC = 2; 36 | */ 37 | const PG_NUMERIC = 2; 38 | /** 39 | * PostgreSQL compatible JSONB type. This annotation needs to be applied to 40 | * [Type][google.spanner.v1.Type] instances having 41 | * [JSON][google.spanner.v1.TypeCode.JSON] type code to specify that values of 42 | * this type should be treated as PostgreSQL JSONB values. Currently this 43 | * annotation is always needed for [JSON][google.spanner.v1.TypeCode.JSON] 44 | * when a client interacts with PostgreSQL-enabled Spanner databases. 45 | * 46 | * Generated from protobuf enum PG_JSONB = 3; 47 | */ 48 | const PG_JSONB = 3; 49 | /** 50 | * PostgreSQL compatible OID type. This annotation can be used by a client 51 | * interacting with PostgreSQL-enabled Spanner database to specify that a 52 | * value should be treated using the semantics of the OID type. 53 | * 54 | * Generated from protobuf enum PG_OID = 4; 55 | */ 56 | const PG_OID = 4; 57 | 58 | private static $valueToName = [ 59 | self::TYPE_ANNOTATION_CODE_UNSPECIFIED => 'TYPE_ANNOTATION_CODE_UNSPECIFIED', 60 | self::PG_NUMERIC => 'PG_NUMERIC', 61 | self::PG_JSONB => 'PG_JSONB', 62 | self::PG_OID => 'PG_OID', 63 | ]; 64 | 65 | public static function name($value) 66 | { 67 | if (!isset(self::$valueToName[$value])) { 68 | throw new UnexpectedValueException(sprintf( 69 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 70 | } 71 | return self::$valueToName[$value]; 72 | } 73 | 74 | 75 | public static function value($name) 76 | { 77 | $const = __CLASS__ . '::' . strtoupper($name); 78 | if (!defined($const)) { 79 | throw new UnexpectedValueException(sprintf( 80 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 81 | } 82 | return constant($const); 83 | } 84 | } 85 | 86 | -------------------------------------------------------------------------------- /src/SnapshotTrait.php: -------------------------------------------------------------------------------- 1 | operation = $operation; 58 | $this->session = $session; 59 | 60 | $this->transactionId = $options['id'] ?? null; 61 | $this->readTimestamp = $options['readTimestamp'] ?? null; 62 | $this->type = $this->transactionId 63 | ? self::TYPE_PRE_ALLOCATED 64 | : self::TYPE_SINGLE_USE; 65 | 66 | $this->context = Database::CONTEXT_READ; 67 | $this->directedReadOptions = $options['directedReadOptions'] ?? []; 68 | $this->transactionSelector = $this->pluckArray( 69 | ['singleUse', 'begin'], 70 | $options, 71 | ); 72 | $this->transactionOptions = $options['transactionOptions'] ?? new TransactionOptions(); 73 | $this->transactionOptionsBuilder = new TransactionOptionsBuilder(); 74 | } 75 | 76 | /** 77 | * Retrieve the Read Timestamp. 78 | * 79 | * For snapshot read-only transactions, the read timestamp chosen for the 80 | * transaction. 81 | * 82 | * Example: 83 | * ``` 84 | * $timestamp = $snapshot->readTimestamp(); 85 | * ``` 86 | * 87 | * @return Timestamp 88 | */ 89 | public function readTimestamp(): Timestamp 90 | { 91 | return $this->readTimestamp; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/V1/ChangeStreamRecord/PartitionEventRecord/MoveOutEvent.php: -------------------------------------------------------------------------------- 1 | google.spanner.v1.ChangeStreamRecord.PartitionEventRecord.MoveOutEvent 25 | */ 26 | class MoveOutEvent extends \Google\Protobuf\Internal\Message 27 | { 28 | /** 29 | * An unique partition identifier describing the destination change 30 | * stream partition that will record changes for the key range that is 31 | * moving out of this partition. 32 | * 33 | * Generated from protobuf field string destination_partition_token = 1; 34 | */ 35 | protected $destination_partition_token = ''; 36 | 37 | /** 38 | * Constructor. 39 | * 40 | * @param array $data { 41 | * Optional. Data for populating the Message object. 42 | * 43 | * @type string $destination_partition_token 44 | * An unique partition identifier describing the destination change 45 | * stream partition that will record changes for the key range that is 46 | * moving out of this partition. 47 | * } 48 | */ 49 | public function __construct($data = NULL) { 50 | \GPBMetadata\Google\Spanner\V1\ChangeStream::initOnce(); 51 | parent::__construct($data); 52 | } 53 | 54 | /** 55 | * An unique partition identifier describing the destination change 56 | * stream partition that will record changes for the key range that is 57 | * moving out of this partition. 58 | * 59 | * Generated from protobuf field string destination_partition_token = 1; 60 | * @return string 61 | */ 62 | public function getDestinationPartitionToken() 63 | { 64 | return $this->destination_partition_token; 65 | } 66 | 67 | /** 68 | * An unique partition identifier describing the destination change 69 | * stream partition that will record changes for the key range that is 70 | * moving out of this partition. 71 | * 72 | * Generated from protobuf field string destination_partition_token = 1; 73 | * @param string $var 74 | * @return $this 75 | */ 76 | public function setDestinationPartitionToken($var) 77 | { 78 | GPBUtil::checkString($var, True); 79 | $this->destination_partition_token = $var; 80 | 81 | return $this; 82 | } 83 | 84 | } 85 | 86 | 87 | -------------------------------------------------------------------------------- /src/Admin/Instance/V1/GetInstancePartitionRequest.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.instance.v1.GetInstancePartitionRequest 16 | */ 17 | class GetInstancePartitionRequest extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * Required. The name of the requested instance partition. Values are of 21 | * the form 22 | * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`. 23 | * 24 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 25 | */ 26 | protected $name = ''; 27 | 28 | /** 29 | * @param string $name Required. The name of the requested instance partition. Values are of 30 | * the form 31 | * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`. Please see 32 | * {@see InstanceAdminClient::instancePartitionName()} for help formatting this field. 33 | * 34 | * @return \Google\Cloud\Spanner\Admin\Instance\V1\GetInstancePartitionRequest 35 | * 36 | * @experimental 37 | */ 38 | public static function build(string $name): self 39 | { 40 | return (new self()) 41 | ->setName($name); 42 | } 43 | 44 | /** 45 | * Constructor. 46 | * 47 | * @param array $data { 48 | * Optional. Data for populating the Message object. 49 | * 50 | * @type string $name 51 | * Required. The name of the requested instance partition. Values are of 52 | * the form 53 | * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`. 54 | * } 55 | */ 56 | public function __construct($data = NULL) { 57 | \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); 58 | parent::__construct($data); 59 | } 60 | 61 | /** 62 | * Required. The name of the requested instance partition. Values are of 63 | * the form 64 | * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`. 65 | * 66 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 67 | * @return string 68 | */ 69 | public function getName() 70 | { 71 | return $this->name; 72 | } 73 | 74 | /** 75 | * Required. The name of the requested instance partition. Values are of 76 | * the form 77 | * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`. 78 | * 79 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 80 | * @param string $var 81 | * @return $this 82 | */ 83 | public function setName($var) 84 | { 85 | GPBUtil::checkString($var, True); 86 | $this->name = $var; 87 | 88 | return $this; 89 | } 90 | 91 | } 92 | 93 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/GetBackupScheduleRequest.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.GetBackupScheduleRequest 16 | */ 17 | class GetBackupScheduleRequest extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * Required. The name of the schedule to retrieve. 21 | * Values are of the form 22 | * `projects//instances//databases//backupSchedules/`. 23 | * 24 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 25 | */ 26 | protected $name = ''; 27 | 28 | /** 29 | * @param string $name Required. The name of the schedule to retrieve. 30 | * Values are of the form 31 | * `projects//instances//databases//backupSchedules/`. Please see 32 | * {@see DatabaseAdminClient::backupScheduleName()} for help formatting this field. 33 | * 34 | * @return \Google\Cloud\Spanner\Admin\Database\V1\GetBackupScheduleRequest 35 | * 36 | * @experimental 37 | */ 38 | public static function build(string $name): self 39 | { 40 | return (new self()) 41 | ->setName($name); 42 | } 43 | 44 | /** 45 | * Constructor. 46 | * 47 | * @param array $data { 48 | * Optional. Data for populating the Message object. 49 | * 50 | * @type string $name 51 | * Required. The name of the schedule to retrieve. 52 | * Values are of the form 53 | * `projects//instances//databases//backupSchedules/`. 54 | * } 55 | */ 56 | public function __construct($data = NULL) { 57 | \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); 58 | parent::__construct($data); 59 | } 60 | 61 | /** 62 | * Required. The name of the schedule to retrieve. 63 | * Values are of the form 64 | * `projects//instances//databases//backupSchedules/`. 65 | * 66 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 67 | * @return string 68 | */ 69 | public function getName() 70 | { 71 | return $this->name; 72 | } 73 | 74 | /** 75 | * Required. The name of the schedule to retrieve. 76 | * Values are of the form 77 | * `projects//instances//databases//backupSchedules/`. 78 | * 79 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 80 | * @param string $var 81 | * @return $this 82 | */ 83 | public function setName($var) 84 | { 85 | GPBUtil::checkString($var, True); 86 | $this->name = $var; 87 | 88 | return $this; 89 | } 90 | 91 | } 92 | 93 | -------------------------------------------------------------------------------- /src/Admin/Database/V1/DeleteBackupScheduleRequest.php: -------------------------------------------------------------------------------- 1 | google.spanner.admin.database.v1.DeleteBackupScheduleRequest 16 | */ 17 | class DeleteBackupScheduleRequest extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * Required. The name of the schedule to delete. 21 | * Values are of the form 22 | * `projects//instances//databases//backupSchedules/`. 23 | * 24 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 25 | */ 26 | protected $name = ''; 27 | 28 | /** 29 | * @param string $name Required. The name of the schedule to delete. 30 | * Values are of the form 31 | * `projects//instances//databases//backupSchedules/`. Please see 32 | * {@see DatabaseAdminClient::backupScheduleName()} for help formatting this field. 33 | * 34 | * @return \Google\Cloud\Spanner\Admin\Database\V1\DeleteBackupScheduleRequest 35 | * 36 | * @experimental 37 | */ 38 | public static function build(string $name): self 39 | { 40 | return (new self()) 41 | ->setName($name); 42 | } 43 | 44 | /** 45 | * Constructor. 46 | * 47 | * @param array $data { 48 | * Optional. Data for populating the Message object. 49 | * 50 | * @type string $name 51 | * Required. The name of the schedule to delete. 52 | * Values are of the form 53 | * `projects//instances//databases//backupSchedules/`. 54 | * } 55 | */ 56 | public function __construct($data = NULL) { 57 | \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); 58 | parent::__construct($data); 59 | } 60 | 61 | /** 62 | * Required. The name of the schedule to delete. 63 | * Values are of the form 64 | * `projects//instances//databases//backupSchedules/`. 65 | * 66 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 67 | * @return string 68 | */ 69 | public function getName() 70 | { 71 | return $this->name; 72 | } 73 | 74 | /** 75 | * Required. The name of the schedule to delete. 76 | * Values are of the form 77 | * `projects//instances//databases//backupSchedules/`. 78 | * 79 | * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { 80 | * @param string $var 81 | * @return $this 82 | */ 83 | public function setName($var) 84 | { 85 | GPBUtil::checkString($var, True); 86 | $this->name = $var; 87 | 88 | return $this; 89 | } 90 | 91 | } 92 | 93 | -------------------------------------------------------------------------------- /src/Proto.php: -------------------------------------------------------------------------------- 1 | get(); 48 | * var_dump($message->serializeToJsonString()); 49 | * ``` 50 | * 51 | * @return T 52 | * @throws RuntimeException If the proto type is not found. 53 | */ 54 | public function get(): Message 55 | { 56 | /** @var \Google\Protobuf\Internal\DescriptorPool $pool */ 57 | $pool = DescriptorPool::getGeneratedPool(); 58 | /** @var \Google\Protobuf\Internal\Descriptor|null $descriptor */ 59 | $descriptor = $pool->getDescriptorByProtoName($this->protoTypeFqn); 60 | if (!$descriptor) { 61 | throw new RuntimeException(sprintf( 62 | 'Unable to decode proto value. Descriptor not found for %s.', 63 | $this->protoTypeFqn 64 | )); 65 | } 66 | /** @var Message $message */ 67 | $message = new ($descriptor->getClass())(); 68 | $message->mergeFromString(base64_decode($this->value)); 69 | return $message; 70 | } 71 | 72 | public function getValue(): string 73 | { 74 | return $this->value; 75 | } 76 | 77 | public function getProtoTypeFqn(): string 78 | { 79 | return $this->protoTypeFqn; 80 | } 81 | 82 | /** 83 | * Get the type. 84 | * 85 | * Example: 86 | * ``` 87 | * echo $proto->type(); 88 | * ``` 89 | * 90 | * @return int 91 | */ 92 | public function type(): int 93 | { 94 | return Database::TYPE_PROTO; 95 | } 96 | 97 | /** 98 | * Format the value as a string. 99 | * 100 | * Example: 101 | * ``` 102 | * echo $proto->formatAsString(); 103 | * ``` 104 | * 105 | * @return string 106 | */ 107 | public function formatAsString(): string 108 | { 109 | return $this->value; 110 | } 111 | 112 | /** 113 | * Format the value as a string. 114 | * 115 | * @return string 116 | * @access private 117 | */ 118 | public function __toString() 119 | { 120 | return $this->formatAsString(); 121 | } 122 | } 123 | --------------------------------------------------------------------------------