From 22265f0553a885609120060b87e39b1061c47345 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 17 Dec 2024 08:01:03 +0000 Subject: [PATCH 1/2] feat: Exposing InstanceType in Instance configuration (to define PROVISIONED or FREE spanner instance) feat: Exposing FreeInstanceMetadata in Instance configuration (to define the metadata related to FREE instance type) feat: Exposing storage_limit_per_processing_unit in InstanceConfig feat: Exposing QuorumType in InstanceConfig feat: Exposing FreeInstanceAvailability in InstanceConfig docs: A comment for method `ListInstanceConfigs` in service `InstanceAdmin` is changed docs: A comment for method `CreateInstanceConfig` in service `InstanceAdmin` is changed docs: A comment for method `UpdateInstanceConfig` in service `InstanceAdmin` is changed docs: A comment for method `ListInstanceConfigOperations` in service `InstanceAdmin` is changed docs: A comment for method `CreateInstance` in service `InstanceAdmin` is changed docs: A comment for method `UpdateInstance` in service `InstanceAdmin` is changed docs: A comment for method `CreateInstancePartition` in service `InstanceAdmin` is changed docs: A comment for method `UpdateInstancePartition` in service `InstanceAdmin` is changed docs: A comment for method `ListInstancePartitionOperations` in service `InstanceAdmin` is changed docs: A comment for method `MoveInstance` in service `InstanceAdmin` is changed docs: A comment for field `location` in message `.google.spanner.admin.instance.v1.ReplicaInfo` is changed docs: A comment for enum value `GOOGLE_MANAGED` in enum `Type` is changed docs: A comment for enum value `USER_MANAGED` in enum `Type` is changed docs: A comment for field `replicas` in message `.google.spanner.admin.instance.v1.InstanceConfig` is changed docs: A comment for field `optional_replicas` in message `.google.spanner.admin.instance.v1.InstanceConfig` is changed docs: A comment for field `base_config` in message `.google.spanner.admin.instance.v1.InstanceConfig` is changed docs: A comment for field `storage_utilization_percent` in message `.google.spanner.admin.instance.v1.AutoscalingConfig` is changed docs: A comment for enum `DefaultBackupScheduleType` is changed docs: A comment for enum value `NONE` in enum `DefaultBackupScheduleType` is changed docs: A comment for enum value `AUTOMATIC` in enum `DefaultBackupScheduleType` is changed docs: A comment for field `node_count` in message `.google.spanner.admin.instance.v1.Instance` is changed docs: A comment for field `processing_units` in message `.google.spanner.admin.instance.v1.Instance` is changed docs: A comment for field `default_backup_schedule_type` in message `.google.spanner.admin.instance.v1.Instance` is changed docs: A comment for message `CreateInstanceConfigRequest` is changed docs: A comment for field `instance_config` in message `.google.spanner.admin.instance.v1.CreateInstanceConfigRequest` is changed docs: A comment for message `UpdateInstanceConfigRequest` is changed docs: A comment for message `DeleteInstanceConfigRequest` is changed docs: A comment for field `filter` in message `.google.spanner.admin.instance.v1.ListInstanceConfigOperationsRequest` is changed docs: A comment for field `operations` in message `.google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse` is changed docs: A comment for field `node_count` in message `.google.spanner.admin.instance.v1.InstancePartition` is changed docs: A comment for field `processing_units` in message `.google.spanner.admin.instance.v1.InstancePartition` is changed docs: A comment for field `referencing_backups` in message `.google.spanner.admin.instance.v1.InstancePartition` is changed docs: A comment for field `parent` in message `.google.spanner.admin.instance.v1.ListInstancePartitionsRequest` is changed docs: A comment for field `unreachable` in message `.google.spanner.admin.instance.v1.ListInstancePartitionsResponse` is changed docs: A comment for field `filter` in message `.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest` is changed docs: A comment for field `instance_partition_deadline` in message `.google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest` is changed docs: A comment for field `operations` in message `.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse` is changed PiperOrigin-RevId: 706945550 Source-Link: https://github.com/googleapis/googleapis/commit/3db0452ba6b45012794e61640ea6eadd7153af74 Source-Link: https://github.com/googleapis/googleapis-gen/commit/6c42be3bf546f10f09cad98b3f56f77c271fc8e2 Copy-Tag: eyJwIjoiU3Bhbm5lci8uT3dsQm90LnlhbWwiLCJoIjoiNmM0MmJlM2JmNTQ2ZjEwZjA5Y2FkOThiM2Y1NmY3N2MyNzFmYzhlMiJ9 --- .../Spanner/Admin/Database/V1/Backup.php | Bin 0 -> 5621 bytes .../Admin/Database/V1/BackupSchedule.php | Bin 0 -> 3205 bytes .../Spanner/Admin/Database/V1/Common.php | Bin 0 -> 2220 bytes .../Database/V1/SpannerDatabaseAdmin.php | Bin 0 -> 13533 bytes .../Spanner/Admin/Database/V1/Backup.php | 1013 +++++++ .../Admin/Database/V1/Backup/State.php | 65 + .../Spanner/Admin/Database/V1/BackupInfo.php | 213 ++ .../Admin/Database/V1/BackupSchedule.php | 380 +++ .../Admin/Database/V1/BackupScheduleSpec.php | 75 + .../V1/CopyBackupEncryptionConfig.php | 207 ++ .../EncryptionType.php | 78 + .../Admin/Database/V1/CopyBackupMetadata.php | 258 ++ .../Admin/Database/V1/CopyBackupRequest.php | 321 +++ .../V1/CreateBackupEncryptionConfig.php | 203 ++ .../EncryptionType.php | 77 + .../Database/V1/CreateBackupMetadata.php | 242 ++ .../Admin/Database/V1/CreateBackupRequest.php | 259 ++ .../V1/CreateBackupScheduleRequest.php | 174 ++ .../Database/V1/CreateDatabaseMetadata.php | 68 + .../Database/V1/CreateDatabaseRequest.php | 365 +++ .../Spanner/Admin/Database/V1/CrontabSpec.php | 214 ++ .../Spanner/Admin/Database/V1/Database.php | 605 +++++ .../Admin/Database/V1/Database/State.php | 78 + .../Admin/Database/V1/DatabaseDialect.php | 62 + .../Admin/Database/V1/DatabaseRole.php | 75 + .../Database/V1/DdlStatementActionInfo.php | 165 ++ .../Admin/Database/V1/DeleteBackupRequest.php | 92 + .../V1/DeleteBackupScheduleRequest.php | 92 + .../Admin/Database/V1/DropDatabaseRequest.php | 82 + .../Admin/Database/V1/EncryptionConfig.php | 161 ++ .../Admin/Database/V1/EncryptionInfo.php | 157 ++ .../Admin/Database/V1/EncryptionInfo/Type.php | 68 + .../Admin/Database/V1/FullBackupSpec.php | 35 + .../Admin/Database/V1/GetBackupRequest.php | 92 + .../Database/V1/GetBackupScheduleRequest.php | 92 + .../Database/V1/GetDatabaseDdlRequest.php | 92 + .../Database/V1/GetDatabaseDdlResponse.php | 122 + .../Admin/Database/V1/GetDatabaseRequest.php | 87 + .../Database/V1/IncrementalBackupSpec.php | 38 + .../V1/ListBackupOperationsRequest.php | 461 ++++ .../V1/ListBackupOperationsResponse.php | 142 + .../V1/ListBackupSchedulesRequest.php | 180 ++ .../V1/ListBackupSchedulesResponse.php | 110 + .../Admin/Database/V1/ListBackupsRequest.php | 341 +++ .../Admin/Database/V1/ListBackupsResponse.php | 114 + .../V1/ListDatabaseOperationsRequest.php | 361 +++ .../V1/ListDatabaseOperationsResponse.php | 126 + .../Database/V1/ListDatabaseRolesRequest.php | 176 ++ .../Database/V1/ListDatabaseRolesResponse.php | 110 + .../Database/V1/ListDatabasesRequest.php | 171 ++ .../Database/V1/ListDatabasesResponse.php | 110 + .../Admin/Database/V1/OperationProgress.php | 164 ++ .../V1/OptimizeRestoredDatabaseMetadata.php | 114 + .../V1/RestoreDatabaseEncryptionConfig.php | 203 ++ .../EncryptionType.php | 74 + .../Database/V1/RestoreDatabaseMetadata.php | 358 +++ .../Database/V1/RestoreDatabaseRequest.php | 265 ++ .../Spanner/Admin/Database/V1/RestoreInfo.php | 112 + .../Admin/Database/V1/RestoreSourceType.php | 54 + .../Admin/Database/V1/UpdateBackupRequest.php | 172 ++ .../V1/UpdateBackupScheduleRequest.php | 167 ++ .../Database/V1/UpdateDatabaseDdlMetadata.php | 286 ++ .../Database/V1/UpdateDatabaseDdlRequest.php | 323 +++ .../Database/V1/UpdateDatabaseMetadata.php | 182 ++ .../Database/V1/UpdateDatabaseRequest.php | 152 ++ .../V1/DatabaseAdminClient/copy_backup.php | 116 + .../V1/DatabaseAdminClient/create_backup.php | 106 + .../create_backup_schedule.php | 78 + .../DatabaseAdminClient/create_database.php | 98 + .../V1/DatabaseAdminClient/delete_backup.php | 72 + .../delete_backup_schedule.php | 76 + .../V1/DatabaseAdminClient/drop_database.php | 73 + .../V1/DatabaseAdminClient/get_backup.php | 74 + .../get_backup_schedule.php | 78 + .../V1/DatabaseAdminClient/get_database.php | 72 + .../DatabaseAdminClient/get_database_ddl.php | 75 + .../V1/DatabaseAdminClient/get_iam_policy.php | 78 + .../list_backup_operations.php | 86 + .../list_backup_schedules.php | 78 + .../V1/DatabaseAdminClient/list_backups.php | 79 + .../list_database_operations.php | 84 + .../list_database_roles.php | 78 + .../V1/DatabaseAdminClient/list_databases.php | 77 + .../DatabaseAdminClient/restore_database.php | 109 + .../V1/DatabaseAdminClient/set_iam_policy.php | 79 + .../test_iam_permissions.php | 87 + .../V1/DatabaseAdminClient/update_backup.php | 63 + .../update_backup_schedule.php | 62 + .../DatabaseAdminClient/update_database.php | 126 + .../update_database_ddl.php | 91 + .../v1/src/V1/Client/DatabaseAdminClient.php | 1232 +++++++++ .../v1/src/V1/DatabaseAdminClient.php | 34 + .../src/V1/Gapic/DatabaseAdminGapicClient.php | 2401 +++++++++++++++++ .../Database/v1/src/V1/gapic_metadata.json | 143 + .../database_admin_client_config.json | 193 ++ .../database_admin_descriptor_config.php | 429 +++ .../database_admin_rest_client_config.php | 477 ++++ .../V1/Client/DatabaseAdminClientTest.php | 2352 ++++++++++++++++ .../tests/Unit/V1/DatabaseAdminClientTest.php | 2109 +++++++++++++++ .../Spanner/Admin/Instance/V1/Common.php | Bin 0 -> 1447 bytes .../Instance/V1/SpannerInstanceAdmin.php | Bin 0 -> 17768 bytes .../Admin/Instance/V1/AutoscalingConfig.php | 183 ++ .../AsymmetricAutoscalingOption.php | 133 + .../AutoscalingConfigOverrides.php | 129 + .../AutoscalingConfig/AutoscalingLimits.php | 205 ++ .../AutoscalingConfig/AutoscalingTargets.php | 128 + .../V1/CreateInstanceConfigMetadata.php | 174 ++ .../V1/CreateInstanceConfigRequest.php | 242 ++ .../Instance/V1/CreateInstanceMetadata.php | 260 ++ .../V1/CreateInstancePartitionMetadata.php | 226 ++ .../V1/CreateInstancePartitionRequest.php | 194 ++ .../Instance/V1/CreateInstanceRequest.php | 184 ++ .../V1/DeleteInstanceConfigRequest.php | 188 ++ .../V1/DeleteInstancePartitionRequest.php | 138 + .../Instance/V1/DeleteInstanceRequest.php | 87 + .../Instance/V1/FreeInstanceMetadata.php | 180 ++ .../FreeInstanceMetadata/ExpireBehavior.php | 66 + .../Admin/Instance/V1/FulfillmentPeriod.php | 63 + .../Instance/V1/GetInstanceConfigRequest.php | 87 + .../V1/GetInstancePartitionRequest.php | 92 + .../Admin/Instance/V1/GetInstanceRequest.php | 143 + .../Spanner/Admin/Instance/V1/Instance.php | 861 ++++++ .../V1/Instance/DefaultBackupScheduleType.php | 71 + .../Admin/Instance/V1/Instance/Edition.php | 72 + .../Instance/V1/Instance/InstanceType.php | 70 + .../Admin/Instance/V1/Instance/State.php | 67 + .../Admin/Instance/V1/InstanceConfig.php | 690 +++++ .../FreeInstanceAvailability.php | 84 + .../Instance/V1/InstanceConfig/QuorumType.php | 78 + .../Instance/V1/InstanceConfig/State.php | 65 + .../Admin/Instance/V1/InstanceConfig/Type.php | 64 + .../Admin/Instance/V1/InstancePartition.php | 568 ++++ .../Instance/V1/InstancePartition/State.php | 67 + .../ListInstanceConfigOperationsRequest.php | 349 +++ .../ListInstanceConfigOperationsResponse.php | 126 + .../V1/ListInstanceConfigsRequest.php | 176 ++ .../V1/ListInstanceConfigsResponse.php | 110 + ...ListInstancePartitionOperationsRequest.php | 413 +++ ...istInstancePartitionOperationsResponse.php | 172 ++ .../V1/ListInstancePartitionsRequest.php | 245 ++ .../V1/ListInstancePartitionsResponse.php | 156 ++ .../Instance/V1/ListInstancesRequest.php | 329 +++ .../Instance/V1/ListInstancesResponse.php | 156 ++ .../Instance/V1/MoveInstanceMetadata.php | 176 ++ .../Admin/Instance/V1/MoveInstanceRequest.php | 110 + .../Instance/V1/MoveInstanceResponse.php | 34 + .../Admin/Instance/V1/OperationProgress.php | 164 ++ .../Instance/V1/ReplicaComputeCapacity.php | 169 ++ .../Spanner/Admin/Instance/V1/ReplicaInfo.php | 145 + .../Instance/V1/ReplicaInfo/ReplicaType.php | 87 + .../Admin/Instance/V1/ReplicaSelection.php | 67 + .../V1/UpdateInstanceConfigMetadata.php | 174 ++ .../V1/UpdateInstanceConfigRequest.php | 230 ++ .../Instance/V1/UpdateInstanceMetadata.php | 260 ++ .../V1/UpdateInstancePartitionMetadata.php | 226 ++ .../V1/UpdateInstancePartitionRequest.php | 177 ++ .../Instance/V1/UpdateInstanceRequest.php | 172 ++ .../InstanceAdminClient/create_instance.php | 155 ++ .../create_instance_config.php | 132 + .../create_instance_partition.php | 161 ++ .../InstanceAdminClient/delete_instance.php | 80 + .../delete_instance_config.php | 78 + .../delete_instance_partition.php | 81 + .../V1/InstanceAdminClient/get_iam_policy.php | 75 + .../V1/InstanceAdminClient/get_instance.php | 72 + .../get_instance_config.php | 72 + .../get_instance_partition.php | 77 + .../list_instance_config_operations.php | 87 + .../list_instance_configs.php | 81 + .../list_instance_partition_operations.php | 90 + .../list_instance_partitions.php | 79 + .../V1/InstanceAdminClient/list_instances.php | 77 + .../V1/InstanceAdminClient/move_instance.php | 149 + .../V1/InstanceAdminClient/set_iam_policy.php | 77 + .../test_iam_permissions.php | 83 + .../InstanceAdminClient/update_instance.php | 145 + .../update_instance_config.php | 117 + .../update_instance_partition.php | 155 ++ .../v1/src/V1/Client/InstanceAdminClient.php | 1302 +++++++++ .../src/V1/Gapic/InstanceAdminGapicClient.php | 2277 ++++++++++++++++ .../v1/src/V1/InstanceAdminClient.php | 34 + .../Instance/v1/src/V1/gapic_metadata.json | 123 + .../instance_admin_client_config.json | 173 ++ .../instance_admin_descriptor_config.php | 378 +++ .../instance_admin_rest_client_config.php | 343 +++ .../V1/Client/InstanceAdminClientTest.php | 2172 +++++++++++++++ .../tests/Unit/V1/InstanceAdminClientTest.php | 1955 ++++++++++++++ .../Google/Spanner/V1/CommitResponse.php | Bin 0 -> 1251 bytes .../GPBMetadata/Google/Spanner/V1/Keys.php | Bin 0 -> 1173 bytes .../Google/Spanner/V1/Mutation.php | Bin 0 -> 1480 bytes .../Google/Spanner/V1/QueryPlan.php | Bin 0 -> 1535 bytes .../Google/Spanner/V1/ResultSet.php | Bin 0 -> 2130 bytes .../GPBMetadata/Google/Spanner/V1/Spanner.php | Bin 0 -> 12024 bytes .../Google/Spanner/V1/Transaction.php | Bin 0 -> 2283 bytes .../GPBMetadata/Google/Spanner/V1/Type.php | Bin 0 -> 1525 bytes .../Spanner/V1/BatchCreateSessionsRequest.php | 187 ++ .../V1/BatchCreateSessionsResponse.php | 68 + .../Cloud/Spanner/V1/BatchWriteRequest.php | 235 ++ .../V1/BatchWriteRequest/MutationGroup.php | 72 + .../Cloud/Spanner/V1/BatchWriteResponse.php | 163 ++ .../Spanner/V1/BeginTransactionRequest.php | 252 ++ .../Google/Cloud/Spanner/V1/CommitRequest.php | 466 ++++ .../Cloud/Spanner/V1/CommitResponse.php | 174 ++ .../Spanner/V1/CommitResponse/CommitStats.php | 94 + .../Cloud/Spanner/V1/CreateSessionRequest.php | 125 + .../Cloud/Spanner/V1/DeleteSessionRequest.php | 81 + .../Cloud/Spanner/V1/DirectedReadOptions.php | 129 + .../DirectedReadOptions/ExcludeReplicas.php | 71 + .../DirectedReadOptions/IncludeReplicas.php | 113 + .../DirectedReadOptions/ReplicaSelection.php | 118 + .../ReplicaSelection/Type.php | 64 + .../Spanner/V1/ExecuteBatchDmlRequest.php | 337 +++ .../V1/ExecuteBatchDmlRequest/Statement.php | 208 ++ .../Spanner/V1/ExecuteBatchDmlResponse.php | 235 ++ .../Cloud/Spanner/V1/ExecuteSqlRequest.php | 764 ++++++ .../V1/ExecuteSqlRequest/QueryMode.php | 84 + .../V1/ExecuteSqlRequest/QueryOptions.php | 232 ++ .../Cloud/Spanner/V1/GetSessionRequest.php | 81 + .../src/Google/Cloud/Spanner/V1/KeyRange.php | 255 ++ .../src/Google/Cloud/Spanner/V1/KeySet.php | 164 ++ .../Cloud/Spanner/V1/ListSessionsRequest.php | 223 ++ .../Cloud/Spanner/V1/ListSessionsResponse.php | 109 + .../V1/MultiplexedSessionPrecommitToken.php | 112 + .../src/Google/Cloud/Spanner/V1/Mutation.php | 254 ++ .../Cloud/Spanner/V1/Mutation/Delete.php | 134 + .../Cloud/Spanner/V1/Mutation/Write.php | 179 ++ .../Cloud/Spanner/V1/PartialResultSet.php | 573 ++++ .../src/Google/Cloud/Spanner/V1/Partition.php | 76 + .../Cloud/Spanner/V1/PartitionOptions.php | 142 + .../Spanner/V1/PartitionQueryRequest.php | 367 +++ .../Cloud/Spanner/V1/PartitionReadRequest.php | 361 +++ .../Cloud/Spanner/V1/PartitionResponse.php | 112 + .../src/Google/Cloud/Spanner/V1/PlanNode.php | 353 +++ .../Cloud/Spanner/V1/PlanNode/ChildLink.php | 179 ++ .../Google/Cloud/Spanner/V1/PlanNode/Kind.php | 70 + .../V1/PlanNode/ShortRepresentation.php | 121 + .../src/Google/Cloud/Spanner/V1/QueryPlan.php | 75 + .../Google/Cloud/Spanner/V1/ReadRequest.php | 706 +++++ .../Cloud/Spanner/V1/ReadRequest/LockHint.php | 95 + .../Cloud/Spanner/V1/ReadRequest/OrderBy.php | 67 + .../Cloud/Spanner/V1/RequestOptions.php | 211 ++ .../Spanner/V1/RequestOptions/Priority.php | 84 + .../src/Google/Cloud/Spanner/V1/ResultSet.php | 272 ++ .../Cloud/Spanner/V1/ResultSetMetadata.php | 225 ++ .../Cloud/Spanner/V1/ResultSetStats.php | 227 ++ .../Cloud/Spanner/V1/RollbackRequest.php | 117 + .../src/Google/Cloud/Spanner/V1/Session.php | 309 +++ .../Google/Cloud/Spanner/V1/StructType.php | 88 + .../Cloud/Spanner/V1/StructType/Field.php | 138 + .../Google/Cloud/Spanner/V1/Transaction.php | 227 ++ .../Cloud/Spanner/V1/TransactionOptions.php | 504 ++++ .../V1/TransactionOptions/PBReadOnly.php | 357 +++ .../V1/TransactionOptions/PartitionedDml.php | 36 + .../V1/TransactionOptions/ReadOnly.php | 9 + .../V1/TransactionOptions/ReadWrite.php | 121 + .../ReadWrite/ReadLockMode.php | 70 + .../Cloud/Spanner/V1/TransactionSelector.php | 160 ++ .../src/Google/Cloud/Spanner/V1/Type.php | 284 ++ .../Cloud/Spanner/V1/TypeAnnotationCode.php | 85 + .../src/Google/Cloud/Spanner/V1/TypeCode.php | 199 ++ .../SpannerClient/batch_create_sessions.php | 82 + .../samples/V1/SpannerClient/batch_write.php | 102 + .../V1/SpannerClient/begin_transaction.php | 83 + .../v1/samples/V1/SpannerClient/commit.php | 92 + .../V1/SpannerClient/create_session.php | 89 + .../V1/SpannerClient/delete_session.php | 71 + .../V1/SpannerClient/execute_batch_dml.php | 110 + .../samples/V1/SpannerClient/execute_sql.php | 91 + .../SpannerClient/execute_streaming_sql.php | 88 + .../samples/V1/SpannerClient/get_session.php | 73 + .../V1/SpannerClient/list_sessions.php | 76 + .../V1/SpannerClient/partition_query.php | 101 + .../V1/SpannerClient/partition_read.php | 95 + .../v1/samples/V1/SpannerClient/read.php | 100 + .../v1/samples/V1/SpannerClient/rollback.php | 85 + .../V1/SpannerClient/streaming_read.php | 99 + .../v1/src/V1/Client/SpannerClient.php | 836 ++++++ .../v1/src/V1/Gapic/SpannerGapicClient.php | 1919 +++++++++++++ .../Spanner/v1/src/V1/SpannerClient.php | 34 + .../Spanner/v1/src/V1/gapic_metadata.json | 98 + .../V1/resources/spanner_client_config.json | 145 + .../resources/spanner_descriptor_config.php | 241 ++ .../resources/spanner_rest_client_config.php | 320 +++ .../Unit/V1/Client/SpannerClientTest.php | 1308 +++++++++ .../v1/tests/Unit/V1/SpannerClientTest.php | 1161 ++++++++ 285 files changed, 64364 insertions(+) create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Database/V1/Backup.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Database/V1/BackupSchedule.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Database/V1/Common.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Database/V1/SpannerDatabaseAdmin.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Backup.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Backup/State.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupInfo.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupSchedule.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupScheduleSpec.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupEncryptionConfig.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupEncryptionConfig/EncryptionType.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupMetadata.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupEncryptionConfig.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupEncryptionConfig/EncryptionType.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupMetadata.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupScheduleRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateDatabaseMetadata.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateDatabaseRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CrontabSpec.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Database.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Database/State.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DatabaseDialect.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DatabaseRole.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DdlStatementActionInfo.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DeleteBackupRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DeleteBackupScheduleRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DropDatabaseRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionConfig.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionInfo.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionInfo/Type.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/FullBackupSpec.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetBackupRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetBackupScheduleRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseDdlRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseDdlResponse.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/IncrementalBackupSpec.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupOperationsRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupOperationsResponse.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupSchedulesRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupSchedulesResponse.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupsRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupsResponse.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseOperationsRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseOperationsResponse.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseRolesRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseRolesResponse.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabasesRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabasesResponse.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/OperationProgress.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/OptimizeRestoredDatabaseMetadata.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseEncryptionConfig.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseEncryptionConfig/EncryptionType.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseMetadata.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreInfo.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreSourceType.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateBackupRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateBackupScheduleRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseDdlMetadata.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseDdlRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseMetadata.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/copy_backup.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_backup.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_backup_schedule.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_database.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/delete_backup.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/delete_backup_schedule.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/drop_database.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_backup.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_backup_schedule.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_database.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_database_ddl.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_iam_policy.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backup_operations.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backup_schedules.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backups.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_database_operations.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_database_roles.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_databases.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/restore_database.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/set_iam_policy.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/test_iam_permissions.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_backup.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_backup_schedule.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_database.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_database_ddl.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/Client/DatabaseAdminClient.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/DatabaseAdminClient.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/Gapic/DatabaseAdminGapicClient.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/gapic_metadata.json create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_client_config.json create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_descriptor_config.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_rest_client_config.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/tests/Unit/V1/Client/DatabaseAdminClientTest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/tests/Unit/V1/DatabaseAdminClientTest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Instance/V1/Common.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Instance/V1/SpannerInstanceAdmin.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AsymmetricAutoscalingOption.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AsymmetricAutoscalingOption/AutoscalingConfigOverrides.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AutoscalingLimits.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AutoscalingTargets.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceConfigMetadata.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceConfigRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceMetadata.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstancePartitionMetadata.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstancePartitionRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstanceConfigRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstancePartitionRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstanceRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FreeInstanceMetadata.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FreeInstanceMetadata/ExpireBehavior.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FulfillmentPeriod.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstanceConfigRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstancePartitionRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstanceRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/DefaultBackupScheduleType.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/Edition.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/InstanceType.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/State.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/FreeInstanceAvailability.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/QuorumType.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/State.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/Type.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstancePartition.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstancePartition/State.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigOperationsRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigOperationsResponse.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigsRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigsResponse.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionOperationsRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionOperationsResponse.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionsRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionsResponse.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancesRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancesResponse.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceMetadata.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceResponse.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/OperationProgress.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaComputeCapacity.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaInfo.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaInfo/ReplicaType.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaSelection.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceConfigMetadata.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceConfigRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceMetadata.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstancePartitionMetadata.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstancePartitionRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceRequest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance_config.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance_partition.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance_config.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance_partition.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_iam_policy.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance_config.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance_partition.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_config_operations.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_configs.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_partition_operations.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_partitions.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instances.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/move_instance.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/set_iam_policy.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/test_iam_permissions.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance_config.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance_partition.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/Client/InstanceAdminClient.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/Gapic/InstanceAdminGapicClient.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/InstanceAdminClient.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/gapic_metadata.json create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/resources/instance_admin_client_config.json create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/resources/instance_admin_descriptor_config.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/resources/instance_admin_rest_client_config.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/tests/Unit/V1/Client/InstanceAdminClientTest.php create mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/tests/Unit/V1/InstanceAdminClientTest.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/CommitResponse.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Keys.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Mutation.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/QueryPlan.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/ResultSet.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Spanner.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Transaction.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Type.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchCreateSessionsRequest.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchCreateSessionsResponse.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteRequest.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteRequest/MutationGroup.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteResponse.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BeginTransactionRequest.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitRequest.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitResponse.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitResponse/CommitStats.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CreateSessionRequest.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DeleteSessionRequest.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ExcludeReplicas.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/IncludeReplicas.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ReplicaSelection.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ReplicaSelection/Type.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlRequest.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlRequest/Statement.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlResponse.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest/QueryMode.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest/QueryOptions.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/GetSessionRequest.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/KeyRange.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/KeySet.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ListSessionsRequest.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ListSessionsResponse.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/MultiplexedSessionPrecommitToken.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation/Delete.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation/Write.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartialResultSet.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Partition.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionOptions.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionQueryRequest.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionReadRequest.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionResponse.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/ChildLink.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/Kind.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/ShortRepresentation.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/QueryPlan.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest/LockHint.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest/OrderBy.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RequestOptions.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RequestOptions/Priority.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSet.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSetMetadata.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSetStats.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RollbackRequest.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Session.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/StructType.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/StructType/Field.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Transaction.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/PBReadOnly.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/PartitionedDml.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/ReadOnly.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/ReadWrite.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/ReadWrite/ReadLockMode.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionSelector.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Type.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TypeAnnotationCode.php create mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TypeCode.php create mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/batch_create_sessions.php create mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/batch_write.php create mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/begin_transaction.php create mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/commit.php create mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/create_session.php create mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/delete_session.php create mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_batch_dml.php create mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_sql.php create mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_streaming_sql.php create mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/get_session.php create mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/list_sessions.php create mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/partition_query.php create mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/partition_read.php create mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/read.php create mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/rollback.php create mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/streaming_read.php create mode 100644 owl-bot-staging/Spanner/v1/src/V1/Client/SpannerClient.php create mode 100644 owl-bot-staging/Spanner/v1/src/V1/Gapic/SpannerGapicClient.php create mode 100644 owl-bot-staging/Spanner/v1/src/V1/SpannerClient.php create mode 100644 owl-bot-staging/Spanner/v1/src/V1/gapic_metadata.json create mode 100644 owl-bot-staging/Spanner/v1/src/V1/resources/spanner_client_config.json create mode 100644 owl-bot-staging/Spanner/v1/src/V1/resources/spanner_descriptor_config.php create mode 100644 owl-bot-staging/Spanner/v1/src/V1/resources/spanner_rest_client_config.php create mode 100644 owl-bot-staging/Spanner/v1/tests/Unit/V1/Client/SpannerClientTest.php create mode 100644 owl-bot-staging/Spanner/v1/tests/Unit/V1/SpannerClientTest.php diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Database/V1/Backup.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Database/V1/Backup.php new file mode 100644 index 0000000000000000000000000000000000000000..57f9f920210920820883b8e47ba916ed0fa103d4 GIT binary patch literal 5621 zcmd5=-EZ4e6elSy%W2mSm$9%h&C3ey1aoMI`0!T1`DhfjHc^vK8nUn)=O#6EY-2ms z3hEoYAc6P`;2qxi6L{dSKs@d*fJsQ4d#}IRwM*!Ppf7dobIv`VzjN-n^MSkT!gaAm zY~tww>582LG1w)d>p6jAIF{HM_Ikt<4QJq*7V#uetTe=}Mq8{_>g{XD>N`WvAhOtZ zoW4bhzN_0PtEhJerd{mnf!@)5QrurHc64KJ=t@j7fUOS*(i%jpHA|Z$&?%`}V?xvx z7osXuh*}ASsP|WI0~nU>`(lX+gD*hDKX=%%OhfboJ-~lUrmvZ{8JN0devTHci#^@) z39>#(+Z)rLI?I|Faq z#5@Z0fjd6$soABLox#AdPnN`z;pY2h7<#4KjU&B*m9Y}XhDK@`ep!N>|EMH{u!5wp zf+SW!QdB|G{_3TdLxH+$7QHZByq+#y4?kH+Oo~n%laMH?QC5PO$Hg8^7j1x^4=JvO zVq%IQa&Jg5+9pH_^dToNe3yeMUaG>|a4xbXpA|DJxzf^O zBP8<)NeLz?a*+HKzMEZ>BI_gPJ&`LC_qx=gTwIY2xZn}Qa$*};v04-iKmUR_fzeQx z(TuSovITP}!#i+ky(852ocuXdYkKX?(P~v=#yawG#dhGOWAeNK!;<`Y)a=Y+n=l{Q zsCBU!5F^L~bKmM{J)`uia7M0Z2^P~H?64l>=ck$fUS;mP3Rj|-982i14Bmygf&NfS zC+G}w-cvG~pI(D`exl|ZyQDj`FwbV$(Kp%A>N33g)U#V5o3H|xO^gE>5IfKL!M>n_obEa{SCYu;^G_1X%4z4GLpvTzCg2S^fzZV4>Ak+Es05tJSQQ>l^iIW&Sx~ z2F{hYt4h1RRh!QUIhe#Bl?U@#Sydk?4@Pp}@HpWm$c0`+|8aCfRLBbJ zFvZ{JISQ?e&OELXb$?d)1Qt@2VK{cr?B_Wky+2w~+Qg*p%1jECpDFy2ffv(M(Hw@L zn?l4=;juC@ug?naRXB&y>tj3fLm%B5ZCN~RG(%R3`34QVH6~~me$K)|*>Mm4?F_gB z=lNU}mKifLS3_us$7^@d$1ywyMZ)i`NUb{2eyNO#)&YC|nAS5);kTdTc z_YJR{ankL-N}I1Uu(;!5Um-^mCn@}C`BXJM*mT6p2&z$z?2&ei*TQexFK zDF^`URp9Iqn*n65V8Y@NHGCH@Cq#G;Ug(5+$Lbx& zNBog6$KXCSqth^)R4>V$U>)W{7>;Jb5QxXRgcN?5fLGFu@;ERGdq-yC;J_tphL~O3 zjNBTHW>1dlPZKO9C$&*19}7N!nZ1Fp?U4hG-CHUqa#A49p%?O}Gk|t6Sym2hDc9v8A;iG>?yam*L`0tEyF$ zwo+2?A)&_U?+UzJYcy*2@OyPb*}2zFf6h|j<(*c$v02^LHkB=L6mHJB7Y;+IkXe z1UHlsG`OAH$>WdN*J^AlDV1qmNiDvcl-O=ks)V~q>Hg}k5uvIwN;O_%hI`Cpk%^nk zN7>i8SXpM&vK$JQWhPmcBhj*af3-7(LvrBUT8_6&Z}5F#YQ0Do1g3GqYLQX$1>hkZ G0{jhnw=9JK literal 0 HcmV?d00001 diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Database/V1/BackupSchedule.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Database/V1/BackupSchedule.php new file mode 100644 index 0000000000000000000000000000000000000000..cb0825c4e2d4ffb66fd087a0bf6963e1151be444 GIT binary patch literal 3205 zcmcImQBNC35Uy=P!=i?8m5M{8vTTkxG5(U&wQQLZ3Rjw|m9`3kRvZaNgbdX7-zJX6Nf~qQeM%gj z*yY5>?Gwxo36A2Bhh7-qcG~HX7<*waq5+9bjGNo|@%A3R-`v`}1*S=u#vZY7Hw?Q0 zsU?xi0ITNuJ<4jn%iXq{klOJ|t?hb8Y2+l{A@S3In9>D8%ofd3KYFW82+NP9Z(M^+~x3ZktPmhlv6jLFW`#n zxZ?&10f@6_J1O%x4H*^&+sq@?+c?7%XBVRoC|SokydA+3Fl28rPGaT;c9SGtOd}q~ zJ8;ypx`gN4ik0eZ~b{S9wwUx@PnJj!=u!1NPO4g*OqnrdSav*ukG{CM0VdF01j2)N8Z+oU-B~0~<@YP-+ORKU7EOq5 zBV9~2O0ViyjTV}aUMHp3I~RK$h7`^PP{FW}0o6&EkiDaME|(~NkoW8u!#r;aw zABETTUkm7C%~2*DD2T*_cdMp6s3*dB3NSwqk0-U4>Z@O)4EhFidsx$-{rvHQMO|=x z^@{2D2DY^7`k&5Z{N{VB*M=7w2D+ZDIQ%3cnM|Ld=~F@$66NGaK9Fe9_yA1_GMpD7 zBjqA6BBfh0?xGpUg6y--bISbi`B-u*RsJfVo2Nyi1AaoDrO-bCcrtQh$gYaQUV2q8 z{#(C=7Df=P-(_O~8R~+X6^HtRn2W|^q)5ug02T8XLTn7Z^dj@c%2QNs5k9=5udy~% z?aT5G_R^RtsT`o2O%gyw{~zGL6wv%bn!FKsq9eb20zfN~+XZRCpd)#|l68PNgycF8 zj|h{kMT)3U`3baeZX`(*vV<7l=91MJO+XbT=+JMSF=GzRFwnMhDiSH@%5M47!YX>LgFot7p4RK8i@I#?M8x2<=2SBV7w;UgXC6!?)NGL*h>1 zVABi2)Ys;sF?GXH<1+Lvn3#3fiP~#}&p(TwwB&GXZb-b{Y(zHYh-~UoH1}8j)(34{ zp0x96T8-0#c^U@l*Tv5=Sj&>9ElUAgmPEEJ4Q*NbEA2_yi@#jTC!No;arM-6J94s> MC$sspkNODx2ja&x8vpP;i5D!vL$;wB(|}X%#_iLMwZvkQd!bS z>kMwkzkmZbegFp!{0xr#3eNorJ@Iz6vQwH&%>iG$+I{bPZ@>4weNVnk&J%POw@E}& zpOFzB&M`YDI7wp`2XTmpv+%k(j8NoH3D^b%xBHC~!hCM(wgrf5=OC`ZL0nUU zxM%x^2nC^^Wwm9D%N#v6 zPY7U^>RSh27d%{BL-lni)dA;5yRM5icrwZ-sOmiJTi$8c?pw`Ht7Dnfca+c3t#+^1KDIp5 zY8j`;j%Rh7gQtC`)9Y4C%5C&%^VD{FC)U6_F}gEzSkCWLTz$6s&ZPWVp^!hz16e* zzY0Uw6_)ODu*k`>8Z9teUY5VeVRc$(Kib%Ctw1+=b%weizB?O;P+{|NMF+6%c_ zXki?P_J_S^b8CSX2>k<i4mxsn^#dUg`~C3fs&lBk$skC z{H9Zo6x|7-no%_Yw`3;g3$yo4*C1fUc}ldn!iW|%LbRCUM2oLa-$bZXF&rn!A;b~| zL{Cr>{_4&3id9NFuHnMRdCSqQn&nzX#d;g$ok?yO6~_cZ?XVloTFJHST9P0v)k@~Y zOG!qPz@D$$pr4tfV6s3|2I?v<)LgSsGb+WL>698)-L)G909DmZ)0K)Qzg)b;w+}?2JEVELcHMfjMmfh$Lb=l-j6`9EeqYB#;AIIz!?VerRY&2^% ztF~EOs*~91O{>ybz*PBa-R*&6iAptm-*6sAmsaAgS`cooQLRVE?HYu|S)=r@`3xzo zl(x)rvtm9A-m-SJYS%hbq7i)gw#DOBE0<+>&Ox%fC!UNFY0mPTi@FmNrl0*z2 zdYy&|Uq9(z_pP1dYn7J6r)}x*oWLm#ROcx$Z4#H}i=r~fMaF&=9G61~*(8K3ypsc5 z=JdJVIuw_6>Vh2ndPH#D;f@x08z_U|O$=Q5Weg2Ms)F=xF4Q(`d>0L}yrsL_b#pwH zj9omExsqbcbhmkm(^#Q}bQMr>77a3ipj2(x<8h!gn3)Qv!~&5pbN9K~!;&3BM0whe z21I$pBj|Zja4C<8*}ng1ahyYkNcl18ZbvdNhwmn+rB(Xau0^%_&6G- zU-hNJ>cahnHwZwVy8fA_qqD+iSoA?Uby5(#X~8`Ryjy3Ex2db)x|$<&jmq0HO7T_F`9l7WkGBk%_vo zY3dGir8H~~VT=&{$+aJvwQ&*?3B^XEfsLIyv~wn&K?%X01Dg}~oQ!Tsd;%SZ&6nvz{ZUeTFNQ|f>cEI8ei9V50DnC>8nZA|i6*73lP-YQxArO_8(fN| z?8eZTpCzfYyXb`m3qh)~!OV?t-}jRe(&fJcbhP7F0C1VwPzpW~B>zz2y*1y8H5$1@r<_ z9Z3-+b-xnszMZWAdF5CR>TfV;58y${G8*+HmS^LZ$~+ni66KZ5Z#GiO5_qChHYFZ4 zr2HU;PJ2tDjKybAl)z&uI|AJrJBvt#Dv=QmxI%G{;Kb9W?Z? z>gW&6ZJkbDOrw{e75G9shh8jI>}DAN_~x=-&5}{Ze$Cv*ucE_V0-_~~PC@xe3?1>a zhR>o?`Niz=1L&WZ7WLH!g<$Xf5-MI;TgmI$rNz00c|Dh()7I{->PyS|td@Okt)REi zp*KH`Cgzux=I`Ytpl3NwcFV4yX`G@%<8$1JN2JgpE za*1PdyOc!`9>_4>x=E}u80DNq=0eeB5sw}c{4CoQv%|TD`s6e1F*+x5OP6twB7Y4U zzkQE{a!w?qU{-9v$Byzg8uwNLx+a>so|ChX)L({(`hv3}anFSE9W>Elb6$bw;B-JF zc*3iwLaFfdC-@-JbS+Dh&}ng(@f>Wy#NHvvAk@#Y$#5+5qiJ+lY(Q^u@E>C6uvZQT zUk~Tehrl&{GQv<0z+=i%ZtrS*uK(`eKmB1mjW3gP)F*7zpOJ1e={Z4|^qd^v58~*E zf7-(lc=2NhA@*()l;6glYGrgO^w3f07~cp5_46U(epfreFN=+}hRXL8#BHq&{~ss*G|cJ-LHFhl1)KTcViNk0H1Y zG3z^ER>gCG+hq{m)sBm(o@%xxY%1Pt<~sFS0g#F+rz+1Q@cVHz;^!a60j!4GsSPQj z+#iD6D`=GaC`1~)VolL2GpvTXZripk?>#2;FeM$=p?Xp?*L-@4;tJ_?P}5(l-Vnj(>*hb{{nvN2^?a=2Ci|2wAK zrm7Z;QT#%6JZyo3yrC(#A`xLD7RfSgB-WHdBoe~Efk>K>6Zfi}$l~9D62Vg4mFQgz zQR3&I!~vnF188s4!_Pjo7bNkFv=<b2C`pibva>(_LgD(c0tQ|yX@=^py z9ytGvLz)-boq~%au^rX))3}oB)jxJrw~cqA?|Ef55-E?jb|&-<<@HE}LVUI}@dwIk z&&0(>v?C``){!*+DFg*;f7nSzlzi@m7uF4_?jJ#w`zB1?IVwK|!XL&F%G&j9&RT?twgnwgJ%0xEyxD_#u7s;cGTc(m zByVS>R;KuEKKo(Hd|bESf|^{xa(%tri@r**C20|U9zzL8rCePRZmcA*(3VUpVyJCD zFk{pe)!W`)#>~EZwS7!f+T4B&tqg0QII9s_883YA+4Aizi~6HM?-Ac_QJ zNS-Tc;HwJjQ$y4wupJd@HBl0Y{!if!(|g7s&$JwTM|1$)!@4u3(BP~4C&2w--tP~u zU^X#E6x1WjzhdkG3Fg(Fg_&qP2JwW5xA%+A1A1In5OV{LV7*RwLdXcuOEJTX z4V8CbkhsL7ah*QmC!g69-HUjJPqZ=1%AH=NXOzXJj(Rk(75*#OTb5w~7scLfNc&d> z7`b&+rC}!IUbS52pN{h%eh-Z7t=Cel2uALNw|~jL2Sz>>PrJP0D> zvBXVVydD#Lwi%d*s|Ml8_4S*rufK?Yd7i!>lgbjAQhdu4-76(_PQ5<;Q~(x>6tXB^ zsNrwav|g!!wgoogle.spanner.admin.database.v1.Backup + */ +class Backup extends \Google\Protobuf\Internal\Message +{ + /** + * Required for the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * operation. Name of the database from which this backup was created. This + * needs to be in the same instance as the backup. Values are of the form + * `projects//instances//databases/`. + * + * Generated from protobuf field string database = 2 [(.google.api.resource_reference) = { + */ + protected $database = ''; + /** + * The backup will contain an externally consistent copy of the database at + * the timestamp specified by `version_time`. If `version_time` is not + * specified, the system will set `version_time` to the `create_time` of the + * backup. + * + * Generated from protobuf field .google.protobuf.Timestamp version_time = 9; + */ + protected $version_time = null; + /** + * Required for the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * operation. The expiration time of the backup, with microseconds + * granularity that must be at least 6 hours and at most 366 days + * from the time the CreateBackup request is processed. Once the `expire_time` + * has passed, the backup is eligible to be automatically deleted by Cloud + * Spanner to free the resources used by the backup. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3; + */ + protected $expire_time = null; + /** + * Output only for the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * operation. Required for the + * [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup] + * operation. + * A globally unique identifier for the backup which cannot be + * changed. Values are of the form + * `projects//instances//backups/[a-z][a-z0-9_\-]*[a-z0-9]` + * The final segment of the name must be between 2 and 60 characters + * in length. + * The backup is stored in the location(s) specified in the instance + * configuration of the instance containing the backup, identified + * by the prefix of the backup name of the form + * `projects//instances/`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Output only. The time the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * request is received. If the request does not specify `version_time`, the + * `version_time` of the backup will be equivalent to the `create_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Size of the backup in bytes. + * + * Generated from protobuf field int64 size_bytes = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $size_bytes = 0; + /** + * Output only. The number of bytes that will be freed by deleting this + * backup. This value will be zero if, for example, this backup is part of an + * incremental backup chain and younger backups in the chain require that we + * keep its data. For backups not in an incremental backup chain, this is + * always the size of the backup. This value may change if backups on the same + * chain get created, deleted or expired. + * + * Generated from protobuf field int64 freeable_size_bytes = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $freeable_size_bytes = 0; + /** + * Output only. For a backup in an incremental backup chain, this is the + * storage space needed to keep the data that has changed since the previous + * backup. For all other backups, this is always the size of the backup. This + * value may change if backups on the same chain get deleted or expired. + * This field can be used to calculate the total storage space used by a set + * of backups. For example, the total space used by all backups of a database + * can be computed by summing up this field. + * + * Generated from protobuf field int64 exclusive_size_bytes = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $exclusive_size_bytes = 0; + /** + * Output only. The current state of the backup. + * + * Generated from protobuf field .google.spanner.admin.database.v1.Backup.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The names of the restored databases that reference the backup. + * The database names are of + * the form `projects//instances//databases/`. + * Referencing databases may exist in different instances. The existence of + * any referencing database prevents the backup from being deleted. When a + * restored database from the backup enters the `READY` state, the reference + * to the backup is removed. + * + * Generated from protobuf field repeated string referencing_databases = 7 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + private $referencing_databases; + /** + * Output only. The encryption information for the backup. + * + * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionInfo encryption_info = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $encryption_info = null; + /** + * Output only. The encryption information for the backup, whether it is + * protected by one or more KMS keys. The information includes all Cloud + * KMS key versions used to encrypt the backup. The `encryption_status' field + * inside of each `EncryptionInfo` is not populated. At least one of the key + * versions must be available for the backup to be restored. If a key version + * is revoked in the middle of a restore, the restore behavior is undefined. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.EncryptionInfo encryption_information = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $encryption_information; + /** + * Output only. The database dialect information for the backup. + * + * Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $database_dialect = 0; + /** + * Output only. The names of the destination backups being created by copying + * this source backup. The backup names are of the form + * `projects//instances//backups/`. + * Referencing backups may exist in different instances. The existence of + * any referencing backup prevents the backup from being deleted. When the + * copy operation is done (either successfully completed or cancelled or the + * destination backup is deleted), the reference to the backup is removed. + * + * Generated from protobuf field repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + private $referencing_backups; + /** + * Output only. The max allowed expiration time of the backup, with + * microseconds granularity. A backup's expiration time can be configured in + * multiple APIs: CreateBackup, UpdateBackup, CopyBackup. When updating or + * copying an existing backup, the expiration time specified must be + * less than `Backup.max_expire_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp max_expire_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $max_expire_time = null; + /** + * Output only. List of backup schedule URIs that are associated with + * creating this backup. This is only applicable for scheduled backups, and + * is empty for on-demand backups. + * To optimize for storage, whenever possible, multiple schedules are + * collapsed together to create one backup. In such cases, this field captures + * the list of all backup schedule URIs that are associated with creating + * this backup. If collapsing is not done, then this field captures the + * single backup schedule URI associated with creating this backup. + * + * Generated from protobuf field repeated string backup_schedules = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + private $backup_schedules; + /** + * Output only. Populated only for backups in an incremental backup chain. + * Backups share the same chain id if and only if they belong to the same + * incremental backup chain. Use this field to determine which backups are + * part of the same incremental backup chain. The ordering of backups in the + * chain can be determined by ordering the backup `version_time`. + * + * Generated from protobuf field string incremental_backup_chain_id = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $incremental_backup_chain_id = ''; + /** + * Output only. Data deleted at a time older than this is guaranteed not to be + * retained in order to support this backup. For a backup in an incremental + * backup chain, this is the version time of the oldest backup that exists or + * ever existed in the chain. For all other backups, this is the version time + * of the backup. This field can be used to understand what data is being + * retained by the backup system. + * + * Generated from protobuf field .google.protobuf.Timestamp oldest_version_time = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $oldest_version_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $database + * Required for the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * operation. Name of the database from which this backup was created. This + * needs to be in the same instance as the backup. Values are of the form + * `projects//instances//databases/`. + * @type \Google\Protobuf\Timestamp $version_time + * The backup will contain an externally consistent copy of the database at + * the timestamp specified by `version_time`. If `version_time` is not + * specified, the system will set `version_time` to the `create_time` of the + * backup. + * @type \Google\Protobuf\Timestamp $expire_time + * Required for the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * operation. The expiration time of the backup, with microseconds + * granularity that must be at least 6 hours and at most 366 days + * from the time the CreateBackup request is processed. Once the `expire_time` + * has passed, the backup is eligible to be automatically deleted by Cloud + * Spanner to free the resources used by the backup. + * @type string $name + * Output only for the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * operation. Required for the + * [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup] + * operation. + * A globally unique identifier for the backup which cannot be + * changed. Values are of the form + * `projects//instances//backups/[a-z][a-z0-9_\-]*[a-z0-9]` + * The final segment of the name must be between 2 and 60 characters + * in length. + * The backup is stored in the location(s) specified in the instance + * configuration of the instance containing the backup, identified + * by the prefix of the backup name of the form + * `projects//instances/`. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * request is received. If the request does not specify `version_time`, the + * `version_time` of the backup will be equivalent to the `create_time`. + * @type int|string $size_bytes + * Output only. Size of the backup in bytes. + * @type int|string $freeable_size_bytes + * Output only. The number of bytes that will be freed by deleting this + * backup. This value will be zero if, for example, this backup is part of an + * incremental backup chain and younger backups in the chain require that we + * keep its data. For backups not in an incremental backup chain, this is + * always the size of the backup. This value may change if backups on the same + * chain get created, deleted or expired. + * @type int|string $exclusive_size_bytes + * Output only. For a backup in an incremental backup chain, this is the + * storage space needed to keep the data that has changed since the previous + * backup. For all other backups, this is always the size of the backup. This + * value may change if backups on the same chain get deleted or expired. + * This field can be used to calculate the total storage space used by a set + * of backups. For example, the total space used by all backups of a database + * can be computed by summing up this field. + * @type int $state + * Output only. The current state of the backup. + * @type array|\Google\Protobuf\Internal\RepeatedField $referencing_databases + * Output only. The names of the restored databases that reference the backup. + * The database names are of + * the form `projects//instances//databases/`. + * Referencing databases may exist in different instances. The existence of + * any referencing database prevents the backup from being deleted. When a + * restored database from the backup enters the `READY` state, the reference + * to the backup is removed. + * @type \Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo $encryption_info + * Output only. The encryption information for the backup. + * @type array<\Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo>|\Google\Protobuf\Internal\RepeatedField $encryption_information + * Output only. The encryption information for the backup, whether it is + * protected by one or more KMS keys. The information includes all Cloud + * KMS key versions used to encrypt the backup. The `encryption_status' field + * inside of each `EncryptionInfo` is not populated. At least one of the key + * versions must be available for the backup to be restored. If a key version + * is revoked in the middle of a restore, the restore behavior is undefined. + * @type int $database_dialect + * Output only. The database dialect information for the backup. + * @type array|\Google\Protobuf\Internal\RepeatedField $referencing_backups + * Output only. The names of the destination backups being created by copying + * this source backup. The backup names are of the form + * `projects//instances//backups/`. + * Referencing backups may exist in different instances. The existence of + * any referencing backup prevents the backup from being deleted. When the + * copy operation is done (either successfully completed or cancelled or the + * destination backup is deleted), the reference to the backup is removed. + * @type \Google\Protobuf\Timestamp $max_expire_time + * Output only. The max allowed expiration time of the backup, with + * microseconds granularity. A backup's expiration time can be configured in + * multiple APIs: CreateBackup, UpdateBackup, CopyBackup. When updating or + * copying an existing backup, the expiration time specified must be + * less than `Backup.max_expire_time`. + * @type array|\Google\Protobuf\Internal\RepeatedField $backup_schedules + * Output only. List of backup schedule URIs that are associated with + * creating this backup. This is only applicable for scheduled backups, and + * is empty for on-demand backups. + * To optimize for storage, whenever possible, multiple schedules are + * collapsed together to create one backup. In such cases, this field captures + * the list of all backup schedule URIs that are associated with creating + * this backup. If collapsing is not done, then this field captures the + * single backup schedule URI associated with creating this backup. + * @type string $incremental_backup_chain_id + * Output only. Populated only for backups in an incremental backup chain. + * Backups share the same chain id if and only if they belong to the same + * incremental backup chain. Use this field to determine which backups are + * part of the same incremental backup chain. The ordering of backups in the + * chain can be determined by ordering the backup `version_time`. + * @type \Google\Protobuf\Timestamp $oldest_version_time + * Output only. Data deleted at a time older than this is guaranteed not to be + * retained in order to support this backup. For a backup in an incremental + * backup chain, this is the version time of the oldest backup that exists or + * ever existed in the chain. For all other backups, this is the version time + * of the backup. This field can be used to understand what data is being + * retained by the backup system. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); + parent::__construct($data); + } + + /** + * Required for the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * operation. Name of the database from which this backup was created. This + * needs to be in the same instance as the backup. Values are of the form + * `projects//instances//databases/`. + * + * Generated from protobuf field string database = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getDatabase() + { + return $this->database; + } + + /** + * Required for the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * operation. Name of the database from which this backup was created. This + * needs to be in the same instance as the backup. Values are of the form + * `projects//instances//databases/`. + * + * Generated from protobuf field string database = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDatabase($var) + { + GPBUtil::checkString($var, True); + $this->database = $var; + + return $this; + } + + /** + * The backup will contain an externally consistent copy of the database at + * the timestamp specified by `version_time`. If `version_time` is not + * specified, the system will set `version_time` to the `create_time` of the + * backup. + * + * Generated from protobuf field .google.protobuf.Timestamp version_time = 9; + * @return \Google\Protobuf\Timestamp|null + */ + public function getVersionTime() + { + return $this->version_time; + } + + public function hasVersionTime() + { + return isset($this->version_time); + } + + public function clearVersionTime() + { + unset($this->version_time); + } + + /** + * The backup will contain an externally consistent copy of the database at + * the timestamp specified by `version_time`. If `version_time` is not + * specified, the system will set `version_time` to the `create_time` of the + * backup. + * + * Generated from protobuf field .google.protobuf.Timestamp version_time = 9; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setVersionTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->version_time = $var; + + return $this; + } + + /** + * Required for the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * operation. The expiration time of the backup, with microseconds + * granularity that must be at least 6 hours and at most 366 days + * from the time the CreateBackup request is processed. Once the `expire_time` + * has passed, the backup is eligible to be automatically deleted by Cloud + * Spanner to free the resources used by the backup. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExpireTime() + { + return $this->expire_time; + } + + public function hasExpireTime() + { + return isset($this->expire_time); + } + + public function clearExpireTime() + { + unset($this->expire_time); + } + + /** + * Required for the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * operation. The expiration time of the backup, with microseconds + * granularity that must be at least 6 hours and at most 366 days + * from the time the CreateBackup request is processed. Once the `expire_time` + * has passed, the backup is eligible to be automatically deleted by Cloud + * Spanner to free the resources used by the backup. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExpireTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->expire_time = $var; + + return $this; + } + + /** + * Output only for the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * operation. Required for the + * [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup] + * operation. + * A globally unique identifier for the backup which cannot be + * changed. Values are of the form + * `projects//instances//backups/[a-z][a-z0-9_\-]*[a-z0-9]` + * The final segment of the name must be between 2 and 60 characters + * in length. + * The backup is stored in the location(s) specified in the instance + * configuration of the instance containing the backup, identified + * by the prefix of the backup name of the form + * `projects//instances/`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only for the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * operation. Required for the + * [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup] + * operation. + * A globally unique identifier for the backup which cannot be + * changed. Values are of the form + * `projects//instances//backups/[a-z][a-z0-9_\-]*[a-z0-9]` + * The final segment of the name must be between 2 and 60 characters + * in length. + * The backup is stored in the location(s) specified in the instance + * configuration of the instance containing the backup, identified + * by the prefix of the backup name of the form + * `projects//instances/`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The time the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * request is received. If the request does not specify `version_time`, the + * `version_time` of the backup will be equivalent to the `create_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The time the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * request is received. If the request does not specify `version_time`, the + * `version_time` of the backup will be equivalent to the `create_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Size of the backup in bytes. + * + * Generated from protobuf field int64 size_bytes = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getSizeBytes() + { + return $this->size_bytes; + } + + /** + * Output only. Size of the backup in bytes. + * + * Generated from protobuf field int64 size_bytes = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setSizeBytes($var) + { + GPBUtil::checkInt64($var); + $this->size_bytes = $var; + + return $this; + } + + /** + * Output only. The number of bytes that will be freed by deleting this + * backup. This value will be zero if, for example, this backup is part of an + * incremental backup chain and younger backups in the chain require that we + * keep its data. For backups not in an incremental backup chain, this is + * always the size of the backup. This value may change if backups on the same + * chain get created, deleted or expired. + * + * Generated from protobuf field int64 freeable_size_bytes = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getFreeableSizeBytes() + { + return $this->freeable_size_bytes; + } + + /** + * Output only. The number of bytes that will be freed by deleting this + * backup. This value will be zero if, for example, this backup is part of an + * incremental backup chain and younger backups in the chain require that we + * keep its data. For backups not in an incremental backup chain, this is + * always the size of the backup. This value may change if backups on the same + * chain get created, deleted or expired. + * + * Generated from protobuf field int64 freeable_size_bytes = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setFreeableSizeBytes($var) + { + GPBUtil::checkInt64($var); + $this->freeable_size_bytes = $var; + + return $this; + } + + /** + * Output only. For a backup in an incremental backup chain, this is the + * storage space needed to keep the data that has changed since the previous + * backup. For all other backups, this is always the size of the backup. This + * value may change if backups on the same chain get deleted or expired. + * This field can be used to calculate the total storage space used by a set + * of backups. For example, the total space used by all backups of a database + * can be computed by summing up this field. + * + * Generated from protobuf field int64 exclusive_size_bytes = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getExclusiveSizeBytes() + { + return $this->exclusive_size_bytes; + } + + /** + * Output only. For a backup in an incremental backup chain, this is the + * storage space needed to keep the data that has changed since the previous + * backup. For all other backups, this is always the size of the backup. This + * value may change if backups on the same chain get deleted or expired. + * This field can be used to calculate the total storage space used by a set + * of backups. For example, the total space used by all backups of a database + * can be computed by summing up this field. + * + * Generated from protobuf field int64 exclusive_size_bytes = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setExclusiveSizeBytes($var) + { + GPBUtil::checkInt64($var); + $this->exclusive_size_bytes = $var; + + return $this; + } + + /** + * Output only. The current state of the backup. + * + * Generated from protobuf field .google.spanner.admin.database.v1.Backup.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current state of the backup. + * + * Generated from protobuf field .google.spanner.admin.database.v1.Backup.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\Backup\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The names of the restored databases that reference the backup. + * The database names are of + * the form `projects//instances//databases/`. + * Referencing databases may exist in different instances. The existence of + * any referencing database prevents the backup from being deleted. When a + * restored database from the backup enters the `READY` state, the reference + * to the backup is removed. + * + * Generated from protobuf field repeated string referencing_databases = 7 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReferencingDatabases() + { + return $this->referencing_databases; + } + + /** + * Output only. The names of the restored databases that reference the backup. + * The database names are of + * the form `projects//instances//databases/`. + * Referencing databases may exist in different instances. The existence of + * any referencing database prevents the backup from being deleted. When a + * restored database from the backup enters the `READY` state, the reference + * to the backup is removed. + * + * Generated from protobuf field repeated string referencing_databases = 7 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReferencingDatabases($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->referencing_databases = $arr; + + return $this; + } + + /** + * Output only. The encryption information for the backup. + * + * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionInfo encryption_info = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo|null + */ + public function getEncryptionInfo() + { + return $this->encryption_info; + } + + public function hasEncryptionInfo() + { + return isset($this->encryption_info); + } + + public function clearEncryptionInfo() + { + unset($this->encryption_info); + } + + /** + * Output only. The encryption information for the backup. + * + * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionInfo encryption_info = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo $var + * @return $this + */ + public function setEncryptionInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo::class); + $this->encryption_info = $var; + + return $this; + } + + /** + * Output only. The encryption information for the backup, whether it is + * protected by one or more KMS keys. The information includes all Cloud + * KMS key versions used to encrypt the backup. The `encryption_status' field + * inside of each `EncryptionInfo` is not populated. At least one of the key + * versions must be available for the backup to be restored. If a key version + * is revoked in the middle of a restore, the restore behavior is undefined. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.EncryptionInfo encryption_information = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEncryptionInformation() + { + return $this->encryption_information; + } + + /** + * Output only. The encryption information for the backup, whether it is + * protected by one or more KMS keys. The information includes all Cloud + * KMS key versions used to encrypt the backup. The `encryption_status' field + * inside of each `EncryptionInfo` is not populated. At least one of the key + * versions must be available for the backup to be restored. If a key version + * is revoked in the middle of a restore, the restore behavior is undefined. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.EncryptionInfo encryption_information = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEncryptionInformation($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo::class); + $this->encryption_information = $arr; + + return $this; + } + + /** + * Output only. The database dialect information for the backup. + * + * Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getDatabaseDialect() + { + return $this->database_dialect; + } + + /** + * Output only. The database dialect information for the backup. + * + * Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setDatabaseDialect($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\DatabaseDialect::class); + $this->database_dialect = $var; + + return $this; + } + + /** + * Output only. The names of the destination backups being created by copying + * this source backup. The backup names are of the form + * `projects//instances//backups/`. + * Referencing backups may exist in different instances. The existence of + * any referencing backup prevents the backup from being deleted. When the + * copy operation is done (either successfully completed or cancelled or the + * destination backup is deleted), the reference to the backup is removed. + * + * Generated from protobuf field repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReferencingBackups() + { + return $this->referencing_backups; + } + + /** + * Output only. The names of the destination backups being created by copying + * this source backup. The backup names are of the form + * `projects//instances//backups/`. + * Referencing backups may exist in different instances. The existence of + * any referencing backup prevents the backup from being deleted. When the + * copy operation is done (either successfully completed or cancelled or the + * destination backup is deleted), the reference to the backup is removed. + * + * Generated from protobuf field repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReferencingBackups($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->referencing_backups = $arr; + + return $this; + } + + /** + * Output only. The max allowed expiration time of the backup, with + * microseconds granularity. A backup's expiration time can be configured in + * multiple APIs: CreateBackup, UpdateBackup, CopyBackup. When updating or + * copying an existing backup, the expiration time specified must be + * less than `Backup.max_expire_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp max_expire_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getMaxExpireTime() + { + return $this->max_expire_time; + } + + public function hasMaxExpireTime() + { + return isset($this->max_expire_time); + } + + public function clearMaxExpireTime() + { + unset($this->max_expire_time); + } + + /** + * Output only. The max allowed expiration time of the backup, with + * microseconds granularity. A backup's expiration time can be configured in + * multiple APIs: CreateBackup, UpdateBackup, CopyBackup. When updating or + * copying an existing backup, the expiration time specified must be + * less than `Backup.max_expire_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp max_expire_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setMaxExpireTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->max_expire_time = $var; + + return $this; + } + + /** + * Output only. List of backup schedule URIs that are associated with + * creating this backup. This is only applicable for scheduled backups, and + * is empty for on-demand backups. + * To optimize for storage, whenever possible, multiple schedules are + * collapsed together to create one backup. In such cases, this field captures + * the list of all backup schedule URIs that are associated with creating + * this backup. If collapsing is not done, then this field captures the + * single backup schedule URI associated with creating this backup. + * + * Generated from protobuf field repeated string backup_schedules = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBackupSchedules() + { + return $this->backup_schedules; + } + + /** + * Output only. List of backup schedule URIs that are associated with + * creating this backup. This is only applicable for scheduled backups, and + * is empty for on-demand backups. + * To optimize for storage, whenever possible, multiple schedules are + * collapsed together to create one backup. In such cases, this field captures + * the list of all backup schedule URIs that are associated with creating + * this backup. If collapsing is not done, then this field captures the + * single backup schedule URI associated with creating this backup. + * + * Generated from protobuf field repeated string backup_schedules = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBackupSchedules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->backup_schedules = $arr; + + return $this; + } + + /** + * Output only. Populated only for backups in an incremental backup chain. + * Backups share the same chain id if and only if they belong to the same + * incremental backup chain. Use this field to determine which backups are + * part of the same incremental backup chain. The ordering of backups in the + * chain can be determined by ordering the backup `version_time`. + * + * Generated from protobuf field string incremental_backup_chain_id = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getIncrementalBackupChainId() + { + return $this->incremental_backup_chain_id; + } + + /** + * Output only. Populated only for backups in an incremental backup chain. + * Backups share the same chain id if and only if they belong to the same + * incremental backup chain. Use this field to determine which backups are + * part of the same incremental backup chain. The ordering of backups in the + * chain can be determined by ordering the backup `version_time`. + * + * Generated from protobuf field string incremental_backup_chain_id = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setIncrementalBackupChainId($var) + { + GPBUtil::checkString($var, True); + $this->incremental_backup_chain_id = $var; + + return $this; + } + + /** + * Output only. Data deleted at a time older than this is guaranteed not to be + * retained in order to support this backup. For a backup in an incremental + * backup chain, this is the version time of the oldest backup that exists or + * ever existed in the chain. For all other backups, this is the version time + * of the backup. This field can be used to understand what data is being + * retained by the backup system. + * + * Generated from protobuf field .google.protobuf.Timestamp oldest_version_time = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getOldestVersionTime() + { + return $this->oldest_version_time; + } + + public function hasOldestVersionTime() + { + return isset($this->oldest_version_time); + } + + public function clearOldestVersionTime() + { + unset($this->oldest_version_time); + } + + /** + * Output only. Data deleted at a time older than this is guaranteed not to be + * retained in order to support this backup. For a backup in an incremental + * backup chain, this is the version time of the oldest backup that exists or + * ever existed in the chain. For all other backups, this is the version time + * of the backup. This field can be used to understand what data is being + * retained by the backup system. + * + * Generated from protobuf field .google.protobuf.Timestamp oldest_version_time = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setOldestVersionTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->oldest_version_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Backup/State.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Backup/State.php new file mode 100644 index 000000000000..18d79b35ac2d --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Backup/State.php @@ -0,0 +1,65 @@ +google.spanner.admin.database.v1.Backup.State + */ +class State +{ + /** + * Not specified. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The pending backup is still being created. Operations on the + * backup may fail with `FAILED_PRECONDITION` in this state. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The backup is complete and ready for use. + * + * Generated from protobuf enum READY = 2; + */ + const READY = 2; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::READY => 'READY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Spanner\Admin\Database\V1\Backup_State::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupInfo.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupInfo.php new file mode 100644 index 000000000000..301cdec6653a --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupInfo.php @@ -0,0 +1,213 @@ +google.spanner.admin.database.v1.BackupInfo + */ +class BackupInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the backup. + * + * Generated from protobuf field string backup = 1 [(.google.api.resource_reference) = { + */ + protected $backup = ''; + /** + * The backup contains an externally consistent copy of `source_database` at + * the timestamp specified by `version_time`. If the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * request did not specify `version_time`, the `version_time` of the backup is + * equivalent to the `create_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp version_time = 4; + */ + protected $version_time = null; + /** + * The time the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2; + */ + protected $create_time = null; + /** + * Name of the database the backup was created from. + * + * Generated from protobuf field string source_database = 3 [(.google.api.resource_reference) = { + */ + protected $source_database = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $backup + * Name of the backup. + * @type \Google\Protobuf\Timestamp $version_time + * The backup contains an externally consistent copy of `source_database` at + * the timestamp specified by `version_time`. If the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * request did not specify `version_time`, the `version_time` of the backup is + * equivalent to the `create_time`. + * @type \Google\Protobuf\Timestamp $create_time + * The time the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * request was received. + * @type string $source_database + * Name of the database the backup was created from. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); + parent::__construct($data); + } + + /** + * Name of the backup. + * + * Generated from protobuf field string backup = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getBackup() + { + return $this->backup; + } + + /** + * Name of the backup. + * + * Generated from protobuf field string backup = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkString($var, True); + $this->backup = $var; + + return $this; + } + + /** + * The backup contains an externally consistent copy of `source_database` at + * the timestamp specified by `version_time`. If the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * request did not specify `version_time`, the `version_time` of the backup is + * equivalent to the `create_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp version_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getVersionTime() + { + return $this->version_time; + } + + public function hasVersionTime() + { + return isset($this->version_time); + } + + public function clearVersionTime() + { + unset($this->version_time); + } + + /** + * The backup contains an externally consistent copy of `source_database` at + * the timestamp specified by `version_time`. If the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * request did not specify `version_time`, the `version_time` of the backup is + * equivalent to the `create_time`. + * + * Generated from protobuf field .google.protobuf.Timestamp version_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setVersionTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->version_time = $var; + + return $this; + } + + /** + * The time the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * The time the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Name of the database the backup was created from. + * + * Generated from protobuf field string source_database = 3 [(.google.api.resource_reference) = { + * @return string + */ + public function getSourceDatabase() + { + return $this->source_database; + } + + /** + * Name of the database the backup was created from. + * + * Generated from protobuf field string source_database = 3 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSourceDatabase($var) + { + GPBUtil::checkString($var, True); + $this->source_database = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupSchedule.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupSchedule.php new file mode 100644 index 000000000000..4e438c2b75a1 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupSchedule.php @@ -0,0 +1,380 @@ +google.spanner.admin.database.v1.BackupSchedule + */ +class BackupSchedule extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. Output only for the + * [CreateBackupSchedule][DatabaseAdmin.CreateBackupSchededule] operation. + * Required for the + * [UpdateBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule] + * operation. A globally unique identifier for the backup schedule which + * cannot be changed. Values are of the form + * `projects//instances//databases//backupSchedules/[a-z][a-z0-9_\-]*[a-z0-9]` + * The final segment of the name must be between 2 and 60 characters in + * length. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Optional. The schedule specification based on which the backup creations + * are triggered. + * + * Generated from protobuf field .google.spanner.admin.database.v1.BackupScheduleSpec spec = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $spec = null; + /** + * Optional. The retention duration of a backup that must be at least 6 hours + * and at most 366 days. The backup is eligible to be automatically deleted + * once the retention period has elapsed. + * + * Generated from protobuf field .google.protobuf.Duration retention_duration = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $retention_duration = null; + /** + * Optional. The encryption configuration that will be used to encrypt the + * backup. If this field is not specified, the backup will use the same + * encryption configuration as the database. + * + * Generated from protobuf field .google.spanner.admin.database.v1.CreateBackupEncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $encryption_config = null; + /** + * Output only. The timestamp at which the schedule was last updated. + * If the schedule has never been updated, this field contains the timestamp + * when the schedule was first created. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + protected $backup_type_spec; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. Output only for the + * [CreateBackupSchedule][DatabaseAdmin.CreateBackupSchededule] operation. + * Required for the + * [UpdateBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule] + * operation. A globally unique identifier for the backup schedule which + * cannot be changed. Values are of the form + * `projects//instances//databases//backupSchedules/[a-z][a-z0-9_\-]*[a-z0-9]` + * The final segment of the name must be between 2 and 60 characters in + * length. + * @type \Google\Cloud\Spanner\Admin\Database\V1\BackupScheduleSpec $spec + * Optional. The schedule specification based on which the backup creations + * are triggered. + * @type \Google\Protobuf\Duration $retention_duration + * Optional. The retention duration of a backup that must be at least 6 hours + * and at most 366 days. The backup is eligible to be automatically deleted + * once the retention period has elapsed. + * @type \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig $encryption_config + * Optional. The encryption configuration that will be used to encrypt the + * backup. If this field is not specified, the backup will use the same + * encryption configuration as the database. + * @type \Google\Cloud\Spanner\Admin\Database\V1\FullBackupSpec $full_backup_spec + * The schedule creates only full backups. + * @type \Google\Cloud\Spanner\Admin\Database\V1\IncrementalBackupSpec $incremental_backup_spec + * The schedule creates incremental backup chains. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The timestamp at which the schedule was last updated. + * If the schedule has never been updated, this field contains the timestamp + * when the schedule was first created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. Output only for the + * [CreateBackupSchedule][DatabaseAdmin.CreateBackupSchededule] operation. + * Required for the + * [UpdateBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule] + * operation. A globally unique identifier for the backup schedule which + * cannot be changed. Values are of the form + * `projects//instances//databases//backupSchedules/[a-z][a-z0-9_\-]*[a-z0-9]` + * The final segment of the name must be between 2 and 60 characters in + * length. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. Output only for the + * [CreateBackupSchedule][DatabaseAdmin.CreateBackupSchededule] operation. + * Required for the + * [UpdateBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule] + * operation. A globally unique identifier for the backup schedule which + * cannot be changed. Values are of the form + * `projects//instances//databases//backupSchedules/[a-z][a-z0-9_\-]*[a-z0-9]` + * The final segment of the name must be between 2 and 60 characters in + * length. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. The schedule specification based on which the backup creations + * are triggered. + * + * Generated from protobuf field .google.spanner.admin.database.v1.BackupScheduleSpec spec = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Spanner\Admin\Database\V1\BackupScheduleSpec|null + */ + public function getSpec() + { + return $this->spec; + } + + public function hasSpec() + { + return isset($this->spec); + } + + public function clearSpec() + { + unset($this->spec); + } + + /** + * Optional. The schedule specification based on which the backup creations + * are triggered. + * + * Generated from protobuf field .google.spanner.admin.database.v1.BackupScheduleSpec spec = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Spanner\Admin\Database\V1\BackupScheduleSpec $var + * @return $this + */ + public function setSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\BackupScheduleSpec::class); + $this->spec = $var; + + return $this; + } + + /** + * Optional. The retention duration of a backup that must be at least 6 hours + * and at most 366 days. The backup is eligible to be automatically deleted + * once the retention period has elapsed. + * + * Generated from protobuf field .google.protobuf.Duration retention_duration = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Duration|null + */ + public function getRetentionDuration() + { + return $this->retention_duration; + } + + public function hasRetentionDuration() + { + return isset($this->retention_duration); + } + + public function clearRetentionDuration() + { + unset($this->retention_duration); + } + + /** + * Optional. The retention duration of a backup that must be at least 6 hours + * and at most 366 days. The backup is eligible to be automatically deleted + * once the retention period has elapsed. + * + * Generated from protobuf field .google.protobuf.Duration retention_duration = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setRetentionDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->retention_duration = $var; + + return $this; + } + + /** + * Optional. The encryption configuration that will be used to encrypt the + * backup. If this field is not specified, the backup will use the same + * encryption configuration as the database. + * + * Generated from protobuf field .google.spanner.admin.database.v1.CreateBackupEncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig|null + */ + public function getEncryptionConfig() + { + return $this->encryption_config; + } + + public function hasEncryptionConfig() + { + return isset($this->encryption_config); + } + + public function clearEncryptionConfig() + { + unset($this->encryption_config); + } + + /** + * Optional. The encryption configuration that will be used to encrypt the + * backup. If this field is not specified, the backup will use the same + * encryption configuration as the database. + * + * Generated from protobuf field .google.spanner.admin.database.v1.CreateBackupEncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig $var + * @return $this + */ + public function setEncryptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig::class); + $this->encryption_config = $var; + + return $this; + } + + /** + * The schedule creates only full backups. + * + * Generated from protobuf field .google.spanner.admin.database.v1.FullBackupSpec full_backup_spec = 7; + * @return \Google\Cloud\Spanner\Admin\Database\V1\FullBackupSpec|null + */ + public function getFullBackupSpec() + { + return $this->readOneof(7); + } + + public function hasFullBackupSpec() + { + return $this->hasOneof(7); + } + + /** + * The schedule creates only full backups. + * + * Generated from protobuf field .google.spanner.admin.database.v1.FullBackupSpec full_backup_spec = 7; + * @param \Google\Cloud\Spanner\Admin\Database\V1\FullBackupSpec $var + * @return $this + */ + public function setFullBackupSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\FullBackupSpec::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * The schedule creates incremental backup chains. + * + * Generated from protobuf field .google.spanner.admin.database.v1.IncrementalBackupSpec incremental_backup_spec = 8; + * @return \Google\Cloud\Spanner\Admin\Database\V1\IncrementalBackupSpec|null + */ + public function getIncrementalBackupSpec() + { + return $this->readOneof(8); + } + + public function hasIncrementalBackupSpec() + { + return $this->hasOneof(8); + } + + /** + * The schedule creates incremental backup chains. + * + * Generated from protobuf field .google.spanner.admin.database.v1.IncrementalBackupSpec incremental_backup_spec = 8; + * @param \Google\Cloud\Spanner\Admin\Database\V1\IncrementalBackupSpec $var + * @return $this + */ + public function setIncrementalBackupSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\IncrementalBackupSpec::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * Output only. The timestamp at which the schedule was last updated. + * If the schedule has never been updated, this field contains the timestamp + * when the schedule was first created. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The timestamp at which the schedule was last updated. + * If the schedule has never been updated, this field contains the timestamp + * when the schedule was first created. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * @return string + */ + public function getBackupTypeSpec() + { + return $this->whichOneof("backup_type_spec"); + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupScheduleSpec.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupScheduleSpec.php new file mode 100644 index 000000000000..b78eef7af97d --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupScheduleSpec.php @@ -0,0 +1,75 @@ +google.spanner.admin.database.v1.BackupScheduleSpec + */ +class BackupScheduleSpec extends \Google\Protobuf\Internal\Message +{ + protected $schedule_spec; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\Admin\Database\V1\CrontabSpec $cron_spec + * Cron style schedule specification. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); + parent::__construct($data); + } + + /** + * Cron style schedule specification. + * + * Generated from protobuf field .google.spanner.admin.database.v1.CrontabSpec cron_spec = 1; + * @return \Google\Cloud\Spanner\Admin\Database\V1\CrontabSpec|null + */ + public function getCronSpec() + { + return $this->readOneof(1); + } + + public function hasCronSpec() + { + return $this->hasOneof(1); + } + + /** + * Cron style schedule specification. + * + * Generated from protobuf field .google.spanner.admin.database.v1.CrontabSpec cron_spec = 1; + * @param \Google\Cloud\Spanner\Admin\Database\V1\CrontabSpec $var + * @return $this + */ + public function setCronSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\CrontabSpec::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getScheduleSpec() + { + return $this->whichOneof("schedule_spec"); + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupEncryptionConfig.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupEncryptionConfig.php new file mode 100644 index 000000000000..07325d77c3d1 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupEncryptionConfig.php @@ -0,0 +1,207 @@ +google.spanner.admin.database.v1.CopyBackupEncryptionConfig + */ +class CopyBackupEncryptionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The encryption type of the backup. + * + * Generated from protobuf field .google.spanner.admin.database.v1.CopyBackupEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $encryption_type = 0; + /** + * Optional. The Cloud KMS key that will be used to protect the backup. + * This field should be set only when + * [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] + * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $kms_key_name = ''; + /** + * Optional. Specifies the KMS configuration for the one or more keys used to + * protect the backup. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * Kms keys specified can be in any order. + * The keys referenced by kms_key_names must fully cover all + * regions of the backup's instance configuration. Some examples: + * * For single region instance configs, specify a single regional + * location KMS key. + * * For multi-regional instance configs of type GOOGLE_MANAGED, + * either specify a multi-regional location KMS key or multiple regional + * location KMS keys that cover all regions in the instance config. + * * For an instance config of type USER_MANAGED, please specify only + * regional location KMS keys to cover each region in the instance config. + * Multi-regional location KMS keys are not supported for USER_MANAGED + * instance configs. + * + * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + private $kms_key_names; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $encryption_type + * Required. The encryption type of the backup. + * @type string $kms_key_name + * Optional. The Cloud KMS key that will be used to protect the backup. + * This field should be set only when + * [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] + * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * @type array|\Google\Protobuf\Internal\RepeatedField $kms_key_names + * Optional. Specifies the KMS configuration for the one or more keys used to + * protect the backup. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * Kms keys specified can be in any order. + * The keys referenced by kms_key_names must fully cover all + * regions of the backup's instance configuration. Some examples: + * * For single region instance configs, specify a single regional + * location KMS key. + * * For multi-regional instance configs of type GOOGLE_MANAGED, + * either specify a multi-regional location KMS key or multiple regional + * location KMS keys that cover all regions in the instance config. + * * For an instance config of type USER_MANAGED, please specify only + * regional location KMS keys to cover each region in the instance config. + * Multi-regional location KMS keys are not supported for USER_MANAGED + * instance configs. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The encryption type of the backup. + * + * Generated from protobuf field .google.spanner.admin.database.v1.CopyBackupEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getEncryptionType() + { + return $this->encryption_type; + } + + /** + * Required. The encryption type of the backup. + * + * Generated from protobuf field .google.spanner.admin.database.v1.CopyBackupEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setEncryptionType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\CopyBackupEncryptionConfig\EncryptionType::class); + $this->encryption_type = $var; + + return $this; + } + + /** + * Optional. The Cloud KMS key that will be used to protect the backup. + * This field should be set only when + * [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] + * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getKmsKeyName() + { + return $this->kms_key_name; + } + + /** + * Optional. The Cloud KMS key that will be used to protect the backup. + * This field should be set only when + * [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] + * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setKmsKeyName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_name = $var; + + return $this; + } + + /** + * Optional. Specifies the KMS configuration for the one or more keys used to + * protect the backup. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * Kms keys specified can be in any order. + * The keys referenced by kms_key_names must fully cover all + * regions of the backup's instance configuration. Some examples: + * * For single region instance configs, specify a single regional + * location KMS key. + * * For multi-regional instance configs of type GOOGLE_MANAGED, + * either specify a multi-regional location KMS key or multiple regional + * location KMS keys that cover all regions in the instance config. + * * For an instance config of type USER_MANAGED, please specify only + * regional location KMS keys to cover each region in the instance config. + * Multi-regional location KMS keys are not supported for USER_MANAGED + * instance configs. + * + * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getKmsKeyNames() + { + return $this->kms_key_names; + } + + /** + * Optional. Specifies the KMS configuration for the one or more keys used to + * protect the backup. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * Kms keys specified can be in any order. + * The keys referenced by kms_key_names must fully cover all + * regions of the backup's instance configuration. Some examples: + * * For single region instance configs, specify a single regional + * location KMS key. + * * For multi-regional instance configs of type GOOGLE_MANAGED, + * either specify a multi-regional location KMS key or multiple regional + * location KMS keys that cover all regions in the instance config. + * * For an instance config of type USER_MANAGED, please specify only + * regional location KMS keys to cover each region in the instance config. + * Multi-regional location KMS keys are not supported for USER_MANAGED + * instance configs. + * + * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setKmsKeyNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->kms_key_names = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupEncryptionConfig/EncryptionType.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupEncryptionConfig/EncryptionType.php new file mode 100644 index 000000000000..56fa3e3beb2b --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupEncryptionConfig/EncryptionType.php @@ -0,0 +1,78 @@ +google.spanner.admin.database.v1.CopyBackupEncryptionConfig.EncryptionType + */ +class EncryptionType +{ + /** + * Unspecified. Do not use. + * + * Generated from protobuf enum ENCRYPTION_TYPE_UNSPECIFIED = 0; + */ + const ENCRYPTION_TYPE_UNSPECIFIED = 0; + /** + * This is the default option for + * [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup] + * when + * [encryption_config][google.spanner.admin.database.v1.CopyBackupEncryptionConfig] + * is not specified. For example, if the source backup is using + * `Customer_Managed_Encryption`, the backup will be using the same Cloud + * KMS key as the source backup. + * + * Generated from protobuf enum USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION = 1; + */ + const USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION = 1; + /** + * Use Google default encryption. + * + * Generated from protobuf enum GOOGLE_DEFAULT_ENCRYPTION = 2; + */ + const GOOGLE_DEFAULT_ENCRYPTION = 2; + /** + * Use customer managed encryption. If specified, either `kms_key_name` or + * `kms_key_names` must contain valid Cloud KMS key(s). + * + * Generated from protobuf enum CUSTOMER_MANAGED_ENCRYPTION = 3; + */ + const CUSTOMER_MANAGED_ENCRYPTION = 3; + + private static $valueToName = [ + self::ENCRYPTION_TYPE_UNSPECIFIED => 'ENCRYPTION_TYPE_UNSPECIFIED', + self::USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION => 'USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION', + self::GOOGLE_DEFAULT_ENCRYPTION => 'GOOGLE_DEFAULT_ENCRYPTION', + self::CUSTOMER_MANAGED_ENCRYPTION => 'CUSTOMER_MANAGED_ENCRYPTION', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(EncryptionType::class, \Google\Cloud\Spanner\Admin\Database\V1\CopyBackupEncryptionConfig_EncryptionType::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupMetadata.php new file mode 100644 index 000000000000..833787dae626 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupMetadata.php @@ -0,0 +1,258 @@ +google.spanner.admin.database.v1.CopyBackupMetadata + */ +class CopyBackupMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the backup being created through the copy operation. + * Values are of the form + * `projects//instances//backups/`. + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The name of the source backup that is being copied. + * Values are of the form + * `projects//instances//backups/`. + * + * Generated from protobuf field string source_backup = 2 [(.google.api.resource_reference) = { + */ + protected $source_backup = ''; + /** + * The progress of the + * [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup] + * operation. + * + * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 3; + */ + protected $progress = null; + /** + * The time at which cancellation of CopyBackup operation was received. + * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] + * starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not guaranteed. + * Clients can use + * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an [Operation.error][google.longrunning.Operation.error] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 4; + */ + protected $cancel_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the backup being created through the copy operation. + * Values are of the form + * `projects//instances//backups/`. + * @type string $source_backup + * The name of the source backup that is being copied. + * Values are of the form + * `projects//instances//backups/`. + * @type \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress $progress + * The progress of the + * [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup] + * operation. + * @type \Google\Protobuf\Timestamp $cancel_time + * The time at which cancellation of CopyBackup operation was received. + * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] + * starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not guaranteed. + * Clients can use + * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an [Operation.error][google.longrunning.Operation.error] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); + parent::__construct($data); + } + + /** + * The name of the backup being created through the copy operation. + * Values are of the form + * `projects//instances//backups/`. + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the backup being created through the copy operation. + * Values are of the form + * `projects//instances//backups/`. + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The name of the source backup that is being copied. + * Values are of the form + * `projects//instances//backups/`. + * + * Generated from protobuf field string source_backup = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getSourceBackup() + { + return $this->source_backup; + } + + /** + * The name of the source backup that is being copied. + * Values are of the form + * `projects//instances//backups/`. + * + * Generated from protobuf field string source_backup = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSourceBackup($var) + { + GPBUtil::checkString($var, True); + $this->source_backup = $var; + + return $this; + } + + /** + * The progress of the + * [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup] + * operation. + * + * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 3; + * @return \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress|null + */ + public function getProgress() + { + return $this->progress; + } + + public function hasProgress() + { + return isset($this->progress); + } + + public function clearProgress() + { + unset($this->progress); + } + + /** + * The progress of the + * [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup] + * operation. + * + * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 3; + * @param \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress $var + * @return $this + */ + public function setProgress($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress::class); + $this->progress = $var; + + return $this; + } + + /** + * The time at which cancellation of CopyBackup operation was received. + * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] + * starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not guaranteed. + * Clients can use + * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an [Operation.error][google.longrunning.Operation.error] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCancelTime() + { + return $this->cancel_time; + } + + public function hasCancelTime() + { + return isset($this->cancel_time); + } + + public function clearCancelTime() + { + unset($this->cancel_time); + } + + /** + * The time at which cancellation of CopyBackup operation was received. + * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] + * starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not guaranteed. + * Clients can use + * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an [Operation.error][google.longrunning.Operation.error] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCancelTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->cancel_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupRequest.php new file mode 100644 index 000000000000..8a80683e54fa --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupRequest.php @@ -0,0 +1,321 @@ +google.spanner.admin.database.v1.CopyBackupRequest + */ +class CopyBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the destination instance that will contain the backup + * copy. Values are of the form: `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The id of the backup copy. + * The `backup_id` appended to `parent` forms the full backup_uri of the form + * `projects//instances//backups/`. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup_id = ''; + /** + * Required. The source backup to be copied. + * The source backup needs to be in READY state for it to be copied. + * Once CopyBackup is in progress, the source backup cannot be deleted or + * cleaned up on expiration until CopyBackup is finished. + * Values are of the form: + * `projects//instances//backups/`. + * + * Generated from protobuf field string source_backup = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $source_backup = ''; + /** + * Required. The expiration time of the backup in microsecond granularity. + * The expiration time must be at least 6 hours and at most 366 days + * from the `create_time` of the source backup. Once the `expire_time` has + * passed, the backup is eligible to be automatically deleted by Cloud Spanner + * to free the resources used by the backup. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $expire_time = null; + /** + * Optional. The encryption configuration used to encrypt the backup. If this + * field is not specified, the backup will use the same encryption + * configuration as the source backup by default, namely + * [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] + * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`. + * + * Generated from protobuf field .google.spanner.admin.database.v1.CopyBackupEncryptionConfig encryption_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $encryption_config = null; + + /** + * @param string $parent Required. The name of the destination instance that will contain the backup + * copy. Values are of the form: `projects//instances/`. Please see + * {@see DatabaseAdminClient::instanceName()} for help formatting this field. + * @param string $backupId Required. The id of the backup copy. + * The `backup_id` appended to `parent` forms the full backup_uri of the form + * `projects//instances//backups/`. + * @param string $sourceBackup Required. The source backup to be copied. + * The source backup needs to be in READY state for it to be copied. + * Once CopyBackup is in progress, the source backup cannot be deleted or + * cleaned up on expiration until CopyBackup is finished. + * Values are of the form: + * `projects//instances//backups/`. Please see + * {@see DatabaseAdminClient::backupName()} for help formatting this field. + * @param \Google\Protobuf\Timestamp $expireTime Required. The expiration time of the backup in microsecond granularity. + * The expiration time must be at least 6 hours and at most 366 days + * from the `create_time` of the source backup. Once the `expire_time` has + * passed, the backup is eligible to be automatically deleted by Cloud Spanner + * to free the resources used by the backup. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\CopyBackupRequest + * + * @experimental + */ + public static function build(string $parent, string $backupId, string $sourceBackup, \Google\Protobuf\Timestamp $expireTime): self + { + return (new self()) + ->setParent($parent) + ->setBackupId($backupId) + ->setSourceBackup($sourceBackup) + ->setExpireTime($expireTime); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the destination instance that will contain the backup + * copy. Values are of the form: `projects//instances/`. + * @type string $backup_id + * Required. The id of the backup copy. + * The `backup_id` appended to `parent` forms the full backup_uri of the form + * `projects//instances//backups/`. + * @type string $source_backup + * Required. The source backup to be copied. + * The source backup needs to be in READY state for it to be copied. + * Once CopyBackup is in progress, the source backup cannot be deleted or + * cleaned up on expiration until CopyBackup is finished. + * Values are of the form: + * `projects//instances//backups/`. + * @type \Google\Protobuf\Timestamp $expire_time + * Required. The expiration time of the backup in microsecond granularity. + * The expiration time must be at least 6 hours and at most 366 days + * from the `create_time` of the source backup. Once the `expire_time` has + * passed, the backup is eligible to be automatically deleted by Cloud Spanner + * to free the resources used by the backup. + * @type \Google\Cloud\Spanner\Admin\Database\V1\CopyBackupEncryptionConfig $encryption_config + * Optional. The encryption configuration used to encrypt the backup. If this + * field is not specified, the backup will use the same encryption + * configuration as the source backup by default, namely + * [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] + * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the destination instance that will contain the backup + * copy. Values are of the form: `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The name of the destination instance that will contain the backup + * copy. Values are of the form: `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The id of the backup copy. + * The `backup_id` appended to `parent` forms the full backup_uri of the form + * `projects//instances//backups/`. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getBackupId() + { + return $this->backup_id; + } + + /** + * Required. The id of the backup copy. + * The `backup_id` appended to `parent` forms the full backup_uri of the form + * `projects//instances//backups/`. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setBackupId($var) + { + GPBUtil::checkString($var, True); + $this->backup_id = $var; + + return $this; + } + + /** + * Required. The source backup to be copied. + * The source backup needs to be in READY state for it to be copied. + * Once CopyBackup is in progress, the source backup cannot be deleted or + * cleaned up on expiration until CopyBackup is finished. + * Values are of the form: + * `projects//instances//backups/`. + * + * Generated from protobuf field string source_backup = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSourceBackup() + { + return $this->source_backup; + } + + /** + * Required. The source backup to be copied. + * The source backup needs to be in READY state for it to be copied. + * Once CopyBackup is in progress, the source backup cannot be deleted or + * cleaned up on expiration until CopyBackup is finished. + * Values are of the form: + * `projects//instances//backups/`. + * + * Generated from protobuf field string source_backup = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSourceBackup($var) + { + GPBUtil::checkString($var, True); + $this->source_backup = $var; + + return $this; + } + + /** + * Required. The expiration time of the backup in microsecond granularity. + * The expiration time must be at least 6 hours and at most 366 days + * from the `create_time` of the source backup. Once the `expire_time` has + * passed, the backup is eligible to be automatically deleted by Cloud Spanner + * to free the resources used by the backup. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExpireTime() + { + return $this->expire_time; + } + + public function hasExpireTime() + { + return isset($this->expire_time); + } + + public function clearExpireTime() + { + unset($this->expire_time); + } + + /** + * Required. The expiration time of the backup in microsecond granularity. + * The expiration time must be at least 6 hours and at most 366 days + * from the `create_time` of the source backup. Once the `expire_time` has + * passed, the backup is eligible to be automatically deleted by Cloud Spanner + * to free the resources used by the backup. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExpireTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->expire_time = $var; + + return $this; + } + + /** + * Optional. The encryption configuration used to encrypt the backup. If this + * field is not specified, the backup will use the same encryption + * configuration as the source backup by default, namely + * [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] + * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`. + * + * Generated from protobuf field .google.spanner.admin.database.v1.CopyBackupEncryptionConfig encryption_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Spanner\Admin\Database\V1\CopyBackupEncryptionConfig|null + */ + public function getEncryptionConfig() + { + return $this->encryption_config; + } + + public function hasEncryptionConfig() + { + return isset($this->encryption_config); + } + + public function clearEncryptionConfig() + { + unset($this->encryption_config); + } + + /** + * Optional. The encryption configuration used to encrypt the backup. If this + * field is not specified, the backup will use the same encryption + * configuration as the source backup by default, namely + * [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] + * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`. + * + * Generated from protobuf field .google.spanner.admin.database.v1.CopyBackupEncryptionConfig encryption_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Spanner\Admin\Database\V1\CopyBackupEncryptionConfig $var + * @return $this + */ + public function setEncryptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\CopyBackupEncryptionConfig::class); + $this->encryption_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupEncryptionConfig.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupEncryptionConfig.php new file mode 100644 index 000000000000..40ec928a4b04 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupEncryptionConfig.php @@ -0,0 +1,203 @@ +google.spanner.admin.database.v1.CreateBackupEncryptionConfig + */ +class CreateBackupEncryptionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The encryption type of the backup. + * + * Generated from protobuf field .google.spanner.admin.database.v1.CreateBackupEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $encryption_type = 0; + /** + * Optional. The Cloud KMS key that will be used to protect the backup. + * This field should be set only when + * [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type] + * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $kms_key_name = ''; + /** + * Optional. Specifies the KMS configuration for the one or more keys used to + * protect the backup. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * The keys referenced by kms_key_names must fully cover all + * regions of the backup's instance configuration. Some examples: + * * For single region instance configs, specify a single regional + * location KMS key. + * * For multi-regional instance configs of type GOOGLE_MANAGED, + * either specify a multi-regional location KMS key or multiple regional + * location KMS keys that cover all regions in the instance config. + * * For an instance config of type USER_MANAGED, please specify only + * regional location KMS keys to cover each region in the instance config. + * Multi-regional location KMS keys are not supported for USER_MANAGED + * instance configs. + * + * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + private $kms_key_names; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $encryption_type + * Required. The encryption type of the backup. + * @type string $kms_key_name + * Optional. The Cloud KMS key that will be used to protect the backup. + * This field should be set only when + * [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type] + * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * @type array|\Google\Protobuf\Internal\RepeatedField $kms_key_names + * Optional. Specifies the KMS configuration for the one or more keys used to + * protect the backup. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * The keys referenced by kms_key_names must fully cover all + * regions of the backup's instance configuration. Some examples: + * * For single region instance configs, specify a single regional + * location KMS key. + * * For multi-regional instance configs of type GOOGLE_MANAGED, + * either specify a multi-regional location KMS key or multiple regional + * location KMS keys that cover all regions in the instance config. + * * For an instance config of type USER_MANAGED, please specify only + * regional location KMS keys to cover each region in the instance config. + * Multi-regional location KMS keys are not supported for USER_MANAGED + * instance configs. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The encryption type of the backup. + * + * Generated from protobuf field .google.spanner.admin.database.v1.CreateBackupEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getEncryptionType() + { + return $this->encryption_type; + } + + /** + * Required. The encryption type of the backup. + * + * Generated from protobuf field .google.spanner.admin.database.v1.CreateBackupEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setEncryptionType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig\EncryptionType::class); + $this->encryption_type = $var; + + return $this; + } + + /** + * Optional. The Cloud KMS key that will be used to protect the backup. + * This field should be set only when + * [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type] + * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getKmsKeyName() + { + return $this->kms_key_name; + } + + /** + * Optional. The Cloud KMS key that will be used to protect the backup. + * This field should be set only when + * [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type] + * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setKmsKeyName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_name = $var; + + return $this; + } + + /** + * Optional. Specifies the KMS configuration for the one or more keys used to + * protect the backup. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * The keys referenced by kms_key_names must fully cover all + * regions of the backup's instance configuration. Some examples: + * * For single region instance configs, specify a single regional + * location KMS key. + * * For multi-regional instance configs of type GOOGLE_MANAGED, + * either specify a multi-regional location KMS key or multiple regional + * location KMS keys that cover all regions in the instance config. + * * For an instance config of type USER_MANAGED, please specify only + * regional location KMS keys to cover each region in the instance config. + * Multi-regional location KMS keys are not supported for USER_MANAGED + * instance configs. + * + * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getKmsKeyNames() + { + return $this->kms_key_names; + } + + /** + * Optional. Specifies the KMS configuration for the one or more keys used to + * protect the backup. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * The keys referenced by kms_key_names must fully cover all + * regions of the backup's instance configuration. Some examples: + * * For single region instance configs, specify a single regional + * location KMS key. + * * For multi-regional instance configs of type GOOGLE_MANAGED, + * either specify a multi-regional location KMS key or multiple regional + * location KMS keys that cover all regions in the instance config. + * * For an instance config of type USER_MANAGED, please specify only + * regional location KMS keys to cover each region in the instance config. + * Multi-regional location KMS keys are not supported for USER_MANAGED + * instance configs. + * + * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setKmsKeyNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->kms_key_names = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupEncryptionConfig/EncryptionType.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupEncryptionConfig/EncryptionType.php new file mode 100644 index 000000000000..be6e5fb5ea47 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupEncryptionConfig/EncryptionType.php @@ -0,0 +1,77 @@ +google.spanner.admin.database.v1.CreateBackupEncryptionConfig.EncryptionType + */ +class EncryptionType +{ + /** + * Unspecified. Do not use. + * + * Generated from protobuf enum ENCRYPTION_TYPE_UNSPECIFIED = 0; + */ + const ENCRYPTION_TYPE_UNSPECIFIED = 0; + /** + * Use the same encryption configuration as the database. This is the + * default option when + * [encryption_config][google.spanner.admin.database.v1.CreateBackupEncryptionConfig] + * is empty. For example, if the database is using + * `Customer_Managed_Encryption`, the backup will be using the same Cloud + * KMS key as the database. + * + * Generated from protobuf enum USE_DATABASE_ENCRYPTION = 1; + */ + const USE_DATABASE_ENCRYPTION = 1; + /** + * Use Google default encryption. + * + * Generated from protobuf enum GOOGLE_DEFAULT_ENCRYPTION = 2; + */ + const GOOGLE_DEFAULT_ENCRYPTION = 2; + /** + * Use customer managed encryption. If specified, `kms_key_name` + * must contain a valid Cloud KMS key. + * + * Generated from protobuf enum CUSTOMER_MANAGED_ENCRYPTION = 3; + */ + const CUSTOMER_MANAGED_ENCRYPTION = 3; + + private static $valueToName = [ + self::ENCRYPTION_TYPE_UNSPECIFIED => 'ENCRYPTION_TYPE_UNSPECIFIED', + self::USE_DATABASE_ENCRYPTION => 'USE_DATABASE_ENCRYPTION', + self::GOOGLE_DEFAULT_ENCRYPTION => 'GOOGLE_DEFAULT_ENCRYPTION', + self::CUSTOMER_MANAGED_ENCRYPTION => 'CUSTOMER_MANAGED_ENCRYPTION', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(EncryptionType::class, \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig_EncryptionType::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupMetadata.php new file mode 100644 index 000000000000..04df2f570b43 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupMetadata.php @@ -0,0 +1,242 @@ +google.spanner.admin.database.v1.CreateBackupMetadata + */ +class CreateBackupMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the backup being created. + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The name of the database the backup is created from. + * + * Generated from protobuf field string database = 2 [(.google.api.resource_reference) = { + */ + protected $database = ''; + /** + * The progress of the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * operation. + * + * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 3; + */ + protected $progress = null; + /** + * The time at which cancellation of this operation was received. + * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] + * starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not guaranteed. + * Clients can use + * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an [Operation.error][google.longrunning.Operation.error] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 4; + */ + protected $cancel_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the backup being created. + * @type string $database + * The name of the database the backup is created from. + * @type \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress $progress + * The progress of the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * operation. + * @type \Google\Protobuf\Timestamp $cancel_time + * The time at which cancellation of this operation was received. + * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] + * starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not guaranteed. + * Clients can use + * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an [Operation.error][google.longrunning.Operation.error] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); + parent::__construct($data); + } + + /** + * The name of the backup being created. + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the backup being created. + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The name of the database the backup is created from. + * + * Generated from protobuf field string database = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getDatabase() + { + return $this->database; + } + + /** + * The name of the database the backup is created from. + * + * Generated from protobuf field string database = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDatabase($var) + { + GPBUtil::checkString($var, True); + $this->database = $var; + + return $this; + } + + /** + * The progress of the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * operation. + * + * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 3; + * @return \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress|null + */ + public function getProgress() + { + return $this->progress; + } + + public function hasProgress() + { + return isset($this->progress); + } + + public function clearProgress() + { + unset($this->progress); + } + + /** + * The progress of the + * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] + * operation. + * + * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 3; + * @param \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress $var + * @return $this + */ + public function setProgress($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress::class); + $this->progress = $var; + + return $this; + } + + /** + * The time at which cancellation of this operation was received. + * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] + * starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not guaranteed. + * Clients can use + * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an [Operation.error][google.longrunning.Operation.error] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCancelTime() + { + return $this->cancel_time; + } + + public function hasCancelTime() + { + return isset($this->cancel_time); + } + + public function clearCancelTime() + { + unset($this->cancel_time); + } + + /** + * The time at which cancellation of this operation was received. + * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] + * starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not guaranteed. + * Clients can use + * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an [Operation.error][google.longrunning.Operation.error] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, + * corresponding to `Code.CANCELLED`. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCancelTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->cancel_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupRequest.php new file mode 100644 index 000000000000..9c216c980f6f --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupRequest.php @@ -0,0 +1,259 @@ +google.spanner.admin.database.v1.CreateBackupRequest + */ +class CreateBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the instance in which the backup will be + * created. This must be the same instance that contains the database the + * backup will be created from. The backup will be stored in the + * location(s) specified in the instance configuration of this + * instance. Values are of the form + * `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The id of the backup to be created. The `backup_id` appended to + * `parent` forms the full backup name of the form + * `projects//instances//backups/`. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup_id = ''; + /** + * Required. The backup to create. + * + * Generated from protobuf field .google.spanner.admin.database.v1.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup = null; + /** + * Optional. The encryption configuration used to encrypt the backup. If this + * field is not specified, the backup will use the same encryption + * configuration as the database by default, namely + * [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type] + * = `USE_DATABASE_ENCRYPTION`. + * + * Generated from protobuf field .google.spanner.admin.database.v1.CreateBackupEncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $encryption_config = null; + + /** + * @param string $parent Required. The name of the instance in which the backup will be + * created. This must be the same instance that contains the database the + * backup will be created from. The backup will be stored in the + * location(s) specified in the instance configuration of this + * instance. Values are of the form + * `projects//instances/`. Please see + * {@see DatabaseAdminClient::instanceName()} for help formatting this field. + * @param \Google\Cloud\Spanner\Admin\Database\V1\Backup $backup Required. The backup to create. + * @param string $backupId Required. The id of the backup to be created. The `backup_id` appended to + * `parent` forms the full backup name of the form + * `projects//instances//backups/`. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Spanner\Admin\Database\V1\Backup $backup, string $backupId): self + { + return (new self()) + ->setParent($parent) + ->setBackup($backup) + ->setBackupId($backupId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the instance in which the backup will be + * created. This must be the same instance that contains the database the + * backup will be created from. The backup will be stored in the + * location(s) specified in the instance configuration of this + * instance. Values are of the form + * `projects//instances/`. + * @type string $backup_id + * Required. The id of the backup to be created. The `backup_id` appended to + * `parent` forms the full backup name of the form + * `projects//instances//backups/`. + * @type \Google\Cloud\Spanner\Admin\Database\V1\Backup $backup + * Required. The backup to create. + * @type \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig $encryption_config + * Optional. The encryption configuration used to encrypt the backup. If this + * field is not specified, the backup will use the same encryption + * configuration as the database by default, namely + * [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type] + * = `USE_DATABASE_ENCRYPTION`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the instance in which the backup will be + * created. This must be the same instance that contains the database the + * backup will be created from. The backup will be stored in the + * location(s) specified in the instance configuration of this + * instance. Values are of the form + * `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The name of the instance in which the backup will be + * created. This must be the same instance that contains the database the + * backup will be created from. The backup will be stored in the + * location(s) specified in the instance configuration of this + * instance. Values are of the form + * `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The id of the backup to be created. The `backup_id` appended to + * `parent` forms the full backup name of the form + * `projects//instances//backups/`. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getBackupId() + { + return $this->backup_id; + } + + /** + * Required. The id of the backup to be created. The `backup_id` appended to + * `parent` forms the full backup name of the form + * `projects//instances//backups/`. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setBackupId($var) + { + GPBUtil::checkString($var, True); + $this->backup_id = $var; + + return $this; + } + + /** + * Required. The backup to create. + * + * Generated from protobuf field .google.spanner.admin.database.v1.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\Admin\Database\V1\Backup|null + */ + public function getBackup() + { + return $this->backup; + } + + public function hasBackup() + { + return isset($this->backup); + } + + public function clearBackup() + { + unset($this->backup); + } + + /** + * Required. The backup to create. + * + * Generated from protobuf field .google.spanner.admin.database.v1.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\Admin\Database\V1\Backup $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\Backup::class); + $this->backup = $var; + + return $this; + } + + /** + * Optional. The encryption configuration used to encrypt the backup. If this + * field is not specified, the backup will use the same encryption + * configuration as the database by default, namely + * [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type] + * = `USE_DATABASE_ENCRYPTION`. + * + * Generated from protobuf field .google.spanner.admin.database.v1.CreateBackupEncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig|null + */ + public function getEncryptionConfig() + { + return $this->encryption_config; + } + + public function hasEncryptionConfig() + { + return isset($this->encryption_config); + } + + public function clearEncryptionConfig() + { + unset($this->encryption_config); + } + + /** + * Optional. The encryption configuration used to encrypt the backup. If this + * field is not specified, the backup will use the same encryption + * configuration as the database by default, namely + * [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type] + * = `USE_DATABASE_ENCRYPTION`. + * + * Generated from protobuf field .google.spanner.admin.database.v1.CreateBackupEncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig $var + * @return $this + */ + public function setEncryptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig::class); + $this->encryption_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupScheduleRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupScheduleRequest.php new file mode 100644 index 000000000000..229fd26859de --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupScheduleRequest.php @@ -0,0 +1,174 @@ +google.spanner.admin.database.v1.CreateBackupScheduleRequest + */ +class CreateBackupScheduleRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the database that this backup schedule applies to. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The Id to use for the backup schedule. The `backup_schedule_id` + * appended to `parent` forms the full backup schedule name of the form + * `projects//instances//databases//backupSchedules/`. + * + * Generated from protobuf field string backup_schedule_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup_schedule_id = ''; + /** + * Required. The backup schedule to create. + * + * Generated from protobuf field .google.spanner.admin.database.v1.BackupSchedule backup_schedule = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup_schedule = null; + + /** + * @param string $parent Required. The name of the database that this backup schedule applies to. Please see + * {@see DatabaseAdminClient::databaseName()} for help formatting this field. + * @param \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule $backupSchedule Required. The backup schedule to create. + * @param string $backupScheduleId Required. The Id to use for the backup schedule. The `backup_schedule_id` + * appended to `parent` forms the full backup schedule name of the form + * `projects//instances//databases//backupSchedules/`. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupScheduleRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule $backupSchedule, string $backupScheduleId): self + { + return (new self()) + ->setParent($parent) + ->setBackupSchedule($backupSchedule) + ->setBackupScheduleId($backupScheduleId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the database that this backup schedule applies to. + * @type string $backup_schedule_id + * Required. The Id to use for the backup schedule. The `backup_schedule_id` + * appended to `parent` forms the full backup schedule name of the form + * `projects//instances//databases//backupSchedules/`. + * @type \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule $backup_schedule + * Required. The backup schedule to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the database that this backup schedule applies to. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The name of the database that this backup schedule applies to. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The Id to use for the backup schedule. The `backup_schedule_id` + * appended to `parent` forms the full backup schedule name of the form + * `projects//instances//databases//backupSchedules/`. + * + * Generated from protobuf field string backup_schedule_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getBackupScheduleId() + { + return $this->backup_schedule_id; + } + + /** + * Required. The Id to use for the backup schedule. The `backup_schedule_id` + * appended to `parent` forms the full backup schedule name of the form + * `projects//instances//databases//backupSchedules/`. + * + * Generated from protobuf field string backup_schedule_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setBackupScheduleId($var) + { + GPBUtil::checkString($var, True); + $this->backup_schedule_id = $var; + + return $this; + } + + /** + * Required. The backup schedule to create. + * + * Generated from protobuf field .google.spanner.admin.database.v1.BackupSchedule backup_schedule = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule|null + */ + public function getBackupSchedule() + { + return $this->backup_schedule; + } + + public function hasBackupSchedule() + { + return isset($this->backup_schedule); + } + + public function clearBackupSchedule() + { + unset($this->backup_schedule); + } + + /** + * Required. The backup schedule to create. + * + * Generated from protobuf field .google.spanner.admin.database.v1.BackupSchedule backup_schedule = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule $var + * @return $this + */ + public function setBackupSchedule($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule::class); + $this->backup_schedule = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateDatabaseMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateDatabaseMetadata.php new file mode 100644 index 000000000000..15e141e01574 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateDatabaseMetadata.php @@ -0,0 +1,68 @@ +google.spanner.admin.database.v1.CreateDatabaseMetadata + */ +class CreateDatabaseMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The database being created. + * + * Generated from protobuf field string database = 1 [(.google.api.resource_reference) = { + */ + protected $database = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $database + * The database being created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The database being created. + * + * Generated from protobuf field string database = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getDatabase() + { + return $this->database; + } + + /** + * The database being created. + * + * Generated from protobuf field string database = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDatabase($var) + { + GPBUtil::checkString($var, True); + $this->database = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateDatabaseRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateDatabaseRequest.php new file mode 100644 index 000000000000..52e40ad3836f --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateDatabaseRequest.php @@ -0,0 +1,365 @@ +google.spanner.admin.database.v1.CreateDatabaseRequest + */ +class CreateDatabaseRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the instance that will serve the new database. + * Values are of the form `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. A `CREATE DATABASE` statement, which specifies the ID of the + * new database. The database ID must conform to the regular expression + * `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length. + * If the database ID is a reserved word or if it contains a hyphen, the + * database ID must be enclosed in backticks (`` ` ``). + * + * Generated from protobuf field string create_statement = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $create_statement = ''; + /** + * Optional. A list of DDL statements to run inside the newly created + * database. Statements can create tables, indexes, etc. These + * statements execute atomically with the creation of the database: + * if there is an error in any statement, the database is not created. + * + * Generated from protobuf field repeated string extra_statements = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $extra_statements; + /** + * Optional. The encryption configuration for the database. If this field is + * not specified, Cloud Spanner will encrypt/decrypt all data at rest using + * Google default encryption. + * + * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $encryption_config = null; + /** + * Optional. The dialect of the Cloud Spanner Database. + * + * Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $database_dialect = 0; + /** + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in + * 'extra_statements' above. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * + * Generated from protobuf field bytes proto_descriptors = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $proto_descriptors = ''; + + /** + * @param string $parent Required. The name of the instance that will serve the new database. + * Values are of the form `projects//instances/`. Please see + * {@see DatabaseAdminClient::instanceName()} for help formatting this field. + * @param string $createStatement Required. A `CREATE DATABASE` statement, which specifies the ID of the + * new database. The database ID must conform to the regular expression + * `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length. + * If the database ID is a reserved word or if it contains a hyphen, the + * database ID must be enclosed in backticks (`` ` ``). + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\CreateDatabaseRequest + * + * @experimental + */ + public static function build(string $parent, string $createStatement): self + { + return (new self()) + ->setParent($parent) + ->setCreateStatement($createStatement); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the instance that will serve the new database. + * Values are of the form `projects//instances/`. + * @type string $create_statement + * Required. A `CREATE DATABASE` statement, which specifies the ID of the + * new database. The database ID must conform to the regular expression + * `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length. + * If the database ID is a reserved word or if it contains a hyphen, the + * database ID must be enclosed in backticks (`` ` ``). + * @type array|\Google\Protobuf\Internal\RepeatedField $extra_statements + * Optional. A list of DDL statements to run inside the newly created + * database. Statements can create tables, indexes, etc. These + * statements execute atomically with the creation of the database: + * if there is an error in any statement, the database is not created. + * @type \Google\Cloud\Spanner\Admin\Database\V1\EncryptionConfig $encryption_config + * Optional. The encryption configuration for the database. If this field is + * not specified, Cloud Spanner will encrypt/decrypt all data at rest using + * Google default encryption. + * @type int $database_dialect + * Optional. The dialect of the Cloud Spanner Database. + * @type string $proto_descriptors + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in + * 'extra_statements' above. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the instance that will serve the new database. + * Values are of the form `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The name of the instance that will serve the new database. + * Values are of the form `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. A `CREATE DATABASE` statement, which specifies the ID of the + * new database. The database ID must conform to the regular expression + * `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length. + * If the database ID is a reserved word or if it contains a hyphen, the + * database ID must be enclosed in backticks (`` ` ``). + * + * Generated from protobuf field string create_statement = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getCreateStatement() + { + return $this->create_statement; + } + + /** + * Required. A `CREATE DATABASE` statement, which specifies the ID of the + * new database. The database ID must conform to the regular expression + * `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length. + * If the database ID is a reserved word or if it contains a hyphen, the + * database ID must be enclosed in backticks (`` ` ``). + * + * Generated from protobuf field string create_statement = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setCreateStatement($var) + { + GPBUtil::checkString($var, True); + $this->create_statement = $var; + + return $this; + } + + /** + * Optional. A list of DDL statements to run inside the newly created + * database. Statements can create tables, indexes, etc. These + * statements execute atomically with the creation of the database: + * if there is an error in any statement, the database is not created. + * + * Generated from protobuf field repeated string extra_statements = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExtraStatements() + { + return $this->extra_statements; + } + + /** + * Optional. A list of DDL statements to run inside the newly created + * database. Statements can create tables, indexes, etc. These + * statements execute atomically with the creation of the database: + * if there is an error in any statement, the database is not created. + * + * Generated from protobuf field repeated string extra_statements = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExtraStatements($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->extra_statements = $arr; + + return $this; + } + + /** + * Optional. The encryption configuration for the database. If this field is + * not specified, Cloud Spanner will encrypt/decrypt all data at rest using + * Google default encryption. + * + * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Spanner\Admin\Database\V1\EncryptionConfig|null + */ + public function getEncryptionConfig() + { + return $this->encryption_config; + } + + public function hasEncryptionConfig() + { + return isset($this->encryption_config); + } + + public function clearEncryptionConfig() + { + unset($this->encryption_config); + } + + /** + * Optional. The encryption configuration for the database. If this field is + * not specified, Cloud Spanner will encrypt/decrypt all data at rest using + * Google default encryption. + * + * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Spanner\Admin\Database\V1\EncryptionConfig $var + * @return $this + */ + public function setEncryptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\EncryptionConfig::class); + $this->encryption_config = $var; + + return $this; + } + + /** + * Optional. The dialect of the Cloud Spanner Database. + * + * Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getDatabaseDialect() + { + return $this->database_dialect; + } + + /** + * Optional. The dialect of the Cloud Spanner Database. + * + * Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setDatabaseDialect($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\DatabaseDialect::class); + $this->database_dialect = $var; + + return $this; + } + + /** + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in + * 'extra_statements' above. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * + * Generated from protobuf field bytes proto_descriptors = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getProtoDescriptors() + { + return $this->proto_descriptors; + } + + /** + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in + * 'extra_statements' above. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * + * Generated from protobuf field bytes proto_descriptors = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setProtoDescriptors($var) + { + GPBUtil::checkString($var, False); + $this->proto_descriptors = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CrontabSpec.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CrontabSpec.php new file mode 100644 index 000000000000..ba03270160ca --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CrontabSpec.php @@ -0,0 +1,214 @@ +google.spanner.admin.database.v1.CrontabSpec + */ +class CrontabSpec extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Textual representation of the crontab. User can customize the + * backup frequency and the backup version time using the cron + * expression. The version time must be in UTC timzeone. + * The backup will contain an externally consistent copy of the + * database at the version time. Allowed frequencies are 12 hour, 1 day, + * 1 week and 1 month. Examples of valid cron specifications: + * * `0 2/12 * * * ` : every 12 hours at (2, 14) hours past midnight in UTC. + * * `0 2,14 * * * ` : every 12 hours at (2,14) hours past midnight in UTC. + * * `0 2 * * * ` : once a day at 2 past midnight in UTC. + * * `0 2 * * 0 ` : once a week every Sunday at 2 past midnight in UTC. + * * `0 2 8 * * ` : once a month on 8th day at 2 past midnight in UTC. + * + * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $text = ''; + /** + * Output only. The time zone of the times in `CrontabSpec.text`. Currently + * only UTC is supported. + * + * Generated from protobuf field string time_zone = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $time_zone = ''; + /** + * Output only. Schedule backups will contain an externally consistent copy + * of the database at the version time specified in + * `schedule_spec.cron_spec`. However, Spanner may not initiate the creation + * of the scheduled backups at that version time. Spanner will initiate + * the creation of scheduled backups within the time window bounded by the + * version_time specified in `schedule_spec.cron_spec` and version_time + + * `creation_window`. + * + * Generated from protobuf field .google.protobuf.Duration creation_window = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $creation_window = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * Required. Textual representation of the crontab. User can customize the + * backup frequency and the backup version time using the cron + * expression. The version time must be in UTC timzeone. + * The backup will contain an externally consistent copy of the + * database at the version time. Allowed frequencies are 12 hour, 1 day, + * 1 week and 1 month. Examples of valid cron specifications: + * * `0 2/12 * * * ` : every 12 hours at (2, 14) hours past midnight in UTC. + * * `0 2,14 * * * ` : every 12 hours at (2,14) hours past midnight in UTC. + * * `0 2 * * * ` : once a day at 2 past midnight in UTC. + * * `0 2 * * 0 ` : once a week every Sunday at 2 past midnight in UTC. + * * `0 2 8 * * ` : once a month on 8th day at 2 past midnight in UTC. + * @type string $time_zone + * Output only. The time zone of the times in `CrontabSpec.text`. Currently + * only UTC is supported. + * @type \Google\Protobuf\Duration $creation_window + * Output only. Schedule backups will contain an externally consistent copy + * of the database at the version time specified in + * `schedule_spec.cron_spec`. However, Spanner may not initiate the creation + * of the scheduled backups at that version time. Spanner will initiate + * the creation of scheduled backups within the time window bounded by the + * version_time specified in `schedule_spec.cron_spec` and version_time + + * `creation_window`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); + parent::__construct($data); + } + + /** + * Required. Textual representation of the crontab. User can customize the + * backup frequency and the backup version time using the cron + * expression. The version time must be in UTC timzeone. + * The backup will contain an externally consistent copy of the + * database at the version time. Allowed frequencies are 12 hour, 1 day, + * 1 week and 1 month. Examples of valid cron specifications: + * * `0 2/12 * * * ` : every 12 hours at (2, 14) hours past midnight in UTC. + * * `0 2,14 * * * ` : every 12 hours at (2,14) hours past midnight in UTC. + * * `0 2 * * * ` : once a day at 2 past midnight in UTC. + * * `0 2 * * 0 ` : once a week every Sunday at 2 past midnight in UTC. + * * `0 2 8 * * ` : once a month on 8th day at 2 past midnight in UTC. + * + * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * Required. Textual representation of the crontab. User can customize the + * backup frequency and the backup version time using the cron + * expression. The version time must be in UTC timzeone. + * The backup will contain an externally consistent copy of the + * database at the version time. Allowed frequencies are 12 hour, 1 day, + * 1 week and 1 month. Examples of valid cron specifications: + * * `0 2/12 * * * ` : every 12 hours at (2, 14) hours past midnight in UTC. + * * `0 2,14 * * * ` : every 12 hours at (2,14) hours past midnight in UTC. + * * `0 2 * * * ` : once a day at 2 past midnight in UTC. + * * `0 2 * * 0 ` : once a week every Sunday at 2 past midnight in UTC. + * * `0 2 8 * * ` : once a month on 8th day at 2 past midnight in UTC. + * + * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + + /** + * Output only. The time zone of the times in `CrontabSpec.text`. Currently + * only UTC is supported. + * + * Generated from protobuf field string time_zone = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTimeZone() + { + return $this->time_zone; + } + + /** + * Output only. The time zone of the times in `CrontabSpec.text`. Currently + * only UTC is supported. + * + * Generated from protobuf field string time_zone = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTimeZone($var) + { + GPBUtil::checkString($var, True); + $this->time_zone = $var; + + return $this; + } + + /** + * Output only. Schedule backups will contain an externally consistent copy + * of the database at the version time specified in + * `schedule_spec.cron_spec`. However, Spanner may not initiate the creation + * of the scheduled backups at that version time. Spanner will initiate + * the creation of scheduled backups within the time window bounded by the + * version_time specified in `schedule_spec.cron_spec` and version_time + + * `creation_window`. + * + * Generated from protobuf field .google.protobuf.Duration creation_window = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Duration|null + */ + public function getCreationWindow() + { + return $this->creation_window; + } + + public function hasCreationWindow() + { + return isset($this->creation_window); + } + + public function clearCreationWindow() + { + unset($this->creation_window); + } + + /** + * Output only. Schedule backups will contain an externally consistent copy + * of the database at the version time specified in + * `schedule_spec.cron_spec`. However, Spanner may not initiate the creation + * of the scheduled backups at that version time. Spanner will initiate + * the creation of scheduled backups within the time window bounded by the + * version_time specified in `schedule_spec.cron_spec` and version_time + + * `creation_window`. + * + * Generated from protobuf field .google.protobuf.Duration creation_window = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setCreationWindow($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->creation_window = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Database.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Database.php new file mode 100644 index 000000000000..7116c55f5d1a --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Database.php @@ -0,0 +1,605 @@ +google.spanner.admin.database.v1.Database + */ +class Database extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the database. Values are of the form + * `projects//instances//databases/`, + * where `` is as specified in the `CREATE DATABASE` + * statement. This name can be passed to other API methods to + * identify the database. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Output only. The current database state. + * + * Generated from protobuf field .google.spanner.admin.database.v1.Database.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. If exists, the time at which the database creation started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Applicable only for restored databases. Contains information + * about the restore source. + * + * Generated from protobuf field .google.spanner.admin.database.v1.RestoreInfo restore_info = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $restore_info = null; + /** + * Output only. For databases that are using customer managed encryption, this + * field contains the encryption configuration for the database. + * For databases that are using Google default or other types of encryption, + * this field is empty. + * + * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $encryption_config = null; + /** + * Output only. For databases that are using customer managed encryption, this + * field contains the encryption information for the database, such as + * all Cloud KMS key versions that are in use. The `encryption_status' field + * inside of each `EncryptionInfo` is not populated. + * For databases that are using Google default or other types of encryption, + * this field is empty. + * This field is propagated lazily from the backend. There might be a delay + * from when a key version is being used and when it appears in this field. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.EncryptionInfo encryption_info = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $encryption_info; + /** + * Output only. The period in which Cloud Spanner retains all versions of data + * for the database. This is the same as the value of version_retention_period + * database option set using + * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]. + * Defaults to 1 hour, if not set. + * + * Generated from protobuf field string version_retention_period = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $version_retention_period = ''; + /** + * Output only. Earliest timestamp at which older versions of the data can be + * read. This value is continuously updated by Cloud Spanner and becomes stale + * the moment it is queried. If you are using this value to recover data, make + * sure to account for the time from the moment when the value is queried to + * the moment when you initiate the recovery. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_version_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $earliest_version_time = null; + /** + * Output only. The read-write region which contains the database's leader + * replicas. + * This is the same as the value of default_leader + * database option set using DatabaseAdmin.CreateDatabase or + * DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty. + * + * Generated from protobuf field string default_leader = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $default_leader = ''; + /** + * Output only. The dialect of the Cloud Spanner Database. + * + * Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $database_dialect = 0; + /** + * Whether drop protection is enabled for this database. Defaults to false, + * if not set. For more details, please see how to [prevent accidental + * database + * deletion](https://cloud.google.com/spanner/docs/prevent-database-deletion). + * + * Generated from protobuf field bool enable_drop_protection = 11; + */ + protected $enable_drop_protection = false; + /** + * Output only. If true, the database is being updated. If false, there are no + * ongoing update operations for the database. + * + * Generated from protobuf field bool reconciling = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reconciling = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the database. Values are of the form + * `projects//instances//databases/`, + * where `` is as specified in the `CREATE DATABASE` + * statement. This name can be passed to other API methods to + * identify the database. + * @type int $state + * Output only. The current database state. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. If exists, the time at which the database creation started. + * @type \Google\Cloud\Spanner\Admin\Database\V1\RestoreInfo $restore_info + * Output only. Applicable only for restored databases. Contains information + * about the restore source. + * @type \Google\Cloud\Spanner\Admin\Database\V1\EncryptionConfig $encryption_config + * Output only. For databases that are using customer managed encryption, this + * field contains the encryption configuration for the database. + * For databases that are using Google default or other types of encryption, + * this field is empty. + * @type array<\Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo>|\Google\Protobuf\Internal\RepeatedField $encryption_info + * Output only. For databases that are using customer managed encryption, this + * field contains the encryption information for the database, such as + * all Cloud KMS key versions that are in use. The `encryption_status' field + * inside of each `EncryptionInfo` is not populated. + * For databases that are using Google default or other types of encryption, + * this field is empty. + * This field is propagated lazily from the backend. There might be a delay + * from when a key version is being used and when it appears in this field. + * @type string $version_retention_period + * Output only. The period in which Cloud Spanner retains all versions of data + * for the database. This is the same as the value of version_retention_period + * database option set using + * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]. + * Defaults to 1 hour, if not set. + * @type \Google\Protobuf\Timestamp $earliest_version_time + * Output only. Earliest timestamp at which older versions of the data can be + * read. This value is continuously updated by Cloud Spanner and becomes stale + * the moment it is queried. If you are using this value to recover data, make + * sure to account for the time from the moment when the value is queried to + * the moment when you initiate the recovery. + * @type string $default_leader + * Output only. The read-write region which contains the database's leader + * replicas. + * This is the same as the value of default_leader + * database option set using DatabaseAdmin.CreateDatabase or + * DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty. + * @type int $database_dialect + * Output only. The dialect of the Cloud Spanner Database. + * @type bool $enable_drop_protection + * Whether drop protection is enabled for this database. Defaults to false, + * if not set. For more details, please see how to [prevent accidental + * database + * deletion](https://cloud.google.com/spanner/docs/prevent-database-deletion). + * @type bool $reconciling + * Output only. If true, the database is being updated. If false, there are no + * ongoing update operations for the database. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the database. Values are of the form + * `projects//instances//databases/`, + * where `` is as specified in the `CREATE DATABASE` + * statement. This name can be passed to other API methods to + * identify the database. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the database. Values are of the form + * `projects//instances//databases/`, + * where `` is as specified in the `CREATE DATABASE` + * statement. This name can be passed to other API methods to + * identify the database. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The current database state. + * + * Generated from protobuf field .google.spanner.admin.database.v1.Database.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current database state. + * + * Generated from protobuf field .google.spanner.admin.database.v1.Database.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\Database\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. If exists, the time at which the database creation started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. If exists, the time at which the database creation started. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Applicable only for restored databases. Contains information + * about the restore source. + * + * Generated from protobuf field .google.spanner.admin.database.v1.RestoreInfo restore_info = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Spanner\Admin\Database\V1\RestoreInfo|null + */ + public function getRestoreInfo() + { + return $this->restore_info; + } + + public function hasRestoreInfo() + { + return isset($this->restore_info); + } + + public function clearRestoreInfo() + { + unset($this->restore_info); + } + + /** + * Output only. Applicable only for restored databases. Contains information + * about the restore source. + * + * Generated from protobuf field .google.spanner.admin.database.v1.RestoreInfo restore_info = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Spanner\Admin\Database\V1\RestoreInfo $var + * @return $this + */ + public function setRestoreInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\RestoreInfo::class); + $this->restore_info = $var; + + return $this; + } + + /** + * Output only. For databases that are using customer managed encryption, this + * field contains the encryption configuration for the database. + * For databases that are using Google default or other types of encryption, + * this field is empty. + * + * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Spanner\Admin\Database\V1\EncryptionConfig|null + */ + public function getEncryptionConfig() + { + return $this->encryption_config; + } + + public function hasEncryptionConfig() + { + return isset($this->encryption_config); + } + + public function clearEncryptionConfig() + { + unset($this->encryption_config); + } + + /** + * Output only. For databases that are using customer managed encryption, this + * field contains the encryption configuration for the database. + * For databases that are using Google default or other types of encryption, + * this field is empty. + * + * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Spanner\Admin\Database\V1\EncryptionConfig $var + * @return $this + */ + public function setEncryptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\EncryptionConfig::class); + $this->encryption_config = $var; + + return $this; + } + + /** + * Output only. For databases that are using customer managed encryption, this + * field contains the encryption information for the database, such as + * all Cloud KMS key versions that are in use. The `encryption_status' field + * inside of each `EncryptionInfo` is not populated. + * For databases that are using Google default or other types of encryption, + * this field is empty. + * This field is propagated lazily from the backend. There might be a delay + * from when a key version is being used and when it appears in this field. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.EncryptionInfo encryption_info = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEncryptionInfo() + { + return $this->encryption_info; + } + + /** + * Output only. For databases that are using customer managed encryption, this + * field contains the encryption information for the database, such as + * all Cloud KMS key versions that are in use. The `encryption_status' field + * inside of each `EncryptionInfo` is not populated. + * For databases that are using Google default or other types of encryption, + * this field is empty. + * This field is propagated lazily from the backend. There might be a delay + * from when a key version is being used and when it appears in this field. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.EncryptionInfo encryption_info = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEncryptionInfo($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo::class); + $this->encryption_info = $arr; + + return $this; + } + + /** + * Output only. The period in which Cloud Spanner retains all versions of data + * for the database. This is the same as the value of version_retention_period + * database option set using + * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]. + * Defaults to 1 hour, if not set. + * + * Generated from protobuf field string version_retention_period = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVersionRetentionPeriod() + { + return $this->version_retention_period; + } + + /** + * Output only. The period in which Cloud Spanner retains all versions of data + * for the database. This is the same as the value of version_retention_period + * database option set using + * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]. + * Defaults to 1 hour, if not set. + * + * Generated from protobuf field string version_retention_period = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVersionRetentionPeriod($var) + { + GPBUtil::checkString($var, True); + $this->version_retention_period = $var; + + return $this; + } + + /** + * Output only. Earliest timestamp at which older versions of the data can be + * read. This value is continuously updated by Cloud Spanner and becomes stale + * the moment it is queried. If you are using this value to recover data, make + * sure to account for the time from the moment when the value is queried to + * the moment when you initiate the recovery. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_version_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEarliestVersionTime() + { + return $this->earliest_version_time; + } + + public function hasEarliestVersionTime() + { + return isset($this->earliest_version_time); + } + + public function clearEarliestVersionTime() + { + unset($this->earliest_version_time); + } + + /** + * Output only. Earliest timestamp at which older versions of the data can be + * read. This value is continuously updated by Cloud Spanner and becomes stale + * the moment it is queried. If you are using this value to recover data, make + * sure to account for the time from the moment when the value is queried to + * the moment when you initiate the recovery. + * + * Generated from protobuf field .google.protobuf.Timestamp earliest_version_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEarliestVersionTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->earliest_version_time = $var; + + return $this; + } + + /** + * Output only. The read-write region which contains the database's leader + * replicas. + * This is the same as the value of default_leader + * database option set using DatabaseAdmin.CreateDatabase or + * DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty. + * + * Generated from protobuf field string default_leader = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDefaultLeader() + { + return $this->default_leader; + } + + /** + * Output only. The read-write region which contains the database's leader + * replicas. + * This is the same as the value of default_leader + * database option set using DatabaseAdmin.CreateDatabase or + * DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty. + * + * Generated from protobuf field string default_leader = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDefaultLeader($var) + { + GPBUtil::checkString($var, True); + $this->default_leader = $var; + + return $this; + } + + /** + * Output only. The dialect of the Cloud Spanner Database. + * + * Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getDatabaseDialect() + { + return $this->database_dialect; + } + + /** + * Output only. The dialect of the Cloud Spanner Database. + * + * Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setDatabaseDialect($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\DatabaseDialect::class); + $this->database_dialect = $var; + + return $this; + } + + /** + * Whether drop protection is enabled for this database. Defaults to false, + * if not set. For more details, please see how to [prevent accidental + * database + * deletion](https://cloud.google.com/spanner/docs/prevent-database-deletion). + * + * Generated from protobuf field bool enable_drop_protection = 11; + * @return bool + */ + public function getEnableDropProtection() + { + return $this->enable_drop_protection; + } + + /** + * Whether drop protection is enabled for this database. Defaults to false, + * if not set. For more details, please see how to [prevent accidental + * database + * deletion](https://cloud.google.com/spanner/docs/prevent-database-deletion). + * + * Generated from protobuf field bool enable_drop_protection = 11; + * @param bool $var + * @return $this + */ + public function setEnableDropProtection($var) + { + GPBUtil::checkBool($var); + $this->enable_drop_protection = $var; + + return $this; + } + + /** + * Output only. If true, the database is being updated. If false, there are no + * ongoing update operations for the database. + * + * Generated from protobuf field bool reconciling = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getReconciling() + { + return $this->reconciling; + } + + /** + * Output only. If true, the database is being updated. If false, there are no + * ongoing update operations for the database. + * + * Generated from protobuf field bool reconciling = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setReconciling($var) + { + GPBUtil::checkBool($var); + $this->reconciling = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Database/State.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Database/State.php new file mode 100644 index 000000000000..92c56529fbad --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Database/State.php @@ -0,0 +1,78 @@ +google.spanner.admin.database.v1.Database.State + */ +class State +{ + /** + * Not specified. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The database is still being created. Operations on the database may fail + * with `FAILED_PRECONDITION` in this state. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The database is fully created and ready for use. + * + * Generated from protobuf enum READY = 2; + */ + const READY = 2; + /** + * The database is fully created and ready for use, but is still + * being optimized for performance and cannot handle full load. + * In this state, the database still references the backup + * it was restore from, preventing the backup + * from being deleted. When optimizations are complete, the full performance + * of the database will be restored, and the database will transition to + * `READY` state. + * + * Generated from protobuf enum READY_OPTIMIZING = 3; + */ + const READY_OPTIMIZING = 3; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::READY => 'READY', + self::READY_OPTIMIZING => 'READY_OPTIMIZING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Spanner\Admin\Database\V1\Database_State::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DatabaseDialect.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DatabaseDialect.php new file mode 100644 index 000000000000..ed173031894b --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DatabaseDialect.php @@ -0,0 +1,62 @@ +google.spanner.admin.database.v1.DatabaseDialect + */ +class DatabaseDialect +{ + /** + * Default value. This value will create a database with the + * GOOGLE_STANDARD_SQL dialect. + * + * Generated from protobuf enum DATABASE_DIALECT_UNSPECIFIED = 0; + */ + const DATABASE_DIALECT_UNSPECIFIED = 0; + /** + * GoogleSQL supported SQL. + * + * Generated from protobuf enum GOOGLE_STANDARD_SQL = 1; + */ + const GOOGLE_STANDARD_SQL = 1; + /** + * PostgreSQL supported SQL. + * + * Generated from protobuf enum POSTGRESQL = 2; + */ + const POSTGRESQL = 2; + + private static $valueToName = [ + self::DATABASE_DIALECT_UNSPECIFIED => 'DATABASE_DIALECT_UNSPECIFIED', + self::GOOGLE_STANDARD_SQL => 'GOOGLE_STANDARD_SQL', + self::POSTGRESQL => 'POSTGRESQL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DatabaseRole.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DatabaseRole.php new file mode 100644 index 000000000000..f34003461bac --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DatabaseRole.php @@ -0,0 +1,75 @@ +google.spanner.admin.database.v1.DatabaseRole + */ +class DatabaseRole extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the database role. Values are of the form + * `projects//instances//databases//databaseRoles/` + * where `` is as specified in the `CREATE ROLE` DDL statement. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the database role. Values are of the form + * `projects//instances//databases//databaseRoles/` + * where `` is as specified in the `CREATE ROLE` DDL statement. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the database role. Values are of the form + * `projects//instances//databases//databaseRoles/` + * where `` is as specified in the `CREATE ROLE` DDL statement. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the database role. Values are of the form + * `projects//instances//databases//databaseRoles/` + * where `` is as specified in the `CREATE ROLE` DDL statement. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DdlStatementActionInfo.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DdlStatementActionInfo.php new file mode 100644 index 000000000000..10cae9737db2 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DdlStatementActionInfo.php @@ -0,0 +1,165 @@ +google.spanner.admin.database.v1.DdlStatementActionInfo + */ +class DdlStatementActionInfo extends \Google\Protobuf\Internal\Message +{ + /** + * The action for the DDL statement, e.g. CREATE, ALTER, DROP, GRANT, etc. + * This field is a non-empty string. + * + * Generated from protobuf field string action = 1; + */ + protected $action = ''; + /** + * The entity type for the DDL statement, e.g. TABLE, INDEX, VIEW, etc. + * This field can be empty string for some DDL statement, + * e.g. for statement "ANALYZE", `entity_type` = "". + * + * Generated from protobuf field string entity_type = 2; + */ + protected $entity_type = ''; + /** + * The entity name(s) being operated on the DDL statement. + * E.g. + * 1. For statement "CREATE TABLE t1(...)", `entity_names` = ["t1"]. + * 2. For statement "GRANT ROLE r1, r2 ...", `entity_names` = ["r1", "r2"]. + * 3. For statement "ANALYZE", `entity_names` = []. + * + * Generated from protobuf field repeated string entity_names = 3; + */ + private $entity_names; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $action + * The action for the DDL statement, e.g. CREATE, ALTER, DROP, GRANT, etc. + * This field is a non-empty string. + * @type string $entity_type + * The entity type for the DDL statement, e.g. TABLE, INDEX, VIEW, etc. + * This field can be empty string for some DDL statement, + * e.g. for statement "ANALYZE", `entity_type` = "". + * @type array|\Google\Protobuf\Internal\RepeatedField $entity_names + * The entity name(s) being operated on the DDL statement. + * E.g. + * 1. For statement "CREATE TABLE t1(...)", `entity_names` = ["t1"]. + * 2. For statement "GRANT ROLE r1, r2 ...", `entity_names` = ["r1", "r2"]. + * 3. For statement "ANALYZE", `entity_names` = []. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The action for the DDL statement, e.g. CREATE, ALTER, DROP, GRANT, etc. + * This field is a non-empty string. + * + * Generated from protobuf field string action = 1; + * @return string + */ + public function getAction() + { + return $this->action; + } + + /** + * The action for the DDL statement, e.g. CREATE, ALTER, DROP, GRANT, etc. + * This field is a non-empty string. + * + * Generated from protobuf field string action = 1; + * @param string $var + * @return $this + */ + public function setAction($var) + { + GPBUtil::checkString($var, True); + $this->action = $var; + + return $this; + } + + /** + * The entity type for the DDL statement, e.g. TABLE, INDEX, VIEW, etc. + * This field can be empty string for some DDL statement, + * e.g. for statement "ANALYZE", `entity_type` = "". + * + * Generated from protobuf field string entity_type = 2; + * @return string + */ + public function getEntityType() + { + return $this->entity_type; + } + + /** + * The entity type for the DDL statement, e.g. TABLE, INDEX, VIEW, etc. + * This field can be empty string for some DDL statement, + * e.g. for statement "ANALYZE", `entity_type` = "". + * + * Generated from protobuf field string entity_type = 2; + * @param string $var + * @return $this + */ + public function setEntityType($var) + { + GPBUtil::checkString($var, True); + $this->entity_type = $var; + + return $this; + } + + /** + * The entity name(s) being operated on the DDL statement. + * E.g. + * 1. For statement "CREATE TABLE t1(...)", `entity_names` = ["t1"]. + * 2. For statement "GRANT ROLE r1, r2 ...", `entity_names` = ["r1", "r2"]. + * 3. For statement "ANALYZE", `entity_names` = []. + * + * Generated from protobuf field repeated string entity_names = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEntityNames() + { + return $this->entity_names; + } + + /** + * The entity name(s) being operated on the DDL statement. + * E.g. + * 1. For statement "CREATE TABLE t1(...)", `entity_names` = ["t1"]. + * 2. For statement "GRANT ROLE r1, r2 ...", `entity_names` = ["r1", "r2"]. + * 3. For statement "ANALYZE", `entity_names` = []. + * + * Generated from protobuf field repeated string entity_names = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEntityNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->entity_names = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DeleteBackupRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DeleteBackupRequest.php new file mode 100644 index 000000000000..a2418220b700 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DeleteBackupRequest.php @@ -0,0 +1,92 @@ +google.spanner.admin.database.v1.DeleteBackupRequest + */ +class DeleteBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the backup to delete. + * Values are of the form + * `projects//instances//backups/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the backup to delete. + * Values are of the form + * `projects//instances//backups/`. Please see + * {@see DatabaseAdminClient::backupName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\DeleteBackupRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the backup to delete. + * Values are of the form + * `projects//instances//backups/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the backup to delete. + * Values are of the form + * `projects//instances//backups/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the backup to delete. + * Values are of the form + * `projects//instances//backups/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DeleteBackupScheduleRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DeleteBackupScheduleRequest.php new file mode 100644 index 000000000000..34083030de53 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DeleteBackupScheduleRequest.php @@ -0,0 +1,92 @@ +google.spanner.admin.database.v1.DeleteBackupScheduleRequest + */ +class DeleteBackupScheduleRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the schedule to delete. + * Values are of the form + * `projects//instances//databases//backupSchedules/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the schedule to delete. + * Values are of the form + * `projects//instances//databases//backupSchedules/`. Please see + * {@see DatabaseAdminClient::backupScheduleName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\DeleteBackupScheduleRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the schedule to delete. + * Values are of the form + * `projects//instances//databases//backupSchedules/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the schedule to delete. + * Values are of the form + * `projects//instances//databases//backupSchedules/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the schedule to delete. + * Values are of the form + * `projects//instances//databases//backupSchedules/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DropDatabaseRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DropDatabaseRequest.php new file mode 100644 index 000000000000..29d92fc6d153 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DropDatabaseRequest.php @@ -0,0 +1,82 @@ +google.spanner.admin.database.v1.DropDatabaseRequest + */ +class DropDatabaseRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The database to be dropped. + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $database = ''; + + /** + * @param string $database Required. The database to be dropped. Please see + * {@see DatabaseAdminClient::databaseName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\DropDatabaseRequest + * + * @experimental + */ + public static function build(string $database): self + { + return (new self()) + ->setDatabase($database); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $database + * Required. The database to be dropped. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The database to be dropped. + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getDatabase() + { + return $this->database; + } + + /** + * Required. The database to be dropped. + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDatabase($var) + { + GPBUtil::checkString($var, True); + $this->database = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionConfig.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionConfig.php new file mode 100644 index 000000000000..c0bc45190b62 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionConfig.php @@ -0,0 +1,161 @@ +google.spanner.admin.database.v1.EncryptionConfig + */ +class EncryptionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The Cloud KMS key to be used for encrypting and decrypting + * the database. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { + */ + protected $kms_key_name = ''; + /** + * Specifies the KMS configuration for the one or more keys used to encrypt + * the database. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * The keys referenced by kms_key_names must fully cover all + * regions of the database instance configuration. Some examples: + * * For single region database instance configs, specify a single regional + * location KMS key. + * * For multi-regional database instance configs of type GOOGLE_MANAGED, + * either specify a multi-regional location KMS key or multiple regional + * location KMS keys that cover all regions in the instance config. + * * For a database instance config of type USER_MANAGED, please specify only + * regional location KMS keys to cover each region in the instance config. + * Multi-regional location KMS keys are not supported for USER_MANAGED + * instance configs. + * + * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.resource_reference) = { + */ + private $kms_key_names; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $kms_key_name + * The Cloud KMS key to be used for encrypting and decrypting + * the database. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * @type array|\Google\Protobuf\Internal\RepeatedField $kms_key_names + * Specifies the KMS configuration for the one or more keys used to encrypt + * the database. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * The keys referenced by kms_key_names must fully cover all + * regions of the database instance configuration. Some examples: + * * For single region database instance configs, specify a single regional + * location KMS key. + * * For multi-regional database instance configs of type GOOGLE_MANAGED, + * either specify a multi-regional location KMS key or multiple regional + * location KMS keys that cover all regions in the instance config. + * * For a database instance config of type USER_MANAGED, please specify only + * regional location KMS keys to cover each region in the instance config. + * Multi-regional location KMS keys are not supported for USER_MANAGED + * instance configs. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * The Cloud KMS key to be used for encrypting and decrypting + * the database. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getKmsKeyName() + { + return $this->kms_key_name; + } + + /** + * The Cloud KMS key to be used for encrypting and decrypting + * the database. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setKmsKeyName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_name = $var; + + return $this; + } + + /** + * Specifies the KMS configuration for the one or more keys used to encrypt + * the database. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * The keys referenced by kms_key_names must fully cover all + * regions of the database instance configuration. Some examples: + * * For single region database instance configs, specify a single regional + * location KMS key. + * * For multi-regional database instance configs of type GOOGLE_MANAGED, + * either specify a multi-regional location KMS key or multiple regional + * location KMS keys that cover all regions in the instance config. + * * For a database instance config of type USER_MANAGED, please specify only + * regional location KMS keys to cover each region in the instance config. + * Multi-regional location KMS keys are not supported for USER_MANAGED + * instance configs. + * + * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getKmsKeyNames() + { + return $this->kms_key_names; + } + + /** + * Specifies the KMS configuration for the one or more keys used to encrypt + * the database. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * The keys referenced by kms_key_names must fully cover all + * regions of the database instance configuration. Some examples: + * * For single region database instance configs, specify a single regional + * location KMS key. + * * For multi-regional database instance configs of type GOOGLE_MANAGED, + * either specify a multi-regional location KMS key or multiple regional + * location KMS keys that cover all regions in the instance config. + * * For a database instance config of type USER_MANAGED, please specify only + * regional location KMS keys to cover each region in the instance config. + * Multi-regional location KMS keys are not supported for USER_MANAGED + * instance configs. + * + * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setKmsKeyNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->kms_key_names = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionInfo.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionInfo.php new file mode 100644 index 000000000000..960ada451ae8 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionInfo.php @@ -0,0 +1,157 @@ +google.spanner.admin.database.v1.EncryptionInfo + */ +class EncryptionInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The type of encryption. + * + * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionInfo.Type encryption_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $encryption_type = 0; + /** + * Output only. If present, the status of a recent encrypt/decrypt call on + * underlying data for this database or backup. Regardless of status, data is + * always encrypted at rest. + * + * Generated from protobuf field .google.rpc.Status encryption_status = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $encryption_status = null; + /** + * Output only. A Cloud KMS key version that is being used to protect the + * database or backup. + * + * Generated from protobuf field string kms_key_version = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + protected $kms_key_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $encryption_type + * Output only. The type of encryption. + * @type \Google\Rpc\Status $encryption_status + * Output only. If present, the status of a recent encrypt/decrypt call on + * underlying data for this database or backup. Regardless of status, data is + * always encrypted at rest. + * @type string $kms_key_version + * Output only. A Cloud KMS key version that is being used to protect the + * database or backup. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The type of encryption. + * + * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionInfo.Type encryption_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getEncryptionType() + { + return $this->encryption_type; + } + + /** + * Output only. The type of encryption. + * + * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionInfo.Type encryption_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setEncryptionType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo\Type::class); + $this->encryption_type = $var; + + return $this; + } + + /** + * Output only. If present, the status of a recent encrypt/decrypt call on + * underlying data for this database or backup. Regardless of status, data is + * always encrypted at rest. + * + * Generated from protobuf field .google.rpc.Status encryption_status = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Rpc\Status|null + */ + public function getEncryptionStatus() + { + return $this->encryption_status; + } + + public function hasEncryptionStatus() + { + return isset($this->encryption_status); + } + + public function clearEncryptionStatus() + { + unset($this->encryption_status); + } + + /** + * Output only. If present, the status of a recent encrypt/decrypt call on + * underlying data for this database or backup. Regardless of status, data is + * always encrypted at rest. + * + * Generated from protobuf field .google.rpc.Status encryption_status = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setEncryptionStatus($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->encryption_status = $var; + + return $this; + } + + /** + * Output only. A Cloud KMS key version that is being used to protect the + * database or backup. + * + * Generated from protobuf field string kms_key_version = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return string + */ + public function getKmsKeyVersion() + { + return $this->kms_key_version; + } + + /** + * Output only. A Cloud KMS key version that is being used to protect the + * database or backup. + * + * Generated from protobuf field string kms_key_version = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setKmsKeyVersion($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionInfo/Type.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionInfo/Type.php new file mode 100644 index 000000000000..d54274fba026 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionInfo/Type.php @@ -0,0 +1,68 @@ +google.spanner.admin.database.v1.EncryptionInfo.Type + */ +class Type +{ + /** + * Encryption type was not specified, though data at rest remains encrypted. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * The data is encrypted at rest with a key that is + * fully managed by Google. No key version or status will be populated. + * This is the default state. + * + * Generated from protobuf enum GOOGLE_DEFAULT_ENCRYPTION = 1; + */ + const GOOGLE_DEFAULT_ENCRYPTION = 1; + /** + * The data is encrypted at rest with a key that is + * managed by the customer. The active version of the key. `kms_key_version` + * will be populated, and `encryption_status` may be populated. + * + * Generated from protobuf enum CUSTOMER_MANAGED_ENCRYPTION = 2; + */ + const CUSTOMER_MANAGED_ENCRYPTION = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::GOOGLE_DEFAULT_ENCRYPTION => 'GOOGLE_DEFAULT_ENCRYPTION', + self::CUSTOMER_MANAGED_ENCRYPTION => 'CUSTOMER_MANAGED_ENCRYPTION', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo_Type::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/FullBackupSpec.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/FullBackupSpec.php new file mode 100644 index 000000000000..3edbb8d4fd2b --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/FullBackupSpec.php @@ -0,0 +1,35 @@ +google.spanner.admin.database.v1.FullBackupSpec + */ +class FullBackupSpec extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetBackupRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetBackupRequest.php new file mode 100644 index 000000000000..442d207b6386 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetBackupRequest.php @@ -0,0 +1,92 @@ +google.spanner.admin.database.v1.GetBackupRequest + */ +class GetBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the backup. + * Values are of the form + * `projects//instances//backups/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Name of the backup. + * Values are of the form + * `projects//instances//backups/`. Please see + * {@see DatabaseAdminClient::backupName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\GetBackupRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the backup. + * Values are of the form + * `projects//instances//backups/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the backup. + * Values are of the form + * `projects//instances//backups/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of the backup. + * Values are of the form + * `projects//instances//backups/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetBackupScheduleRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetBackupScheduleRequest.php new file mode 100644 index 000000000000..75b5f8400005 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetBackupScheduleRequest.php @@ -0,0 +1,92 @@ +google.spanner.admin.database.v1.GetBackupScheduleRequest + */ +class GetBackupScheduleRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the schedule to retrieve. + * Values are of the form + * `projects//instances//databases//backupSchedules/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the schedule to retrieve. + * Values are of the form + * `projects//instances//databases//backupSchedules/`. Please see + * {@see DatabaseAdminClient::backupScheduleName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\GetBackupScheduleRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the schedule to retrieve. + * Values are of the form + * `projects//instances//databases//backupSchedules/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the schedule to retrieve. + * Values are of the form + * `projects//instances//databases//backupSchedules/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the schedule to retrieve. + * Values are of the form + * `projects//instances//databases//backupSchedules/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseDdlRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseDdlRequest.php new file mode 100644 index 000000000000..6e955af72d1a --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseDdlRequest.php @@ -0,0 +1,92 @@ +google.spanner.admin.database.v1.GetDatabaseDdlRequest + */ +class GetDatabaseDdlRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The database whose schema we wish to get. + * Values are of the form + * `projects//instances//databases/` + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $database = ''; + + /** + * @param string $database Required. The database whose schema we wish to get. + * Values are of the form + * `projects//instances//databases/` + * Please see {@see DatabaseAdminClient::databaseName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\GetDatabaseDdlRequest + * + * @experimental + */ + public static function build(string $database): self + { + return (new self()) + ->setDatabase($database); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $database + * Required. The database whose schema we wish to get. + * Values are of the form + * `projects//instances//databases/` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The database whose schema we wish to get. + * Values are of the form + * `projects//instances//databases/` + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getDatabase() + { + return $this->database; + } + + /** + * Required. The database whose schema we wish to get. + * Values are of the form + * `projects//instances//databases/` + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDatabase($var) + { + GPBUtil::checkString($var, True); + $this->database = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseDdlResponse.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseDdlResponse.php new file mode 100644 index 000000000000..a190d7f20b13 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseDdlResponse.php @@ -0,0 +1,122 @@ +google.spanner.admin.database.v1.GetDatabaseDdlResponse + */ +class GetDatabaseDdlResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of formatted DDL statements defining the schema of the database + * specified in the request. + * + * Generated from protobuf field repeated string statements = 1; + */ + private $statements; + /** + * Proto descriptors stored in the database. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * + * Generated from protobuf field bytes proto_descriptors = 2; + */ + protected $proto_descriptors = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $statements + * A list of formatted DDL statements defining the schema of the database + * specified in the request. + * @type string $proto_descriptors + * Proto descriptors stored in the database. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * A list of formatted DDL statements defining the schema of the database + * specified in the request. + * + * Generated from protobuf field repeated string statements = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStatements() + { + return $this->statements; + } + + /** + * A list of formatted DDL statements defining the schema of the database + * specified in the request. + * + * Generated from protobuf field repeated string statements = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStatements($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->statements = $arr; + + return $this; + } + + /** + * Proto descriptors stored in the database. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * + * Generated from protobuf field bytes proto_descriptors = 2; + * @return string + */ + public function getProtoDescriptors() + { + return $this->proto_descriptors; + } + + /** + * Proto descriptors stored in the database. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * + * Generated from protobuf field bytes proto_descriptors = 2; + * @param string $var + * @return $this + */ + public function setProtoDescriptors($var) + { + GPBUtil::checkString($var, False); + $this->proto_descriptors = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseRequest.php new file mode 100644 index 000000000000..bacc542101f3 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseRequest.php @@ -0,0 +1,87 @@ +google.spanner.admin.database.v1.GetDatabaseRequest + */ +class GetDatabaseRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the requested database. Values are of the form + * `projects//instances//databases/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the requested database. Values are of the form + * `projects//instances//databases/`. Please see + * {@see DatabaseAdminClient::databaseName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\GetDatabaseRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the requested database. Values are of the form + * `projects//instances//databases/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the requested database. Values are of the form + * `projects//instances//databases/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the requested database. Values are of the form + * `projects//instances//databases/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/IncrementalBackupSpec.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/IncrementalBackupSpec.php new file mode 100644 index 000000000000..8db0cd8de770 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/IncrementalBackupSpec.php @@ -0,0 +1,38 @@ +google.spanner.admin.database.v1.IncrementalBackupSpec + */ +class IncrementalBackupSpec extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupOperationsRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupOperationsRequest.php new file mode 100644 index 000000000000..c12ea71b9f7e --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupOperationsRequest.php @@ -0,0 +1,461 @@ +google.spanner.admin.database.v1.ListBackupOperationsRequest + */ +class ListBackupOperationsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The instance of the backup operations. Values are of + * the form `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * An expression that filters the list of returned backup operations. + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the [operation][google.longrunning.Operation] + * are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] + * is + * `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic, but + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ + * `metadata.database:prod` - Returns operations where: + * * The operation's metadata type is + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. + * * The source database name of backup contains the string "prod". + * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ + * `(metadata.name:howl) AND` \ + * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Returns operations where: + * * The operation's metadata type is + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. + * * The backup name contains the string "howl". + * * The operation started before 2018-03-28T14:50:00Z. + * * The operation resulted in an error. + * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \ + * `(metadata.source_backup:test) AND` \ + * `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \ + * `(error:*)` - Returns operations where: + * * The operation's metadata type is + * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. + * * The source backup name contains the string "test". + * * The operation started before 2022-01-18T14:50:00Z. + * * The operation resulted in an error. + * * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ + * `(metadata.database:test_db)) OR` \ + * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) + * AND` \ + * `(metadata.source_backup:test_bkp)) AND` \ + * `(error:*)` - Returns operations where: + * * The operation's metadata matches either of criteria: + * * The operation's metadata type is + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] + * AND the source database name of the backup contains the string + * "test_db" + * * The operation's metadata type is + * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata] + * AND the source backup name contains the string "test_bkp" + * * The operation resulted in an error. + * + * Generated from protobuf field string filter = 2; + */ + protected $filter = ''; + /** + * Number of operations to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListBackupOperationsResponse.next_page_token] + * from a previous + * [ListBackupOperationsResponse][google.spanner.admin.database.v1.ListBackupOperationsResponse] + * to the same `parent` and with the same `filter`. + * + * Generated from protobuf field string page_token = 4; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The instance of the backup operations. Values are of + * the form `projects//instances/`. Please see + * {@see DatabaseAdminClient::instanceName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\ListBackupOperationsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The instance of the backup operations. Values are of + * the form `projects//instances/`. + * @type string $filter + * An expression that filters the list of returned backup operations. + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the [operation][google.longrunning.Operation] + * are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] + * is + * `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic, but + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ + * `metadata.database:prod` - Returns operations where: + * * The operation's metadata type is + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. + * * The source database name of backup contains the string "prod". + * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ + * `(metadata.name:howl) AND` \ + * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Returns operations where: + * * The operation's metadata type is + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. + * * The backup name contains the string "howl". + * * The operation started before 2018-03-28T14:50:00Z. + * * The operation resulted in an error. + * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \ + * `(metadata.source_backup:test) AND` \ + * `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \ + * `(error:*)` - Returns operations where: + * * The operation's metadata type is + * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. + * * The source backup name contains the string "test". + * * The operation started before 2022-01-18T14:50:00Z. + * * The operation resulted in an error. + * * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ + * `(metadata.database:test_db)) OR` \ + * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) + * AND` \ + * `(metadata.source_backup:test_bkp)) AND` \ + * `(error:*)` - Returns operations where: + * * The operation's metadata matches either of criteria: + * * The operation's metadata type is + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] + * AND the source database name of the backup contains the string + * "test_db" + * * The operation's metadata type is + * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata] + * AND the source backup name contains the string "test_bkp" + * * The operation resulted in an error. + * @type int $page_size + * Number of operations to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * @type string $page_token + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListBackupOperationsResponse.next_page_token] + * from a previous + * [ListBackupOperationsResponse][google.spanner.admin.database.v1.ListBackupOperationsResponse] + * to the same `parent` and with the same `filter`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The instance of the backup operations. Values are of + * the form `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The instance of the backup operations. Values are of + * the form `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * An expression that filters the list of returned backup operations. + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the [operation][google.longrunning.Operation] + * are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] + * is + * `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic, but + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ + * `metadata.database:prod` - Returns operations where: + * * The operation's metadata type is + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. + * * The source database name of backup contains the string "prod". + * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ + * `(metadata.name:howl) AND` \ + * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Returns operations where: + * * The operation's metadata type is + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. + * * The backup name contains the string "howl". + * * The operation started before 2018-03-28T14:50:00Z. + * * The operation resulted in an error. + * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \ + * `(metadata.source_backup:test) AND` \ + * `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \ + * `(error:*)` - Returns operations where: + * * The operation's metadata type is + * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. + * * The source backup name contains the string "test". + * * The operation started before 2022-01-18T14:50:00Z. + * * The operation resulted in an error. + * * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ + * `(metadata.database:test_db)) OR` \ + * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) + * AND` \ + * `(metadata.source_backup:test_bkp)) AND` \ + * `(error:*)` - Returns operations where: + * * The operation's metadata matches either of criteria: + * * The operation's metadata type is + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] + * AND the source database name of the backup contains the string + * "test_db" + * * The operation's metadata type is + * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata] + * AND the source backup name contains the string "test_bkp" + * * The operation resulted in an error. + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * An expression that filters the list of returned backup operations. + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the [operation][google.longrunning.Operation] + * are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] + * is + * `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic, but + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ + * `metadata.database:prod` - Returns operations where: + * * The operation's metadata type is + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. + * * The source database name of backup contains the string "prod". + * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ + * `(metadata.name:howl) AND` \ + * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Returns operations where: + * * The operation's metadata type is + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. + * * The backup name contains the string "howl". + * * The operation started before 2018-03-28T14:50:00Z. + * * The operation resulted in an error. + * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \ + * `(metadata.source_backup:test) AND` \ + * `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \ + * `(error:*)` - Returns operations where: + * * The operation's metadata type is + * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. + * * The source backup name contains the string "test". + * * The operation started before 2022-01-18T14:50:00Z. + * * The operation resulted in an error. + * * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ + * `(metadata.database:test_db)) OR` \ + * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) + * AND` \ + * `(metadata.source_backup:test_bkp)) AND` \ + * `(error:*)` - Returns operations where: + * * The operation's metadata matches either of criteria: + * * The operation's metadata type is + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] + * AND the source database name of the backup contains the string + * "test_db" + * * The operation's metadata type is + * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata] + * AND the source backup name contains the string "test_bkp" + * * The operation resulted in an error. + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Number of operations to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Number of operations to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListBackupOperationsResponse.next_page_token] + * from a previous + * [ListBackupOperationsResponse][google.spanner.admin.database.v1.ListBackupOperationsResponse] + * to the same `parent` and with the same `filter`. + * + * Generated from protobuf field string page_token = 4; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListBackupOperationsResponse.next_page_token] + * from a previous + * [ListBackupOperationsResponse][google.spanner.admin.database.v1.ListBackupOperationsResponse] + * to the same `parent` and with the same `filter`. + * + * Generated from protobuf field string page_token = 4; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupOperationsResponse.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupOperationsResponse.php new file mode 100644 index 000000000000..145888a176cd --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupOperationsResponse.php @@ -0,0 +1,142 @@ +google.spanner.admin.database.v1.ListBackupOperationsResponse + */ +class ListBackupOperationsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of matching backup [long-running + * operations][google.longrunning.Operation]. Each operation's name will be + * prefixed by the backup's name. The operation's + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that are pending or have completed/failed/canceled within the + * last 7 days. Operations returned are ordered by + * `operation.metadata.value.progress.start_time` in descending order starting + * from the most recently started operation. + * + * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; + */ + private $operations; + /** + * `next_page_token` can be sent in a subsequent + * [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations] + * call to fetch more of the matching metadata. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\LongRunning\Operation>|\Google\Protobuf\Internal\RepeatedField $operations + * The list of matching backup [long-running + * operations][google.longrunning.Operation]. Each operation's name will be + * prefixed by the backup's name. The operation's + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that are pending or have completed/failed/canceled within the + * last 7 days. Operations returned are ordered by + * `operation.metadata.value.progress.start_time` in descending order starting + * from the most recently started operation. + * @type string $next_page_token + * `next_page_token` can be sent in a subsequent + * [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations] + * call to fetch more of the matching metadata. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); + parent::__construct($data); + } + + /** + * The list of matching backup [long-running + * operations][google.longrunning.Operation]. Each operation's name will be + * prefixed by the backup's name. The operation's + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that are pending or have completed/failed/canceled within the + * last 7 days. Operations returned are ordered by + * `operation.metadata.value.progress.start_time` in descending order starting + * from the most recently started operation. + * + * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOperations() + { + return $this->operations; + } + + /** + * The list of matching backup [long-running + * operations][google.longrunning.Operation]. Each operation's name will be + * prefixed by the backup's name. The operation's + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that are pending or have completed/failed/canceled within the + * last 7 days. Operations returned are ordered by + * `operation.metadata.value.progress.start_time` in descending order starting + * from the most recently started operation. + * + * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; + * @param array<\Google\LongRunning\Operation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOperations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\LongRunning\Operation::class); + $this->operations = $arr; + + return $this; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations] + * call to fetch more of the matching metadata. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations] + * call to fetch more of the matching metadata. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupSchedulesRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupSchedulesRequest.php new file mode 100644 index 000000000000..01af05ece7c9 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupSchedulesRequest.php @@ -0,0 +1,180 @@ +google.spanner.admin.database.v1.ListBackupSchedulesRequest + */ +class ListBackupSchedulesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Database is the parent resource whose backup schedules should be + * listed. Values are of the form + * projects//instances//databases/ + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Number of backup schedules to be returned in the response. If 0 + * or less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token] + * from a previous + * [ListBackupSchedulesResponse][google.spanner.admin.database.v1.ListBackupSchedulesResponse] + * to the same `parent`. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. Database is the parent resource whose backup schedules should be + * listed. Values are of the form + * projects//instances//databases/ + * Please see {@see DatabaseAdminClient::databaseName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\ListBackupSchedulesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Database is the parent resource whose backup schedules should be + * listed. Values are of the form + * projects//instances//databases/ + * @type int $page_size + * Optional. Number of backup schedules to be returned in the response. If 0 + * or less, defaults to the server's maximum allowed page size. + * @type string $page_token + * Optional. If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token] + * from a previous + * [ListBackupSchedulesResponse][google.spanner.admin.database.v1.ListBackupSchedulesResponse] + * to the same `parent`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); + parent::__construct($data); + } + + /** + * Required. Database is the parent resource whose backup schedules should be + * listed. Values are of the form + * projects//instances//databases/ + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Database is the parent resource whose backup schedules should be + * listed. Values are of the form + * projects//instances//databases/ + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. Number of backup schedules to be returned in the response. If 0 + * or less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Number of backup schedules to be returned in the response. If 0 + * or less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token] + * from a previous + * [ListBackupSchedulesResponse][google.spanner.admin.database.v1.ListBackupSchedulesResponse] + * to the same `parent`. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token] + * from a previous + * [ListBackupSchedulesResponse][google.spanner.admin.database.v1.ListBackupSchedulesResponse] + * to the same `parent`. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupSchedulesResponse.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupSchedulesResponse.php new file mode 100644 index 000000000000..412a6c3800a9 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupSchedulesResponse.php @@ -0,0 +1,110 @@ +google.spanner.admin.database.v1.ListBackupSchedulesResponse + */ +class ListBackupSchedulesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of backup schedules for a database. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.BackupSchedule backup_schedules = 1; + */ + private $backup_schedules; + /** + * `next_page_token` can be sent in a subsequent + * [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules] + * call to fetch more of the schedules. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule>|\Google\Protobuf\Internal\RepeatedField $backup_schedules + * The list of backup schedules for a database. + * @type string $next_page_token + * `next_page_token` can be sent in a subsequent + * [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules] + * call to fetch more of the schedules. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); + parent::__construct($data); + } + + /** + * The list of backup schedules for a database. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.BackupSchedule backup_schedules = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBackupSchedules() + { + return $this->backup_schedules; + } + + /** + * The list of backup schedules for a database. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.BackupSchedule backup_schedules = 1; + * @param array<\Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBackupSchedules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule::class); + $this->backup_schedules = $arr; + + return $this; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules] + * call to fetch more of the schedules. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules] + * call to fetch more of the schedules. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupsRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupsRequest.php new file mode 100644 index 000000000000..cdcfabb13d44 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupsRequest.php @@ -0,0 +1,341 @@ +google.spanner.admin.database.v1.ListBackupsRequest + */ +class ListBackupsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The instance to list backups from. Values are of the + * form `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * An expression that filters the list of returned backups. + * A filter expression consists of a field name, a comparison operator, and a + * value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the + * [Backup][google.spanner.admin.database.v1.Backup] are eligible for + * filtering: + * * `name` + * * `database` + * * `state` + * * `create_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `size_bytes` + * * `backup_schedules` + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic, but + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `name:Howl` - The backup's name contains the string "howl". + * * `database:prod` + * - The database's name contains the string "prod". + * * `state:CREATING` - The backup is pending creation. + * * `state:READY` - The backup is fully created and ready for use. + * * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")` + * - The backup name contains the string "howl" and `create_time` + * of the backup is before 2018-03-28T14:50:00Z. + * * `expire_time < \"2018-03-28T14:50:00Z\"` + * - The backup `expire_time` is before 2018-03-28T14:50:00Z. + * * `size_bytes > 10000000000` - The backup's size is greater than 10GB + * * `backup_schedules:daily` + * - The backup is created from a schedule with "daily" in its name. + * + * Generated from protobuf field string filter = 2; + */ + protected $filter = ''; + /** + * Number of backups to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListBackupsResponse.next_page_token] + * from a previous + * [ListBackupsResponse][google.spanner.admin.database.v1.ListBackupsResponse] + * to the same `parent` and with the same `filter`. + * + * Generated from protobuf field string page_token = 4; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The instance to list backups from. Values are of the + * form `projects//instances/`. Please see + * {@see DatabaseAdminClient::instanceName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\ListBackupsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The instance to list backups from. Values are of the + * form `projects//instances/`. + * @type string $filter + * An expression that filters the list of returned backups. + * A filter expression consists of a field name, a comparison operator, and a + * value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the + * [Backup][google.spanner.admin.database.v1.Backup] are eligible for + * filtering: + * * `name` + * * `database` + * * `state` + * * `create_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `size_bytes` + * * `backup_schedules` + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic, but + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `name:Howl` - The backup's name contains the string "howl". + * * `database:prod` + * - The database's name contains the string "prod". + * * `state:CREATING` - The backup is pending creation. + * * `state:READY` - The backup is fully created and ready for use. + * * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")` + * - The backup name contains the string "howl" and `create_time` + * of the backup is before 2018-03-28T14:50:00Z. + * * `expire_time < \"2018-03-28T14:50:00Z\"` + * - The backup `expire_time` is before 2018-03-28T14:50:00Z. + * * `size_bytes > 10000000000` - The backup's size is greater than 10GB + * * `backup_schedules:daily` + * - The backup is created from a schedule with "daily" in its name. + * @type int $page_size + * Number of backups to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * @type string $page_token + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListBackupsResponse.next_page_token] + * from a previous + * [ListBackupsResponse][google.spanner.admin.database.v1.ListBackupsResponse] + * to the same `parent` and with the same `filter`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The instance to list backups from. Values are of the + * form `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The instance to list backups from. Values are of the + * form `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * An expression that filters the list of returned backups. + * A filter expression consists of a field name, a comparison operator, and a + * value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the + * [Backup][google.spanner.admin.database.v1.Backup] are eligible for + * filtering: + * * `name` + * * `database` + * * `state` + * * `create_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `size_bytes` + * * `backup_schedules` + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic, but + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `name:Howl` - The backup's name contains the string "howl". + * * `database:prod` + * - The database's name contains the string "prod". + * * `state:CREATING` - The backup is pending creation. + * * `state:READY` - The backup is fully created and ready for use. + * * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")` + * - The backup name contains the string "howl" and `create_time` + * of the backup is before 2018-03-28T14:50:00Z. + * * `expire_time < \"2018-03-28T14:50:00Z\"` + * - The backup `expire_time` is before 2018-03-28T14:50:00Z. + * * `size_bytes > 10000000000` - The backup's size is greater than 10GB + * * `backup_schedules:daily` + * - The backup is created from a schedule with "daily" in its name. + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * An expression that filters the list of returned backups. + * A filter expression consists of a field name, a comparison operator, and a + * value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the + * [Backup][google.spanner.admin.database.v1.Backup] are eligible for + * filtering: + * * `name` + * * `database` + * * `state` + * * `create_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `size_bytes` + * * `backup_schedules` + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic, but + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `name:Howl` - The backup's name contains the string "howl". + * * `database:prod` + * - The database's name contains the string "prod". + * * `state:CREATING` - The backup is pending creation. + * * `state:READY` - The backup is fully created and ready for use. + * * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")` + * - The backup name contains the string "howl" and `create_time` + * of the backup is before 2018-03-28T14:50:00Z. + * * `expire_time < \"2018-03-28T14:50:00Z\"` + * - The backup `expire_time` is before 2018-03-28T14:50:00Z. + * * `size_bytes > 10000000000` - The backup's size is greater than 10GB + * * `backup_schedules:daily` + * - The backup is created from a schedule with "daily" in its name. + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Number of backups to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Number of backups to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListBackupsResponse.next_page_token] + * from a previous + * [ListBackupsResponse][google.spanner.admin.database.v1.ListBackupsResponse] + * to the same `parent` and with the same `filter`. + * + * Generated from protobuf field string page_token = 4; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListBackupsResponse.next_page_token] + * from a previous + * [ListBackupsResponse][google.spanner.admin.database.v1.ListBackupsResponse] + * to the same `parent` and with the same `filter`. + * + * Generated from protobuf field string page_token = 4; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupsResponse.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupsResponse.php new file mode 100644 index 000000000000..97493b3614f1 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupsResponse.php @@ -0,0 +1,114 @@ +google.spanner.admin.database.v1.ListBackupsResponse + */ +class ListBackupsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of matching backups. Backups returned are ordered by `create_time` + * in descending order, starting from the most recent `create_time`. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.Backup backups = 1; + */ + private $backups; + /** + * `next_page_token` can be sent in a subsequent + * [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups] + * call to fetch more of the matching backups. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Spanner\Admin\Database\V1\Backup>|\Google\Protobuf\Internal\RepeatedField $backups + * The list of matching backups. Backups returned are ordered by `create_time` + * in descending order, starting from the most recent `create_time`. + * @type string $next_page_token + * `next_page_token` can be sent in a subsequent + * [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups] + * call to fetch more of the matching backups. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); + parent::__construct($data); + } + + /** + * The list of matching backups. Backups returned are ordered by `create_time` + * in descending order, starting from the most recent `create_time`. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.Backup backups = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBackups() + { + return $this->backups; + } + + /** + * The list of matching backups. Backups returned are ordered by `create_time` + * in descending order, starting from the most recent `create_time`. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.Backup backups = 1; + * @param array<\Google\Cloud\Spanner\Admin\Database\V1\Backup>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBackups($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Database\V1\Backup::class); + $this->backups = $arr; + + return $this; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups] + * call to fetch more of the matching backups. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups] + * call to fetch more of the matching backups. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseOperationsRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseOperationsRequest.php new file mode 100644 index 000000000000..b080b3ec6f4c --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseOperationsRequest.php @@ -0,0 +1,361 @@ +google.spanner.admin.database.v1.ListDatabaseOperationsRequest + */ +class ListDatabaseOperationsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The instance of the database operations. + * Values are of the form `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * An expression that filters the list of returned operations. + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the [Operation][google.longrunning.Operation] + * are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata] + * is + * `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \ + * `(metadata.source_type:BACKUP) AND` \ + * `(metadata.backup_info.backup:backup_howl) AND` \ + * `(metadata.name:restored_howl) AND` \ + * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. + * * The database is restored from a backup. + * * The backup name contains "backup_howl". + * * The restored database's name contains "restored_howl". + * * The operation started before 2018-03-28T14:50:00Z. + * * The operation resulted in an error. + * + * Generated from protobuf field string filter = 2; + */ + protected $filter = ''; + /** + * Number of operations to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token] + * from a previous + * [ListDatabaseOperationsResponse][google.spanner.admin.database.v1.ListDatabaseOperationsResponse] + * to the same `parent` and with the same `filter`. + * + * Generated from protobuf field string page_token = 4; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The instance of the database operations. + * Values are of the form `projects//instances/`. Please see + * {@see DatabaseAdminClient::instanceName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\ListDatabaseOperationsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The instance of the database operations. + * Values are of the form `projects//instances/`. + * @type string $filter + * An expression that filters the list of returned operations. + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the [Operation][google.longrunning.Operation] + * are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata] + * is + * `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \ + * `(metadata.source_type:BACKUP) AND` \ + * `(metadata.backup_info.backup:backup_howl) AND` \ + * `(metadata.name:restored_howl) AND` \ + * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. + * * The database is restored from a backup. + * * The backup name contains "backup_howl". + * * The restored database's name contains "restored_howl". + * * The operation started before 2018-03-28T14:50:00Z. + * * The operation resulted in an error. + * @type int $page_size + * Number of operations to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * @type string $page_token + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token] + * from a previous + * [ListDatabaseOperationsResponse][google.spanner.admin.database.v1.ListDatabaseOperationsResponse] + * to the same `parent` and with the same `filter`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The instance of the database operations. + * Values are of the form `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The instance of the database operations. + * Values are of the form `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * An expression that filters the list of returned operations. + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the [Operation][google.longrunning.Operation] + * are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata] + * is + * `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \ + * `(metadata.source_type:BACKUP) AND` \ + * `(metadata.backup_info.backup:backup_howl) AND` \ + * `(metadata.name:restored_howl) AND` \ + * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. + * * The database is restored from a backup. + * * The backup name contains "backup_howl". + * * The restored database's name contains "restored_howl". + * * The operation started before 2018-03-28T14:50:00Z. + * * The operation resulted in an error. + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * An expression that filters the list of returned operations. + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the [Operation][google.longrunning.Operation] + * are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata] + * is + * `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \ + * `(metadata.source_type:BACKUP) AND` \ + * `(metadata.backup_info.backup:backup_howl) AND` \ + * `(metadata.name:restored_howl) AND` \ + * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. + * * The database is restored from a backup. + * * The backup name contains "backup_howl". + * * The restored database's name contains "restored_howl". + * * The operation started before 2018-03-28T14:50:00Z. + * * The operation resulted in an error. + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Number of operations to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Number of operations to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token] + * from a previous + * [ListDatabaseOperationsResponse][google.spanner.admin.database.v1.ListDatabaseOperationsResponse] + * to the same `parent` and with the same `filter`. + * + * Generated from protobuf field string page_token = 4; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token] + * from a previous + * [ListDatabaseOperationsResponse][google.spanner.admin.database.v1.ListDatabaseOperationsResponse] + * to the same `parent` and with the same `filter`. + * + * Generated from protobuf field string page_token = 4; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseOperationsResponse.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseOperationsResponse.php new file mode 100644 index 000000000000..5e6f45741b25 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseOperationsResponse.php @@ -0,0 +1,126 @@ +google.spanner.admin.database.v1.ListDatabaseOperationsResponse + */ +class ListDatabaseOperationsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of matching database [long-running + * operations][google.longrunning.Operation]. Each operation's name will be + * prefixed by the database's name. The operation's + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. + * + * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; + */ + private $operations; + /** + * `next_page_token` can be sent in a subsequent + * [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations] + * call to fetch more of the matching metadata. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\LongRunning\Operation>|\Google\Protobuf\Internal\RepeatedField $operations + * The list of matching database [long-running + * operations][google.longrunning.Operation]. Each operation's name will be + * prefixed by the database's name. The operation's + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. + * @type string $next_page_token + * `next_page_token` can be sent in a subsequent + * [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations] + * call to fetch more of the matching metadata. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The list of matching database [long-running + * operations][google.longrunning.Operation]. Each operation's name will be + * prefixed by the database's name. The operation's + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. + * + * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOperations() + { + return $this->operations; + } + + /** + * The list of matching database [long-running + * operations][google.longrunning.Operation]. Each operation's name will be + * prefixed by the database's name. The operation's + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. + * + * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; + * @param array<\Google\LongRunning\Operation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOperations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\LongRunning\Operation::class); + $this->operations = $arr; + + return $this; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations] + * call to fetch more of the matching metadata. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations] + * call to fetch more of the matching metadata. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseRolesRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseRolesRequest.php new file mode 100644 index 000000000000..789226a8d1cd --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseRolesRequest.php @@ -0,0 +1,176 @@ +google.spanner.admin.database.v1.ListDatabaseRolesRequest + */ +class ListDatabaseRolesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The database whose roles should be listed. + * Values are of the form + * `projects//instances//databases/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Number of database roles to be returned in the response. If 0 or less, + * defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token] + * from a previous + * [ListDatabaseRolesResponse][google.spanner.admin.database.v1.ListDatabaseRolesResponse]. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The database whose roles should be listed. + * Values are of the form + * `projects//instances//databases/`. Please see + * {@see DatabaseAdminClient::databaseName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\ListDatabaseRolesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The database whose roles should be listed. + * Values are of the form + * `projects//instances//databases/`. + * @type int $page_size + * Number of database roles to be returned in the response. If 0 or less, + * defaults to the server's maximum allowed page size. + * @type string $page_token + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token] + * from a previous + * [ListDatabaseRolesResponse][google.spanner.admin.database.v1.ListDatabaseRolesResponse]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The database whose roles should be listed. + * Values are of the form + * `projects//instances//databases/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The database whose roles should be listed. + * Values are of the form + * `projects//instances//databases/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Number of database roles to be returned in the response. If 0 or less, + * defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Number of database roles to be returned in the response. If 0 or less, + * defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token] + * from a previous + * [ListDatabaseRolesResponse][google.spanner.admin.database.v1.ListDatabaseRolesResponse]. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token] + * from a previous + * [ListDatabaseRolesResponse][google.spanner.admin.database.v1.ListDatabaseRolesResponse]. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseRolesResponse.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseRolesResponse.php new file mode 100644 index 000000000000..e2f2c68f908e --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseRolesResponse.php @@ -0,0 +1,110 @@ +google.spanner.admin.database.v1.ListDatabaseRolesResponse + */ +class ListDatabaseRolesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Database roles that matched the request. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.DatabaseRole database_roles = 1; + */ + private $database_roles; + /** + * `next_page_token` can be sent in a subsequent + * [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles] + * call to fetch more of the matching roles. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Spanner\Admin\Database\V1\DatabaseRole>|\Google\Protobuf\Internal\RepeatedField $database_roles + * Database roles that matched the request. + * @type string $next_page_token + * `next_page_token` can be sent in a subsequent + * [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles] + * call to fetch more of the matching roles. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Database roles that matched the request. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.DatabaseRole database_roles = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDatabaseRoles() + { + return $this->database_roles; + } + + /** + * Database roles that matched the request. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.DatabaseRole database_roles = 1; + * @param array<\Google\Cloud\Spanner\Admin\Database\V1\DatabaseRole>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDatabaseRoles($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Database\V1\DatabaseRole::class); + $this->database_roles = $arr; + + return $this; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles] + * call to fetch more of the matching roles. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles] + * call to fetch more of the matching roles. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabasesRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabasesRequest.php new file mode 100644 index 000000000000..647992bff82d --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabasesRequest.php @@ -0,0 +1,171 @@ +google.spanner.admin.database.v1.ListDatabasesRequest + */ +class ListDatabasesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The instance whose databases should be listed. + * Values are of the form `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Number of databases to be returned in the response. If 0 or less, + * defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token] + * from a previous + * [ListDatabasesResponse][google.spanner.admin.database.v1.ListDatabasesResponse]. + * + * Generated from protobuf field string page_token = 4; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The instance whose databases should be listed. + * Values are of the form `projects//instances/`. Please see + * {@see DatabaseAdminClient::instanceName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\ListDatabasesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The instance whose databases should be listed. + * Values are of the form `projects//instances/`. + * @type int $page_size + * Number of databases to be returned in the response. If 0 or less, + * defaults to the server's maximum allowed page size. + * @type string $page_token + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token] + * from a previous + * [ListDatabasesResponse][google.spanner.admin.database.v1.ListDatabasesResponse]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The instance whose databases should be listed. + * Values are of the form `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The instance whose databases should be listed. + * Values are of the form `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Number of databases to be returned in the response. If 0 or less, + * defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Number of databases to be returned in the response. If 0 or less, + * defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token] + * from a previous + * [ListDatabasesResponse][google.spanner.admin.database.v1.ListDatabasesResponse]. + * + * Generated from protobuf field string page_token = 4; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token] + * from a previous + * [ListDatabasesResponse][google.spanner.admin.database.v1.ListDatabasesResponse]. + * + * Generated from protobuf field string page_token = 4; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabasesResponse.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabasesResponse.php new file mode 100644 index 000000000000..91e10c3ba675 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabasesResponse.php @@ -0,0 +1,110 @@ +google.spanner.admin.database.v1.ListDatabasesResponse + */ +class ListDatabasesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Databases that matched the request. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.Database databases = 1; + */ + private $databases; + /** + * `next_page_token` can be sent in a subsequent + * [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases] + * call to fetch more of the matching databases. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Spanner\Admin\Database\V1\Database>|\Google\Protobuf\Internal\RepeatedField $databases + * Databases that matched the request. + * @type string $next_page_token + * `next_page_token` can be sent in a subsequent + * [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases] + * call to fetch more of the matching databases. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Databases that matched the request. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.Database databases = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDatabases() + { + return $this->databases; + } + + /** + * Databases that matched the request. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.Database databases = 1; + * @param array<\Google\Cloud\Spanner\Admin\Database\V1\Database>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDatabases($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Database\V1\Database::class); + $this->databases = $arr; + + return $this; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases] + * call to fetch more of the matching databases. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases] + * call to fetch more of the matching databases. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/OperationProgress.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/OperationProgress.php new file mode 100644 index 000000000000..457e0f5b87d2 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/OperationProgress.php @@ -0,0 +1,164 @@ +google.spanner.admin.database.v1.OperationProgress + */ +class OperationProgress extends \Google\Protobuf\Internal\Message +{ + /** + * Percent completion of the operation. + * Values are between 0 and 100 inclusive. + * + * Generated from protobuf field int32 progress_percent = 1; + */ + protected $progress_percent = 0; + /** + * Time the request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + */ + protected $start_time = null; + /** + * If set, the time at which this operation failed or was completed + * successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + */ + protected $end_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $progress_percent + * Percent completion of the operation. + * Values are between 0 and 100 inclusive. + * @type \Google\Protobuf\Timestamp $start_time + * Time the request was received. + * @type \Google\Protobuf\Timestamp $end_time + * If set, the time at which this operation failed or was completed + * successfully. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * Percent completion of the operation. + * Values are between 0 and 100 inclusive. + * + * Generated from protobuf field int32 progress_percent = 1; + * @return int + */ + public function getProgressPercent() + { + return $this->progress_percent; + } + + /** + * Percent completion of the operation. + * Values are between 0 and 100 inclusive. + * + * Generated from protobuf field int32 progress_percent = 1; + * @param int $var + * @return $this + */ + public function setProgressPercent($var) + { + GPBUtil::checkInt32($var); + $this->progress_percent = $var; + + return $this; + } + + /** + * Time the request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Time the request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * If set, the time at which this operation failed or was completed + * successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * If set, the time at which this operation failed or was completed + * successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/OptimizeRestoredDatabaseMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/OptimizeRestoredDatabaseMetadata.php new file mode 100644 index 000000000000..6030a18943a5 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/OptimizeRestoredDatabaseMetadata.php @@ -0,0 +1,114 @@ +google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata + */ +class OptimizeRestoredDatabaseMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the restored database being optimized. + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The progress of the post-restore optimizations. + * + * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 2; + */ + protected $progress = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Name of the restored database being optimized. + * @type \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress $progress + * The progress of the post-restore optimizations. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Name of the restored database being optimized. + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Name of the restored database being optimized. + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The progress of the post-restore optimizations. + * + * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 2; + * @return \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress|null + */ + public function getProgress() + { + return $this->progress; + } + + public function hasProgress() + { + return isset($this->progress); + } + + public function clearProgress() + { + unset($this->progress); + } + + /** + * The progress of the post-restore optimizations. + * + * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 2; + * @param \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress $var + * @return $this + */ + public function setProgress($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress::class); + $this->progress = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseEncryptionConfig.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseEncryptionConfig.php new file mode 100644 index 000000000000..7826049bac09 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseEncryptionConfig.php @@ -0,0 +1,203 @@ +google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig + */ +class RestoreDatabaseEncryptionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The encryption type of the restored database. + * + * Generated from protobuf field .google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $encryption_type = 0; + /** + * Optional. The Cloud KMS key that will be used to encrypt/decrypt the + * restored database. This field should be set only when + * [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type] + * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $kms_key_name = ''; + /** + * Optional. Specifies the KMS configuration for the one or more keys used to + * encrypt the database. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * The keys referenced by kms_key_names must fully cover all + * regions of the database instance configuration. Some examples: + * * For single region database instance configs, specify a single regional + * location KMS key. + * * For multi-regional database instance configs of type GOOGLE_MANAGED, + * either specify a multi-regional location KMS key or multiple regional + * location KMS keys that cover all regions in the instance config. + * * For a database instance config of type USER_MANAGED, please specify only + * regional location KMS keys to cover each region in the instance config. + * Multi-regional location KMS keys are not supported for USER_MANAGED + * instance configs. + * + * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + private $kms_key_names; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $encryption_type + * Required. The encryption type of the restored database. + * @type string $kms_key_name + * Optional. The Cloud KMS key that will be used to encrypt/decrypt the + * restored database. This field should be set only when + * [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type] + * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * @type array|\Google\Protobuf\Internal\RepeatedField $kms_key_names + * Optional. Specifies the KMS configuration for the one or more keys used to + * encrypt the database. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * The keys referenced by kms_key_names must fully cover all + * regions of the database instance configuration. Some examples: + * * For single region database instance configs, specify a single regional + * location KMS key. + * * For multi-regional database instance configs of type GOOGLE_MANAGED, + * either specify a multi-regional location KMS key or multiple regional + * location KMS keys that cover all regions in the instance config. + * * For a database instance config of type USER_MANAGED, please specify only + * regional location KMS keys to cover each region in the instance config. + * Multi-regional location KMS keys are not supported for USER_MANAGED + * instance configs. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The encryption type of the restored database. + * + * Generated from protobuf field .google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getEncryptionType() + { + return $this->encryption_type; + } + + /** + * Required. The encryption type of the restored database. + * + * Generated from protobuf field .google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setEncryptionType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\RestoreDatabaseEncryptionConfig\EncryptionType::class); + $this->encryption_type = $var; + + return $this; + } + + /** + * Optional. The Cloud KMS key that will be used to encrypt/decrypt the + * restored database. This field should be set only when + * [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type] + * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getKmsKeyName() + { + return $this->kms_key_name; + } + + /** + * Optional. The Cloud KMS key that will be used to encrypt/decrypt the + * restored database. This field should be set only when + * [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type] + * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * + * Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setKmsKeyName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_name = $var; + + return $this; + } + + /** + * Optional. Specifies the KMS configuration for the one or more keys used to + * encrypt the database. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * The keys referenced by kms_key_names must fully cover all + * regions of the database instance configuration. Some examples: + * * For single region database instance configs, specify a single regional + * location KMS key. + * * For multi-regional database instance configs of type GOOGLE_MANAGED, + * either specify a multi-regional location KMS key or multiple regional + * location KMS keys that cover all regions in the instance config. + * * For a database instance config of type USER_MANAGED, please specify only + * regional location KMS keys to cover each region in the instance config. + * Multi-regional location KMS keys are not supported for USER_MANAGED + * instance configs. + * + * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getKmsKeyNames() + { + return $this->kms_key_names; + } + + /** + * Optional. Specifies the KMS configuration for the one or more keys used to + * encrypt the database. Values are of the form + * `projects//locations//keyRings//cryptoKeys/`. + * The keys referenced by kms_key_names must fully cover all + * regions of the database instance configuration. Some examples: + * * For single region database instance configs, specify a single regional + * location KMS key. + * * For multi-regional database instance configs of type GOOGLE_MANAGED, + * either specify a multi-regional location KMS key or multiple regional + * location KMS keys that cover all regions in the instance config. + * * For a database instance config of type USER_MANAGED, please specify only + * regional location KMS keys to cover each region in the instance config. + * Multi-regional location KMS keys are not supported for USER_MANAGED + * instance configs. + * + * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setKmsKeyNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->kms_key_names = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseEncryptionConfig/EncryptionType.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseEncryptionConfig/EncryptionType.php new file mode 100644 index 000000000000..6650757c3714 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseEncryptionConfig/EncryptionType.php @@ -0,0 +1,74 @@ +google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.EncryptionType + */ +class EncryptionType +{ + /** + * Unspecified. Do not use. + * + * Generated from protobuf enum ENCRYPTION_TYPE_UNSPECIFIED = 0; + */ + const ENCRYPTION_TYPE_UNSPECIFIED = 0; + /** + * This is the default option when + * [encryption_config][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig] + * is not specified. + * + * Generated from protobuf enum USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION = 1; + */ + const USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION = 1; + /** + * Use Google default encryption. + * + * Generated from protobuf enum GOOGLE_DEFAULT_ENCRYPTION = 2; + */ + const GOOGLE_DEFAULT_ENCRYPTION = 2; + /** + * Use customer managed encryption. If specified, `kms_key_name` must + * must contain a valid Cloud KMS key. + * + * Generated from protobuf enum CUSTOMER_MANAGED_ENCRYPTION = 3; + */ + const CUSTOMER_MANAGED_ENCRYPTION = 3; + + private static $valueToName = [ + self::ENCRYPTION_TYPE_UNSPECIFIED => 'ENCRYPTION_TYPE_UNSPECIFIED', + self::USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION => 'USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION', + self::GOOGLE_DEFAULT_ENCRYPTION => 'GOOGLE_DEFAULT_ENCRYPTION', + self::CUSTOMER_MANAGED_ENCRYPTION => 'CUSTOMER_MANAGED_ENCRYPTION', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(EncryptionType::class, \Google\Cloud\Spanner\Admin\Database\V1\RestoreDatabaseEncryptionConfig_EncryptionType::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseMetadata.php new file mode 100644 index 000000000000..176d1a1ee7ad --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseMetadata.php @@ -0,0 +1,358 @@ +google.spanner.admin.database.v1.RestoreDatabaseMetadata + */ +class RestoreDatabaseMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the database being created and restored to. + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The type of the restore source. + * + * Generated from protobuf field .google.spanner.admin.database.v1.RestoreSourceType source_type = 2; + */ + protected $source_type = 0; + /** + * The progress of the + * [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase] + * operation. + * + * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 4; + */ + protected $progress = null; + /** + * The time at which cancellation of this operation was received. + * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] + * starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not guaranteed. + * Clients can use + * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an [Operation.error][google.longrunning.Operation.error] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 5; + */ + protected $cancel_time = null; + /** + * If exists, the name of the long-running operation that will be used to + * track the post-restore optimization process to optimize the performance of + * the restored database, and remove the dependency on the restore source. + * The name is of the form + * `projects//instances//databases//operations/` + * where the is the name of database being created and restored to. + * The metadata type of the long-running operation is + * [OptimizeRestoredDatabaseMetadata][google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata]. + * This long-running operation will be automatically created by the system + * after the RestoreDatabase long-running operation completes successfully. + * This operation will not be created if the restore was not successful. + * + * Generated from protobuf field string optimize_database_operation_name = 6; + */ + protected $optimize_database_operation_name = ''; + protected $source_info; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Name of the database being created and restored to. + * @type int $source_type + * The type of the restore source. + * @type \Google\Cloud\Spanner\Admin\Database\V1\BackupInfo $backup_info + * Information about the backup used to restore the database. + * @type \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress $progress + * The progress of the + * [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase] + * operation. + * @type \Google\Protobuf\Timestamp $cancel_time + * The time at which cancellation of this operation was received. + * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] + * starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not guaranteed. + * Clients can use + * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an [Operation.error][google.longrunning.Operation.error] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * @type string $optimize_database_operation_name + * If exists, the name of the long-running operation that will be used to + * track the post-restore optimization process to optimize the performance of + * the restored database, and remove the dependency on the restore source. + * The name is of the form + * `projects//instances//databases//operations/` + * where the is the name of database being created and restored to. + * The metadata type of the long-running operation is + * [OptimizeRestoredDatabaseMetadata][google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata]. + * This long-running operation will be automatically created by the system + * after the RestoreDatabase long-running operation completes successfully. + * This operation will not be created if the restore was not successful. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Name of the database being created and restored to. + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Name of the database being created and restored to. + * + * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The type of the restore source. + * + * Generated from protobuf field .google.spanner.admin.database.v1.RestoreSourceType source_type = 2; + * @return int + */ + public function getSourceType() + { + return $this->source_type; + } + + /** + * The type of the restore source. + * + * Generated from protobuf field .google.spanner.admin.database.v1.RestoreSourceType source_type = 2; + * @param int $var + * @return $this + */ + public function setSourceType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\RestoreSourceType::class); + $this->source_type = $var; + + return $this; + } + + /** + * Information about the backup used to restore the database. + * + * Generated from protobuf field .google.spanner.admin.database.v1.BackupInfo backup_info = 3; + * @return \Google\Cloud\Spanner\Admin\Database\V1\BackupInfo|null + */ + public function getBackupInfo() + { + return $this->readOneof(3); + } + + public function hasBackupInfo() + { + return $this->hasOneof(3); + } + + /** + * Information about the backup used to restore the database. + * + * Generated from protobuf field .google.spanner.admin.database.v1.BackupInfo backup_info = 3; + * @param \Google\Cloud\Spanner\Admin\Database\V1\BackupInfo $var + * @return $this + */ + public function setBackupInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\BackupInfo::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * The progress of the + * [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase] + * operation. + * + * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 4; + * @return \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress|null + */ + public function getProgress() + { + return $this->progress; + } + + public function hasProgress() + { + return isset($this->progress); + } + + public function clearProgress() + { + unset($this->progress); + } + + /** + * The progress of the + * [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase] + * operation. + * + * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 4; + * @param \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress $var + * @return $this + */ + public function setProgress($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress::class); + $this->progress = $var; + + return $this; + } + + /** + * The time at which cancellation of this operation was received. + * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] + * starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not guaranteed. + * Clients can use + * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an [Operation.error][google.longrunning.Operation.error] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCancelTime() + { + return $this->cancel_time; + } + + public function hasCancelTime() + { + return isset($this->cancel_time); + } + + public function clearCancelTime() + { + unset($this->cancel_time); + } + + /** + * The time at which cancellation of this operation was received. + * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] + * starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not guaranteed. + * Clients can use + * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an [Operation.error][google.longrunning.Operation.error] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCancelTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->cancel_time = $var; + + return $this; + } + + /** + * If exists, the name of the long-running operation that will be used to + * track the post-restore optimization process to optimize the performance of + * the restored database, and remove the dependency on the restore source. + * The name is of the form + * `projects//instances//databases//operations/` + * where the is the name of database being created and restored to. + * The metadata type of the long-running operation is + * [OptimizeRestoredDatabaseMetadata][google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata]. + * This long-running operation will be automatically created by the system + * after the RestoreDatabase long-running operation completes successfully. + * This operation will not be created if the restore was not successful. + * + * Generated from protobuf field string optimize_database_operation_name = 6; + * @return string + */ + public function getOptimizeDatabaseOperationName() + { + return $this->optimize_database_operation_name; + } + + /** + * If exists, the name of the long-running operation that will be used to + * track the post-restore optimization process to optimize the performance of + * the restored database, and remove the dependency on the restore source. + * The name is of the form + * `projects//instances//databases//operations/` + * where the is the name of database being created and restored to. + * The metadata type of the long-running operation is + * [OptimizeRestoredDatabaseMetadata][google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata]. + * This long-running operation will be automatically created by the system + * after the RestoreDatabase long-running operation completes successfully. + * This operation will not be created if the restore was not successful. + * + * Generated from protobuf field string optimize_database_operation_name = 6; + * @param string $var + * @return $this + */ + public function setOptimizeDatabaseOperationName($var) + { + GPBUtil::checkString($var, True); + $this->optimize_database_operation_name = $var; + + return $this; + } + + /** + * @return string + */ + public function getSourceInfo() + { + return $this->whichOneof("source_info"); + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseRequest.php new file mode 100644 index 000000000000..7e9f39516096 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseRequest.php @@ -0,0 +1,265 @@ +google.spanner.admin.database.v1.RestoreDatabaseRequest + */ +class RestoreDatabaseRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the instance in which to create the + * restored database. This instance must be in the same project and + * have the same instance configuration as the instance containing + * the source backup. Values are of the form + * `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The id of the database to create and restore to. This + * database must not already exist. The `database_id` appended to + * `parent` forms the full database name of the form + * `projects//instances//databases/`. + * + * Generated from protobuf field string database_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $database_id = ''; + /** + * Optional. An encryption configuration describing the encryption type and + * key resources in Cloud KMS used to encrypt/decrypt the database to restore + * to. If this field is not specified, the restored database will use the same + * encryption configuration as the backup by default, namely + * [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type] + * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`. + * + * Generated from protobuf field .google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $encryption_config = null; + protected $source; + + /** + * @param string $parent Required. The name of the instance in which to create the + * restored database. This instance must be in the same project and + * have the same instance configuration as the instance containing + * the source backup. Values are of the form + * `projects//instances/`. Please see + * {@see DatabaseAdminClient::instanceName()} for help formatting this field. + * @param string $databaseId Required. The id of the database to create and restore to. This + * database must not already exist. The `database_id` appended to + * `parent` forms the full database name of the form + * `projects//instances//databases/`. + * @param string $backup Name of the backup from which to restore. Values are of the form + * `projects//instances//backups/`. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\RestoreDatabaseRequest + * + * @experimental + */ + public static function build(string $parent, string $databaseId, string $backup): self + { + return (new self()) + ->setParent($parent) + ->setDatabaseId($databaseId) + ->setBackup($backup); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the instance in which to create the + * restored database. This instance must be in the same project and + * have the same instance configuration as the instance containing + * the source backup. Values are of the form + * `projects//instances/`. + * @type string $database_id + * Required. The id of the database to create and restore to. This + * database must not already exist. The `database_id` appended to + * `parent` forms the full database name of the form + * `projects//instances//databases/`. + * @type string $backup + * Name of the backup from which to restore. Values are of the form + * `projects//instances//backups/`. + * @type \Google\Cloud\Spanner\Admin\Database\V1\RestoreDatabaseEncryptionConfig $encryption_config + * Optional. An encryption configuration describing the encryption type and + * key resources in Cloud KMS used to encrypt/decrypt the database to restore + * to. If this field is not specified, the restored database will use the same + * encryption configuration as the backup by default, namely + * [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type] + * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the instance in which to create the + * restored database. This instance must be in the same project and + * have the same instance configuration as the instance containing + * the source backup. Values are of the form + * `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The name of the instance in which to create the + * restored database. This instance must be in the same project and + * have the same instance configuration as the instance containing + * the source backup. Values are of the form + * `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The id of the database to create and restore to. This + * database must not already exist. The `database_id` appended to + * `parent` forms the full database name of the form + * `projects//instances//databases/`. + * + * Generated from protobuf field string database_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDatabaseId() + { + return $this->database_id; + } + + /** + * Required. The id of the database to create and restore to. This + * database must not already exist. The `database_id` appended to + * `parent` forms the full database name of the form + * `projects//instances//databases/`. + * + * Generated from protobuf field string database_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDatabaseId($var) + { + GPBUtil::checkString($var, True); + $this->database_id = $var; + + return $this; + } + + /** + * Name of the backup from which to restore. Values are of the form + * `projects//instances//backups/`. + * + * Generated from protobuf field string backup = 3 [(.google.api.resource_reference) = { + * @return string + */ + public function getBackup() + { + return $this->readOneof(3); + } + + public function hasBackup() + { + return $this->hasOneof(3); + } + + /** + * Name of the backup from which to restore. Values are of the form + * `projects//instances//backups/`. + * + * Generated from protobuf field string backup = 3 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Optional. An encryption configuration describing the encryption type and + * key resources in Cloud KMS used to encrypt/decrypt the database to restore + * to. If this field is not specified, the restored database will use the same + * encryption configuration as the backup by default, namely + * [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type] + * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`. + * + * Generated from protobuf field .google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Spanner\Admin\Database\V1\RestoreDatabaseEncryptionConfig|null + */ + public function getEncryptionConfig() + { + return $this->encryption_config; + } + + public function hasEncryptionConfig() + { + return isset($this->encryption_config); + } + + public function clearEncryptionConfig() + { + unset($this->encryption_config); + } + + /** + * Optional. An encryption configuration describing the encryption type and + * key resources in Cloud KMS used to encrypt/decrypt the database to restore + * to. If this field is not specified, the restored database will use the same + * encryption configuration as the backup by default, namely + * [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type] + * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`. + * + * Generated from protobuf field .google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Spanner\Admin\Database\V1\RestoreDatabaseEncryptionConfig $var + * @return $this + */ + public function setEncryptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\RestoreDatabaseEncryptionConfig::class); + $this->encryption_config = $var; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreInfo.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreInfo.php new file mode 100644 index 000000000000..2bcfe27d1868 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreInfo.php @@ -0,0 +1,112 @@ +google.spanner.admin.database.v1.RestoreInfo + */ +class RestoreInfo extends \Google\Protobuf\Internal\Message +{ + /** + * The type of the restore source. + * + * Generated from protobuf field .google.spanner.admin.database.v1.RestoreSourceType source_type = 1; + */ + protected $source_type = 0; + protected $source_info; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $source_type + * The type of the restore source. + * @type \Google\Cloud\Spanner\Admin\Database\V1\BackupInfo $backup_info + * Information about the backup used to restore the database. The backup + * may no longer exist. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The type of the restore source. + * + * Generated from protobuf field .google.spanner.admin.database.v1.RestoreSourceType source_type = 1; + * @return int + */ + public function getSourceType() + { + return $this->source_type; + } + + /** + * The type of the restore source. + * + * Generated from protobuf field .google.spanner.admin.database.v1.RestoreSourceType source_type = 1; + * @param int $var + * @return $this + */ + public function setSourceType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\RestoreSourceType::class); + $this->source_type = $var; + + return $this; + } + + /** + * Information about the backup used to restore the database. The backup + * may no longer exist. + * + * Generated from protobuf field .google.spanner.admin.database.v1.BackupInfo backup_info = 2; + * @return \Google\Cloud\Spanner\Admin\Database\V1\BackupInfo|null + */ + public function getBackupInfo() + { + return $this->readOneof(2); + } + + public function hasBackupInfo() + { + return $this->hasOneof(2); + } + + /** + * Information about the backup used to restore the database. The backup + * may no longer exist. + * + * Generated from protobuf field .google.spanner.admin.database.v1.BackupInfo backup_info = 2; + * @param \Google\Cloud\Spanner\Admin\Database\V1\BackupInfo $var + * @return $this + */ + public function setBackupInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\BackupInfo::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getSourceInfo() + { + return $this->whichOneof("source_info"); + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreSourceType.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreSourceType.php new file mode 100644 index 000000000000..9d51c00e2be6 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreSourceType.php @@ -0,0 +1,54 @@ +google.spanner.admin.database.v1.RestoreSourceType + */ +class RestoreSourceType +{ + /** + * No restore associated. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * A backup was used as the source of the restore. + * + * Generated from protobuf enum BACKUP = 1; + */ + const BACKUP = 1; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::BACKUP => 'BACKUP', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateBackupRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateBackupRequest.php new file mode 100644 index 000000000000..0c76d8690c85 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateBackupRequest.php @@ -0,0 +1,172 @@ +google.spanner.admin.database.v1.UpdateBackupRequest + */ +class UpdateBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The backup to update. `backup.name`, and the fields to be updated + * as specified by `update_mask` are required. Other fields are ignored. + * Update is only supported for the following fields: + * * `backup.expire_time`. + * + * Generated from protobuf field .google.spanner.admin.database.v1.Backup backup = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup = null; + /** + * Required. A mask specifying which fields (e.g. `expire_time`) in the + * Backup resource should be updated. This mask is relative to the Backup + * resource, not to the request message. The field mask must always be + * specified; this prevents any future fields from being erased accidentally + * by clients that do not know about them. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\Spanner\Admin\Database\V1\Backup $backup Required. The backup to update. `backup.name`, and the fields to be updated + * as specified by `update_mask` are required. Other fields are ignored. + * Update is only supported for the following fields: + * * `backup.expire_time`. + * @param \Google\Protobuf\FieldMask $updateMask Required. A mask specifying which fields (e.g. `expire_time`) in the + * Backup resource should be updated. This mask is relative to the Backup + * resource, not to the request message. The field mask must always be + * specified; this prevents any future fields from being erased accidentally + * by clients that do not know about them. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\UpdateBackupRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Spanner\Admin\Database\V1\Backup $backup, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setBackup($backup) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\Admin\Database\V1\Backup $backup + * Required. The backup to update. `backup.name`, and the fields to be updated + * as specified by `update_mask` are required. Other fields are ignored. + * Update is only supported for the following fields: + * * `backup.expire_time`. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. A mask specifying which fields (e.g. `expire_time`) in the + * Backup resource should be updated. This mask is relative to the Backup + * resource, not to the request message. The field mask must always be + * specified; this prevents any future fields from being erased accidentally + * by clients that do not know about them. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The backup to update. `backup.name`, and the fields to be updated + * as specified by `update_mask` are required. Other fields are ignored. + * Update is only supported for the following fields: + * * `backup.expire_time`. + * + * Generated from protobuf field .google.spanner.admin.database.v1.Backup backup = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\Admin\Database\V1\Backup|null + */ + public function getBackup() + { + return $this->backup; + } + + public function hasBackup() + { + return isset($this->backup); + } + + public function clearBackup() + { + unset($this->backup); + } + + /** + * Required. The backup to update. `backup.name`, and the fields to be updated + * as specified by `update_mask` are required. Other fields are ignored. + * Update is only supported for the following fields: + * * `backup.expire_time`. + * + * Generated from protobuf field .google.spanner.admin.database.v1.Backup backup = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\Admin\Database\V1\Backup $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\Backup::class); + $this->backup = $var; + + return $this; + } + + /** + * Required. A mask specifying which fields (e.g. `expire_time`) in the + * Backup resource should be updated. This mask is relative to the Backup + * resource, not to the request message. The field mask must always be + * specified; this prevents any future fields from being erased accidentally + * by clients that do not know about them. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. A mask specifying which fields (e.g. `expire_time`) in the + * Backup resource should be updated. This mask is relative to the Backup + * resource, not to the request message. The field mask must always be + * specified; this prevents any future fields from being erased accidentally + * by clients that do not know about them. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateBackupScheduleRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateBackupScheduleRequest.php new file mode 100644 index 000000000000..9d0e58d7f5b8 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateBackupScheduleRequest.php @@ -0,0 +1,167 @@ +google.spanner.admin.database.v1.UpdateBackupScheduleRequest + */ +class UpdateBackupScheduleRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The backup schedule to update. `backup_schedule.name`, and the + * fields to be updated as specified by `update_mask` are required. Other + * fields are ignored. + * + * Generated from protobuf field .google.spanner.admin.database.v1.BackupSchedule backup_schedule = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup_schedule = null; + /** + * Required. A mask specifying which fields in the BackupSchedule resource + * should be updated. This mask is relative to the BackupSchedule resource, + * not to the request message. The field mask must always be + * specified; this prevents any future fields from being erased + * accidentally. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule $backupSchedule Required. The backup schedule to update. `backup_schedule.name`, and the + * fields to be updated as specified by `update_mask` are required. Other + * fields are ignored. + * @param \Google\Protobuf\FieldMask $updateMask Required. A mask specifying which fields in the BackupSchedule resource + * should be updated. This mask is relative to the BackupSchedule resource, + * not to the request message. The field mask must always be + * specified; this prevents any future fields from being erased + * accidentally. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\UpdateBackupScheduleRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule $backupSchedule, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setBackupSchedule($backupSchedule) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule $backup_schedule + * Required. The backup schedule to update. `backup_schedule.name`, and the + * fields to be updated as specified by `update_mask` are required. Other + * fields are ignored. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. A mask specifying which fields in the BackupSchedule resource + * should be updated. This mask is relative to the BackupSchedule resource, + * not to the request message. The field mask must always be + * specified; this prevents any future fields from being erased + * accidentally. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); + parent::__construct($data); + } + + /** + * Required. The backup schedule to update. `backup_schedule.name`, and the + * fields to be updated as specified by `update_mask` are required. Other + * fields are ignored. + * + * Generated from protobuf field .google.spanner.admin.database.v1.BackupSchedule backup_schedule = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule|null + */ + public function getBackupSchedule() + { + return $this->backup_schedule; + } + + public function hasBackupSchedule() + { + return isset($this->backup_schedule); + } + + public function clearBackupSchedule() + { + unset($this->backup_schedule); + } + + /** + * Required. The backup schedule to update. `backup_schedule.name`, and the + * fields to be updated as specified by `update_mask` are required. Other + * fields are ignored. + * + * Generated from protobuf field .google.spanner.admin.database.v1.BackupSchedule backup_schedule = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule $var + * @return $this + */ + public function setBackupSchedule($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule::class); + $this->backup_schedule = $var; + + return $this; + } + + /** + * Required. A mask specifying which fields in the BackupSchedule resource + * should be updated. This mask is relative to the BackupSchedule resource, + * not to the request message. The field mask must always be + * specified; this prevents any future fields from being erased + * accidentally. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. A mask specifying which fields in the BackupSchedule resource + * should be updated. This mask is relative to the BackupSchedule resource, + * not to the request message. The field mask must always be + * specified; this prevents any future fields from being erased + * accidentally. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseDdlMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseDdlMetadata.php new file mode 100644 index 000000000000..767766fad333 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseDdlMetadata.php @@ -0,0 +1,286 @@ +google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata + */ +class UpdateDatabaseDdlMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The database being modified. + * + * Generated from protobuf field string database = 1 [(.google.api.resource_reference) = { + */ + protected $database = ''; + /** + * For an update this list contains all the statements. For an + * individual statement, this list contains only that statement. + * + * Generated from protobuf field repeated string statements = 2; + */ + private $statements; + /** + * Reports the commit timestamps of all statements that have + * succeeded so far, where `commit_timestamps[i]` is the commit + * timestamp for the statement `statements[i]`. + * + * Generated from protobuf field repeated .google.protobuf.Timestamp commit_timestamps = 3; + */ + private $commit_timestamps; + /** + * Output only. When true, indicates that the operation is throttled e.g. + * due to resource constraints. When resources become available the operation + * will resume and this field will be false again. + * + * Generated from protobuf field bool throttled = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $throttled = false; + /** + * The progress of the + * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] + * operations. All DDL statements will have continuously updating progress, + * and `progress[i]` is the operation progress for `statements[i]`. Also, + * `progress[i]` will have start time and end time populated with commit + * timestamp of operation, as well as a progress of 100% once the operation + * has completed. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.OperationProgress progress = 5; + */ + private $progress; + /** + * The brief action info for the DDL statements. + * `actions[i]` is the brief info for `statements[i]`. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.DdlStatementActionInfo actions = 6; + */ + private $actions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $database + * The database being modified. + * @type array|\Google\Protobuf\Internal\RepeatedField $statements + * For an update this list contains all the statements. For an + * individual statement, this list contains only that statement. + * @type array<\Google\Protobuf\Timestamp>|\Google\Protobuf\Internal\RepeatedField $commit_timestamps + * Reports the commit timestamps of all statements that have + * succeeded so far, where `commit_timestamps[i]` is the commit + * timestamp for the statement `statements[i]`. + * @type bool $throttled + * Output only. When true, indicates that the operation is throttled e.g. + * due to resource constraints. When resources become available the operation + * will resume and this field will be false again. + * @type array<\Google\Cloud\Spanner\Admin\Database\V1\OperationProgress>|\Google\Protobuf\Internal\RepeatedField $progress + * The progress of the + * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] + * operations. All DDL statements will have continuously updating progress, + * and `progress[i]` is the operation progress for `statements[i]`. Also, + * `progress[i]` will have start time and end time populated with commit + * timestamp of operation, as well as a progress of 100% once the operation + * has completed. + * @type array<\Google\Cloud\Spanner\Admin\Database\V1\DdlStatementActionInfo>|\Google\Protobuf\Internal\RepeatedField $actions + * The brief action info for the DDL statements. + * `actions[i]` is the brief info for `statements[i]`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The database being modified. + * + * Generated from protobuf field string database = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getDatabase() + { + return $this->database; + } + + /** + * The database being modified. + * + * Generated from protobuf field string database = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDatabase($var) + { + GPBUtil::checkString($var, True); + $this->database = $var; + + return $this; + } + + /** + * For an update this list contains all the statements. For an + * individual statement, this list contains only that statement. + * + * Generated from protobuf field repeated string statements = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStatements() + { + return $this->statements; + } + + /** + * For an update this list contains all the statements. For an + * individual statement, this list contains only that statement. + * + * Generated from protobuf field repeated string statements = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStatements($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->statements = $arr; + + return $this; + } + + /** + * Reports the commit timestamps of all statements that have + * succeeded so far, where `commit_timestamps[i]` is the commit + * timestamp for the statement `statements[i]`. + * + * Generated from protobuf field repeated .google.protobuf.Timestamp commit_timestamps = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCommitTimestamps() + { + return $this->commit_timestamps; + } + + /** + * Reports the commit timestamps of all statements that have + * succeeded so far, where `commit_timestamps[i]` is the commit + * timestamp for the statement `statements[i]`. + * + * Generated from protobuf field repeated .google.protobuf.Timestamp commit_timestamps = 3; + * @param array<\Google\Protobuf\Timestamp>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCommitTimestamps($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Timestamp::class); + $this->commit_timestamps = $arr; + + return $this; + } + + /** + * Output only. When true, indicates that the operation is throttled e.g. + * due to resource constraints. When resources become available the operation + * will resume and this field will be false again. + * + * Generated from protobuf field bool throttled = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getThrottled() + { + return $this->throttled; + } + + /** + * Output only. When true, indicates that the operation is throttled e.g. + * due to resource constraints. When resources become available the operation + * will resume and this field will be false again. + * + * Generated from protobuf field bool throttled = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setThrottled($var) + { + GPBUtil::checkBool($var); + $this->throttled = $var; + + return $this; + } + + /** + * The progress of the + * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] + * operations. All DDL statements will have continuously updating progress, + * and `progress[i]` is the operation progress for `statements[i]`. Also, + * `progress[i]` will have start time and end time populated with commit + * timestamp of operation, as well as a progress of 100% once the operation + * has completed. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.OperationProgress progress = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProgress() + { + return $this->progress; + } + + /** + * The progress of the + * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] + * operations. All DDL statements will have continuously updating progress, + * and `progress[i]` is the operation progress for `statements[i]`. Also, + * `progress[i]` will have start time and end time populated with commit + * timestamp of operation, as well as a progress of 100% once the operation + * has completed. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.OperationProgress progress = 5; + * @param array<\Google\Cloud\Spanner\Admin\Database\V1\OperationProgress>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProgress($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress::class); + $this->progress = $arr; + + return $this; + } + + /** + * The brief action info for the DDL statements. + * `actions[i]` is the brief info for `statements[i]`. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.DdlStatementActionInfo actions = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getActions() + { + return $this->actions; + } + + /** + * The brief action info for the DDL statements. + * `actions[i]` is the brief info for `statements[i]`. + * + * Generated from protobuf field repeated .google.spanner.admin.database.v1.DdlStatementActionInfo actions = 6; + * @param array<\Google\Cloud\Spanner\Admin\Database\V1\DdlStatementActionInfo>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setActions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Database\V1\DdlStatementActionInfo::class); + $this->actions = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseDdlRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseDdlRequest.php new file mode 100644 index 000000000000..d520012a1ad1 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseDdlRequest.php @@ -0,0 +1,323 @@ +google.spanner.admin.database.v1.UpdateDatabaseDdlRequest + */ +class UpdateDatabaseDdlRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The database to update. + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $database = ''; + /** + * Required. DDL statements to be applied to the database. + * + * Generated from protobuf field repeated string statements = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $statements; + /** + * If empty, the new update request is assigned an + * automatically-generated operation ID. Otherwise, `operation_id` + * is used to construct the name of the resulting + * [Operation][google.longrunning.Operation]. + * Specifying an explicit operation ID simplifies determining + * whether the statements were executed in the event that the + * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] + * call is replayed, or the return value is otherwise lost: the + * [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database] + * and `operation_id` fields can be combined to form the + * [name][google.longrunning.Operation.name] of the resulting + * [longrunning.Operation][google.longrunning.Operation]: + * `/operations/`. + * `operation_id` should be unique within the database, and must be + * a valid identifier: `[a-z][a-z0-9_]*`. Note that + * automatically-generated operation IDs always begin with an + * underscore. If the named operation already exists, + * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] + * returns `ALREADY_EXISTS`. + * + * Generated from protobuf field string operation_id = 3; + */ + protected $operation_id = ''; + /** + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * + * Generated from protobuf field bytes proto_descriptors = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $proto_descriptors = ''; + + /** + * @param string $database Required. The database to update. Please see + * {@see DatabaseAdminClient::databaseName()} for help formatting this field. + * @param string[] $statements Required. DDL statements to be applied to the database. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseDdlRequest + * + * @experimental + */ + public static function build(string $database, array $statements): self + { + return (new self()) + ->setDatabase($database) + ->setStatements($statements); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $database + * Required. The database to update. + * @type array|\Google\Protobuf\Internal\RepeatedField $statements + * Required. DDL statements to be applied to the database. + * @type string $operation_id + * If empty, the new update request is assigned an + * automatically-generated operation ID. Otherwise, `operation_id` + * is used to construct the name of the resulting + * [Operation][google.longrunning.Operation]. + * Specifying an explicit operation ID simplifies determining + * whether the statements were executed in the event that the + * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] + * call is replayed, or the return value is otherwise lost: the + * [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database] + * and `operation_id` fields can be combined to form the + * [name][google.longrunning.Operation.name] of the resulting + * [longrunning.Operation][google.longrunning.Operation]: + * `/operations/`. + * `operation_id` should be unique within the database, and must be + * a valid identifier: `[a-z][a-z0-9_]*`. Note that + * automatically-generated operation IDs always begin with an + * underscore. If the named operation already exists, + * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] + * returns `ALREADY_EXISTS`. + * @type string $proto_descriptors + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The database to update. + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getDatabase() + { + return $this->database; + } + + /** + * Required. The database to update. + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDatabase($var) + { + GPBUtil::checkString($var, True); + $this->database = $var; + + return $this; + } + + /** + * Required. DDL statements to be applied to the database. + * + * Generated from protobuf field repeated string statements = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStatements() + { + return $this->statements; + } + + /** + * Required. DDL statements to be applied to the database. + * + * Generated from protobuf field repeated string statements = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStatements($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->statements = $arr; + + return $this; + } + + /** + * If empty, the new update request is assigned an + * automatically-generated operation ID. Otherwise, `operation_id` + * is used to construct the name of the resulting + * [Operation][google.longrunning.Operation]. + * Specifying an explicit operation ID simplifies determining + * whether the statements were executed in the event that the + * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] + * call is replayed, or the return value is otherwise lost: the + * [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database] + * and `operation_id` fields can be combined to form the + * [name][google.longrunning.Operation.name] of the resulting + * [longrunning.Operation][google.longrunning.Operation]: + * `/operations/`. + * `operation_id` should be unique within the database, and must be + * a valid identifier: `[a-z][a-z0-9_]*`. Note that + * automatically-generated operation IDs always begin with an + * underscore. If the named operation already exists, + * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] + * returns `ALREADY_EXISTS`. + * + * Generated from protobuf field string operation_id = 3; + * @return string + */ + public function getOperationId() + { + return $this->operation_id; + } + + /** + * If empty, the new update request is assigned an + * automatically-generated operation ID. Otherwise, `operation_id` + * is used to construct the name of the resulting + * [Operation][google.longrunning.Operation]. + * Specifying an explicit operation ID simplifies determining + * whether the statements were executed in the event that the + * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] + * call is replayed, or the return value is otherwise lost: the + * [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database] + * and `operation_id` fields can be combined to form the + * [name][google.longrunning.Operation.name] of the resulting + * [longrunning.Operation][google.longrunning.Operation]: + * `/operations/`. + * `operation_id` should be unique within the database, and must be + * a valid identifier: `[a-z][a-z0-9_]*`. Note that + * automatically-generated operation IDs always begin with an + * underscore. If the named operation already exists, + * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] + * returns `ALREADY_EXISTS`. + * + * Generated from protobuf field string operation_id = 3; + * @param string $var + * @return $this + */ + public function setOperationId($var) + { + GPBUtil::checkString($var, True); + $this->operation_id = $var; + + return $this; + } + + /** + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * + * Generated from protobuf field bytes proto_descriptors = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getProtoDescriptors() + { + return $this->proto_descriptors; + } + + /** + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * + * Generated from protobuf field bytes proto_descriptors = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setProtoDescriptors($var) + { + GPBUtil::checkString($var, False); + $this->proto_descriptors = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseMetadata.php new file mode 100644 index 000000000000..19c926a4aa5e --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseMetadata.php @@ -0,0 +1,182 @@ +google.spanner.admin.database.v1.UpdateDatabaseMetadata + */ +class UpdateDatabaseMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The request for + * [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]. + * + * Generated from protobuf field .google.spanner.admin.database.v1.UpdateDatabaseRequest request = 1; + */ + protected $request = null; + /** + * The progress of the + * [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase] + * operation. + * + * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 2; + */ + protected $progress = null; + /** + * The time at which this operation was cancelled. If set, this operation is + * in the process of undoing itself (which is best-effort). + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + */ + protected $cancel_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseRequest $request + * The request for + * [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]. + * @type \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress $progress + * The progress of the + * [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase] + * operation. + * @type \Google\Protobuf\Timestamp $cancel_time + * The time at which this operation was cancelled. If set, this operation is + * in the process of undoing itself (which is best-effort). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The request for + * [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]. + * + * Generated from protobuf field .google.spanner.admin.database.v1.UpdateDatabaseRequest request = 1; + * @return \Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseRequest|null + */ + public function getRequest() + { + return $this->request; + } + + public function hasRequest() + { + return isset($this->request); + } + + public function clearRequest() + { + unset($this->request); + } + + /** + * The request for + * [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]. + * + * Generated from protobuf field .google.spanner.admin.database.v1.UpdateDatabaseRequest request = 1; + * @param \Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseRequest $var + * @return $this + */ + public function setRequest($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseRequest::class); + $this->request = $var; + + return $this; + } + + /** + * The progress of the + * [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase] + * operation. + * + * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 2; + * @return \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress|null + */ + public function getProgress() + { + return $this->progress; + } + + public function hasProgress() + { + return isset($this->progress); + } + + public function clearProgress() + { + unset($this->progress); + } + + /** + * The progress of the + * [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase] + * operation. + * + * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 2; + * @param \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress $var + * @return $this + */ + public function setProgress($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress::class); + $this->progress = $var; + + return $this; + } + + /** + * The time at which this operation was cancelled. If set, this operation is + * in the process of undoing itself (which is best-effort). + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCancelTime() + { + return $this->cancel_time; + } + + public function hasCancelTime() + { + return isset($this->cancel_time); + } + + public function clearCancelTime() + { + unset($this->cancel_time); + } + + /** + * The time at which this operation was cancelled. If set, this operation is + * in the process of undoing itself (which is best-effort). + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCancelTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->cancel_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseRequest.php new file mode 100644 index 000000000000..7fecddf2dd12 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseRequest.php @@ -0,0 +1,152 @@ +google.spanner.admin.database.v1.UpdateDatabaseRequest + */ +class UpdateDatabaseRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The database to update. + * The `name` field of the database is of the form + * `projects//instances//databases/`. + * + * Generated from protobuf field .google.spanner.admin.database.v1.Database database = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $database = null; + /** + * Required. The list of fields to update. Currently, only + * `enable_drop_protection` field can be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\Spanner\Admin\Database\V1\Database $database Required. The database to update. + * The `name` field of the database is of the form + * `projects//instances//databases/`. + * @param \Google\Protobuf\FieldMask $updateMask Required. The list of fields to update. Currently, only + * `enable_drop_protection` field can be updated. + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Spanner\Admin\Database\V1\Database $database, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setDatabase($database) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\Admin\Database\V1\Database $database + * Required. The database to update. + * The `name` field of the database is of the form + * `projects//instances//databases/`. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. The list of fields to update. Currently, only + * `enable_drop_protection` field can be updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The database to update. + * The `name` field of the database is of the form + * `projects//instances//databases/`. + * + * Generated from protobuf field .google.spanner.admin.database.v1.Database database = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\Admin\Database\V1\Database|null + */ + public function getDatabase() + { + return $this->database; + } + + public function hasDatabase() + { + return isset($this->database); + } + + public function clearDatabase() + { + unset($this->database); + } + + /** + * Required. The database to update. + * The `name` field of the database is of the form + * `projects//instances//databases/`. + * + * Generated from protobuf field .google.spanner.admin.database.v1.Database database = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\Admin\Database\V1\Database $var + * @return $this + */ + public function setDatabase($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\Database::class); + $this->database = $var; + + return $this; + } + + /** + * Required. The list of fields to update. Currently, only + * `enable_drop_protection` field can be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. The list of fields to update. Currently, only + * `enable_drop_protection` field can be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/copy_backup.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/copy_backup.php new file mode 100644 index 000000000000..bf4780852402 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/copy_backup.php @@ -0,0 +1,116 @@ +/instances//backups//operations/` + * and can be used to track copying of the backup. The operation is associated + * with the destination backup. + * The [metadata][google.longrunning.Operation.metadata] field type is + * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Backup][google.spanner.admin.database.v1.Backup], if successful. + * Cancelling the returned operation will stop the copying and delete the + * destination backup. Concurrent CopyBackup requests can run on the same + * source backup. + * + * @param string $formattedParent The name of the destination instance that will contain the backup + * copy. Values are of the form: `projects//instances/`. Please see + * {@see DatabaseAdminClient::instanceName()} for help formatting this field. + * @param string $backupId The id of the backup copy. + * The `backup_id` appended to `parent` forms the full backup_uri of the form + * `projects//instances//backups/`. + * @param string $formattedSourceBackup The source backup to be copied. + * The source backup needs to be in READY state for it to be copied. + * Once CopyBackup is in progress, the source backup cannot be deleted or + * cleaned up on expiration until CopyBackup is finished. + * Values are of the form: + * `projects//instances//backups/`. Please see + * {@see DatabaseAdminClient::backupName()} for help formatting this field. + */ +function copy_backup_sample( + string $formattedParent, + string $backupId, + string $formattedSourceBackup +): void { + // Create a client. + $databaseAdminClient = new DatabaseAdminClient(); + + // Prepare the request message. + $expireTime = new Timestamp(); + $request = (new CopyBackupRequest()) + ->setParent($formattedParent) + ->setBackupId($backupId) + ->setSourceBackup($formattedSourceBackup) + ->setExpireTime($expireTime); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $databaseAdminClient->copyBackup($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Backup $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DatabaseAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); + $backupId = '[BACKUP_ID]'; + $formattedSourceBackup = DatabaseAdminClient::backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); + + copy_backup_sample($formattedParent, $backupId, $formattedSourceBackup); +} +// [END spanner_v1_generated_DatabaseAdmin_CopyBackup_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_backup.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_backup.php new file mode 100644 index 000000000000..f37b442933b9 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_backup.php @@ -0,0 +1,106 @@ +/instances//backups//operations/` + * and can be used to track creation of the backup. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Backup][google.spanner.admin.database.v1.Backup], if successful. + * Cancelling the returned operation will stop the creation and delete the + * backup. There can be only one pending backup creation per database. Backup + * creation of different databases can run concurrently. + * + * @param string $formattedParent The name of the instance in which the backup will be + * created. This must be the same instance that contains the database the + * backup will be created from. The backup will be stored in the + * location(s) specified in the instance configuration of this + * instance. Values are of the form + * `projects//instances/`. Please see + * {@see DatabaseAdminClient::instanceName()} for help formatting this field. + * @param string $backupId The id of the backup to be created. The `backup_id` appended to + * `parent` forms the full backup name of the form + * `projects//instances//backups/`. + */ +function create_backup_sample(string $formattedParent, string $backupId): void +{ + // Create a client. + $databaseAdminClient = new DatabaseAdminClient(); + + // Prepare the request message. + $backup = new Backup(); + $request = (new CreateBackupRequest()) + ->setParent($formattedParent) + ->setBackupId($backupId) + ->setBackup($backup); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $databaseAdminClient->createBackup($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Backup $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DatabaseAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); + $backupId = '[BACKUP_ID]'; + + create_backup_sample($formattedParent, $backupId); +} +// [END spanner_v1_generated_DatabaseAdmin_CreateBackup_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_backup_schedule.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_backup_schedule.php new file mode 100644 index 000000000000..ba14928345f0 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_backup_schedule.php @@ -0,0 +1,78 @@ +/instances//databases//backupSchedules/`. + */ +function create_backup_schedule_sample(string $formattedParent, string $backupScheduleId): void +{ + // Create a client. + $databaseAdminClient = new DatabaseAdminClient(); + + // Prepare the request message. + $backupSchedule = new BackupSchedule(); + $request = (new CreateBackupScheduleRequest()) + ->setParent($formattedParent) + ->setBackupScheduleId($backupScheduleId) + ->setBackupSchedule($backupSchedule); + + // Call the API and handle any network failures. + try { + /** @var BackupSchedule $response */ + $response = $databaseAdminClient->createBackupSchedule($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DatabaseAdminClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $backupScheduleId = '[BACKUP_SCHEDULE_ID]'; + + create_backup_schedule_sample($formattedParent, $backupScheduleId); +} +// [END spanner_v1_generated_DatabaseAdmin_CreateBackupSchedule_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_database.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_database.php new file mode 100644 index 000000000000..308c9926dcd8 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_database.php @@ -0,0 +1,98 @@ +/operations/` and + * can be used to track preparation of the database. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Database][google.spanner.admin.database.v1.Database], if successful. + * + * @param string $formattedParent The name of the instance that will serve the new database. + * Values are of the form `projects//instances/`. Please see + * {@see DatabaseAdminClient::instanceName()} for help formatting this field. + * @param string $createStatement A `CREATE DATABASE` statement, which specifies the ID of the + * new database. The database ID must conform to the regular expression + * `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length. + * If the database ID is a reserved word or if it contains a hyphen, the + * database ID must be enclosed in backticks (`` ` ``). + */ +function create_database_sample(string $formattedParent, string $createStatement): void +{ + // Create a client. + $databaseAdminClient = new DatabaseAdminClient(); + + // Prepare the request message. + $request = (new CreateDatabaseRequest()) + ->setParent($formattedParent) + ->setCreateStatement($createStatement); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $databaseAdminClient->createDatabase($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Database $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DatabaseAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); + $createStatement = '[CREATE_STATEMENT]'; + + create_database_sample($formattedParent, $createStatement); +} +// [END spanner_v1_generated_DatabaseAdmin_CreateDatabase_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/delete_backup.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/delete_backup.php new file mode 100644 index 000000000000..46ba2aa004e1 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/delete_backup.php @@ -0,0 +1,72 @@ +/instances//backups/`. Please see + * {@see DatabaseAdminClient::backupName()} for help formatting this field. + */ +function delete_backup_sample(string $formattedName): void +{ + // Create a client. + $databaseAdminClient = new DatabaseAdminClient(); + + // Prepare the request message. + $request = (new DeleteBackupRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + $databaseAdminClient->deleteBackup($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DatabaseAdminClient::backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); + + delete_backup_sample($formattedName); +} +// [END spanner_v1_generated_DatabaseAdmin_DeleteBackup_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/delete_backup_schedule.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/delete_backup_schedule.php new file mode 100644 index 000000000000..ed7fab2b6c98 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/delete_backup_schedule.php @@ -0,0 +1,76 @@ +/instances//databases//backupSchedules/`. Please see + * {@see DatabaseAdminClient::backupScheduleName()} for help formatting this field. + */ +function delete_backup_schedule_sample(string $formattedName): void +{ + // Create a client. + $databaseAdminClient = new DatabaseAdminClient(); + + // Prepare the request message. + $request = (new DeleteBackupScheduleRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + $databaseAdminClient->deleteBackupSchedule($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DatabaseAdminClient::backupScheduleName( + '[PROJECT]', + '[INSTANCE]', + '[DATABASE]', + '[SCHEDULE]' + ); + + delete_backup_schedule_sample($formattedName); +} +// [END spanner_v1_generated_DatabaseAdmin_DeleteBackupSchedule_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/drop_database.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/drop_database.php new file mode 100644 index 000000000000..691a64182331 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/drop_database.php @@ -0,0 +1,73 @@ +setDatabase($formattedDatabase); + + // Call the API and handle any network failures. + try { + $databaseAdminClient->dropDatabase($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedDatabase = DatabaseAdminClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + + drop_database_sample($formattedDatabase); +} +// [END spanner_v1_generated_DatabaseAdmin_DropDatabase_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_backup.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_backup.php new file mode 100644 index 000000000000..dd0c37e50d96 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_backup.php @@ -0,0 +1,74 @@ +/instances//backups/`. Please see + * {@see DatabaseAdminClient::backupName()} for help formatting this field. + */ +function get_backup_sample(string $formattedName): void +{ + // Create a client. + $databaseAdminClient = new DatabaseAdminClient(); + + // Prepare the request message. + $request = (new GetBackupRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Backup $response */ + $response = $databaseAdminClient->getBackup($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DatabaseAdminClient::backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); + + get_backup_sample($formattedName); +} +// [END spanner_v1_generated_DatabaseAdmin_GetBackup_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_backup_schedule.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_backup_schedule.php new file mode 100644 index 000000000000..d6b4b6d9996b --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_backup_schedule.php @@ -0,0 +1,78 @@ +/instances//databases//backupSchedules/`. Please see + * {@see DatabaseAdminClient::backupScheduleName()} for help formatting this field. + */ +function get_backup_schedule_sample(string $formattedName): void +{ + // Create a client. + $databaseAdminClient = new DatabaseAdminClient(); + + // Prepare the request message. + $request = (new GetBackupScheduleRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var BackupSchedule $response */ + $response = $databaseAdminClient->getBackupSchedule($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DatabaseAdminClient::backupScheduleName( + '[PROJECT]', + '[INSTANCE]', + '[DATABASE]', + '[SCHEDULE]' + ); + + get_backup_schedule_sample($formattedName); +} +// [END spanner_v1_generated_DatabaseAdmin_GetBackupSchedule_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_database.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_database.php new file mode 100644 index 000000000000..2d3f26df97fe --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_database.php @@ -0,0 +1,72 @@ +/instances//databases/`. Please see + * {@see DatabaseAdminClient::databaseName()} for help formatting this field. + */ +function get_database_sample(string $formattedName): void +{ + // Create a client. + $databaseAdminClient = new DatabaseAdminClient(); + + // Prepare the request message. + $request = (new GetDatabaseRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Database $response */ + $response = $databaseAdminClient->getDatabase($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DatabaseAdminClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + + get_database_sample($formattedName); +} +// [END spanner_v1_generated_DatabaseAdmin_GetDatabase_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_database_ddl.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_database_ddl.php new file mode 100644 index 000000000000..011dd8892cfb --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_database_ddl.php @@ -0,0 +1,75 @@ +/instances//databases/` + * Please see {@see DatabaseAdminClient::databaseName()} for help formatting this field. + */ +function get_database_ddl_sample(string $formattedDatabase): void +{ + // Create a client. + $databaseAdminClient = new DatabaseAdminClient(); + + // Prepare the request message. + $request = (new GetDatabaseDdlRequest()) + ->setDatabase($formattedDatabase); + + // Call the API and handle any network failures. + try { + /** @var GetDatabaseDdlResponse $response */ + $response = $databaseAdminClient->getDatabaseDdl($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedDatabase = DatabaseAdminClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + + get_database_ddl_sample($formattedDatabase); +} +// [END spanner_v1_generated_DatabaseAdmin_GetDatabaseDdl_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_iam_policy.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_iam_policy.php new file mode 100644 index 000000000000..4bbbe40d0e1f --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_iam_policy.php @@ -0,0 +1,78 @@ +setResource($resource); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $databaseAdminClient->getIamPolicy($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + + get_iam_policy_sample($resource); +} +// [END spanner_v1_generated_DatabaseAdmin_GetIamPolicy_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backup_operations.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backup_operations.php new file mode 100644 index 000000000000..2298fb55c22a --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backup_operations.php @@ -0,0 +1,86 @@ +/instances//backups//operations/`. + * The long-running operation + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that have completed/failed/canceled within the last 7 days, + * and pending operations. Operations returned are ordered by + * `operation.metadata.value.progress.start_time` in descending order starting + * from the most recently started operation. + * + * @param string $formattedParent The instance of the backup operations. Values are of + * the form `projects//instances/`. Please see + * {@see DatabaseAdminClient::instanceName()} for help formatting this field. + */ +function list_backup_operations_sample(string $formattedParent): void +{ + // Create a client. + $databaseAdminClient = new DatabaseAdminClient(); + + // Prepare the request message. + $request = (new ListBackupOperationsRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $databaseAdminClient->listBackupOperations($request); + + /** @var Operation $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DatabaseAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); + + list_backup_operations_sample($formattedParent); +} +// [END spanner_v1_generated_DatabaseAdmin_ListBackupOperations_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backup_schedules.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backup_schedules.php new file mode 100644 index 000000000000..82cd57070834 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backup_schedules.php @@ -0,0 +1,78 @@ +/instances//databases/ + * Please see {@see DatabaseAdminClient::databaseName()} for help formatting this field. + */ +function list_backup_schedules_sample(string $formattedParent): void +{ + // Create a client. + $databaseAdminClient = new DatabaseAdminClient(); + + // Prepare the request message. + $request = (new ListBackupSchedulesRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $databaseAdminClient->listBackupSchedules($request); + + /** @var BackupSchedule $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DatabaseAdminClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + + list_backup_schedules_sample($formattedParent); +} +// [END spanner_v1_generated_DatabaseAdmin_ListBackupSchedules_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backups.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backups.php new file mode 100644 index 000000000000..d687264c7a41 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backups.php @@ -0,0 +1,79 @@ +/instances/`. Please see + * {@see DatabaseAdminClient::instanceName()} for help formatting this field. + */ +function list_backups_sample(string $formattedParent): void +{ + // Create a client. + $databaseAdminClient = new DatabaseAdminClient(); + + // Prepare the request message. + $request = (new ListBackupsRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $databaseAdminClient->listBackups($request); + + /** @var Backup $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DatabaseAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); + + list_backups_sample($formattedParent); +} +// [END spanner_v1_generated_DatabaseAdmin_ListBackups_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_database_operations.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_database_operations.php new file mode 100644 index 000000000000..b5fdc2e72e1f --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_database_operations.php @@ -0,0 +1,84 @@ +/instances//databases//operations/`. + * The long-running operation + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that have completed/failed/canceled within the last 7 days, + * and pending operations. + * + * @param string $formattedParent The instance of the database operations. + * Values are of the form `projects//instances/`. Please see + * {@see DatabaseAdminClient::instanceName()} for help formatting this field. + */ +function list_database_operations_sample(string $formattedParent): void +{ + // Create a client. + $databaseAdminClient = new DatabaseAdminClient(); + + // Prepare the request message. + $request = (new ListDatabaseOperationsRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $databaseAdminClient->listDatabaseOperations($request); + + /** @var Operation $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DatabaseAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); + + list_database_operations_sample($formattedParent); +} +// [END spanner_v1_generated_DatabaseAdmin_ListDatabaseOperations_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_database_roles.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_database_roles.php new file mode 100644 index 000000000000..adad9a597fe4 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_database_roles.php @@ -0,0 +1,78 @@ +/instances//databases/`. Please see + * {@see DatabaseAdminClient::databaseName()} for help formatting this field. + */ +function list_database_roles_sample(string $formattedParent): void +{ + // Create a client. + $databaseAdminClient = new DatabaseAdminClient(); + + // Prepare the request message. + $request = (new ListDatabaseRolesRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $databaseAdminClient->listDatabaseRoles($request); + + /** @var DatabaseRole $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DatabaseAdminClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + + list_database_roles_sample($formattedParent); +} +// [END spanner_v1_generated_DatabaseAdmin_ListDatabaseRoles_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_databases.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_databases.php new file mode 100644 index 000000000000..34951db4e1cf --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_databases.php @@ -0,0 +1,77 @@ +/instances/`. Please see + * {@see DatabaseAdminClient::instanceName()} for help formatting this field. + */ +function list_databases_sample(string $formattedParent): void +{ + // Create a client. + $databaseAdminClient = new DatabaseAdminClient(); + + // Prepare the request message. + $request = (new ListDatabasesRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $databaseAdminClient->listDatabases($request); + + /** @var Database $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DatabaseAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); + + list_databases_sample($formattedParent); +} +// [END spanner_v1_generated_DatabaseAdmin_ListDatabases_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/restore_database.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/restore_database.php new file mode 100644 index 000000000000..bc4a42a8b5e1 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/restore_database.php @@ -0,0 +1,109 @@ +/instances//databases//operations/`, + * and can be used to track the progress of the operation, and to cancel it. + * The [metadata][google.longrunning.Operation.metadata] field type is + * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. + * The [response][google.longrunning.Operation.response] type + * is [Database][google.spanner.admin.database.v1.Database], if + * successful. Cancelling the returned operation will stop the restore and + * delete the database. + * There can be only one database being restored into an instance at a time. + * Once the restore operation completes, a new restore operation can be + * initiated, without waiting for the optimize operation associated with the + * first restore to complete. + * + * @param string $formattedParent The name of the instance in which to create the + * restored database. This instance must be in the same project and + * have the same instance configuration as the instance containing + * the source backup. Values are of the form + * `projects//instances/`. Please see + * {@see DatabaseAdminClient::instanceName()} for help formatting this field. + * @param string $databaseId The id of the database to create and restore to. This + * database must not already exist. The `database_id` appended to + * `parent` forms the full database name of the form + * `projects//instances//databases/`. + */ +function restore_database_sample(string $formattedParent, string $databaseId): void +{ + // Create a client. + $databaseAdminClient = new DatabaseAdminClient(); + + // Prepare the request message. + $request = (new RestoreDatabaseRequest()) + ->setParent($formattedParent) + ->setDatabaseId($databaseId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $databaseAdminClient->restoreDatabase($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Database $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DatabaseAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); + $databaseId = '[DATABASE_ID]'; + + restore_database_sample($formattedParent, $databaseId); +} +// [END spanner_v1_generated_DatabaseAdmin_RestoreDatabase_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/set_iam_policy.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/set_iam_policy.php new file mode 100644 index 000000000000..3b13570033d8 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/set_iam_policy.php @@ -0,0 +1,79 @@ +setResource($resource) + ->setPolicy($policy); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $databaseAdminClient->setIamPolicy($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + + set_iam_policy_sample($resource); +} +// [END spanner_v1_generated_DatabaseAdmin_SetIamPolicy_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/test_iam_permissions.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/test_iam_permissions.php new file mode 100644 index 000000000000..5dabcf6475f4 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/test_iam_permissions.php @@ -0,0 +1,87 @@ +setResource($resource) + ->setPermissions($permissions); + + // Call the API and handle any network failures. + try { + /** @var TestIamPermissionsResponse $response */ + $response = $databaseAdminClient->testIamPermissions($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + $permissionsElement = '[PERMISSIONS]'; + + test_iam_permissions_sample($resource, $permissionsElement); +} +// [END spanner_v1_generated_DatabaseAdmin_TestIamPermissions_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_backup.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_backup.php new file mode 100644 index 000000000000..af4bc1f93d3f --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_backup.php @@ -0,0 +1,63 @@ +setBackup($backup) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var Backup $response */ + $response = $databaseAdminClient->updateBackup($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END spanner_v1_generated_DatabaseAdmin_UpdateBackup_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_backup_schedule.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_backup_schedule.php new file mode 100644 index 000000000000..b00ed6cc827e --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_backup_schedule.php @@ -0,0 +1,62 @@ +setBackupSchedule($backupSchedule) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var BackupSchedule $response */ + $response = $databaseAdminClient->updateBackupSchedule($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END spanner_v1_generated_DatabaseAdmin_UpdateBackupSchedule_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_database.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_database.php new file mode 100644 index 000000000000..2897445d8857 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_database.php @@ -0,0 +1,126 @@ +/instances//databases//operations/` + * and can be used to track the database modification. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Database][google.spanner.admin.database.v1.Database], if successful. + * + * @param string $databaseName The name of the database. Values are of the form + * `projects//instances//databases/`, + * where `` is as specified in the `CREATE DATABASE` + * statement. This name can be passed to other API methods to + * identify the database. + */ +function update_database_sample(string $databaseName): void +{ + // Create a client. + $databaseAdminClient = new DatabaseAdminClient(); + + // Prepare the request message. + $database = (new Database()) + ->setName($databaseName); + $updateMask = new FieldMask(); + $request = (new UpdateDatabaseRequest()) + ->setDatabase($database) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $databaseAdminClient->updateDatabase($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Database $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $databaseName = '[NAME]'; + + update_database_sample($databaseName); +} +// [END spanner_v1_generated_DatabaseAdmin_UpdateDatabase_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_database_ddl.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_database_ddl.php new file mode 100644 index 000000000000..9597e1cda6ef --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_database_ddl.php @@ -0,0 +1,91 @@ +/operations/` and can be used to + * track execution of the schema change(s). The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]. + * The operation has no response. + * + * @param string $formattedDatabase The database to update. Please see + * {@see DatabaseAdminClient::databaseName()} for help formatting this field. + * @param string $statementsElement DDL statements to be applied to the database. + */ +function update_database_ddl_sample(string $formattedDatabase, string $statementsElement): void +{ + // Create a client. + $databaseAdminClient = new DatabaseAdminClient(); + + // Prepare the request message. + $statements = [$statementsElement,]; + $request = (new UpdateDatabaseDdlRequest()) + ->setDatabase($formattedDatabase) + ->setStatements($statements); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $databaseAdminClient->updateDatabaseDdl($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedDatabase = DatabaseAdminClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $statementsElement = '[STATEMENTS]'; + + update_database_ddl_sample($formattedDatabase, $statementsElement); +} +// [END spanner_v1_generated_DatabaseAdmin_UpdateDatabaseDdl_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/Client/DatabaseAdminClient.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/Client/DatabaseAdminClient.php new file mode 100644 index 000000000000..6b925d2de9e4 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/Client/DatabaseAdminClient.php @@ -0,0 +1,1232 @@ + copyBackupAsync(CopyBackupRequest $request, array $optionalArgs = []) + * @method PromiseInterface createBackupAsync(CreateBackupRequest $request, array $optionalArgs = []) + * @method PromiseInterface createBackupScheduleAsync(CreateBackupScheduleRequest $request, array $optionalArgs = []) + * @method PromiseInterface createDatabaseAsync(CreateDatabaseRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteBackupAsync(DeleteBackupRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteBackupScheduleAsync(DeleteBackupScheduleRequest $request, array $optionalArgs = []) + * @method PromiseInterface dropDatabaseAsync(DropDatabaseRequest $request, array $optionalArgs = []) + * @method PromiseInterface getBackupAsync(GetBackupRequest $request, array $optionalArgs = []) + * @method PromiseInterface getBackupScheduleAsync(GetBackupScheduleRequest $request, array $optionalArgs = []) + * @method PromiseInterface getDatabaseAsync(GetDatabaseRequest $request, array $optionalArgs = []) + * @method PromiseInterface getDatabaseDdlAsync(GetDatabaseDdlRequest $request, array $optionalArgs = []) + * @method PromiseInterface getIamPolicyAsync(GetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface listBackupOperationsAsync(ListBackupOperationsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listBackupSchedulesAsync(ListBackupSchedulesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listBackupsAsync(ListBackupsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listDatabaseOperationsAsync(ListDatabaseOperationsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listDatabaseRolesAsync(ListDatabaseRolesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listDatabasesAsync(ListDatabasesRequest $request, array $optionalArgs = []) + * @method PromiseInterface restoreDatabaseAsync(RestoreDatabaseRequest $request, array $optionalArgs = []) + * @method PromiseInterface setIamPolicyAsync(SetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface testIamPermissionsAsync(TestIamPermissionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateBackupAsync(UpdateBackupRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateBackupScheduleAsync(UpdateBackupScheduleRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateDatabaseAsync(UpdateDatabaseRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateDatabaseDdlAsync(UpdateDatabaseDdlRequest $request, array $optionalArgs = []) + */ +final class DatabaseAdminClient +{ + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.spanner.admin.database.v1.DatabaseAdmin'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + private const SERVICE_ADDRESS = 'spanner.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'spanner.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/spanner.admin', + ]; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/database_admin_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/database_admin_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/database_admin_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/database_admin_rest_client_config.php', + ], + ], + ]; + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Formats a string containing the fully-qualified path to represent a backup + * resource. + * + * @param string $project + * @param string $instance + * @param string $backup + * + * @return string The formatted backup resource. + */ + public static function backupName(string $project, string $instance, string $backup): string + { + return self::getPathTemplate('backup')->render([ + 'project' => $project, + 'instance' => $instance, + 'backup' => $backup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * backup_schedule resource. + * + * @param string $project + * @param string $instance + * @param string $database + * @param string $schedule + * + * @return string The formatted backup_schedule resource. + */ + public static function backupScheduleName(string $project, string $instance, string $database, string $schedule): string + { + return self::getPathTemplate('backupSchedule')->render([ + 'project' => $project, + 'instance' => $instance, + 'database' => $database, + 'schedule' => $schedule, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a crypto_key + * resource. + * + * @param string $project + * @param string $location + * @param string $keyRing + * @param string $cryptoKey + * + * @return string The formatted crypto_key resource. + */ + public static function cryptoKeyName(string $project, string $location, string $keyRing, string $cryptoKey): string + { + return self::getPathTemplate('cryptoKey')->render([ + 'project' => $project, + 'location' => $location, + 'key_ring' => $keyRing, + 'crypto_key' => $cryptoKey, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * crypto_key_version resource. + * + * @param string $project + * @param string $location + * @param string $keyRing + * @param string $cryptoKey + * @param string $cryptoKeyVersion + * + * @return string The formatted crypto_key_version resource. + */ + public static function cryptoKeyVersionName(string $project, string $location, string $keyRing, string $cryptoKey, string $cryptoKeyVersion): string + { + return self::getPathTemplate('cryptoKeyVersion')->render([ + 'project' => $project, + 'location' => $location, + 'key_ring' => $keyRing, + 'crypto_key' => $cryptoKey, + 'crypto_key_version' => $cryptoKeyVersion, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a database + * resource. + * + * @param string $project + * @param string $instance + * @param string $database + * + * @return string The formatted database resource. + */ + public static function databaseName(string $project, string $instance, string $database): string + { + return self::getPathTemplate('database')->render([ + 'project' => $project, + 'instance' => $instance, + 'database' => $database, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a instance + * resource. + * + * @param string $project + * @param string $instance + * + * @return string The formatted instance resource. + */ + public static function instanceName(string $project, string $instance): string + { + return self::getPathTemplate('instance')->render([ + 'project' => $project, + 'instance' => $instance, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - backup: projects/{project}/instances/{instance}/backups/{backup} + * - backupSchedule: projects/{project}/instances/{instance}/databases/{database}/backupSchedules/{schedule} + * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key} + * - cryptoKeyVersion: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version} + * - database: projects/{project}/instances/{instance}/databases/{database} + * - instance: projects/{project}/instances/{instance} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, ?string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * Setting the "SPANNER_EMULATOR_HOST" environment variable will automatically set + * the API Endpoint to the value specified in the variable, as well as ensure that + * empty credentials are used in the transport layer. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'spanner.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * @type false|LoggerInterface $logger + * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the + * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $options = $this->setDefaultEmulatorConfig($options); + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Starts copying a Cloud Spanner Backup. + * The returned backup [long-running operation][google.longrunning.Operation] + * will have a name of the format + * `projects//instances//backups//operations/` + * and can be used to track copying of the backup. The operation is associated + * with the destination backup. + * The [metadata][google.longrunning.Operation.metadata] field type is + * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Backup][google.spanner.admin.database.v1.Backup], if successful. + * Cancelling the returned operation will stop the copying and delete the + * destination backup. Concurrent CopyBackup requests can run on the same + * source backup. + * + * The async variant is {@see DatabaseAdminClient::copyBackupAsync()} . + * + * @example samples/V1/DatabaseAdminClient/copy_backup.php + * + * @param CopyBackupRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function copyBackup(CopyBackupRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CopyBackup', $request, $callOptions)->wait(); + } + + /** + * Starts creating a new Cloud Spanner Backup. + * The returned backup [long-running operation][google.longrunning.Operation] + * will have a name of the format + * `projects//instances//backups//operations/` + * and can be used to track creation of the backup. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Backup][google.spanner.admin.database.v1.Backup], if successful. + * Cancelling the returned operation will stop the creation and delete the + * backup. There can be only one pending backup creation per database. Backup + * creation of different databases can run concurrently. + * + * The async variant is {@see DatabaseAdminClient::createBackupAsync()} . + * + * @example samples/V1/DatabaseAdminClient/create_backup.php + * + * @param CreateBackupRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createBackup(CreateBackupRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateBackup', $request, $callOptions)->wait(); + } + + /** + * Creates a new backup schedule. + * + * The async variant is {@see DatabaseAdminClient::createBackupScheduleAsync()} . + * + * @example samples/V1/DatabaseAdminClient/create_backup_schedule.php + * + * @param CreateBackupScheduleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return BackupSchedule + * + * @throws ApiException Thrown if the API call fails. + */ + public function createBackupSchedule(CreateBackupScheduleRequest $request, array $callOptions = []): BackupSchedule + { + return $this->startApiCall('CreateBackupSchedule', $request, $callOptions)->wait(); + } + + /** + * Creates a new Cloud Spanner database and starts to prepare it for serving. + * The returned [long-running operation][google.longrunning.Operation] will + * have a name of the format `/operations/` and + * can be used to track preparation of the database. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Database][google.spanner.admin.database.v1.Database], if successful. + * + * The async variant is {@see DatabaseAdminClient::createDatabaseAsync()} . + * + * @example samples/V1/DatabaseAdminClient/create_database.php + * + * @param CreateDatabaseRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createDatabase(CreateDatabaseRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateDatabase', $request, $callOptions)->wait(); + } + + /** + * Deletes a pending or completed + * [Backup][google.spanner.admin.database.v1.Backup]. + * + * The async variant is {@see DatabaseAdminClient::deleteBackupAsync()} . + * + * @example samples/V1/DatabaseAdminClient/delete_backup.php + * + * @param DeleteBackupRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteBackup(DeleteBackupRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteBackup', $request, $callOptions)->wait(); + } + + /** + * Deletes a backup schedule. + * + * The async variant is {@see DatabaseAdminClient::deleteBackupScheduleAsync()} . + * + * @example samples/V1/DatabaseAdminClient/delete_backup_schedule.php + * + * @param DeleteBackupScheduleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteBackupSchedule(DeleteBackupScheduleRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteBackupSchedule', $request, $callOptions)->wait(); + } + + /** + * Drops (aka deletes) a Cloud Spanner database. + * Completed backups for the database will be retained according to their + * `expire_time`. + * Note: Cloud Spanner might continue to accept requests for a few seconds + * after the database has been deleted. + * + * The async variant is {@see DatabaseAdminClient::dropDatabaseAsync()} . + * + * @example samples/V1/DatabaseAdminClient/drop_database.php + * + * @param DropDatabaseRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function dropDatabase(DropDatabaseRequest $request, array $callOptions = []): void + { + $this->startApiCall('DropDatabase', $request, $callOptions)->wait(); + } + + /** + * Gets metadata on a pending or completed + * [Backup][google.spanner.admin.database.v1.Backup]. + * + * The async variant is {@see DatabaseAdminClient::getBackupAsync()} . + * + * @example samples/V1/DatabaseAdminClient/get_backup.php + * + * @param GetBackupRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Backup + * + * @throws ApiException Thrown if the API call fails. + */ + public function getBackup(GetBackupRequest $request, array $callOptions = []): Backup + { + return $this->startApiCall('GetBackup', $request, $callOptions)->wait(); + } + + /** + * Gets backup schedule for the input schedule name. + * + * The async variant is {@see DatabaseAdminClient::getBackupScheduleAsync()} . + * + * @example samples/V1/DatabaseAdminClient/get_backup_schedule.php + * + * @param GetBackupScheduleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return BackupSchedule + * + * @throws ApiException Thrown if the API call fails. + */ + public function getBackupSchedule(GetBackupScheduleRequest $request, array $callOptions = []): BackupSchedule + { + return $this->startApiCall('GetBackupSchedule', $request, $callOptions)->wait(); + } + + /** + * Gets the state of a Cloud Spanner database. + * + * The async variant is {@see DatabaseAdminClient::getDatabaseAsync()} . + * + * @example samples/V1/DatabaseAdminClient/get_database.php + * + * @param GetDatabaseRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Database + * + * @throws ApiException Thrown if the API call fails. + */ + public function getDatabase(GetDatabaseRequest $request, array $callOptions = []): Database + { + return $this->startApiCall('GetDatabase', $request, $callOptions)->wait(); + } + + /** + * Returns the schema of a Cloud Spanner database as a list of formatted + * DDL statements. This method does not show pending schema updates, those may + * be queried using the [Operations][google.longrunning.Operations] API. + * + * The async variant is {@see DatabaseAdminClient::getDatabaseDdlAsync()} . + * + * @example samples/V1/DatabaseAdminClient/get_database_ddl.php + * + * @param GetDatabaseDdlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return GetDatabaseDdlResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function getDatabaseDdl(GetDatabaseDdlRequest $request, array $callOptions = []): GetDatabaseDdlResponse + { + return $this->startApiCall('GetDatabaseDdl', $request, $callOptions)->wait(); + } + + /** + * Gets the access control policy for a database or backup resource. + * Returns an empty policy if a database or backup exists but does not have a + * policy set. + * + * Authorization requires `spanner.databases.getIamPolicy` permission on + * [resource][google.iam.v1.GetIamPolicyRequest.resource]. + * For backups, authorization requires `spanner.backups.getIamPolicy` + * permission on [resource][google.iam.v1.GetIamPolicyRequest.resource]. + * + * The async variant is {@see DatabaseAdminClient::getIamPolicyAsync()} . + * + * @example samples/V1/DatabaseAdminClient/get_iam_policy.php + * + * @param GetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Lists the backup [long-running operations][google.longrunning.Operation] in + * the given instance. A backup operation has a name of the form + * `projects//instances//backups//operations/`. + * The long-running operation + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that have completed/failed/canceled within the last 7 days, + * and pending operations. Operations returned are ordered by + * `operation.metadata.value.progress.start_time` in descending order starting + * from the most recently started operation. + * + * The async variant is {@see DatabaseAdminClient::listBackupOperationsAsync()} . + * + * @example samples/V1/DatabaseAdminClient/list_backup_operations.php + * + * @param ListBackupOperationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listBackupOperations(ListBackupOperationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListBackupOperations', $request, $callOptions); + } + + /** + * Lists all the backup schedules for the database. + * + * The async variant is {@see DatabaseAdminClient::listBackupSchedulesAsync()} . + * + * @example samples/V1/DatabaseAdminClient/list_backup_schedules.php + * + * @param ListBackupSchedulesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listBackupSchedules(ListBackupSchedulesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListBackupSchedules', $request, $callOptions); + } + + /** + * Lists completed and pending backups. + * Backups returned are ordered by `create_time` in descending order, + * starting from the most recent `create_time`. + * + * The async variant is {@see DatabaseAdminClient::listBackupsAsync()} . + * + * @example samples/V1/DatabaseAdminClient/list_backups.php + * + * @param ListBackupsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listBackups(ListBackupsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListBackups', $request, $callOptions); + } + + /** + * Lists database [longrunning-operations][google.longrunning.Operation]. + * A database operation has a name of the form + * `projects//instances//databases//operations/`. + * The long-running operation + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that have completed/failed/canceled within the last 7 days, + * and pending operations. + * + * The async variant is {@see DatabaseAdminClient::listDatabaseOperationsAsync()} . + * + * @example samples/V1/DatabaseAdminClient/list_database_operations.php + * + * @param ListDatabaseOperationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listDatabaseOperations(ListDatabaseOperationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListDatabaseOperations', $request, $callOptions); + } + + /** + * Lists Cloud Spanner database roles. + * + * The async variant is {@see DatabaseAdminClient::listDatabaseRolesAsync()} . + * + * @example samples/V1/DatabaseAdminClient/list_database_roles.php + * + * @param ListDatabaseRolesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listDatabaseRoles(ListDatabaseRolesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListDatabaseRoles', $request, $callOptions); + } + + /** + * Lists Cloud Spanner databases. + * + * The async variant is {@see DatabaseAdminClient::listDatabasesAsync()} . + * + * @example samples/V1/DatabaseAdminClient/list_databases.php + * + * @param ListDatabasesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listDatabases(ListDatabasesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListDatabases', $request, $callOptions); + } + + /** + * Create a new database by restoring from a completed backup. The new + * database must be in the same project and in an instance with the same + * instance configuration as the instance containing + * the backup. The returned database [long-running + * operation][google.longrunning.Operation] has a name of the format + * `projects//instances//databases//operations/`, + * and can be used to track the progress of the operation, and to cancel it. + * The [metadata][google.longrunning.Operation.metadata] field type is + * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. + * The [response][google.longrunning.Operation.response] type + * is [Database][google.spanner.admin.database.v1.Database], if + * successful. Cancelling the returned operation will stop the restore and + * delete the database. + * There can be only one database being restored into an instance at a time. + * Once the restore operation completes, a new restore operation can be + * initiated, without waiting for the optimize operation associated with the + * first restore to complete. + * + * The async variant is {@see DatabaseAdminClient::restoreDatabaseAsync()} . + * + * @example samples/V1/DatabaseAdminClient/restore_database.php + * + * @param RestoreDatabaseRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function restoreDatabase(RestoreDatabaseRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('RestoreDatabase', $request, $callOptions)->wait(); + } + + /** + * Sets the access control policy on a database or backup resource. + * Replaces any existing policy. + * + * Authorization requires `spanner.databases.setIamPolicy` + * permission on [resource][google.iam.v1.SetIamPolicyRequest.resource]. + * For backups, authorization requires `spanner.backups.setIamPolicy` + * permission on [resource][google.iam.v1.SetIamPolicyRequest.resource]. + * + * The async variant is {@see DatabaseAdminClient::setIamPolicyAsync()} . + * + * @example samples/V1/DatabaseAdminClient/set_iam_policy.php + * + * @param SetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Returns permissions that the caller has on the specified database or backup + * resource. + * + * Attempting this RPC on a non-existent Cloud Spanner database will + * result in a NOT_FOUND error if the user has + * `spanner.databases.list` permission on the containing Cloud + * Spanner instance. Otherwise returns an empty set of permissions. + * Calling this method on a backup that does not exist will + * result in a NOT_FOUND error if the user has + * `spanner.backups.list` permission on the containing instance. + * + * The async variant is {@see DatabaseAdminClient::testIamPermissionsAsync()} . + * + * @example samples/V1/DatabaseAdminClient/test_iam_permissions.php + * + * @param TestIamPermissionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return TestIamPermissionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse + { + return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); + } + + /** + * Updates a pending or completed + * [Backup][google.spanner.admin.database.v1.Backup]. + * + * The async variant is {@see DatabaseAdminClient::updateBackupAsync()} . + * + * @example samples/V1/DatabaseAdminClient/update_backup.php + * + * @param UpdateBackupRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Backup + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateBackup(UpdateBackupRequest $request, array $callOptions = []): Backup + { + return $this->startApiCall('UpdateBackup', $request, $callOptions)->wait(); + } + + /** + * Updates a backup schedule. + * + * The async variant is {@see DatabaseAdminClient::updateBackupScheduleAsync()} . + * + * @example samples/V1/DatabaseAdminClient/update_backup_schedule.php + * + * @param UpdateBackupScheduleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return BackupSchedule + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateBackupSchedule(UpdateBackupScheduleRequest $request, array $callOptions = []): BackupSchedule + { + return $this->startApiCall('UpdateBackupSchedule', $request, $callOptions)->wait(); + } + + /** + * Updates a Cloud Spanner database. The returned + * [long-running operation][google.longrunning.Operation] can be used to track + * the progress of updating the database. If the named database does not + * exist, returns `NOT_FOUND`. + * + * While the operation is pending: + * + * * The database's + * [reconciling][google.spanner.admin.database.v1.Database.reconciling] + * field is set to true. + * * Cancelling the operation is best-effort. If the cancellation succeeds, + * the operation metadata's + * [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time] + * is set, the updates are reverted, and the operation terminates with a + * `CANCELLED` status. + * * New UpdateDatabase requests will return a `FAILED_PRECONDITION` error + * until the pending operation is done (returns successfully or with + * error). + * * Reading the database via the API continues to give the pre-request + * values. + * + * Upon completion of the returned operation: + * + * * The new values are in effect and readable via the API. + * * The database's + * [reconciling][google.spanner.admin.database.v1.Database.reconciling] + * field becomes false. + * + * The returned [long-running operation][google.longrunning.Operation] will + * have a name of the format + * `projects//instances//databases//operations/` + * and can be used to track the database modification. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Database][google.spanner.admin.database.v1.Database], if successful. + * + * The async variant is {@see DatabaseAdminClient::updateDatabaseAsync()} . + * + * @example samples/V1/DatabaseAdminClient/update_database.php + * + * @param UpdateDatabaseRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateDatabase(UpdateDatabaseRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateDatabase', $request, $callOptions)->wait(); + } + + /** + * Updates the schema of a Cloud Spanner database by + * creating/altering/dropping tables, columns, indexes, etc. The returned + * [long-running operation][google.longrunning.Operation] will have a name of + * the format `/operations/` and can be used to + * track execution of the schema change(s). The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]. + * The operation has no response. + * + * The async variant is {@see DatabaseAdminClient::updateDatabaseDdlAsync()} . + * + * @example samples/V1/DatabaseAdminClient/update_database_ddl.php + * + * @param UpdateDatabaseDdlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateDatabaseDdl(UpdateDatabaseDdlRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateDatabaseDdl', $request, $callOptions)->wait(); + } + + /** Configure the gapic configuration to use a service emulator. */ + private function setDefaultEmulatorConfig(array $options): array + { + $emulatorHost = getenv('SPANNER_EMULATOR_HOST'); + if (empty($emulatorHost)) { + return $options; + } + + if ($scheme = parse_url($emulatorHost, PHP_URL_SCHEME)) { + $search = $scheme . '://'; + $emulatorHost = str_replace($search, '', $emulatorHost); + } + + $options['apiEndpoint'] ??= $emulatorHost; + $options['transportConfig']['grpc']['stubOpts']['credentials'] ??= ChannelCredentials::createInsecure(); + $options['credentials'] ??= new InsecureCredentialsWrapper(); + return $options; + } +} diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/DatabaseAdminClient.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/DatabaseAdminClient.php new file mode 100644 index 000000000000..b3ac00fb0866 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/DatabaseAdminClient.php @@ -0,0 +1,34 @@ +instanceName('[PROJECT]', '[INSTANCE]'); + * $backupId = 'backup_id'; + * $formattedSourceBackup = $databaseAdminClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); + * $expireTime = new Timestamp(); + * $operationResponse = $databaseAdminClient->copyBackup($formattedParent, $backupId, $formattedSourceBackup, $expireTime); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $databaseAdminClient->copyBackup($formattedParent, $backupId, $formattedSourceBackup, $expireTime); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'copyBackup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\Spanner\Admin\Database\V1\Client\DatabaseAdminClient}. + */ +class DatabaseAdminGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.spanner.admin.database.v1.DatabaseAdmin'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'spanner.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'spanner.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/spanner.admin', + ]; + + private static $backupNameTemplate; + + private static $backupScheduleNameTemplate; + + private static $cryptoKeyNameTemplate; + + private static $cryptoKeyVersionNameTemplate; + + private static $databaseNameTemplate; + + private static $instanceNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/database_admin_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/database_admin_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/database_admin_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/database_admin_rest_client_config.php', + ], + ], + ]; + } + + private static function getBackupNameTemplate() + { + if (self::$backupNameTemplate == null) { + self::$backupNameTemplate = new PathTemplate('projects/{project}/instances/{instance}/backups/{backup}'); + } + + return self::$backupNameTemplate; + } + + private static function getBackupScheduleNameTemplate() + { + if (self::$backupScheduleNameTemplate == null) { + self::$backupScheduleNameTemplate = new PathTemplate('projects/{project}/instances/{instance}/databases/{database}/backupSchedules/{schedule}'); + } + + return self::$backupScheduleNameTemplate; + } + + private static function getCryptoKeyNameTemplate() + { + if (self::$cryptoKeyNameTemplate == null) { + self::$cryptoKeyNameTemplate = new PathTemplate('projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}'); + } + + return self::$cryptoKeyNameTemplate; + } + + private static function getCryptoKeyVersionNameTemplate() + { + if (self::$cryptoKeyVersionNameTemplate == null) { + self::$cryptoKeyVersionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}'); + } + + return self::$cryptoKeyVersionNameTemplate; + } + + private static function getDatabaseNameTemplate() + { + if (self::$databaseNameTemplate == null) { + self::$databaseNameTemplate = new PathTemplate('projects/{project}/instances/{instance}/databases/{database}'); + } + + return self::$databaseNameTemplate; + } + + private static function getInstanceNameTemplate() + { + if (self::$instanceNameTemplate == null) { + self::$instanceNameTemplate = new PathTemplate('projects/{project}/instances/{instance}'); + } + + return self::$instanceNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'backup' => self::getBackupNameTemplate(), + 'backupSchedule' => self::getBackupScheduleNameTemplate(), + 'cryptoKey' => self::getCryptoKeyNameTemplate(), + 'cryptoKeyVersion' => self::getCryptoKeyVersionNameTemplate(), + 'database' => self::getDatabaseNameTemplate(), + 'instance' => self::getInstanceNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a backup + * resource. + * + * @param string $project + * @param string $instance + * @param string $backup + * + * @return string The formatted backup resource. + */ + public static function backupName($project, $instance, $backup) + { + return self::getBackupNameTemplate()->render([ + 'project' => $project, + 'instance' => $instance, + 'backup' => $backup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * backup_schedule resource. + * + * @param string $project + * @param string $instance + * @param string $database + * @param string $schedule + * + * @return string The formatted backup_schedule resource. + */ + public static function backupScheduleName($project, $instance, $database, $schedule) + { + return self::getBackupScheduleNameTemplate()->render([ + 'project' => $project, + 'instance' => $instance, + 'database' => $database, + 'schedule' => $schedule, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a crypto_key + * resource. + * + * @param string $project + * @param string $location + * @param string $keyRing + * @param string $cryptoKey + * + * @return string The formatted crypto_key resource. + */ + public static function cryptoKeyName($project, $location, $keyRing, $cryptoKey) + { + return self::getCryptoKeyNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'key_ring' => $keyRing, + 'crypto_key' => $cryptoKey, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * crypto_key_version resource. + * + * @param string $project + * @param string $location + * @param string $keyRing + * @param string $cryptoKey + * @param string $cryptoKeyVersion + * + * @return string The formatted crypto_key_version resource. + */ + public static function cryptoKeyVersionName($project, $location, $keyRing, $cryptoKey, $cryptoKeyVersion) + { + return self::getCryptoKeyVersionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'key_ring' => $keyRing, + 'crypto_key' => $cryptoKey, + 'crypto_key_version' => $cryptoKeyVersion, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a database + * resource. + * + * @param string $project + * @param string $instance + * @param string $database + * + * @return string The formatted database resource. + */ + public static function databaseName($project, $instance, $database) + { + return self::getDatabaseNameTemplate()->render([ + 'project' => $project, + 'instance' => $instance, + 'database' => $database, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a instance + * resource. + * + * @param string $project + * @param string $instance + * + * @return string The formatted instance resource. + */ + public static function instanceName($project, $instance) + { + return self::getInstanceNameTemplate()->render([ + 'project' => $project, + 'instance' => $instance, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - backup: projects/{project}/instances/{instance}/backups/{backup} + * - backupSchedule: projects/{project}/instances/{instance}/databases/{database}/backupSchedules/{schedule} + * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key} + * - cryptoKeyVersion: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version} + * - database: projects/{project}/instances/{instance}/databases/{database} + * - instance: projects/{project}/instances/{instance} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'spanner.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Starts copying a Cloud Spanner Backup. + * The returned backup [long-running operation][google.longrunning.Operation] + * will have a name of the format + * `projects//instances//backups//operations/` + * and can be used to track copying of the backup. The operation is associated + * with the destination backup. + * The [metadata][google.longrunning.Operation.metadata] field type is + * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Backup][google.spanner.admin.database.v1.Backup], if successful. + * Cancelling the returned operation will stop the copying and delete the + * destination backup. Concurrent CopyBackup requests can run on the same + * source backup. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); + * $backupId = 'backup_id'; + * $formattedSourceBackup = $databaseAdminClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); + * $expireTime = new Timestamp(); + * $operationResponse = $databaseAdminClient->copyBackup($formattedParent, $backupId, $formattedSourceBackup, $expireTime); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $databaseAdminClient->copyBackup($formattedParent, $backupId, $formattedSourceBackup, $expireTime); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'copyBackup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the destination instance that will contain the backup + * copy. Values are of the form: `projects//instances/`. + * @param string $backupId Required. The id of the backup copy. + * The `backup_id` appended to `parent` forms the full backup_uri of the form + * `projects//instances//backups/`. + * @param string $sourceBackup Required. The source backup to be copied. + * The source backup needs to be in READY state for it to be copied. + * Once CopyBackup is in progress, the source backup cannot be deleted or + * cleaned up on expiration until CopyBackup is finished. + * Values are of the form: + * `projects//instances//backups/`. + * @param Timestamp $expireTime Required. The expiration time of the backup in microsecond granularity. + * The expiration time must be at least 6 hours and at most 366 days + * from the `create_time` of the source backup. Once the `expire_time` has + * passed, the backup is eligible to be automatically deleted by Cloud Spanner + * to free the resources used by the backup. + * @param array $optionalArgs { + * Optional. + * + * @type CopyBackupEncryptionConfig $encryptionConfig + * Optional. The encryption configuration used to encrypt the backup. If this + * field is not specified, the backup will use the same encryption + * configuration as the source backup by default, namely + * [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] + * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function copyBackup($parent, $backupId, $sourceBackup, $expireTime, array $optionalArgs = []) + { + $request = new CopyBackupRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setBackupId($backupId); + $request->setSourceBackup($sourceBackup); + $request->setExpireTime($expireTime); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['encryptionConfig'])) { + $request->setEncryptionConfig($optionalArgs['encryptionConfig']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CopyBackup', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Starts creating a new Cloud Spanner Backup. + * The returned backup [long-running operation][google.longrunning.Operation] + * will have a name of the format + * `projects//instances//backups//operations/` + * and can be used to track creation of the backup. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Backup][google.spanner.admin.database.v1.Backup], if successful. + * Cancelling the returned operation will stop the creation and delete the + * backup. There can be only one pending backup creation per database. Backup + * creation of different databases can run concurrently. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); + * $backupId = 'backup_id'; + * $backup = new Backup(); + * $operationResponse = $databaseAdminClient->createBackup($formattedParent, $backupId, $backup); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $databaseAdminClient->createBackup($formattedParent, $backupId, $backup); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'createBackup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the instance in which the backup will be + * created. This must be the same instance that contains the database the + * backup will be created from. The backup will be stored in the + * location(s) specified in the instance configuration of this + * instance. Values are of the form + * `projects//instances/`. + * @param string $backupId Required. The id of the backup to be created. The `backup_id` appended to + * `parent` forms the full backup name of the form + * `projects//instances//backups/`. + * @param Backup $backup Required. The backup to create. + * @param array $optionalArgs { + * Optional. + * + * @type CreateBackupEncryptionConfig $encryptionConfig + * Optional. The encryption configuration used to encrypt the backup. If this + * field is not specified, the backup will use the same encryption + * configuration as the database by default, namely + * [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type] + * = `USE_DATABASE_ENCRYPTION`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createBackup($parent, $backupId, $backup, array $optionalArgs = []) + { + $request = new CreateBackupRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setBackupId($backupId); + $request->setBackup($backup); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['encryptionConfig'])) { + $request->setEncryptionConfig($optionalArgs['encryptionConfig']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateBackup', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a new backup schedule. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $formattedParent = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + * $backupScheduleId = 'backup_schedule_id'; + * $backupSchedule = new BackupSchedule(); + * $response = $databaseAdminClient->createBackupSchedule($formattedParent, $backupScheduleId, $backupSchedule); + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the database that this backup schedule applies to. + * @param string $backupScheduleId Required. The Id to use for the backup schedule. The `backup_schedule_id` + * appended to `parent` forms the full backup schedule name of the form + * `projects//instances//databases//backupSchedules/`. + * @param BackupSchedule $backupSchedule Required. The backup schedule to create. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule + * + * @throws ApiException if the remote call fails + */ + public function createBackupSchedule($parent, $backupScheduleId, $backupSchedule, array $optionalArgs = []) + { + $request = new CreateBackupScheduleRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setBackupScheduleId($backupScheduleId); + $request->setBackupSchedule($backupSchedule); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateBackupSchedule', BackupSchedule::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a new Cloud Spanner database and starts to prepare it for serving. + * The returned [long-running operation][google.longrunning.Operation] will + * have a name of the format `/operations/` and + * can be used to track preparation of the database. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Database][google.spanner.admin.database.v1.Database], if successful. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); + * $createStatement = 'create_statement'; + * $operationResponse = $databaseAdminClient->createDatabase($formattedParent, $createStatement); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $databaseAdminClient->createDatabase($formattedParent, $createStatement); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'createDatabase'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the instance that will serve the new database. + * Values are of the form `projects//instances/`. + * @param string $createStatement Required. A `CREATE DATABASE` statement, which specifies the ID of the + * new database. The database ID must conform to the regular expression + * `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length. + * If the database ID is a reserved word or if it contains a hyphen, the + * database ID must be enclosed in backticks (`` ` ``). + * @param array $optionalArgs { + * Optional. + * + * @type string[] $extraStatements + * Optional. A list of DDL statements to run inside the newly created + * database. Statements can create tables, indexes, etc. These + * statements execute atomically with the creation of the database: + * if there is an error in any statement, the database is not created. + * @type EncryptionConfig $encryptionConfig + * Optional. The encryption configuration for the database. If this field is + * not specified, Cloud Spanner will encrypt/decrypt all data at rest using + * Google default encryption. + * @type int $databaseDialect + * Optional. The dialect of the Cloud Spanner Database. + * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\Admin\Database\V1\DatabaseDialect} + * @type string $protoDescriptors + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in + * 'extra_statements' above. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createDatabase($parent, $createStatement, array $optionalArgs = []) + { + $request = new CreateDatabaseRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setCreateStatement($createStatement); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['extraStatements'])) { + $request->setExtraStatements($optionalArgs['extraStatements']); + } + + if (isset($optionalArgs['encryptionConfig'])) { + $request->setEncryptionConfig($optionalArgs['encryptionConfig']); + } + + if (isset($optionalArgs['databaseDialect'])) { + $request->setDatabaseDialect($optionalArgs['databaseDialect']); + } + + if (isset($optionalArgs['protoDescriptors'])) { + $request->setProtoDescriptors($optionalArgs['protoDescriptors']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateDatabase', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes a pending or completed + * [Backup][google.spanner.admin.database.v1.Backup]. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $formattedName = $databaseAdminClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); + * $databaseAdminClient->deleteBackup($formattedName); + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the backup to delete. + * Values are of the form + * `projects//instances//backups/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteBackup($name, array $optionalArgs = []) + { + $request = new DeleteBackupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteBackup', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes a backup schedule. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $formattedName = $databaseAdminClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]'); + * $databaseAdminClient->deleteBackupSchedule($formattedName); + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the schedule to delete. + * Values are of the form + * `projects//instances//databases//backupSchedules/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteBackupSchedule($name, array $optionalArgs = []) + { + $request = new DeleteBackupScheduleRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteBackupSchedule', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Drops (aka deletes) a Cloud Spanner database. + * Completed backups for the database will be retained according to their + * `expire_time`. + * Note: Cloud Spanner might continue to accept requests for a few seconds + * after the database has been deleted. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $formattedDatabase = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + * $databaseAdminClient->dropDatabase($formattedDatabase); + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $database Required. The database to be dropped. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function dropDatabase($database, array $optionalArgs = []) + { + $request = new DropDatabaseRequest(); + $requestParamHeaders = []; + $request->setDatabase($database); + $requestParamHeaders['database'] = $database; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DropDatabase', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets metadata on a pending or completed + * [Backup][google.spanner.admin.database.v1.Backup]. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $formattedName = $databaseAdminClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); + * $response = $databaseAdminClient->getBackup($formattedName); + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the backup. + * Values are of the form + * `projects//instances//backups/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\Backup + * + * @throws ApiException if the remote call fails + */ + public function getBackup($name, array $optionalArgs = []) + { + $request = new GetBackupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetBackup', Backup::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets backup schedule for the input schedule name. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $formattedName = $databaseAdminClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]'); + * $response = $databaseAdminClient->getBackupSchedule($formattedName); + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the schedule to retrieve. + * Values are of the form + * `projects//instances//databases//backupSchedules/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule + * + * @throws ApiException if the remote call fails + */ + public function getBackupSchedule($name, array $optionalArgs = []) + { + $request = new GetBackupScheduleRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetBackupSchedule', BackupSchedule::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the state of a Cloud Spanner database. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $formattedName = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + * $response = $databaseAdminClient->getDatabase($formattedName); + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the requested database. Values are of the form + * `projects//instances//databases/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\Database + * + * @throws ApiException if the remote call fails + */ + public function getDatabase($name, array $optionalArgs = []) + { + $request = new GetDatabaseRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetDatabase', Database::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the schema of a Cloud Spanner database as a list of formatted + * DDL statements. This method does not show pending schema updates, those may + * be queried using the [Operations][google.longrunning.Operations] API. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $formattedDatabase = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + * $response = $databaseAdminClient->getDatabaseDdl($formattedDatabase); + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $database Required. The database whose schema we wish to get. + * Values are of the form + * `projects//instances//databases/` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\GetDatabaseDdlResponse + * + * @throws ApiException if the remote call fails + */ + public function getDatabaseDdl($database, array $optionalArgs = []) + { + $request = new GetDatabaseDdlRequest(); + $requestParamHeaders = []; + $request->setDatabase($database); + $requestParamHeaders['database'] = $database; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetDatabaseDdl', GetDatabaseDdlResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the access control policy for a database or backup resource. + * Returns an empty policy if a database or backup exists but does not have a + * policy set. + * + * Authorization requires `spanner.databases.getIamPolicy` permission on + * [resource][google.iam.v1.GetIamPolicyRequest.resource]. + * For backups, authorization requires `spanner.backups.getIamPolicy` + * permission on [resource][google.iam.v1.GetIamPolicyRequest.resource]. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $resource = 'resource'; + * $response = $databaseAdminClient->getIamPolicy($resource); + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param array $optionalArgs { + * Optional. + * + * @type GetPolicyOptions $options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function getIamPolicy($resource, array $optionalArgs = []) + { + $request = new GetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['options'])) { + $request->setOptions($optionalArgs['options']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists the backup [long-running operations][google.longrunning.Operation] in + * the given instance. A backup operation has a name of the form + * `projects//instances//backups//operations/`. + * The long-running operation + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that have completed/failed/canceled within the last 7 days, + * and pending operations. Operations returned are ordered by + * `operation.metadata.value.progress.start_time` in descending order starting + * from the most recently started operation. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); + * // Iterate over pages of elements + * $pagedResponse = $databaseAdminClient->listBackupOperations($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $databaseAdminClient->listBackupOperations($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The instance of the backup operations. Values are of + * the form `projects//instances/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * An expression that filters the list of returned backup operations. + * + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * + * The following fields in the [operation][google.longrunning.Operation] + * are eligible for filtering: + * + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] + * is + * `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic, but + * you can specify AND, OR, and NOT logic explicitly. + * + * Here are a few examples: + * + * * `done:true` - The operation is complete. + * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ + * `metadata.database:prod` - Returns operations where: + * * The operation's metadata type is + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. + * * The source database name of backup contains the string "prod". + * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ + * `(metadata.name:howl) AND` \ + * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Returns operations where: + * * The operation's metadata type is + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. + * * The backup name contains the string "howl". + * * The operation started before 2018-03-28T14:50:00Z. + * * The operation resulted in an error. + * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \ + * `(metadata.source_backup:test) AND` \ + * `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \ + * `(error:*)` - Returns operations where: + * * The operation's metadata type is + * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. + * * The source backup name contains the string "test". + * * The operation started before 2022-01-18T14:50:00Z. + * * The operation resulted in an error. + * * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ + * `(metadata.database:test_db)) OR` \ + * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) + * AND` \ + * `(metadata.source_backup:test_bkp)) AND` \ + * `(error:*)` - Returns operations where: + * * The operation's metadata matches either of criteria: + * * The operation's metadata type is + * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] + * AND the source database name of the backup contains the string + * "test_db" + * * The operation's metadata type is + * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata] + * AND the source backup name contains the string "test_bkp" + * * The operation resulted in an error. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listBackupOperations($parent, array $optionalArgs = []) + { + $request = new ListBackupOperationsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListBackupOperations', $optionalArgs, ListBackupOperationsResponse::class, $request); + } + + /** + * Lists all the backup schedules for the database. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $formattedParent = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + * // Iterate over pages of elements + * $pagedResponse = $databaseAdminClient->listBackupSchedules($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $databaseAdminClient->listBackupSchedules($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. Database is the parent resource whose backup schedules should be + * listed. Values are of the form + * projects//instances//databases/ + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listBackupSchedules($parent, array $optionalArgs = []) + { + $request = new ListBackupSchedulesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListBackupSchedules', $optionalArgs, ListBackupSchedulesResponse::class, $request); + } + + /** + * Lists completed and pending backups. + * Backups returned are ordered by `create_time` in descending order, + * starting from the most recent `create_time`. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); + * // Iterate over pages of elements + * $pagedResponse = $databaseAdminClient->listBackups($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $databaseAdminClient->listBackups($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The instance to list backups from. Values are of the + * form `projects//instances/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * An expression that filters the list of returned backups. + * + * A filter expression consists of a field name, a comparison operator, and a + * value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * + * The following fields in the + * [Backup][google.spanner.admin.database.v1.Backup] are eligible for + * filtering: + * + * * `name` + * * `database` + * * `state` + * * `create_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) + * * `size_bytes` + * * `backup_schedules` + * + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic, but + * you can specify AND, OR, and NOT logic explicitly. + * + * Here are a few examples: + * + * * `name:Howl` - The backup's name contains the string "howl". + * * `database:prod` + * - The database's name contains the string "prod". + * * `state:CREATING` - The backup is pending creation. + * * `state:READY` - The backup is fully created and ready for use. + * * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")` + * - The backup name contains the string "howl" and `create_time` + * of the backup is before 2018-03-28T14:50:00Z. + * * `expire_time < \"2018-03-28T14:50:00Z\"` + * - The backup `expire_time` is before 2018-03-28T14:50:00Z. + * * `size_bytes > 10000000000` - The backup's size is greater than 10GB + * * `backup_schedules:daily` + * - The backup is created from a schedule with "daily" in its name. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listBackups($parent, array $optionalArgs = []) + { + $request = new ListBackupsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListBackups', $optionalArgs, ListBackupsResponse::class, $request); + } + + /** + * Lists database [longrunning-operations][google.longrunning.Operation]. + * A database operation has a name of the form + * `projects//instances//databases//operations/`. + * The long-running operation + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that have completed/failed/canceled within the last 7 days, + * and pending operations. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); + * // Iterate over pages of elements + * $pagedResponse = $databaseAdminClient->listDatabaseOperations($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $databaseAdminClient->listDatabaseOperations($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The instance of the database operations. + * Values are of the form `projects//instances/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * An expression that filters the list of returned operations. + * + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * + * The following fields in the [Operation][google.longrunning.Operation] + * are eligible for filtering: + * + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata] + * is + * `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * + * Here are a few examples: + * + * * `done:true` - The operation is complete. + * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \ + * `(metadata.source_type:BACKUP) AND` \ + * `(metadata.backup_info.backup:backup_howl) AND` \ + * `(metadata.name:restored_howl) AND` \ + * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. + * * The database is restored from a backup. + * * The backup name contains "backup_howl". + * * The restored database's name contains "restored_howl". + * * The operation started before 2018-03-28T14:50:00Z. + * * The operation resulted in an error. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listDatabaseOperations($parent, array $optionalArgs = []) + { + $request = new ListDatabaseOperationsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListDatabaseOperations', $optionalArgs, ListDatabaseOperationsResponse::class, $request); + } + + /** + * Lists Cloud Spanner database roles. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $formattedParent = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + * // Iterate over pages of elements + * $pagedResponse = $databaseAdminClient->listDatabaseRoles($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $databaseAdminClient->listDatabaseRoles($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The database whose roles should be listed. + * Values are of the form + * `projects//instances//databases/`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listDatabaseRoles($parent, array $optionalArgs = []) + { + $request = new ListDatabaseRolesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListDatabaseRoles', $optionalArgs, ListDatabaseRolesResponse::class, $request); + } + + /** + * Lists Cloud Spanner databases. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); + * // Iterate over pages of elements + * $pagedResponse = $databaseAdminClient->listDatabases($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $databaseAdminClient->listDatabases($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The instance whose databases should be listed. + * Values are of the form `projects//instances/`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listDatabases($parent, array $optionalArgs = []) + { + $request = new ListDatabasesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListDatabases', $optionalArgs, ListDatabasesResponse::class, $request); + } + + /** + * Create a new database by restoring from a completed backup. The new + * database must be in the same project and in an instance with the same + * instance configuration as the instance containing + * the backup. The returned database [long-running + * operation][google.longrunning.Operation] has a name of the format + * `projects//instances//databases//operations/`, + * and can be used to track the progress of the operation, and to cancel it. + * The [metadata][google.longrunning.Operation.metadata] field type is + * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. + * The [response][google.longrunning.Operation.response] type + * is [Database][google.spanner.admin.database.v1.Database], if + * successful. Cancelling the returned operation will stop the restore and + * delete the database. + * There can be only one database being restored into an instance at a time. + * Once the restore operation completes, a new restore operation can be + * initiated, without waiting for the optimize operation associated with the + * first restore to complete. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); + * $databaseId = 'database_id'; + * $operationResponse = $databaseAdminClient->restoreDatabase($formattedParent, $databaseId); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $databaseAdminClient->restoreDatabase($formattedParent, $databaseId); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'restoreDatabase'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the instance in which to create the + * restored database. This instance must be in the same project and + * have the same instance configuration as the instance containing + * the source backup. Values are of the form + * `projects//instances/`. + * @param string $databaseId Required. The id of the database to create and restore to. This + * database must not already exist. The `database_id` appended to + * `parent` forms the full database name of the form + * `projects//instances//databases/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $backup + * Name of the backup from which to restore. Values are of the form + * `projects//instances//backups/`. + * @type RestoreDatabaseEncryptionConfig $encryptionConfig + * Optional. An encryption configuration describing the encryption type and + * key resources in Cloud KMS used to encrypt/decrypt the database to restore + * to. If this field is not specified, the restored database will use the same + * encryption configuration as the backup by default, namely + * [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type] + * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function restoreDatabase($parent, $databaseId, array $optionalArgs = []) + { + $request = new RestoreDatabaseRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setDatabaseId($databaseId); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['backup'])) { + $request->setBackup($optionalArgs['backup']); + } + + if (isset($optionalArgs['encryptionConfig'])) { + $request->setEncryptionConfig($optionalArgs['encryptionConfig']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('RestoreDatabase', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Sets the access control policy on a database or backup resource. + * Replaces any existing policy. + * + * Authorization requires `spanner.databases.setIamPolicy` + * permission on [resource][google.iam.v1.SetIamPolicyRequest.resource]. + * For backups, authorization requires `spanner.backups.setIamPolicy` + * permission on [resource][google.iam.v1.SetIamPolicyRequest.resource]. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $databaseAdminClient->setIamPolicy($resource, $policy); + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function setIamPolicy($resource, $policy, array $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPolicy($policy); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns permissions that the caller has on the specified database or backup + * resource. + * + * Attempting this RPC on a non-existent Cloud Spanner database will + * result in a NOT_FOUND error if the user has + * `spanner.databases.list` permission on the containing Cloud + * Spanner instance. Otherwise returns an empty set of permissions. + * Calling this method on a backup that does not exist will + * result in a NOT_FOUND error if the user has + * `spanner.backups.list` permission on the containing instance. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $databaseAdminClient->testIamPermissions($resource, $permissions); + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + */ + public function testIamPermissions($resource, $permissions, array $optionalArgs = []) + { + $request = new TestIamPermissionsRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPermissions($permissions); + $requestParamHeaders['resource'] = $resource; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates a pending or completed + * [Backup][google.spanner.admin.database.v1.Backup]. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $backup = new Backup(); + * $updateMask = new FieldMask(); + * $response = $databaseAdminClient->updateBackup($backup, $updateMask); + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param Backup $backup Required. The backup to update. `backup.name`, and the fields to be updated + * as specified by `update_mask` are required. Other fields are ignored. + * Update is only supported for the following fields: + * * `backup.expire_time`. + * @param FieldMask $updateMask Required. A mask specifying which fields (e.g. `expire_time`) in the + * Backup resource should be updated. This mask is relative to the Backup + * resource, not to the request message. The field mask must always be + * specified; this prevents any future fields from being erased accidentally + * by clients that do not know about them. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\Backup + * + * @throws ApiException if the remote call fails + */ + public function updateBackup($backup, $updateMask, array $optionalArgs = []) + { + $request = new UpdateBackupRequest(); + $requestParamHeaders = []; + $request->setBackup($backup); + $request->setUpdateMask($updateMask); + $requestParamHeaders['backup.name'] = $backup->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateBackup', Backup::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates a backup schedule. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $backupSchedule = new BackupSchedule(); + * $updateMask = new FieldMask(); + * $response = $databaseAdminClient->updateBackupSchedule($backupSchedule, $updateMask); + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param BackupSchedule $backupSchedule Required. The backup schedule to update. `backup_schedule.name`, and the + * fields to be updated as specified by `update_mask` are required. Other + * fields are ignored. + * @param FieldMask $updateMask Required. A mask specifying which fields in the BackupSchedule resource + * should be updated. This mask is relative to the BackupSchedule resource, + * not to the request message. The field mask must always be + * specified; this prevents any future fields from being erased + * accidentally. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule + * + * @throws ApiException if the remote call fails + */ + public function updateBackupSchedule($backupSchedule, $updateMask, array $optionalArgs = []) + { + $request = new UpdateBackupScheduleRequest(); + $requestParamHeaders = []; + $request->setBackupSchedule($backupSchedule); + $request->setUpdateMask($updateMask); + $requestParamHeaders['backup_schedule.name'] = $backupSchedule->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateBackupSchedule', BackupSchedule::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates a Cloud Spanner database. The returned + * [long-running operation][google.longrunning.Operation] can be used to track + * the progress of updating the database. If the named database does not + * exist, returns `NOT_FOUND`. + * + * While the operation is pending: + * + * * The database's + * [reconciling][google.spanner.admin.database.v1.Database.reconciling] + * field is set to true. + * * Cancelling the operation is best-effort. If the cancellation succeeds, + * the operation metadata's + * [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time] + * is set, the updates are reverted, and the operation terminates with a + * `CANCELLED` status. + * * New UpdateDatabase requests will return a `FAILED_PRECONDITION` error + * until the pending operation is done (returns successfully or with + * error). + * * Reading the database via the API continues to give the pre-request + * values. + * + * Upon completion of the returned operation: + * + * * The new values are in effect and readable via the API. + * * The database's + * [reconciling][google.spanner.admin.database.v1.Database.reconciling] + * field becomes false. + * + * The returned [long-running operation][google.longrunning.Operation] will + * have a name of the format + * `projects//instances//databases//operations/` + * and can be used to track the database modification. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Database][google.spanner.admin.database.v1.Database], if successful. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $database = new Database(); + * $updateMask = new FieldMask(); + * $operationResponse = $databaseAdminClient->updateDatabase($database, $updateMask); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $databaseAdminClient->updateDatabase($database, $updateMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'updateDatabase'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param Database $database Required. The database to update. + * The `name` field of the database is of the form + * `projects//instances//databases/`. + * @param FieldMask $updateMask Required. The list of fields to update. Currently, only + * `enable_drop_protection` field can be updated. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateDatabase($database, $updateMask, array $optionalArgs = []) + { + $request = new UpdateDatabaseRequest(); + $requestParamHeaders = []; + $request->setDatabase($database); + $request->setUpdateMask($updateMask); + $requestParamHeaders['database.name'] = $database->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateDatabase', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the schema of a Cloud Spanner database by + * creating/altering/dropping tables, columns, indexes, etc. The returned + * [long-running operation][google.longrunning.Operation] will have a name of + * the format `/operations/` and can be used to + * track execution of the schema change(s). The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]. + * The operation has no response. + * + * Sample code: + * ``` + * $databaseAdminClient = new DatabaseAdminClient(); + * try { + * $formattedDatabase = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + * $statements = []; + * $operationResponse = $databaseAdminClient->updateDatabaseDdl($formattedDatabase, $statements); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $databaseAdminClient->updateDatabaseDdl($formattedDatabase, $statements); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'updateDatabaseDdl'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $databaseAdminClient->close(); + * } + * ``` + * + * @param string $database Required. The database to update. + * @param string[] $statements Required. DDL statements to be applied to the database. + * @param array $optionalArgs { + * Optional. + * + * @type string $operationId + * If empty, the new update request is assigned an + * automatically-generated operation ID. Otherwise, `operation_id` + * is used to construct the name of the resulting + * [Operation][google.longrunning.Operation]. + * + * Specifying an explicit operation ID simplifies determining + * whether the statements were executed in the event that the + * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] + * call is replayed, or the return value is otherwise lost: the + * [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database] + * and `operation_id` fields can be combined to form the + * [name][google.longrunning.Operation.name] of the resulting + * [longrunning.Operation][google.longrunning.Operation]: + * `/operations/`. + * + * `operation_id` should be unique within the database, and must be + * a valid identifier: `[a-z][a-z0-9_]*`. Note that + * automatically-generated operation IDs always begin with an + * underscore. If the named operation already exists, + * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] + * returns `ALREADY_EXISTS`. + * @type string $protoDescriptors + * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements. + * Contains a protobuf-serialized + * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). + * To generate it, [install](https://grpc.io/docs/protoc-installation/) and + * run `protoc` with --include_imports and --descriptor_set_out. For example, + * to generate for moon/shot/app.proto, run + * ``` + * $protoc --proto_path=/app_path --proto_path=/lib_path \ + * --include_imports \ + * --descriptor_set_out=descriptors.data \ + * moon/shot/app.proto + * ``` + * For more details, see protobuffer [self + * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateDatabaseDdl($database, $statements, array $optionalArgs = []) + { + $request = new UpdateDatabaseDdlRequest(); + $requestParamHeaders = []; + $request->setDatabase($database); + $request->setStatements($statements); + $requestParamHeaders['database'] = $database; + if (isset($optionalArgs['operationId'])) { + $request->setOperationId($optionalArgs['operationId']); + } + + if (isset($optionalArgs['protoDescriptors'])) { + $request->setProtoDescriptors($optionalArgs['protoDescriptors']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateDatabaseDdl', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } +} diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/gapic_metadata.json b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..42f9576de062 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/gapic_metadata.json @@ -0,0 +1,143 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.spanner.admin.database.v1", + "libraryPackage": "Google\\Cloud\\Spanner\\Admin\\Database\\V1", + "services": { + "DatabaseAdmin": { + "clients": { + "grpc": { + "libraryClient": "DatabaseAdminGapicClient", + "rpcs": { + "CopyBackup": { + "methods": [ + "copyBackup" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "CreateBackupSchedule": { + "methods": [ + "createBackupSchedule" + ] + }, + "CreateDatabase": { + "methods": [ + "createDatabase" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "DeleteBackupSchedule": { + "methods": [ + "deleteBackupSchedule" + ] + }, + "DropDatabase": { + "methods": [ + "dropDatabase" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "GetBackupSchedule": { + "methods": [ + "getBackupSchedule" + ] + }, + "GetDatabase": { + "methods": [ + "getDatabase" + ] + }, + "GetDatabaseDdl": { + "methods": [ + "getDatabaseDdl" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "ListBackupOperations": { + "methods": [ + "listBackupOperations" + ] + }, + "ListBackupSchedules": { + "methods": [ + "listBackupSchedules" + ] + }, + "ListBackups": { + "methods": [ + "listBackups" + ] + }, + "ListDatabaseOperations": { + "methods": [ + "listDatabaseOperations" + ] + }, + "ListDatabaseRoles": { + "methods": [ + "listDatabaseRoles" + ] + }, + "ListDatabases": { + "methods": [ + "listDatabases" + ] + }, + "RestoreDatabase": { + "methods": [ + "restoreDatabase" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "UpdateBackup": { + "methods": [ + "updateBackup" + ] + }, + "UpdateBackupSchedule": { + "methods": [ + "updateBackupSchedule" + ] + }, + "UpdateDatabase": { + "methods": [ + "updateDatabase" + ] + }, + "UpdateDatabaseDdl": { + "methods": [ + "updateDatabaseDdl" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_client_config.json b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_client_config.json new file mode 100644 index 000000000000..c39bb9e64ee2 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_client_config.json @@ -0,0 +1,193 @@ +{ + "interfaces": { + "google.spanner.admin.database.v1.DatabaseAdmin": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE", + "DEADLINE_EXCEEDED" + ], + "retry_policy_2_codes": [ + "UNAVAILABLE", + "DEADLINE_EXCEEDED" + ], + "no_retry_1_codes": [], + "no_retry_2_codes": [] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 32000, + "initial_rpc_timeout_millis": 3600000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 3600000, + "total_timeout_millis": 3600000 + }, + "retry_policy_2_params": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 32000, + "initial_rpc_timeout_millis": 30000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 30000, + "total_timeout_millis": 30000 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 3600000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 3600000, + "total_timeout_millis": 3600000 + }, + "no_retry_2_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 30000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 30000, + "total_timeout_millis": 30000 + } + }, + "methods": { + "CopyBackup": { + "timeout_millis": 3600000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateBackup": { + "timeout_millis": 3600000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateBackupSchedule": { + "timeout_millis": 3600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "CreateDatabase": { + "timeout_millis": 3600000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteBackup": { + "timeout_millis": 3600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "DeleteBackupSchedule": { + "timeout_millis": 3600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "DropDatabase": { + "timeout_millis": 3600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetBackup": { + "timeout_millis": 3600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetBackupSchedule": { + "timeout_millis": 3600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetDatabase": { + "timeout_millis": 3600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetDatabaseDdl": { + "timeout_millis": 3600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetIamPolicy": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "ListBackupOperations": { + "timeout_millis": 3600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListBackupSchedules": { + "timeout_millis": 3600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListBackups": { + "timeout_millis": 3600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListDatabaseOperations": { + "timeout_millis": 3600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListDatabaseRoles": { + "timeout_millis": 3600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListDatabases": { + "timeout_millis": 3600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "RestoreDatabase": { + "timeout_millis": 3600000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "SetIamPolicy": { + "timeout_millis": 30000, + "retry_codes_name": "no_retry_2_codes", + "retry_params_name": "no_retry_2_params" + }, + "TestIamPermissions": { + "timeout_millis": 30000, + "retry_codes_name": "no_retry_2_codes", + "retry_params_name": "no_retry_2_params" + }, + "UpdateBackup": { + "timeout_millis": 3600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateBackupSchedule": { + "timeout_millis": 3600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateDatabase": { + "timeout_millis": 3600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateDatabaseDdl": { + "timeout_millis": 3600000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_descriptor_config.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_descriptor_config.php new file mode 100644 index 000000000000..8c838a9fed43 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_descriptor_config.php @@ -0,0 +1,429 @@ + [ + 'google.spanner.admin.database.v1.DatabaseAdmin' => [ + 'CopyBackup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\Backup', + 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\CopyBackupMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateBackup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\Backup', + 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\CreateBackupMetadata', + 'initialPollDelayMillis' => '20000', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '45000', + 'totalPollTimeoutMillis' => '172800000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateDatabase' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\Database', + 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\CreateDatabaseMetadata', + 'initialPollDelayMillis' => '20000', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '45000', + 'totalPollTimeoutMillis' => '86400000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'RestoreDatabase' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\Database', + 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\RestoreDatabaseMetadata', + 'initialPollDelayMillis' => '20000', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '45000', + 'totalPollTimeoutMillis' => '86400000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateDatabase' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\Database', + 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'database.name', + 'fieldAccessors' => [ + 'getDatabase', + 'getName', + ], + ], + ], + ], + 'UpdateDatabaseDdl' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseDdlMetadata', + 'initialPollDelayMillis' => '20000', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '45000', + 'totalPollTimeoutMillis' => '86400000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'database', + 'fieldAccessors' => [ + 'getDatabase', + ], + ], + ], + ], + 'CreateBackupSchedule' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteBackup' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteBackupSchedule' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DropDatabase' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'database', + 'fieldAccessors' => [ + 'getDatabase', + ], + ], + ], + ], + 'GetBackup' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\Backup', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetBackupSchedule' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetDatabase' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\Database', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetDatabaseDdl' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\GetDatabaseDdlResponse', + 'headerParams' => [ + [ + 'keyName' => 'database', + 'fieldAccessors' => [ + 'getDatabase', + ], + ], + ], + ], + 'GetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + ], + 'ListBackupOperations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getOperations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\ListBackupOperationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListBackupSchedules' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getBackupSchedules', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\ListBackupSchedulesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListBackups' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getBackups', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\ListBackupsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListDatabaseOperations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getOperations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\ListDatabaseOperationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListDatabaseRoles' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getDatabaseRoles', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\ListDatabaseRolesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListDatabases' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getDatabases', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\ListDatabasesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\TestIamPermissionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + ], + 'UpdateBackup' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\Backup', + 'headerParams' => [ + [ + 'keyName' => 'backup.name', + 'fieldAccessors' => [ + 'getBackup', + 'getName', + ], + ], + ], + ], + 'UpdateBackupSchedule' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule', + 'headerParams' => [ + [ + 'keyName' => 'backup_schedule.name', + 'fieldAccessors' => [ + 'getBackupSchedule', + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'backup' => 'projects/{project}/instances/{instance}/backups/{backup}', + 'backupSchedule' => 'projects/{project}/instances/{instance}/databases/{database}/backupSchedules/{schedule}', + 'cryptoKey' => 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}', + 'cryptoKeyVersion' => 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}', + 'database' => 'projects/{project}/instances/{instance}/databases/{database}', + 'instance' => 'projects/{project}/instances/{instance}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_rest_client_config.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_rest_client_config.php new file mode 100644 index 000000000000..1bf0d796614f --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_rest_client_config.php @@ -0,0 +1,477 @@ + [ + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations/*}:cancel', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations/*}:cancel', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/backups/*/operations/*}:cancel', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/instanceConfigs/*/operations/*}:cancel', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations/*}', + ], + [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/backups/*/operations/*}', + ], + [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/instanceConfigs/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/backups/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instanceConfigs/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/backups/*/operations}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instanceConfigs/*/operations}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.spanner.admin.database.v1.DatabaseAdmin' => [ + 'CopyBackup' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/backups:copy', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateBackup' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/backups', + 'body' => 'backup', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'backup_id', + ], + ], + 'CreateBackupSchedule' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/instances/*/databases/*}/backupSchedules', + 'body' => 'backup_schedule', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'backup_schedule_id', + ], + ], + 'CreateDatabase' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/databases', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteBackup' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/backups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteBackupSchedule' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/backupSchedules/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DropDatabase' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{database=projects/*/instances/*/databases/*}', + 'placeholders' => [ + 'database' => [ + 'getters' => [ + 'getDatabase', + ], + ], + ], + ], + 'GetBackup' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/backups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetBackupSchedule' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/backupSchedules/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetDatabase' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetDatabaseDdl' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{database=projects/*/instances/*/databases/*}/ddl', + 'placeholders' => [ + 'database' => [ + 'getters' => [ + 'getDatabase', + ], + ], + ], + ], + 'GetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/instances/*/databases/*}:getIamPolicy', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/instances/*/backups/*}:getIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:getIamPolicy', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'ListBackupOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/backupOperations', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListBackupSchedules' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/instances/*/databases/*}/backupSchedules', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListBackups' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/backups', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListDatabaseOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/databaseOperations', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListDatabaseRoles' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/instances/*/databases/*}/databaseRoles', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListDatabases' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/databases', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'RestoreDatabase' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/databases:restore', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/instances/*/databases/*}:setIamPolicy', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/instances/*/backups/*}:setIamPolicy', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:setIamPolicy', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/instances/*/databases/*}:testIamPermissions', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/instances/*/backups/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:testIamPermissions', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/instances/*/databases/*/databaseRoles/*}:testIamPermissions', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'UpdateBackup' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{backup.name=projects/*/instances/*/backups/*}', + 'body' => 'backup', + 'placeholders' => [ + 'backup.name' => [ + 'getters' => [ + 'getBackup', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateBackupSchedule' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{backup_schedule.name=projects/*/instances/*/databases/*/backupSchedules/*}', + 'body' => 'backup_schedule', + 'placeholders' => [ + 'backup_schedule.name' => [ + 'getters' => [ + 'getBackupSchedule', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateDatabase' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{database.name=projects/*/instances/*/databases/*}', + 'body' => 'database', + 'placeholders' => [ + 'database.name' => [ + 'getters' => [ + 'getDatabase', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateDatabaseDdl' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{database=projects/*/instances/*/databases/*}/ddl', + 'body' => '*', + 'placeholders' => [ + 'database' => [ + 'getters' => [ + 'getDatabase', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/tests/Unit/V1/Client/DatabaseAdminClientTest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/tests/Unit/V1/Client/DatabaseAdminClientTest.php new file mode 100644 index 000000000000..9f3811b985fd --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/tests/Unit/V1/Client/DatabaseAdminClientTest.php @@ -0,0 +1,2352 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return DatabaseAdminClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new DatabaseAdminClient($options); + } + + /** @test */ + public function copyBackupTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/copyBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $database = 'database1789464955'; + $name = 'name3373707'; + $sizeBytes = 1796325715; + $freeableSizeBytes = 1302251206; + $exclusiveSizeBytes = 1085921554; + $incrementalBackupChainId = 'incrementalBackupChainId-792099119'; + $expectedResponse = new Backup(); + $expectedResponse->setDatabase($database); + $expectedResponse->setName($name); + $expectedResponse->setSizeBytes($sizeBytes); + $expectedResponse->setFreeableSizeBytes($freeableSizeBytes); + $expectedResponse->setExclusiveSizeBytes($exclusiveSizeBytes); + $expectedResponse->setIncrementalBackupChainId($incrementalBackupChainId); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/copyBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $backupId = 'backupId1355353272'; + $formattedSourceBackup = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); + $expireTime = new Timestamp(); + $request = (new CopyBackupRequest()) + ->setParent($formattedParent) + ->setBackupId($backupId) + ->setSourceBackup($formattedSourceBackup) + ->setExpireTime($expireTime); + $response = $gapicClient->copyBackup($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/CopyBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getBackupId(); + $this->assertProtobufEquals($backupId, $actualValue); + $actualValue = $actualApiRequestObject->getSourceBackup(); + $this->assertProtobufEquals($formattedSourceBackup, $actualValue); + $actualValue = $actualApiRequestObject->getExpireTime(); + $this->assertProtobufEquals($expireTime, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/copyBackupTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function copyBackupExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/copyBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $backupId = 'backupId1355353272'; + $formattedSourceBackup = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); + $expireTime = new Timestamp(); + $request = (new CopyBackupRequest()) + ->setParent($formattedParent) + ->setBackupId($backupId) + ->setSourceBackup($formattedSourceBackup) + ->setExpireTime($expireTime); + $response = $gapicClient->copyBackup($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/copyBackupTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createBackupTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $database = 'database1789464955'; + $name = 'name3373707'; + $sizeBytes = 1796325715; + $freeableSizeBytes = 1302251206; + $exclusiveSizeBytes = 1085921554; + $incrementalBackupChainId = 'incrementalBackupChainId-792099119'; + $expectedResponse = new Backup(); + $expectedResponse->setDatabase($database); + $expectedResponse->setName($name); + $expectedResponse->setSizeBytes($sizeBytes); + $expectedResponse->setFreeableSizeBytes($freeableSizeBytes); + $expectedResponse->setExclusiveSizeBytes($exclusiveSizeBytes); + $expectedResponse->setIncrementalBackupChainId($incrementalBackupChainId); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $backupId = 'backupId1355353272'; + $backup = new Backup(); + $request = (new CreateBackupRequest()) + ->setParent($formattedParent) + ->setBackupId($backupId) + ->setBackup($backup); + $response = $gapicClient->createBackup($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/CreateBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getBackupId(); + $this->assertProtobufEquals($backupId, $actualValue); + $actualValue = $actualApiRequestObject->getBackup(); + $this->assertProtobufEquals($backup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createBackupExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $backupId = 'backupId1355353272'; + $backup = new Backup(); + $request = (new CreateBackupRequest()) + ->setParent($formattedParent) + ->setBackupId($backupId) + ->setBackup($backup); + $response = $gapicClient->createBackup($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createBackupScheduleTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new BackupSchedule(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $backupScheduleId = 'backupScheduleId326010054'; + $backupSchedule = new BackupSchedule(); + $request = (new CreateBackupScheduleRequest()) + ->setParent($formattedParent) + ->setBackupScheduleId($backupScheduleId) + ->setBackupSchedule($backupSchedule); + $response = $gapicClient->createBackupSchedule($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/CreateBackupSchedule', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getBackupScheduleId(); + $this->assertProtobufEquals($backupScheduleId, $actualValue); + $actualValue = $actualRequestObject->getBackupSchedule(); + $this->assertProtobufEquals($backupSchedule, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createBackupScheduleExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $backupScheduleId = 'backupScheduleId326010054'; + $backupSchedule = new BackupSchedule(); + $request = (new CreateBackupScheduleRequest()) + ->setParent($formattedParent) + ->setBackupScheduleId($backupScheduleId) + ->setBackupSchedule($backupSchedule); + try { + $gapicClient->createBackupSchedule($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createDatabaseTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createDatabaseTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $versionRetentionPeriod = 'versionRetentionPeriod907249289'; + $defaultLeader = 'defaultLeader1941180615'; + $enableDropProtection = false; + $reconciling = false; + $expectedResponse = new Database(); + $expectedResponse->setName($name); + $expectedResponse->setVersionRetentionPeriod($versionRetentionPeriod); + $expectedResponse->setDefaultLeader($defaultLeader); + $expectedResponse->setEnableDropProtection($enableDropProtection); + $expectedResponse->setReconciling($reconciling); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createDatabaseTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $createStatement = 'createStatement552974828'; + $request = (new CreateDatabaseRequest()) + ->setParent($formattedParent) + ->setCreateStatement($createStatement); + $response = $gapicClient->createDatabase($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/CreateDatabase', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getCreateStatement(); + $this->assertProtobufEquals($createStatement, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createDatabaseTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createDatabaseExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createDatabaseTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $createStatement = 'createStatement552974828'; + $request = (new CreateDatabaseRequest()) + ->setParent($formattedParent) + ->setCreateStatement($createStatement); + $response = $gapicClient->createDatabase($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createDatabaseTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteBackupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); + $request = (new DeleteBackupRequest()) + ->setName($formattedName); + $gapicClient->deleteBackup($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/DeleteBackup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteBackupExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); + $request = (new DeleteBackupRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteBackup($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteBackupScheduleTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]'); + $request = (new DeleteBackupScheduleRequest()) + ->setName($formattedName); + $gapicClient->deleteBackupSchedule($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/DeleteBackupSchedule', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteBackupScheduleExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]'); + $request = (new DeleteBackupScheduleRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteBackupSchedule($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function dropDatabaseTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $request = (new DropDatabaseRequest()) + ->setDatabase($formattedDatabase); + $gapicClient->dropDatabase($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/DropDatabase', $actualFuncCall); + $actualValue = $actualRequestObject->getDatabase(); + $this->assertProtobufEquals($formattedDatabase, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function dropDatabaseExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $request = (new DropDatabaseRequest()) + ->setDatabase($formattedDatabase); + try { + $gapicClient->dropDatabase($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getBackupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $database = 'database1789464955'; + $name2 = 'name2-1052831874'; + $sizeBytes = 1796325715; + $freeableSizeBytes = 1302251206; + $exclusiveSizeBytes = 1085921554; + $incrementalBackupChainId = 'incrementalBackupChainId-792099119'; + $expectedResponse = new Backup(); + $expectedResponse->setDatabase($database); + $expectedResponse->setName($name2); + $expectedResponse->setSizeBytes($sizeBytes); + $expectedResponse->setFreeableSizeBytes($freeableSizeBytes); + $expectedResponse->setExclusiveSizeBytes($exclusiveSizeBytes); + $expectedResponse->setIncrementalBackupChainId($incrementalBackupChainId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); + $request = (new GetBackupRequest()) + ->setName($formattedName); + $response = $gapicClient->getBackup($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/GetBackup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getBackupExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); + $request = (new GetBackupRequest()) + ->setName($formattedName); + try { + $gapicClient->getBackup($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getBackupScheduleTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new BackupSchedule(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]'); + $request = (new GetBackupScheduleRequest()) + ->setName($formattedName); + $response = $gapicClient->getBackupSchedule($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/GetBackupSchedule', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getBackupScheduleExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]'); + $request = (new GetBackupScheduleRequest()) + ->setName($formattedName); + try { + $gapicClient->getBackupSchedule($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDatabaseTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $versionRetentionPeriod = 'versionRetentionPeriod907249289'; + $defaultLeader = 'defaultLeader1941180615'; + $enableDropProtection = false; + $reconciling = false; + $expectedResponse = new Database(); + $expectedResponse->setName($name2); + $expectedResponse->setVersionRetentionPeriod($versionRetentionPeriod); + $expectedResponse->setDefaultLeader($defaultLeader); + $expectedResponse->setEnableDropProtection($enableDropProtection); + $expectedResponse->setReconciling($reconciling); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $request = (new GetDatabaseRequest()) + ->setName($formattedName); + $response = $gapicClient->getDatabase($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/GetDatabase', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDatabaseExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $request = (new GetDatabaseRequest()) + ->setName($formattedName); + try { + $gapicClient->getDatabase($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDatabaseDdlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $protoDescriptors = '13'; + $expectedResponse = new GetDatabaseDdlResponse(); + $expectedResponse->setProtoDescriptors($protoDescriptors); + $transport->addResponse($expectedResponse); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $request = (new GetDatabaseDdlRequest()) + ->setDatabase($formattedDatabase); + $response = $gapicClient->getDatabaseDdl($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/GetDatabaseDdl', $actualFuncCall); + $actualValue = $actualRequestObject->getDatabase(); + $this->assertProtobufEquals($formattedDatabase, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDatabaseDdlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $request = (new GetDatabaseDdlRequest()) + ->setDatabase($formattedDatabase); + try { + $gapicClient->getDatabaseDdl($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + $response = $gapicClient->getIamPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + try { + $gapicClient->getIamPolicy($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBackupOperationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $operationsElement = new Operation(); + $operations = [ + $operationsElement, + ]; + $expectedResponse = new ListBackupOperationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setOperations($operations); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $request = (new ListBackupOperationsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listBackupOperations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getOperations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListBackupOperations', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBackupOperationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $request = (new ListBackupOperationsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listBackupOperations($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBackupSchedulesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $backupSchedulesElement = new BackupSchedule(); + $backupSchedules = [ + $backupSchedulesElement, + ]; + $expectedResponse = new ListBackupSchedulesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setBackupSchedules($backupSchedules); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $request = (new ListBackupSchedulesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listBackupSchedules($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getBackupSchedules()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListBackupSchedules', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBackupSchedulesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $request = (new ListBackupSchedulesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listBackupSchedules($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBackupsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $backupsElement = new Backup(); + $backups = [ + $backupsElement, + ]; + $expectedResponse = new ListBackupsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setBackups($backups); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $request = (new ListBackupsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listBackups($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getBackups()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListBackups', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBackupsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $request = (new ListBackupsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listBackups($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDatabaseOperationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $operationsElement = new Operation(); + $operations = [ + $operationsElement, + ]; + $expectedResponse = new ListDatabaseOperationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setOperations($operations); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $request = (new ListDatabaseOperationsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listDatabaseOperations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getOperations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabaseOperations', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDatabaseOperationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $request = (new ListDatabaseOperationsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listDatabaseOperations($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDatabaseRolesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $databaseRolesElement = new DatabaseRole(); + $databaseRoles = [ + $databaseRolesElement, + ]; + $expectedResponse = new ListDatabaseRolesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setDatabaseRoles($databaseRoles); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $request = (new ListDatabaseRolesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listDatabaseRoles($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getDatabaseRoles()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabaseRoles', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDatabaseRolesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $request = (new ListDatabaseRolesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listDatabaseRoles($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDatabasesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $databasesElement = new Database(); + $databases = [ + $databasesElement, + ]; + $expectedResponse = new ListDatabasesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setDatabases($databases); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $request = (new ListDatabasesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listDatabases($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getDatabases()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabases', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDatabasesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $request = (new ListDatabasesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listDatabases($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function restoreDatabaseTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/restoreDatabaseTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $versionRetentionPeriod = 'versionRetentionPeriod907249289'; + $defaultLeader = 'defaultLeader1941180615'; + $enableDropProtection = false; + $reconciling = false; + $expectedResponse = new Database(); + $expectedResponse->setName($name); + $expectedResponse->setVersionRetentionPeriod($versionRetentionPeriod); + $expectedResponse->setDefaultLeader($defaultLeader); + $expectedResponse->setEnableDropProtection($enableDropProtection); + $expectedResponse->setReconciling($reconciling); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/restoreDatabaseTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $databaseId = 'databaseId816491103'; + $request = (new RestoreDatabaseRequest()) + ->setParent($formattedParent) + ->setDatabaseId($databaseId); + $response = $gapicClient->restoreDatabase($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/RestoreDatabase', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getDatabaseId(); + $this->assertProtobufEquals($databaseId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restoreDatabaseTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function restoreDatabaseExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/restoreDatabaseTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $databaseId = 'databaseId816491103'; + $request = (new RestoreDatabaseRequest()) + ->setParent($formattedParent) + ->setDatabaseId($databaseId); + $response = $gapicClient->restoreDatabase($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restoreDatabaseTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + $response = $gapicClient->setIamPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + try { + $gapicClient->setIamPolicy($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + $response = $gapicClient->testIamPermissions($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + try { + $gapicClient->testIamPermissions($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateBackupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $database = 'database1789464955'; + $name = 'name3373707'; + $sizeBytes = 1796325715; + $freeableSizeBytes = 1302251206; + $exclusiveSizeBytes = 1085921554; + $incrementalBackupChainId = 'incrementalBackupChainId-792099119'; + $expectedResponse = new Backup(); + $expectedResponse->setDatabase($database); + $expectedResponse->setName($name); + $expectedResponse->setSizeBytes($sizeBytes); + $expectedResponse->setFreeableSizeBytes($freeableSizeBytes); + $expectedResponse->setExclusiveSizeBytes($exclusiveSizeBytes); + $expectedResponse->setIncrementalBackupChainId($incrementalBackupChainId); + $transport->addResponse($expectedResponse); + // Mock request + $backup = new Backup(); + $updateMask = new FieldMask(); + $request = (new UpdateBackupRequest()) + ->setBackup($backup) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateBackup($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/UpdateBackup', $actualFuncCall); + $actualValue = $actualRequestObject->getBackup(); + $this->assertProtobufEquals($backup, $actualValue); + $actualValue = $actualRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateBackupExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $backup = new Backup(); + $updateMask = new FieldMask(); + $request = (new UpdateBackupRequest()) + ->setBackup($backup) + ->setUpdateMask($updateMask); + try { + $gapicClient->updateBackup($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateBackupScheduleTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new BackupSchedule(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $backupSchedule = new BackupSchedule(); + $updateMask = new FieldMask(); + $request = (new UpdateBackupScheduleRequest()) + ->setBackupSchedule($backupSchedule) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateBackupSchedule($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/UpdateBackupSchedule', $actualFuncCall); + $actualValue = $actualRequestObject->getBackupSchedule(); + $this->assertProtobufEquals($backupSchedule, $actualValue); + $actualValue = $actualRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateBackupScheduleExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $backupSchedule = new BackupSchedule(); + $updateMask = new FieldMask(); + $request = (new UpdateBackupScheduleRequest()) + ->setBackupSchedule($backupSchedule) + ->setUpdateMask($updateMask); + try { + $gapicClient->updateBackupSchedule($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateDatabaseTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateDatabaseTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $versionRetentionPeriod = 'versionRetentionPeriod907249289'; + $defaultLeader = 'defaultLeader1941180615'; + $enableDropProtection = false; + $reconciling = false; + $expectedResponse = new Database(); + $expectedResponse->setName($name); + $expectedResponse->setVersionRetentionPeriod($versionRetentionPeriod); + $expectedResponse->setDefaultLeader($defaultLeader); + $expectedResponse->setEnableDropProtection($enableDropProtection); + $expectedResponse->setReconciling($reconciling); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateDatabaseTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $database = new Database(); + $databaseName = 'databaseName-459093338'; + $database->setName($databaseName); + $updateMask = new FieldMask(); + $request = (new UpdateDatabaseRequest()) + ->setDatabase($database) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateDatabase($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/UpdateDatabase', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getDatabase(); + $this->assertProtobufEquals($database, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateDatabaseTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateDatabaseExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateDatabaseTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $database = new Database(); + $databaseName = 'databaseName-459093338'; + $database->setName($databaseName); + $updateMask = new FieldMask(); + $request = (new UpdateDatabaseRequest()) + ->setDatabase($database) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateDatabase($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateDatabaseTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateDatabaseDdlTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateDatabaseDdlTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateDatabaseDdlTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $statements = []; + $request = (new UpdateDatabaseDdlRequest()) + ->setDatabase($formattedDatabase) + ->setStatements($statements); + $response = $gapicClient->updateDatabaseDdl($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/UpdateDatabaseDdl', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getDatabase(); + $this->assertProtobufEquals($formattedDatabase, $actualValue); + $actualValue = $actualApiRequestObject->getStatements(); + $this->assertProtobufEquals($statements, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateDatabaseDdlTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateDatabaseDdlExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateDatabaseDdlTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $statements = []; + $request = (new UpdateDatabaseDdlRequest()) + ->setDatabase($formattedDatabase) + ->setStatements($statements); + $response = $gapicClient->updateDatabaseDdl($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateDatabaseDdlTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function copyBackupAsyncTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/copyBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $database = 'database1789464955'; + $name = 'name3373707'; + $sizeBytes = 1796325715; + $freeableSizeBytes = 1302251206; + $exclusiveSizeBytes = 1085921554; + $incrementalBackupChainId = 'incrementalBackupChainId-792099119'; + $expectedResponse = new Backup(); + $expectedResponse->setDatabase($database); + $expectedResponse->setName($name); + $expectedResponse->setSizeBytes($sizeBytes); + $expectedResponse->setFreeableSizeBytes($freeableSizeBytes); + $expectedResponse->setExclusiveSizeBytes($exclusiveSizeBytes); + $expectedResponse->setIncrementalBackupChainId($incrementalBackupChainId); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/copyBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $backupId = 'backupId1355353272'; + $formattedSourceBackup = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); + $expireTime = new Timestamp(); + $request = (new CopyBackupRequest()) + ->setParent($formattedParent) + ->setBackupId($backupId) + ->setSourceBackup($formattedSourceBackup) + ->setExpireTime($expireTime); + $response = $gapicClient->copyBackupAsync($request)->wait(); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/CopyBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getBackupId(); + $this->assertProtobufEquals($backupId, $actualValue); + $actualValue = $actualApiRequestObject->getSourceBackup(); + $this->assertProtobufEquals($formattedSourceBackup, $actualValue); + $actualValue = $actualApiRequestObject->getExpireTime(); + $this->assertProtobufEquals($expireTime, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/copyBackupTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } +} diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/tests/Unit/V1/DatabaseAdminClientTest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/tests/Unit/V1/DatabaseAdminClientTest.php new file mode 100644 index 000000000000..2371125aab73 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/tests/Unit/V1/DatabaseAdminClientTest.php @@ -0,0 +1,2109 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return DatabaseAdminClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new DatabaseAdminClient($options); + } + + /** @test */ + public function copyBackupTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/copyBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $database = 'database1789464955'; + $name = 'name3373707'; + $sizeBytes = 1796325715; + $freeableSizeBytes = 1302251206; + $exclusiveSizeBytes = 1085921554; + $incrementalBackupChainId = 'incrementalBackupChainId-792099119'; + $expectedResponse = new Backup(); + $expectedResponse->setDatabase($database); + $expectedResponse->setName($name); + $expectedResponse->setSizeBytes($sizeBytes); + $expectedResponse->setFreeableSizeBytes($freeableSizeBytes); + $expectedResponse->setExclusiveSizeBytes($exclusiveSizeBytes); + $expectedResponse->setIncrementalBackupChainId($incrementalBackupChainId); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/copyBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $backupId = 'backupId1355353272'; + $formattedSourceBackup = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); + $expireTime = new Timestamp(); + $response = $gapicClient->copyBackup($formattedParent, $backupId, $formattedSourceBackup, $expireTime); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/CopyBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getBackupId(); + $this->assertProtobufEquals($backupId, $actualValue); + $actualValue = $actualApiRequestObject->getSourceBackup(); + $this->assertProtobufEquals($formattedSourceBackup, $actualValue); + $actualValue = $actualApiRequestObject->getExpireTime(); + $this->assertProtobufEquals($expireTime, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/copyBackupTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function copyBackupExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/copyBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $backupId = 'backupId1355353272'; + $formattedSourceBackup = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); + $expireTime = new Timestamp(); + $response = $gapicClient->copyBackup($formattedParent, $backupId, $formattedSourceBackup, $expireTime); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/copyBackupTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createBackupTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $database = 'database1789464955'; + $name = 'name3373707'; + $sizeBytes = 1796325715; + $freeableSizeBytes = 1302251206; + $exclusiveSizeBytes = 1085921554; + $incrementalBackupChainId = 'incrementalBackupChainId-792099119'; + $expectedResponse = new Backup(); + $expectedResponse->setDatabase($database); + $expectedResponse->setName($name); + $expectedResponse->setSizeBytes($sizeBytes); + $expectedResponse->setFreeableSizeBytes($freeableSizeBytes); + $expectedResponse->setExclusiveSizeBytes($exclusiveSizeBytes); + $expectedResponse->setIncrementalBackupChainId($incrementalBackupChainId); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $backupId = 'backupId1355353272'; + $backup = new Backup(); + $response = $gapicClient->createBackup($formattedParent, $backupId, $backup); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/CreateBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getBackupId(); + $this->assertProtobufEquals($backupId, $actualValue); + $actualValue = $actualApiRequestObject->getBackup(); + $this->assertProtobufEquals($backup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createBackupExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $backupId = 'backupId1355353272'; + $backup = new Backup(); + $response = $gapicClient->createBackup($formattedParent, $backupId, $backup); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createBackupTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createBackupScheduleTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new BackupSchedule(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $backupScheduleId = 'backupScheduleId326010054'; + $backupSchedule = new BackupSchedule(); + $response = $gapicClient->createBackupSchedule($formattedParent, $backupScheduleId, $backupSchedule); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/CreateBackupSchedule', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getBackupScheduleId(); + $this->assertProtobufEquals($backupScheduleId, $actualValue); + $actualValue = $actualRequestObject->getBackupSchedule(); + $this->assertProtobufEquals($backupSchedule, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createBackupScheduleExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $backupScheduleId = 'backupScheduleId326010054'; + $backupSchedule = new BackupSchedule(); + try { + $gapicClient->createBackupSchedule($formattedParent, $backupScheduleId, $backupSchedule); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createDatabaseTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createDatabaseTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $versionRetentionPeriod = 'versionRetentionPeriod907249289'; + $defaultLeader = 'defaultLeader1941180615'; + $enableDropProtection = false; + $reconciling = false; + $expectedResponse = new Database(); + $expectedResponse->setName($name); + $expectedResponse->setVersionRetentionPeriod($versionRetentionPeriod); + $expectedResponse->setDefaultLeader($defaultLeader); + $expectedResponse->setEnableDropProtection($enableDropProtection); + $expectedResponse->setReconciling($reconciling); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createDatabaseTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $createStatement = 'createStatement552974828'; + $response = $gapicClient->createDatabase($formattedParent, $createStatement); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/CreateDatabase', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getCreateStatement(); + $this->assertProtobufEquals($createStatement, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createDatabaseTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createDatabaseExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createDatabaseTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $createStatement = 'createStatement552974828'; + $response = $gapicClient->createDatabase($formattedParent, $createStatement); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createDatabaseTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteBackupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); + $gapicClient->deleteBackup($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/DeleteBackup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteBackupExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); + try { + $gapicClient->deleteBackup($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteBackupScheduleTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]'); + $gapicClient->deleteBackupSchedule($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/DeleteBackupSchedule', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteBackupScheduleExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]'); + try { + $gapicClient->deleteBackupSchedule($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function dropDatabaseTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $gapicClient->dropDatabase($formattedDatabase); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/DropDatabase', $actualFuncCall); + $actualValue = $actualRequestObject->getDatabase(); + $this->assertProtobufEquals($formattedDatabase, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function dropDatabaseExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + try { + $gapicClient->dropDatabase($formattedDatabase); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getBackupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $database = 'database1789464955'; + $name2 = 'name2-1052831874'; + $sizeBytes = 1796325715; + $freeableSizeBytes = 1302251206; + $exclusiveSizeBytes = 1085921554; + $incrementalBackupChainId = 'incrementalBackupChainId-792099119'; + $expectedResponse = new Backup(); + $expectedResponse->setDatabase($database); + $expectedResponse->setName($name2); + $expectedResponse->setSizeBytes($sizeBytes); + $expectedResponse->setFreeableSizeBytes($freeableSizeBytes); + $expectedResponse->setExclusiveSizeBytes($exclusiveSizeBytes); + $expectedResponse->setIncrementalBackupChainId($incrementalBackupChainId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); + $response = $gapicClient->getBackup($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/GetBackup', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getBackupExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); + try { + $gapicClient->getBackup($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getBackupScheduleTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new BackupSchedule(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]'); + $response = $gapicClient->getBackupSchedule($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/GetBackupSchedule', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getBackupScheduleExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]'); + try { + $gapicClient->getBackupSchedule($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDatabaseTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $versionRetentionPeriod = 'versionRetentionPeriod907249289'; + $defaultLeader = 'defaultLeader1941180615'; + $enableDropProtection = false; + $reconciling = false; + $expectedResponse = new Database(); + $expectedResponse->setName($name2); + $expectedResponse->setVersionRetentionPeriod($versionRetentionPeriod); + $expectedResponse->setDefaultLeader($defaultLeader); + $expectedResponse->setEnableDropProtection($enableDropProtection); + $expectedResponse->setReconciling($reconciling); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $response = $gapicClient->getDatabase($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/GetDatabase', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDatabaseExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + try { + $gapicClient->getDatabase($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDatabaseDdlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $protoDescriptors = '13'; + $expectedResponse = new GetDatabaseDdlResponse(); + $expectedResponse->setProtoDescriptors($protoDescriptors); + $transport->addResponse($expectedResponse); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $response = $gapicClient->getDatabaseDdl($formattedDatabase); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/GetDatabaseDdl', $actualFuncCall); + $actualValue = $actualRequestObject->getDatabase(); + $this->assertProtobufEquals($formattedDatabase, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDatabaseDdlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + try { + $gapicClient->getDatabaseDdl($formattedDatabase); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $response = $gapicClient->getIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + try { + $gapicClient->getIamPolicy($resource); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBackupOperationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $operationsElement = new Operation(); + $operations = [ + $operationsElement, + ]; + $expectedResponse = new ListBackupOperationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setOperations($operations); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $response = $gapicClient->listBackupOperations($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getOperations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListBackupOperations', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBackupOperationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + try { + $gapicClient->listBackupOperations($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBackupSchedulesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $backupSchedulesElement = new BackupSchedule(); + $backupSchedules = [ + $backupSchedulesElement, + ]; + $expectedResponse = new ListBackupSchedulesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setBackupSchedules($backupSchedules); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $response = $gapicClient->listBackupSchedules($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getBackupSchedules()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListBackupSchedules', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBackupSchedulesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + try { + $gapicClient->listBackupSchedules($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBackupsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $backupsElement = new Backup(); + $backups = [ + $backupsElement, + ]; + $expectedResponse = new ListBackupsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setBackups($backups); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $response = $gapicClient->listBackups($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getBackups()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListBackups', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBackupsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + try { + $gapicClient->listBackups($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDatabaseOperationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $operationsElement = new Operation(); + $operations = [ + $operationsElement, + ]; + $expectedResponse = new ListDatabaseOperationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setOperations($operations); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $response = $gapicClient->listDatabaseOperations($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getOperations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabaseOperations', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDatabaseOperationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + try { + $gapicClient->listDatabaseOperations($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDatabaseRolesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $databaseRolesElement = new DatabaseRole(); + $databaseRoles = [ + $databaseRolesElement, + ]; + $expectedResponse = new ListDatabaseRolesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setDatabaseRoles($databaseRoles); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $response = $gapicClient->listDatabaseRoles($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getDatabaseRoles()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabaseRoles', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDatabaseRolesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + try { + $gapicClient->listDatabaseRoles($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDatabasesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $databasesElement = new Database(); + $databases = [ + $databasesElement, + ]; + $expectedResponse = new ListDatabasesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setDatabases($databases); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $response = $gapicClient->listDatabases($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getDatabases()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabases', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDatabasesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + try { + $gapicClient->listDatabases($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function restoreDatabaseTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/restoreDatabaseTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $versionRetentionPeriod = 'versionRetentionPeriod907249289'; + $defaultLeader = 'defaultLeader1941180615'; + $enableDropProtection = false; + $reconciling = false; + $expectedResponse = new Database(); + $expectedResponse->setName($name); + $expectedResponse->setVersionRetentionPeriod($versionRetentionPeriod); + $expectedResponse->setDefaultLeader($defaultLeader); + $expectedResponse->setEnableDropProtection($enableDropProtection); + $expectedResponse->setReconciling($reconciling); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/restoreDatabaseTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $databaseId = 'databaseId816491103'; + $response = $gapicClient->restoreDatabase($formattedParent, $databaseId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/RestoreDatabase', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getDatabaseId(); + $this->assertProtobufEquals($databaseId, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restoreDatabaseTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function restoreDatabaseExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/restoreDatabaseTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $databaseId = 'databaseId816491103'; + $response = $gapicClient->restoreDatabase($formattedParent, $databaseId); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restoreDatabaseTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $response = $gapicClient->setIamPolicy($resource, $policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + try { + $gapicClient->setIamPolicy($resource, $policy); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $response = $gapicClient->testIamPermissions($resource, $permissions); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + try { + $gapicClient->testIamPermissions($resource, $permissions); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateBackupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $database = 'database1789464955'; + $name = 'name3373707'; + $sizeBytes = 1796325715; + $freeableSizeBytes = 1302251206; + $exclusiveSizeBytes = 1085921554; + $incrementalBackupChainId = 'incrementalBackupChainId-792099119'; + $expectedResponse = new Backup(); + $expectedResponse->setDatabase($database); + $expectedResponse->setName($name); + $expectedResponse->setSizeBytes($sizeBytes); + $expectedResponse->setFreeableSizeBytes($freeableSizeBytes); + $expectedResponse->setExclusiveSizeBytes($exclusiveSizeBytes); + $expectedResponse->setIncrementalBackupChainId($incrementalBackupChainId); + $transport->addResponse($expectedResponse); + // Mock request + $backup = new Backup(); + $updateMask = new FieldMask(); + $response = $gapicClient->updateBackup($backup, $updateMask); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/UpdateBackup', $actualFuncCall); + $actualValue = $actualRequestObject->getBackup(); + $this->assertProtobufEquals($backup, $actualValue); + $actualValue = $actualRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateBackupExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $backup = new Backup(); + $updateMask = new FieldMask(); + try { + $gapicClient->updateBackup($backup, $updateMask); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateBackupScheduleTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $expectedResponse = new BackupSchedule(); + $expectedResponse->setName($name); + $transport->addResponse($expectedResponse); + // Mock request + $backupSchedule = new BackupSchedule(); + $updateMask = new FieldMask(); + $response = $gapicClient->updateBackupSchedule($backupSchedule, $updateMask); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/UpdateBackupSchedule', $actualFuncCall); + $actualValue = $actualRequestObject->getBackupSchedule(); + $this->assertProtobufEquals($backupSchedule, $actualValue); + $actualValue = $actualRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateBackupScheduleExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $backupSchedule = new BackupSchedule(); + $updateMask = new FieldMask(); + try { + $gapicClient->updateBackupSchedule($backupSchedule, $updateMask); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateDatabaseTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateDatabaseTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $versionRetentionPeriod = 'versionRetentionPeriod907249289'; + $defaultLeader = 'defaultLeader1941180615'; + $enableDropProtection = false; + $reconciling = false; + $expectedResponse = new Database(); + $expectedResponse->setName($name); + $expectedResponse->setVersionRetentionPeriod($versionRetentionPeriod); + $expectedResponse->setDefaultLeader($defaultLeader); + $expectedResponse->setEnableDropProtection($enableDropProtection); + $expectedResponse->setReconciling($reconciling); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateDatabaseTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $database = new Database(); + $databaseName = 'databaseName-459093338'; + $database->setName($databaseName); + $updateMask = new FieldMask(); + $response = $gapicClient->updateDatabase($database, $updateMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/UpdateDatabase', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getDatabase(); + $this->assertProtobufEquals($database, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateDatabaseTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateDatabaseExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateDatabaseTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $database = new Database(); + $databaseName = 'databaseName-459093338'; + $database->setName($databaseName); + $updateMask = new FieldMask(); + $response = $gapicClient->updateDatabase($database, $updateMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateDatabaseTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateDatabaseDdlTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateDatabaseDdlTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateDatabaseDdlTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $statements = []; + $response = $gapicClient->updateDatabaseDdl($formattedDatabase, $statements); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/UpdateDatabaseDdl', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getDatabase(); + $this->assertProtobufEquals($formattedDatabase, $actualValue); + $actualValue = $actualApiRequestObject->getStatements(); + $this->assertProtobufEquals($statements, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateDatabaseDdlTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateDatabaseDdlExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateDatabaseDdlTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $statements = []; + $response = $gapicClient->updateDatabaseDdl($formattedDatabase, $statements); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateDatabaseDdlTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } +} diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Instance/V1/Common.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Instance/V1/Common.php new file mode 100644 index 0000000000000000000000000000000000000000..ce280a9688c2e93af7b4ae16afde68b380f0c3af GIT binary patch literal 1447 zcmb7E-D(p-7&R%CI=x93gtnp`Yq6=eyF~A%R!N#40%;P`w1_N($?hZ_*z7E`vlW#- zfp6lA2tI|^zJuVmvp*>`LCsBuo%5aV@637gF1QNNGu&c6lTR zv$Fc}P+%ZXkz&%Po?U05BYB{N>;sgLDO33<<1gidG;K`BC%Bx{NXVTcPq2~^yPX|l z$y6l$V_kPlaFd_x1w*R_+-`E_xixl0uep$f%)6SCEDIg5bd&!am5*b{VV8=|g2fs2 z7?0labZAxA&1cjEO_lSm;vVTCUt%&+?U||eOszdL)1G-<+1^SCX}~R+Hkv4L zdndipx`gFgD(fZz?0zkvjb0Ex4-g9UJOzT#*hD3W(B~0cI?Pv_1zaev8YV(845>yj z(Pk08t-snflPn1(WHIxZ8HZ?%`EG(<`5Suo0F?$T0J+n1<}oc^;~`q}grn=zH9V-T z{HzvVd_)_~$eVD_n?ZGbCb@8pUG$`R(P_3jowG)FIO;bB?OuI!(LL`sPTS3Pqh7ja zJVsj!Fx}qZtlB9Rj2-l7!FA*Pu+gnUe6jYsfcD_EXFV@nOKm-Q##%`I!iT2giO9{u zfWexIWrhNq1W(C!9E^|W$8W{wE$t)bspd=F#MEwLW^Q6$R(@na+tx@sH=fja=GFt= x^Q-tWp(RA42}y|w(aeNo)P!7C#`m?LUhn7XK1^QtEkjsp1{#?>*&B3&&>v5k+K2!E literal 0 HcmV?d00001 diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Instance/V1/SpannerInstanceAdmin.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Instance/V1/SpannerInstanceAdmin.php new file mode 100644 index 0000000000000000000000000000000000000000..3bca763a961b13aecf62ffb380c5bb00eef2dfc6 GIT binary patch literal 17768 zcmeHPPjDRRRZovBTk}SerBAXgOIdricVo+1d94c5X-Ok_f~1)pjl8?5fv(m} zOX}?WOLvcVl|?{O971tORdS$;0t!+Ehj1drfpCEXRKY?~753&6RONz;RB_?LiTC~M z>7GC89<4W_0AH->{=WCU_rCXj@6XrWZ@t|*Zox~*Ewf?ThHF-n2PaAQ*i5$UrrWGE zYsrK5;h||KE6sY#s+o2wncT=Hck`uWb|Y7M5vMxMwp}qZ$)jfTsAjG>Eu(?7R*Y)h zYOGid$2A%ibLGiBc}JJmbT%Z#Rsv`kbra`S%;Z*KZO3$ts^J>tEk?Aw$BC9TO0=94 zM9YuwJp`!K497`|5%Lxr2p>Zd|Fzl&HLH?DMqK>wWy?VhEY~t>);Cbz)#Ra3b4(=E zJNB^MsJK?Mk)#vyD8}NQB&SKozT9e}epZu`$pTdwstfsZO}k;#${VIrv8|TdvVXf~WorXy2_#Gr}mHOp+c!_C>W%vyELJT{(KO?$YhMN=46WF~V)9j&2^{}r0J z*(cH06ElaMw%u$T+3iNdY8;jGE$TbNY1K0p+^TH7j7rHxyX?Oi)4u5~UDL zC=#VO%t+KpJ-Ii3O)Oxvtd$BgZH_|oH+?q_sr~8)!hpqq>%IZDuu^gBhPY)Jb&7WQ zpWb4&DDKY(?+5O^B<|HZR<+XftV$4A5QAC*XI4yVH{zy*U+*SozmC=+Mo8Jb5w0`= zG2pJCFZ9+2!7&KnKJ($~Qw0)5vxVMfNV4-nzrt(G=j9p)V#+E8$SzErS}V2eSdea zkX_Gh=CT`8Um%kJ#jLiWzgx_evQr9~fH?b|-`#$HDn=4;>D^puH@mktHKP7Cz@&^N z>&?cYbwtMD0*z5ZwpkdjT28BGoapQ-l`&3`j|v;DGr>oh;BSNr9$YF#g;*Q;7j1;R z4P!Rfu`@T499c}H?}k(Jsgdl!bhAaV$*AcbrHkjFB>71k7>=oPDd#Rxsn?eNODo@o zFG+vn+l;>Dq|jhig0hiqxL7j|%$hSd#<+MZT%I6>)Ha)*ZMgOc-4sj}j^^S_{a0a9 z*aw%{nY(~%#K{~aY!g|oST)4!Il#eVT%NDMD2=)1T!L-Yn?p0RM`v?dHq0N|rs>OX zo){L&ii^4@bK`7*+|UbbB1x$L%}0>0xetl2x0`mm&JB*RMIH{l$UBTi$Lvz@qJvqB zab)T>t8TeEVv&x(Q866{HK?~SADWxN#YPw#^LHWP-<1T6d|;jkPnm$xCq}K!VIZD~ zJy6s&xNwG_5}4e|=eM@A`i{1%ZK3Zf2rlFMd)cCQC8pkoQKoxx1*Z2(TB+OH$6;(8 z-Mf_A-NN~C7^S|Bey)C7fw@6SB};H?vzX25xm~2WyPnmx$69V%Tgz?dO7C~!3F3#i zyG`NbG9(ah_6vo4v4lLw&^E_5a(mj^HvSqRDAhar`I4q*-&@aSH}Kj8^*w-&=E(wF z!x6>(9lZ~D0bDF*w{rPizS73Nwylc`F{+)N{q0gtUKz=JQ+cNST2z;O9e4I?X2o?@ zJ{EtSdWky+KfGg!q+7WD>C$C+MGQ$#1}~^TRN$(BB1{lkZP#2kFu_M>AVruKV5B={ z4VOlMV&;-ar^Ag`5Z#kAsSU=+EY=XsDut$Y!(}mN^wAf{JWO@jEd^3#5$~-Lm_mS} zjOi7@nfe!FFs-%Src=TCpmD@yBZokY&PDDMj$k+&&TtRGl<&$mbufp^a11m4bzH;7 zlEGoZB+{FoaiJ2Y##j1PxM4Ua^}6ZWRz>$ODxs5yoBX*J^(gz~%(E~=S6AkLM+s<| ztANZv9LqbM?jlz%-M||#OE30pA`Q6oKAmKIBqs5lRoEoF*fZ$@o20BI_(}}h*bf}c ze$3lId^`)4ku-ei*g85!f>_I-0qd1kTW`CF?B8Gs55>m{R!GbwM!AL;VL@VOzmbf8 zHgf)NMqoi3tg_F=TfU`0y!phmZHp?KGLuMu?K$tY-^#fo<>iXp4E{lZd7rks#{7)D zP9a%%;CBG-b$YZ7_qI_{e~^GN8L7#%KU?Gmu?iO}EIDNAj<4NC)EXvpy55y?Qe%&E z(jP4q^B48Xqq%ibeNOq+l_x1)M=9WAlwrABRgehgp`7CDWsleM)q1b=^m3{ z)Jolnm~b4;C8X z2(uo;)nEdP(Sfz$<|Y_{2&(cYRFEEiXAtM@v}@x5n{a5O)AT0auaC67iA%M zU{pS6w{)j+Y*yPf6qHt)*BJQ?sUBI8^mG7H9{CMkSFSN?dxDrugq2|v+jA$S@4&cZ ziCM!7aNSEm`(%TdYZi+6$GJUB2w8qS4HJR974zJExFmE(uE7lL*5cr<6c$rdn&)n4 zMVe$|ft=kfWs8MkZZC@o>9->%X*L(D&9K zWjFRQm+vFR7+lyz{&8iRO7EBQJD9GoPsK6^&omuw%H11KPm=O&H2*<)t1n|cU5Z;G zd3Dlb@=sa^%x_zcEA`H!k5e?i-p0-tS%-@)!$~turPgd$W$&kMG_Xjr zg~53>Z-Fz0Q6S!;MU;cBW}cE_9RTc-+x)<6uv9dzVlZCl%Zk&&R;@|C0#lN0k$%(s zhywKxAjsuITe#dXKf;QR^2M2;F)XgW3v*j$mo}s_9tNV>kbz5mhT^R=5DV&BQhzS0 zz6qpDN4ixNk(Sj5yWmwUvVB1#=s9#qu_%Uh=LFWZ7DL%)qjrM52HJ}HOB8mWVQ+t7 z`>;W~W#?w21NF4mCo;L-0O9qD2QW`nF{b`HENoy^<$4_lZZvYEK9d=Ey&7h2z3Sr} z{E-4L^}0f*!!B8QE;cg>7Z0r(9@cO>3A!ugXSB;*=@!RT8(uz}Md7yh06I-v;jk~r z*yL;VrabWmd*{bMeBLRw@J7Hd%eNUuy%-LiDS%FYINWB`A1QDp=)sbM=dusjpYwb- z=(HMmfX%QnkzSGtl;L4;aA&5j{=EXT{_XmCAUuXvX=%)a$Qv;2NnFL2Huf6KIhwbh znWm|~iTltci?Fp-=ma@oYC~vhpxt2(kZ3m$yDP`WLCs`6=(zeFWFv@i(j5Hz#bIp- zE;uy3Hk@tpP2PnoLEw@Mozp|qzly=tpv8OX>{~vY99l+#u7@3G+vWK@FT8u<+RNw3 z3KjtL1ii*5@Q`)Zgk>1RLV}N`#&)Jfk@sN1{HTQ;IJ2rBwrdE7wK^s}w4q@&tIQ-P z(-CU6&Cc8co60m8G?M?i z7rV+9tY=uYQ_AbXG6>72VsyZ?PM{%91YWp-UaEM>igpK;4A zc-+8RZUc@RXuFDbs&{1nik_NAIuGxW(cj4G>I{vAK|S~8PPxGPNwgt&W`N+cRJdZB z_!yXpN2qxGM<30i$G{FArQ-Rj95dq|!}~K1cC6@#(K&@ekUXxX4XOCKkMJ^of~Q;G zS71@5fCD-N9n;81>=dlXq|BS@>my*vEKKcm$*VOx1Jhnc=UwZ2!t~7;+zf({H{Qdc zyswz`R%M3^i73Ii$8P?IWgY6L3fvf=1DUwp@9MuqFK*CS)5NE)Y{2a3h$7dOItn`f{LPdzIB|OG6m4bRgcc`DIw}6@|}xG4)Szmx7_BXNmrL zdAOqT(&UOz%RnFM1x^8?p%gsRFn9vgjpo&q3)kUf+OuJW~$2>hCJEHWj~qEznwK zjRt-rWKTl-4t!7kK!Nh@P>G*^?+Y9KaMRa>=saN6k^z}N92Zx=tH8_-9&1Z{mau!y zE&v+ygg6bZe1?--^(xE;x#CJv{}@|S{u>@nVQ)FOE=AP%&#R_LKgAuGkUC|L){}ok zP5W(u7a0zT@Hk(eX=0z|SHqioeP;`OK6t8$Lz{1X`jhX)?x5w+M{z$!JHejDs+R;V z^*rB1u){g+i=|u~k_qRhXOfg<=%X3+&8HfB#5Bk}eZ17ix|gB~jjt@7lE1@7K`@;X z{72Adzj;!GvzyiGkCjif7OaFm)+;SXG8H|q-@J&r{PgqEWj~%ey6nVip~NXNVFA{=mB}NzeFC2JBZ)j51%Y}4w~?V7V>&H zYrf%9pdk)l)K~q{M{dO+*P(2a-;2Ry5UNQ8QwYwGoQ8y&KSOw|!ky5_AwvzhA38M1 zhYu3F!;4k*LJNb$TWYwOQtd;fty2zM5vLlK1+hcT7u;j}f7=aq8v+ne*QaVeZjW z4c{%|FIo=A)sc?_$`y7UNC}^rqHLLV-NJW7@UbPb*rk--A(F#85k?At{pwR~R&u?J zhm>+PCc&!uAevs?9&V`|KgMju2cjMtlL%>azj;!;^E4yWtRIeL967^s`veh+(f<~M zYeA&zh!r8+4VWq=3qkFFM_76S=};(^sO@7dbj|?IIzYA3jpO*6pA>m;9%v6U3wo%Y zGhkEu!AHNY1>wmjkTmhZxygX3QrCkZE@&uAod4ksmilnvQj={_LGDxV+tzF;auhmP;X6?WNEyD}S zS2r0Ck_ghn=8*jENB8^W$UJ>bUObuII(XRm^9Qk8TkOLhsdXw-N-UXTYo+AMsmJ#| zkps(RHnQw}DMWlKr1Py1{5-_7*ejfDCc{Q&GJ!zgDml5{5X_};-q)?9e)w)cgC dW&RNk-#0t(NiO`RNT2U@u#x<`8mDjy@ZZDIm@NPR literal 0 HcmV?d00001 diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig.php new file mode 100644 index 000000000000..2dd5cea37d14 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig.php @@ -0,0 +1,183 @@ +google.spanner.admin.instance.v1.AutoscalingConfig + */ +class AutoscalingConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Autoscaling limits for an instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $autoscaling_limits = null; + /** + * Required. The autoscaling targets for an instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets autoscaling_targets = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $autoscaling_targets = null; + /** + * Optional. Optional asymmetric autoscaling options. + * Replicas matching the replica selection criteria will be autoscaled + * independently from other replicas. The autoscaler will scale the replicas + * based on the utilization of replicas identified by the replica selection. + * Replica selections should not overlap with each other. + * Other replicas (those do not match any replica selection) will be + * autoscaled together and will have the same compute capacity allocated to + * them. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $asymmetric_autoscaling_options; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingLimits $autoscaling_limits + * Required. Autoscaling limits for an instance. + * @type \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingTargets $autoscaling_targets + * Required. The autoscaling targets for an instance. + * @type array<\Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AsymmetricAutoscalingOption>|\Google\Protobuf\Internal\RepeatedField $asymmetric_autoscaling_options + * Optional. Optional asymmetric autoscaling options. + * Replicas matching the replica selection criteria will be autoscaled + * independently from other replicas. The autoscaler will scale the replicas + * based on the utilization of replicas identified by the replica selection. + * Replica selections should not overlap with each other. + * Other replicas (those do not match any replica selection) will be + * autoscaled together and will have the same compute capacity allocated to + * them. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. Autoscaling limits for an instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingLimits|null + */ + public function getAutoscalingLimits() + { + return $this->autoscaling_limits; + } + + public function hasAutoscalingLimits() + { + return isset($this->autoscaling_limits); + } + + public function clearAutoscalingLimits() + { + unset($this->autoscaling_limits); + } + + /** + * Required. Autoscaling limits for an instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingLimits $var + * @return $this + */ + public function setAutoscalingLimits($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingLimits::class); + $this->autoscaling_limits = $var; + + return $this; + } + + /** + * Required. The autoscaling targets for an instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets autoscaling_targets = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingTargets|null + */ + public function getAutoscalingTargets() + { + return $this->autoscaling_targets; + } + + public function hasAutoscalingTargets() + { + return isset($this->autoscaling_targets); + } + + public function clearAutoscalingTargets() + { + unset($this->autoscaling_targets); + } + + /** + * Required. The autoscaling targets for an instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets autoscaling_targets = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingTargets $var + * @return $this + */ + public function setAutoscalingTargets($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingTargets::class); + $this->autoscaling_targets = $var; + + return $this; + } + + /** + * Optional. Optional asymmetric autoscaling options. + * Replicas matching the replica selection criteria will be autoscaled + * independently from other replicas. The autoscaler will scale the replicas + * based on the utilization of replicas identified by the replica selection. + * Replica selections should not overlap with each other. + * Other replicas (those do not match any replica selection) will be + * autoscaled together and will have the same compute capacity allocated to + * them. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAsymmetricAutoscalingOptions() + { + return $this->asymmetric_autoscaling_options; + } + + /** + * Optional. Optional asymmetric autoscaling options. + * Replicas matching the replica selection criteria will be autoscaled + * independently from other replicas. The autoscaler will scale the replicas + * based on the utilization of replicas identified by the replica selection. + * Replica selections should not overlap with each other. + * Other replicas (those do not match any replica selection) will be + * autoscaled together and will have the same compute capacity allocated to + * them. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AsymmetricAutoscalingOption>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAsymmetricAutoscalingOptions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AsymmetricAutoscalingOption::class); + $this->asymmetric_autoscaling_options = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AsymmetricAutoscalingOption.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AsymmetricAutoscalingOption.php new file mode 100644 index 000000000000..f2f31e0b6c2c --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AsymmetricAutoscalingOption.php @@ -0,0 +1,133 @@ +google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + */ +class AsymmetricAutoscalingOption extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Selects the replicas to which this AsymmetricAutoscalingOption + * applies. Only read-only replicas are supported. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $replica_selection = null; + /** + * Optional. Overrides applied to the top-level autoscaling configuration + * for the selected replicas. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $overrides = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaSelection $replica_selection + * Required. Selects the replicas to which this AsymmetricAutoscalingOption + * applies. Only read-only replicas are supported. + * @type \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AsymmetricAutoscalingOption\AutoscalingConfigOverrides $overrides + * Optional. Overrides applied to the top-level autoscaling configuration + * for the selected replicas. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. Selects the replicas to which this AsymmetricAutoscalingOption + * applies. Only read-only replicas are supported. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaSelection|null + */ + public function getReplicaSelection() + { + return $this->replica_selection; + } + + public function hasReplicaSelection() + { + return isset($this->replica_selection); + } + + public function clearReplicaSelection() + { + unset($this->replica_selection); + } + + /** + * Required. Selects the replicas to which this AsymmetricAutoscalingOption + * applies. Only read-only replicas are supported. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaSelection $var + * @return $this + */ + public function setReplicaSelection($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaSelection::class); + $this->replica_selection = $var; + + return $this; + } + + /** + * Optional. Overrides applied to the top-level autoscaling configuration + * for the selected replicas. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AsymmetricAutoscalingOption\AutoscalingConfigOverrides|null + */ + public function getOverrides() + { + return $this->overrides; + } + + public function hasOverrides() + { + return isset($this->overrides); + } + + public function clearOverrides() + { + unset($this->overrides); + } + + /** + * Optional. Overrides applied to the top-level autoscaling configuration + * for the selected replicas. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AsymmetricAutoscalingOption\AutoscalingConfigOverrides $var + * @return $this + */ + public function setOverrides($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AsymmetricAutoscalingOption\AutoscalingConfigOverrides::class); + $this->overrides = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AsymmetricAutoscalingOption::class, \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig_AsymmetricAutoscalingOption::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AsymmetricAutoscalingOption/AutoscalingConfigOverrides.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AsymmetricAutoscalingOption/AutoscalingConfigOverrides.php new file mode 100644 index 000000000000..e6c06e4f4013 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AsymmetricAutoscalingOption/AutoscalingConfigOverrides.php @@ -0,0 +1,129 @@ +google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides + */ +class AutoscalingConfigOverrides extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. If specified, overrides the min/max limit in the top-level + * autoscaling configuration for the selected replicas. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $autoscaling_limits = null; + /** + * Optional. If specified, overrides the autoscaling target + * high_priority_cpu_utilization_percent in the top-level autoscaling + * configuration for the selected replicas. + * + * Generated from protobuf field int32 autoscaling_target_high_priority_cpu_utilization_percent = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $autoscaling_target_high_priority_cpu_utilization_percent = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingLimits $autoscaling_limits + * Optional. If specified, overrides the min/max limit in the top-level + * autoscaling configuration for the selected replicas. + * @type int $autoscaling_target_high_priority_cpu_utilization_percent + * Optional. If specified, overrides the autoscaling target + * high_priority_cpu_utilization_percent in the top-level autoscaling + * configuration for the selected replicas. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Optional. If specified, overrides the min/max limit in the top-level + * autoscaling configuration for the selected replicas. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingLimits|null + */ + public function getAutoscalingLimits() + { + return $this->autoscaling_limits; + } + + public function hasAutoscalingLimits() + { + return isset($this->autoscaling_limits); + } + + public function clearAutoscalingLimits() + { + unset($this->autoscaling_limits); + } + + /** + * Optional. If specified, overrides the min/max limit in the top-level + * autoscaling configuration for the selected replicas. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingLimits $var + * @return $this + */ + public function setAutoscalingLimits($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingLimits::class); + $this->autoscaling_limits = $var; + + return $this; + } + + /** + * Optional. If specified, overrides the autoscaling target + * high_priority_cpu_utilization_percent in the top-level autoscaling + * configuration for the selected replicas. + * + * Generated from protobuf field int32 autoscaling_target_high_priority_cpu_utilization_percent = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getAutoscalingTargetHighPriorityCpuUtilizationPercent() + { + return $this->autoscaling_target_high_priority_cpu_utilization_percent; + } + + /** + * Optional. If specified, overrides the autoscaling target + * high_priority_cpu_utilization_percent in the top-level autoscaling + * configuration for the selected replicas. + * + * Generated from protobuf field int32 autoscaling_target_high_priority_cpu_utilization_percent = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setAutoscalingTargetHighPriorityCpuUtilizationPercent($var) + { + GPBUtil::checkInt32($var); + $this->autoscaling_target_high_priority_cpu_utilization_percent = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AutoscalingConfigOverrides::class, \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig_AsymmetricAutoscalingOption_AutoscalingConfigOverrides::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AutoscalingLimits.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AutoscalingLimits.php new file mode 100644 index 000000000000..48ac73c059f5 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AutoscalingLimits.php @@ -0,0 +1,205 @@ +google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + */ +class AutoscalingLimits extends \Google\Protobuf\Internal\Message +{ + protected $min_limit; + protected $max_limit; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $min_nodes + * Minimum number of nodes allocated to the instance. If set, this number + * should be greater than or equal to 1. + * @type int $min_processing_units + * Minimum number of processing units allocated to the instance. If set, + * this number should be multiples of 1000. + * @type int $max_nodes + * Maximum number of nodes allocated to the instance. If set, this number + * should be greater than or equal to min_nodes. + * @type int $max_processing_units + * Maximum number of processing units allocated to the instance. If set, + * this number should be multiples of 1000 and be greater than or equal to + * min_processing_units. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Minimum number of nodes allocated to the instance. If set, this number + * should be greater than or equal to 1. + * + * Generated from protobuf field int32 min_nodes = 1; + * @return int + */ + public function getMinNodes() + { + return $this->readOneof(1); + } + + public function hasMinNodes() + { + return $this->hasOneof(1); + } + + /** + * Minimum number of nodes allocated to the instance. If set, this number + * should be greater than or equal to 1. + * + * Generated from protobuf field int32 min_nodes = 1; + * @param int $var + * @return $this + */ + public function setMinNodes($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Minimum number of processing units allocated to the instance. If set, + * this number should be multiples of 1000. + * + * Generated from protobuf field int32 min_processing_units = 2; + * @return int + */ + public function getMinProcessingUnits() + { + return $this->readOneof(2); + } + + public function hasMinProcessingUnits() + { + return $this->hasOneof(2); + } + + /** + * Minimum number of processing units allocated to the instance. If set, + * this number should be multiples of 1000. + * + * Generated from protobuf field int32 min_processing_units = 2; + * @param int $var + * @return $this + */ + public function setMinProcessingUnits($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Maximum number of nodes allocated to the instance. If set, this number + * should be greater than or equal to min_nodes. + * + * Generated from protobuf field int32 max_nodes = 3; + * @return int + */ + public function getMaxNodes() + { + return $this->readOneof(3); + } + + public function hasMaxNodes() + { + return $this->hasOneof(3); + } + + /** + * Maximum number of nodes allocated to the instance. If set, this number + * should be greater than or equal to min_nodes. + * + * Generated from protobuf field int32 max_nodes = 3; + * @param int $var + * @return $this + */ + public function setMaxNodes($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Maximum number of processing units allocated to the instance. If set, + * this number should be multiples of 1000 and be greater than or equal to + * min_processing_units. + * + * Generated from protobuf field int32 max_processing_units = 4; + * @return int + */ + public function getMaxProcessingUnits() + { + return $this->readOneof(4); + } + + public function hasMaxProcessingUnits() + { + return $this->hasOneof(4); + } + + /** + * Maximum number of processing units allocated to the instance. If set, + * this number should be multiples of 1000 and be greater than or equal to + * min_processing_units. + * + * Generated from protobuf field int32 max_processing_units = 4; + * @param int $var + * @return $this + */ + public function setMaxProcessingUnits($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * @return string + */ + public function getMinLimit() + { + return $this->whichOneof("min_limit"); + } + + /** + * @return string + */ + public function getMaxLimit() + { + return $this->whichOneof("max_limit"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AutoscalingLimits::class, \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig_AutoscalingLimits::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AutoscalingTargets.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AutoscalingTargets.php new file mode 100644 index 000000000000..a1b2d41cc75b --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AutoscalingTargets.php @@ -0,0 +1,128 @@ +google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets + */ +class AutoscalingTargets extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The target high priority cpu utilization percentage that the + * autoscaler should be trying to achieve for the instance. This number is + * on a scale from 0 (no utilization) to 100 (full utilization). The valid + * range is [10, 90] inclusive. + * + * Generated from protobuf field int32 high_priority_cpu_utilization_percent = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $high_priority_cpu_utilization_percent = 0; + /** + * Required. The target storage utilization percentage that the autoscaler + * should be trying to achieve for the instance. This number is on a scale + * from 0 (no utilization) to 100 (full utilization). The valid range is + * [10, 99] inclusive. + * + * Generated from protobuf field int32 storage_utilization_percent = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $storage_utilization_percent = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $high_priority_cpu_utilization_percent + * Required. The target high priority cpu utilization percentage that the + * autoscaler should be trying to achieve for the instance. This number is + * on a scale from 0 (no utilization) to 100 (full utilization). The valid + * range is [10, 90] inclusive. + * @type int $storage_utilization_percent + * Required. The target storage utilization percentage that the autoscaler + * should be trying to achieve for the instance. This number is on a scale + * from 0 (no utilization) to 100 (full utilization). The valid range is + * [10, 99] inclusive. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The target high priority cpu utilization percentage that the + * autoscaler should be trying to achieve for the instance. This number is + * on a scale from 0 (no utilization) to 100 (full utilization). The valid + * range is [10, 90] inclusive. + * + * Generated from protobuf field int32 high_priority_cpu_utilization_percent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getHighPriorityCpuUtilizationPercent() + { + return $this->high_priority_cpu_utilization_percent; + } + + /** + * Required. The target high priority cpu utilization percentage that the + * autoscaler should be trying to achieve for the instance. This number is + * on a scale from 0 (no utilization) to 100 (full utilization). The valid + * range is [10, 90] inclusive. + * + * Generated from protobuf field int32 high_priority_cpu_utilization_percent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setHighPriorityCpuUtilizationPercent($var) + { + GPBUtil::checkInt32($var); + $this->high_priority_cpu_utilization_percent = $var; + + return $this; + } + + /** + * Required. The target storage utilization percentage that the autoscaler + * should be trying to achieve for the instance. This number is on a scale + * from 0 (no utilization) to 100 (full utilization). The valid range is + * [10, 99] inclusive. + * + * Generated from protobuf field int32 storage_utilization_percent = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getStorageUtilizationPercent() + { + return $this->storage_utilization_percent; + } + + /** + * Required. The target storage utilization percentage that the autoscaler + * should be trying to achieve for the instance. This number is on a scale + * from 0 (no utilization) to 100 (full utilization). The valid range is + * [10, 99] inclusive. + * + * Generated from protobuf field int32 storage_utilization_percent = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setStorageUtilizationPercent($var) + { + GPBUtil::checkInt32($var); + $this->storage_utilization_percent = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AutoscalingTargets::class, \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig_AutoscalingTargets::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceConfigMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceConfigMetadata.php new file mode 100644 index 000000000000..ef9454d09d96 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceConfigMetadata.php @@ -0,0 +1,174 @@ +google.spanner.admin.instance.v1.CreateInstanceConfigMetadata + */ +class CreateInstanceConfigMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The target instance configuration end state. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 1; + */ + protected $instance_config = null; + /** + * The progress of the + * [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig] + * operation. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.OperationProgress progress = 2; + */ + protected $progress = null; + /** + * The time at which this operation was cancelled. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + */ + protected $cancel_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $instance_config + * The target instance configuration end state. + * @type \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress $progress + * The progress of the + * [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig] + * operation. + * @type \Google\Protobuf\Timestamp $cancel_time + * The time at which this operation was cancelled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The target instance configuration end state. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 1; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig|null + */ + public function getInstanceConfig() + { + return $this->instance_config; + } + + public function hasInstanceConfig() + { + return isset($this->instance_config); + } + + public function clearInstanceConfig() + { + unset($this->instance_config); + } + + /** + * The target instance configuration end state. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 1; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $var + * @return $this + */ + public function setInstanceConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig::class); + $this->instance_config = $var; + + return $this; + } + + /** + * The progress of the + * [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig] + * operation. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.OperationProgress progress = 2; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress|null + */ + public function getProgress() + { + return $this->progress; + } + + public function hasProgress() + { + return isset($this->progress); + } + + public function clearProgress() + { + unset($this->progress); + } + + /** + * The progress of the + * [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig] + * operation. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.OperationProgress progress = 2; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress $var + * @return $this + */ + public function setProgress($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress::class); + $this->progress = $var; + + return $this; + } + + /** + * The time at which this operation was cancelled. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCancelTime() + { + return $this->cancel_time; + } + + public function hasCancelTime() + { + return isset($this->cancel_time); + } + + public function clearCancelTime() + { + unset($this->cancel_time); + } + + /** + * The time at which this operation was cancelled. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCancelTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->cancel_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceConfigRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceConfigRequest.php new file mode 100644 index 000000000000..c714bc17563b --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceConfigRequest.php @@ -0,0 +1,242 @@ +google.spanner.admin.instance.v1.CreateInstanceConfigRequest + */ +class CreateInstanceConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the project in which to create the instance + * configuration. Values are of the form `projects/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The ID of the instance configuration to create. Valid identifiers + * are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + * characters in length. The `custom-` prefix is required to avoid name + * conflicts with Google-managed configurations. + * + * Generated from protobuf field string instance_config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance_config_id = ''; + /** + * Required. The `InstanceConfig` proto of the configuration to create. + * `instance_config.name` must be + * `/instanceConfigs/`. + * `instance_config.base_config` must be a Google-managed configuration name, + * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance_config = null; + /** + * An option to validate, but not actually execute, a request, + * and provide the same response. + * + * Generated from protobuf field bool validate_only = 4; + */ + protected $validate_only = false; + + /** + * @param string $parent Required. The name of the project in which to create the instance + * configuration. Values are of the form `projects/`. Please see + * {@see InstanceAdminClient::projectName()} for help formatting this field. + * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $instanceConfig Required. The `InstanceConfig` proto of the configuration to create. + * `instance_config.name` must be + * `/instanceConfigs/`. + * `instance_config.base_config` must be a Google-managed configuration name, + * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3. + * @param string $instanceConfigId Required. The ID of the instance configuration to create. Valid identifiers + * are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + * characters in length. The `custom-` prefix is required to avoid name + * conflicts with Google-managed configurations. + * + * @return \Google\Cloud\Spanner\Admin\Instance\V1\CreateInstanceConfigRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $instanceConfig, string $instanceConfigId): self + { + return (new self()) + ->setParent($parent) + ->setInstanceConfig($instanceConfig) + ->setInstanceConfigId($instanceConfigId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the project in which to create the instance + * configuration. Values are of the form `projects/`. + * @type string $instance_config_id + * Required. The ID of the instance configuration to create. Valid identifiers + * are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + * characters in length. The `custom-` prefix is required to avoid name + * conflicts with Google-managed configurations. + * @type \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $instance_config + * Required. The `InstanceConfig` proto of the configuration to create. + * `instance_config.name` must be + * `/instanceConfigs/`. + * `instance_config.base_config` must be a Google-managed configuration name, + * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3. + * @type bool $validate_only + * An option to validate, but not actually execute, a request, + * and provide the same response. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the project in which to create the instance + * configuration. Values are of the form `projects/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The name of the project in which to create the instance + * configuration. Values are of the form `projects/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The ID of the instance configuration to create. Valid identifiers + * are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + * characters in length. The `custom-` prefix is required to avoid name + * conflicts with Google-managed configurations. + * + * Generated from protobuf field string instance_config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getInstanceConfigId() + { + return $this->instance_config_id; + } + + /** + * Required. The ID of the instance configuration to create. Valid identifiers + * are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + * characters in length. The `custom-` prefix is required to avoid name + * conflicts with Google-managed configurations. + * + * Generated from protobuf field string instance_config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setInstanceConfigId($var) + { + GPBUtil::checkString($var, True); + $this->instance_config_id = $var; + + return $this; + } + + /** + * Required. The `InstanceConfig` proto of the configuration to create. + * `instance_config.name` must be + * `/instanceConfigs/`. + * `instance_config.base_config` must be a Google-managed configuration name, + * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig|null + */ + public function getInstanceConfig() + { + return $this->instance_config; + } + + public function hasInstanceConfig() + { + return isset($this->instance_config); + } + + public function clearInstanceConfig() + { + unset($this->instance_config); + } + + /** + * Required. The `InstanceConfig` proto of the configuration to create. + * `instance_config.name` must be + * `/instanceConfigs/`. + * `instance_config.base_config` must be a Google-managed configuration name, + * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $var + * @return $this + */ + public function setInstanceConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig::class); + $this->instance_config = $var; + + return $this; + } + + /** + * An option to validate, but not actually execute, a request, + * and provide the same response. + * + * Generated from protobuf field bool validate_only = 4; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * An option to validate, but not actually execute, a request, + * and provide the same response. + * + * Generated from protobuf field bool validate_only = 4; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceMetadata.php new file mode 100644 index 000000000000..0b08f1253a6f --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceMetadata.php @@ -0,0 +1,260 @@ +google.spanner.admin.instance.v1.CreateInstanceMetadata + */ +class CreateInstanceMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The instance being created. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1; + */ + protected $instance = null; + /** + * The time at which the + * [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance] + * request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + */ + protected $start_time = null; + /** + * The time at which this operation was cancelled. If set, this operation is + * in the process of undoing itself (which is guaranteed to succeed) and + * cannot be cancelled again. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + */ + protected $cancel_time = null; + /** + * The time at which this operation failed or was completed successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; + */ + protected $end_time = null; + /** + * The expected fulfillment period of this create operation. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.FulfillmentPeriod expected_fulfillment_period = 5; + */ + protected $expected_fulfillment_period = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\Admin\Instance\V1\Instance $instance + * The instance being created. + * @type \Google\Protobuf\Timestamp $start_time + * The time at which the + * [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance] + * request was received. + * @type \Google\Protobuf\Timestamp $cancel_time + * The time at which this operation was cancelled. If set, this operation is + * in the process of undoing itself (which is guaranteed to succeed) and + * cannot be cancelled again. + * @type \Google\Protobuf\Timestamp $end_time + * The time at which this operation failed or was completed successfully. + * @type int $expected_fulfillment_period + * The expected fulfillment period of this create operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The instance being created. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\Instance|null + */ + public function getInstance() + { + return $this->instance; + } + + public function hasInstance() + { + return isset($this->instance); + } + + public function clearInstance() + { + unset($this->instance); + } + + /** + * The instance being created. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\Instance $var + * @return $this + */ + public function setInstance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\Instance::class); + $this->instance = $var; + + return $this; + } + + /** + * The time at which the + * [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance] + * request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * The time at which the + * [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance] + * request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * The time at which this operation was cancelled. If set, this operation is + * in the process of undoing itself (which is guaranteed to succeed) and + * cannot be cancelled again. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCancelTime() + { + return $this->cancel_time; + } + + public function hasCancelTime() + { + return isset($this->cancel_time); + } + + public function clearCancelTime() + { + unset($this->cancel_time); + } + + /** + * The time at which this operation was cancelled. If set, this operation is + * in the process of undoing itself (which is guaranteed to succeed) and + * cannot be cancelled again. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCancelTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->cancel_time = $var; + + return $this; + } + + /** + * The time at which this operation failed or was completed successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time at which this operation failed or was completed successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * The expected fulfillment period of this create operation. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.FulfillmentPeriod expected_fulfillment_period = 5; + * @return int + */ + public function getExpectedFulfillmentPeriod() + { + return $this->expected_fulfillment_period; + } + + /** + * The expected fulfillment period of this create operation. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.FulfillmentPeriod expected_fulfillment_period = 5; + * @param int $var + * @return $this + */ + public function setExpectedFulfillmentPeriod($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\FulfillmentPeriod::class); + $this->expected_fulfillment_period = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstancePartitionMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstancePartitionMetadata.php new file mode 100644 index 000000000000..3494bbcea33a --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstancePartitionMetadata.php @@ -0,0 +1,226 @@ +google.spanner.admin.instance.v1.CreateInstancePartitionMetadata + */ +class CreateInstancePartitionMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The instance partition being created. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + */ + protected $instance_partition = null; + /** + * The time at which the + * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition] + * request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + */ + protected $start_time = null; + /** + * The time at which this operation was cancelled. If set, this operation is + * in the process of undoing itself (which is guaranteed to succeed) and + * cannot be cancelled again. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + */ + protected $cancel_time = null; + /** + * The time at which this operation failed or was completed successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; + */ + protected $end_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $instance_partition + * The instance partition being created. + * @type \Google\Protobuf\Timestamp $start_time + * The time at which the + * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition] + * request was received. + * @type \Google\Protobuf\Timestamp $cancel_time + * The time at which this operation was cancelled. If set, this operation is + * in the process of undoing itself (which is guaranteed to succeed) and + * cannot be cancelled again. + * @type \Google\Protobuf\Timestamp $end_time + * The time at which this operation failed or was completed successfully. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The instance partition being created. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition|null + */ + public function getInstancePartition() + { + return $this->instance_partition; + } + + public function hasInstancePartition() + { + return isset($this->instance_partition); + } + + public function clearInstancePartition() + { + unset($this->instance_partition); + } + + /** + * The instance partition being created. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $var + * @return $this + */ + public function setInstancePartition($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition::class); + $this->instance_partition = $var; + + return $this; + } + + /** + * The time at which the + * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition] + * request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * The time at which the + * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition] + * request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * The time at which this operation was cancelled. If set, this operation is + * in the process of undoing itself (which is guaranteed to succeed) and + * cannot be cancelled again. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCancelTime() + { + return $this->cancel_time; + } + + public function hasCancelTime() + { + return isset($this->cancel_time); + } + + public function clearCancelTime() + { + unset($this->cancel_time); + } + + /** + * The time at which this operation was cancelled. If set, this operation is + * in the process of undoing itself (which is guaranteed to succeed) and + * cannot be cancelled again. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCancelTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->cancel_time = $var; + + return $this; + } + + /** + * The time at which this operation failed or was completed successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time at which this operation failed or was completed successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstancePartitionRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstancePartitionRequest.php new file mode 100644 index 000000000000..d12f2223ea98 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstancePartitionRequest.php @@ -0,0 +1,194 @@ +google.spanner.admin.instance.v1.CreateInstancePartitionRequest + */ +class CreateInstancePartitionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the instance in which to create the instance + * partition. Values are of the form + * `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The ID of the instance partition to create. Valid identifiers are + * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + * characters in length. + * + * Generated from protobuf field string instance_partition_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance_partition_id = ''; + /** + * Required. The instance partition to create. The instance_partition.name may + * be omitted, but if specified must be + * `/instancePartitions/`. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance_partition = null; + + /** + * @param string $parent Required. The name of the instance in which to create the instance + * partition. Values are of the form + * `projects//instances/`. Please see + * {@see InstanceAdminClient::instanceName()} for help formatting this field. + * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $instancePartition Required. The instance partition to create. The instance_partition.name may + * be omitted, but if specified must be + * `/instancePartitions/`. + * @param string $instancePartitionId Required. The ID of the instance partition to create. Valid identifiers are + * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + * characters in length. + * + * @return \Google\Cloud\Spanner\Admin\Instance\V1\CreateInstancePartitionRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $instancePartition, string $instancePartitionId): self + { + return (new self()) + ->setParent($parent) + ->setInstancePartition($instancePartition) + ->setInstancePartitionId($instancePartitionId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the instance in which to create the instance + * partition. Values are of the form + * `projects//instances/`. + * @type string $instance_partition_id + * Required. The ID of the instance partition to create. Valid identifiers are + * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + * characters in length. + * @type \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $instance_partition + * Required. The instance partition to create. The instance_partition.name may + * be omitted, but if specified must be + * `/instancePartitions/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the instance in which to create the instance + * partition. Values are of the form + * `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The name of the instance in which to create the instance + * partition. Values are of the form + * `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The ID of the instance partition to create. Valid identifiers are + * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + * characters in length. + * + * Generated from protobuf field string instance_partition_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getInstancePartitionId() + { + return $this->instance_partition_id; + } + + /** + * Required. The ID of the instance partition to create. Valid identifiers are + * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + * characters in length. + * + * Generated from protobuf field string instance_partition_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setInstancePartitionId($var) + { + GPBUtil::checkString($var, True); + $this->instance_partition_id = $var; + + return $this; + } + + /** + * Required. The instance partition to create. The instance_partition.name may + * be omitted, but if specified must be + * `/instancePartitions/`. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition|null + */ + public function getInstancePartition() + { + return $this->instance_partition; + } + + public function hasInstancePartition() + { + return isset($this->instance_partition); + } + + public function clearInstancePartition() + { + unset($this->instance_partition); + } + + /** + * Required. The instance partition to create. The instance_partition.name may + * be omitted, but if specified must be + * `/instancePartitions/`. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $var + * @return $this + */ + public function setInstancePartition($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition::class); + $this->instance_partition = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceRequest.php new file mode 100644 index 000000000000..1954b4933248 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceRequest.php @@ -0,0 +1,184 @@ +google.spanner.admin.instance.v1.CreateInstanceRequest + */ +class CreateInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the project in which to create the instance. Values + * are of the form `projects/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The ID of the instance to create. Valid identifiers are of the + * form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in + * length. + * + * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance_id = ''; + /** + * Required. The instance to create. The name may be omitted, but if + * specified must be `/instances/`. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance = null; + + /** + * @param string $parent Required. The name of the project in which to create the instance. Values + * are of the form `projects/`. Please see + * {@see InstanceAdminClient::projectName()} for help formatting this field. + * @param string $instanceId Required. The ID of the instance to create. Valid identifiers are of the + * form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in + * length. + * @param \Google\Cloud\Spanner\Admin\Instance\V1\Instance $instance Required. The instance to create. The name may be omitted, but if + * specified must be `/instances/`. + * + * @return \Google\Cloud\Spanner\Admin\Instance\V1\CreateInstanceRequest + * + * @experimental + */ + public static function build(string $parent, string $instanceId, \Google\Cloud\Spanner\Admin\Instance\V1\Instance $instance): self + { + return (new self()) + ->setParent($parent) + ->setInstanceId($instanceId) + ->setInstance($instance); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the project in which to create the instance. Values + * are of the form `projects/`. + * @type string $instance_id + * Required. The ID of the instance to create. Valid identifiers are of the + * form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in + * length. + * @type \Google\Cloud\Spanner\Admin\Instance\V1\Instance $instance + * Required. The instance to create. The name may be omitted, but if + * specified must be `/instances/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the project in which to create the instance. Values + * are of the form `projects/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The name of the project in which to create the instance. Values + * are of the form `projects/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The ID of the instance to create. Valid identifiers are of the + * form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in + * length. + * + * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getInstanceId() + { + return $this->instance_id; + } + + /** + * Required. The ID of the instance to create. Valid identifiers are of the + * form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in + * length. + * + * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setInstanceId($var) + { + GPBUtil::checkString($var, True); + $this->instance_id = $var; + + return $this; + } + + /** + * Required. The instance to create. The name may be omitted, but if + * specified must be `/instances/`. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\Instance|null + */ + public function getInstance() + { + return $this->instance; + } + + public function hasInstance() + { + return isset($this->instance); + } + + public function clearInstance() + { + unset($this->instance); + } + + /** + * Required. The instance to create. The name may be omitted, but if + * specified must be `/instances/`. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\Instance $var + * @return $this + */ + public function setInstance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\Instance::class); + $this->instance = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstanceConfigRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstanceConfigRequest.php new file mode 100644 index 000000000000..8b9edba36c3f --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstanceConfigRequest.php @@ -0,0 +1,188 @@ +google.spanner.admin.instance.v1.DeleteInstanceConfigRequest + */ +class DeleteInstanceConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the instance configuration to be deleted. + * Values are of the form + * `projects//instanceConfigs/` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Used for optimistic concurrency control as a way to help prevent + * simultaneous deletes of an instance configuration from overwriting each + * other. If not empty, the API + * only deletes the instance configuration when the etag provided matches the + * current status of the requested instance configuration. Otherwise, deletes + * the instance configuration without checking the current status of the + * requested instance configuration. + * + * Generated from protobuf field string etag = 2; + */ + protected $etag = ''; + /** + * An option to validate, but not actually execute, a request, + * and provide the same response. + * + * Generated from protobuf field bool validate_only = 3; + */ + protected $validate_only = false; + + /** + * @param string $name Required. The name of the instance configuration to be deleted. + * Values are of the form + * `projects//instanceConfigs/` + * Please see {@see InstanceAdminClient::instanceConfigName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Instance\V1\DeleteInstanceConfigRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the instance configuration to be deleted. + * Values are of the form + * `projects//instanceConfigs/` + * @type string $etag + * Used for optimistic concurrency control as a way to help prevent + * simultaneous deletes of an instance configuration from overwriting each + * other. If not empty, the API + * only deletes the instance configuration when the etag provided matches the + * current status of the requested instance configuration. Otherwise, deletes + * the instance configuration without checking the current status of the + * requested instance configuration. + * @type bool $validate_only + * An option to validate, but not actually execute, a request, + * and provide the same response. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the instance configuration to be deleted. + * Values are of the form + * `projects//instanceConfigs/` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the instance configuration to be deleted. + * Values are of the form + * `projects//instanceConfigs/` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Used for optimistic concurrency control as a way to help prevent + * simultaneous deletes of an instance configuration from overwriting each + * other. If not empty, the API + * only deletes the instance configuration when the etag provided matches the + * current status of the requested instance configuration. Otherwise, deletes + * the instance configuration without checking the current status of the + * requested instance configuration. + * + * Generated from protobuf field string etag = 2; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Used for optimistic concurrency control as a way to help prevent + * simultaneous deletes of an instance configuration from overwriting each + * other. If not empty, the API + * only deletes the instance configuration when the etag provided matches the + * current status of the requested instance configuration. Otherwise, deletes + * the instance configuration without checking the current status of the + * requested instance configuration. + * + * Generated from protobuf field string etag = 2; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * An option to validate, but not actually execute, a request, + * and provide the same response. + * + * Generated from protobuf field bool validate_only = 3; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * An option to validate, but not actually execute, a request, + * and provide the same response. + * + * Generated from protobuf field bool validate_only = 3; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstancePartitionRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstancePartitionRequest.php new file mode 100644 index 000000000000..430f00f61956 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstancePartitionRequest.php @@ -0,0 +1,138 @@ +google.spanner.admin.instance.v1.DeleteInstancePartitionRequest + */ +class DeleteInstancePartitionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the instance partition to be deleted. + * Values are of the form + * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. If not empty, the API only deletes the instance partition when + * the etag provided matches the current status of the requested instance + * partition. Otherwise, deletes the instance partition without checking the + * current status of the requested instance partition. + * + * Generated from protobuf field string etag = 2; + */ + protected $etag = ''; + + /** + * @param string $name Required. The name of the instance partition to be deleted. + * Values are of the form + * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}` + * Please see {@see InstanceAdminClient::instancePartitionName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Instance\V1\DeleteInstancePartitionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the instance partition to be deleted. + * Values are of the form + * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}` + * @type string $etag + * Optional. If not empty, the API only deletes the instance partition when + * the etag provided matches the current status of the requested instance + * partition. Otherwise, deletes the instance partition without checking the + * current status of the requested instance partition. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the instance partition to be deleted. + * Values are of the form + * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the instance partition to be deleted. + * Values are of the form + * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. If not empty, the API only deletes the instance partition when + * the etag provided matches the current status of the requested instance + * partition. Otherwise, deletes the instance partition without checking the + * current status of the requested instance partition. + * + * Generated from protobuf field string etag = 2; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. If not empty, the API only deletes the instance partition when + * the etag provided matches the current status of the requested instance + * partition. Otherwise, deletes the instance partition without checking the + * current status of the requested instance partition. + * + * Generated from protobuf field string etag = 2; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstanceRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstanceRequest.php new file mode 100644 index 000000000000..f8633ecef64d --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstanceRequest.php @@ -0,0 +1,87 @@ +google.spanner.admin.instance.v1.DeleteInstanceRequest + */ +class DeleteInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the instance to be deleted. Values are of the form + * `projects//instances/` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the instance to be deleted. Values are of the form + * `projects//instances/` + * Please see {@see InstanceAdminClient::instanceName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Instance\V1\DeleteInstanceRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the instance to be deleted. Values are of the form + * `projects//instances/` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the instance to be deleted. Values are of the form + * `projects//instances/` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the instance to be deleted. Values are of the form + * `projects//instances/` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FreeInstanceMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FreeInstanceMetadata.php new file mode 100644 index 000000000000..49b3e7084a27 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FreeInstanceMetadata.php @@ -0,0 +1,180 @@ +google.spanner.admin.instance.v1.FreeInstanceMetadata + */ +class FreeInstanceMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Timestamp after which the instance will either be upgraded or + * scheduled for deletion after a grace period. ExpireBehavior is used to + * choose between upgrading or scheduling the free instance for deletion. This + * timestamp is set during the creation of a free instance. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $expire_time = null; + /** + * Output only. If present, the timestamp at which the free instance was + * upgraded to a provisioned instance. + * + * Generated from protobuf field .google.protobuf.Timestamp upgrade_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $upgrade_time = null; + /** + * Specifies the expiration behavior of a free instance. The default of + * ExpireBehavior is `REMOVE_AFTER_GRACE_PERIOD`. This can be modified during + * or after creation, and before expiration. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.FreeInstanceMetadata.ExpireBehavior expire_behavior = 3; + */ + protected $expire_behavior = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $expire_time + * Output only. Timestamp after which the instance will either be upgraded or + * scheduled for deletion after a grace period. ExpireBehavior is used to + * choose between upgrading or scheduling the free instance for deletion. This + * timestamp is set during the creation of a free instance. + * @type \Google\Protobuf\Timestamp $upgrade_time + * Output only. If present, the timestamp at which the free instance was + * upgraded to a provisioned instance. + * @type int $expire_behavior + * Specifies the expiration behavior of a free instance. The default of + * ExpireBehavior is `REMOVE_AFTER_GRACE_PERIOD`. This can be modified during + * or after creation, and before expiration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Timestamp after which the instance will either be upgraded or + * scheduled for deletion after a grace period. ExpireBehavior is used to + * choose between upgrading or scheduling the free instance for deletion. This + * timestamp is set during the creation of a free instance. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExpireTime() + { + return $this->expire_time; + } + + public function hasExpireTime() + { + return isset($this->expire_time); + } + + public function clearExpireTime() + { + unset($this->expire_time); + } + + /** + * Output only. Timestamp after which the instance will either be upgraded or + * scheduled for deletion after a grace period. ExpireBehavior is used to + * choose between upgrading or scheduling the free instance for deletion. This + * timestamp is set during the creation of a free instance. + * + * Generated from protobuf field .google.protobuf.Timestamp expire_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExpireTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->expire_time = $var; + + return $this; + } + + /** + * Output only. If present, the timestamp at which the free instance was + * upgraded to a provisioned instance. + * + * Generated from protobuf field .google.protobuf.Timestamp upgrade_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpgradeTime() + { + return $this->upgrade_time; + } + + public function hasUpgradeTime() + { + return isset($this->upgrade_time); + } + + public function clearUpgradeTime() + { + unset($this->upgrade_time); + } + + /** + * Output only. If present, the timestamp at which the free instance was + * upgraded to a provisioned instance. + * + * Generated from protobuf field .google.protobuf.Timestamp upgrade_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpgradeTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->upgrade_time = $var; + + return $this; + } + + /** + * Specifies the expiration behavior of a free instance. The default of + * ExpireBehavior is `REMOVE_AFTER_GRACE_PERIOD`. This can be modified during + * or after creation, and before expiration. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.FreeInstanceMetadata.ExpireBehavior expire_behavior = 3; + * @return int + */ + public function getExpireBehavior() + { + return $this->expire_behavior; + } + + /** + * Specifies the expiration behavior of a free instance. The default of + * ExpireBehavior is `REMOVE_AFTER_GRACE_PERIOD`. This can be modified during + * or after creation, and before expiration. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.FreeInstanceMetadata.ExpireBehavior expire_behavior = 3; + * @param int $var + * @return $this + */ + public function setExpireBehavior($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\FreeInstanceMetadata\ExpireBehavior::class); + $this->expire_behavior = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FreeInstanceMetadata/ExpireBehavior.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FreeInstanceMetadata/ExpireBehavior.php new file mode 100644 index 000000000000..84f5ec48409f --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FreeInstanceMetadata/ExpireBehavior.php @@ -0,0 +1,66 @@ +google.spanner.admin.instance.v1.FreeInstanceMetadata.ExpireBehavior + */ +class ExpireBehavior +{ + /** + * Not specified. + * + * Generated from protobuf enum EXPIRE_BEHAVIOR_UNSPECIFIED = 0; + */ + const EXPIRE_BEHAVIOR_UNSPECIFIED = 0; + /** + * When the free instance expires, upgrade the instance to a provisioned + * instance. + * + * Generated from protobuf enum FREE_TO_PROVISIONED = 1; + */ + const FREE_TO_PROVISIONED = 1; + /** + * When the free instance expires, disable the instance, and delete it + * after the grace period passes if it has not been upgraded. + * + * Generated from protobuf enum REMOVE_AFTER_GRACE_PERIOD = 2; + */ + const REMOVE_AFTER_GRACE_PERIOD = 2; + + private static $valueToName = [ + self::EXPIRE_BEHAVIOR_UNSPECIFIED => 'EXPIRE_BEHAVIOR_UNSPECIFIED', + self::FREE_TO_PROVISIONED => 'FREE_TO_PROVISIONED', + self::REMOVE_AFTER_GRACE_PERIOD => 'REMOVE_AFTER_GRACE_PERIOD', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ExpireBehavior::class, \Google\Cloud\Spanner\Admin\Instance\V1\FreeInstanceMetadata_ExpireBehavior::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FulfillmentPeriod.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FulfillmentPeriod.php new file mode 100644 index 000000000000..3fa91d6d998b --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FulfillmentPeriod.php @@ -0,0 +1,63 @@ +google.spanner.admin.instance.v1.FulfillmentPeriod + */ +class FulfillmentPeriod +{ + /** + * Not specified. + * + * Generated from protobuf enum FULFILLMENT_PERIOD_UNSPECIFIED = 0; + */ + const FULFILLMENT_PERIOD_UNSPECIFIED = 0; + /** + * Normal fulfillment period. The operation is expected to complete within + * minutes. + * + * Generated from protobuf enum FULFILLMENT_PERIOD_NORMAL = 1; + */ + const FULFILLMENT_PERIOD_NORMAL = 1; + /** + * Extended fulfillment period. It can take up to an hour for the operation + * to complete. + * + * Generated from protobuf enum FULFILLMENT_PERIOD_EXTENDED = 2; + */ + const FULFILLMENT_PERIOD_EXTENDED = 2; + + private static $valueToName = [ + self::FULFILLMENT_PERIOD_UNSPECIFIED => 'FULFILLMENT_PERIOD_UNSPECIFIED', + self::FULFILLMENT_PERIOD_NORMAL => 'FULFILLMENT_PERIOD_NORMAL', + self::FULFILLMENT_PERIOD_EXTENDED => 'FULFILLMENT_PERIOD_EXTENDED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstanceConfigRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstanceConfigRequest.php new file mode 100644 index 000000000000..c0d299ac0b80 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstanceConfigRequest.php @@ -0,0 +1,87 @@ +google.spanner.admin.instance.v1.GetInstanceConfigRequest + */ +class GetInstanceConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the requested instance configuration. Values are of + * the form `projects//instanceConfigs/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the requested instance configuration. Values are of + * the form `projects//instanceConfigs/`. Please see + * {@see InstanceAdminClient::instanceConfigName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Instance\V1\GetInstanceConfigRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the requested instance configuration. Values are of + * the form `projects//instanceConfigs/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the requested instance configuration. Values are of + * the form `projects//instanceConfigs/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the requested instance configuration. Values are of + * the form `projects//instanceConfigs/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstancePartitionRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstancePartitionRequest.php new file mode 100644 index 000000000000..e703503feb23 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstancePartitionRequest.php @@ -0,0 +1,92 @@ +google.spanner.admin.instance.v1.GetInstancePartitionRequest + */ +class GetInstancePartitionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the requested instance partition. Values are of + * the form + * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the requested instance partition. Values are of + * the form + * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`. Please see + * {@see InstanceAdminClient::instancePartitionName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Instance\V1\GetInstancePartitionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the requested instance partition. Values are of + * the form + * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the requested instance partition. Values are of + * the form + * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the requested instance partition. Values are of + * the form + * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstanceRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstanceRequest.php new file mode 100644 index 000000000000..6f054759ba44 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstanceRequest.php @@ -0,0 +1,143 @@ +google.spanner.admin.instance.v1.GetInstanceRequest + */ +class GetInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the requested instance. Values are of the form + * `projects//instances/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * If field_mask is present, specifies the subset of + * [Instance][google.spanner.admin.instance.v1.Instance] fields that should be + * returned. If absent, all + * [Instance][google.spanner.admin.instance.v1.Instance] fields are returned. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2; + */ + protected $field_mask = null; + + /** + * @param string $name Required. The name of the requested instance. Values are of the form + * `projects//instances/`. Please see + * {@see InstanceAdminClient::instanceName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Instance\V1\GetInstanceRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the requested instance. Values are of the form + * `projects//instances/`. + * @type \Google\Protobuf\FieldMask $field_mask + * If field_mask is present, specifies the subset of + * [Instance][google.spanner.admin.instance.v1.Instance] fields that should be + * returned. If absent, all + * [Instance][google.spanner.admin.instance.v1.Instance] fields are returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the requested instance. Values are of the form + * `projects//instances/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the requested instance. Values are of the form + * `projects//instances/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * If field_mask is present, specifies the subset of + * [Instance][google.spanner.admin.instance.v1.Instance] fields that should be + * returned. If absent, all + * [Instance][google.spanner.admin.instance.v1.Instance] fields are returned. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getFieldMask() + { + return $this->field_mask; + } + + public function hasFieldMask() + { + return isset($this->field_mask); + } + + public function clearFieldMask() + { + unset($this->field_mask); + } + + /** + * If field_mask is present, specifies the subset of + * [Instance][google.spanner.admin.instance.v1.Instance] fields that should be + * returned. If absent, all + * [Instance][google.spanner.admin.instance.v1.Instance] fields are returned. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setFieldMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->field_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance.php new file mode 100644 index 000000000000..1bfe83d9e4fb --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance.php @@ -0,0 +1,861 @@ +google.spanner.admin.instance.v1.Instance + */ +class Instance extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A unique identifier for the instance, which cannot be changed + * after the instance is created. Values are of the form + * `projects//instances/[a-z][-a-z0-9]*[a-z0-9]`. The final + * segment of the name must be between 2 and 64 characters in length. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Required. The name of the instance's configuration. Values are of the form + * `projects//instanceConfigs/`. See + * also [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and + * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. + * + * Generated from protobuf field string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $config = ''; + /** + * Required. The descriptive name for this instance as it appears in UIs. + * Must be unique per project and between 4 and 30 characters in length. + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + /** + * The number of nodes allocated to this instance. At most, one of either + * `node_count` or `processing_units` should be present in the message. + * Users can set the `node_count` field to specify the target number of nodes + * allocated to the instance. + * If autoscaling is enabled, `node_count` is treated as an `OUTPUT_ONLY` + * field and reflects the current number of nodes allocated to the instance. + * This might be zero in API responses for instances that are not yet in the + * `READY` state. + * For more information, see + * [Compute capacity, nodes, and processing + * units](https://cloud.google.com/spanner/docs/compute-capacity). + * + * Generated from protobuf field int32 node_count = 5; + */ + protected $node_count = 0; + /** + * The number of processing units allocated to this instance. At most, one of + * either `processing_units` or `node_count` should be present in the message. + * Users can set the `processing_units` field to specify the target number of + * processing units allocated to the instance. + * If autoscaling is enabled, `processing_units` is treated as an + * `OUTPUT_ONLY` field and reflects the current number of processing units + * allocated to the instance. + * This might be zero in API responses for instances that are not yet in the + * `READY` state. + * For more information, see + * [Compute capacity, nodes and processing + * units](https://cloud.google.com/spanner/docs/compute-capacity). + * + * Generated from protobuf field int32 processing_units = 9; + */ + protected $processing_units = 0; + /** + * Output only. Lists the compute capacity per ReplicaSelection. A replica + * selection identifies a set of replicas with common properties. Replicas + * identified by a ReplicaSelection are scaled with the same compute capacity. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $replica_compute_capacity; + /** + * Optional. The autoscaling configuration. Autoscaling is enabled if this + * field is set. When autoscaling is enabled, node_count and processing_units + * are treated as OUTPUT_ONLY fields and reflect the current compute capacity + * allocated to the instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig autoscaling_config = 17 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $autoscaling_config = null; + /** + * Output only. The current instance state. For + * [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance], + * the state must be either omitted or set to `CREATING`. For + * [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance], + * the state must be either omitted or set to `READY`. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Cloud Labels are a flexible and lightweight mechanism for organizing cloud + * resources into groups that reflect a customer's organizational needs and + * deployment strategies. Cloud Labels can be used to filter collections of + * resources. They can be used to control how resource metrics are aggregated. + * And they can be used as arguments to policy management rules (e.g. route, + * firewall, load balancing, etc.). + * * Label keys must be between 1 and 63 characters long and must conform to + * the following regular expression: `[a-z][a-z0-9_-]{0,62}`. + * * Label values must be between 0 and 63 characters long and must conform + * to the regular expression `[a-z0-9_-]{0,63}`. + * * No more than 64 labels can be associated with a given resource. + * See https://goo.gl/xmQnxf for more information on and examples of labels. + * If you plan to use labels in your own code, please note that additional + * characters may be allowed in the future. And so you are advised to use an + * internal label representation, such as JSON, which doesn't rely upon + * specific characters being disallowed. For example, representing labels + * as the string: name + "_" + value would prove problematic if we were to + * allow "_" in a future release. + * + * Generated from protobuf field map labels = 7; + */ + private $labels; + /** + * The `InstanceType` of the current instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.InstanceType instance_type = 10; + */ + protected $instance_type = 0; + /** + * Deprecated. This field is not populated. + * + * Generated from protobuf field repeated string endpoint_uris = 8; + */ + private $endpoint_uris; + /** + * Output only. The time at which the instance was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time at which the instance was most recently updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Free instance metadata. Only populated for free instances. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.FreeInstanceMetadata free_instance_metadata = 13; + */ + protected $free_instance_metadata = null; + /** + * Optional. The `Edition` of the current instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.Edition edition = 20 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $edition = 0; + /** + * Optional. Controls the default backup schedule behavior for new databases + * within the instance. By default, a backup schedule is created automatically + * when a new database is created in a new instance. + * Note that the `AUTOMATIC` value isn't permitted for free instances, + * as backups and backup schedules aren't supported for free instances. + * In the `GetInstance` or `ListInstances` response, if the value of + * `default_backup_schedule_type` isn't set, or set to `NONE`, Spanner doesn't + * create a default backup schedule for new databases in the instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.DefaultBackupScheduleType default_backup_schedule_type = 23 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $default_backup_schedule_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A unique identifier for the instance, which cannot be changed + * after the instance is created. Values are of the form + * `projects//instances/[a-z][-a-z0-9]*[a-z0-9]`. The final + * segment of the name must be between 2 and 64 characters in length. + * @type string $config + * Required. The name of the instance's configuration. Values are of the form + * `projects//instanceConfigs/`. See + * also [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and + * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. + * @type string $display_name + * Required. The descriptive name for this instance as it appears in UIs. + * Must be unique per project and between 4 and 30 characters in length. + * @type int $node_count + * The number of nodes allocated to this instance. At most, one of either + * `node_count` or `processing_units` should be present in the message. + * Users can set the `node_count` field to specify the target number of nodes + * allocated to the instance. + * If autoscaling is enabled, `node_count` is treated as an `OUTPUT_ONLY` + * field and reflects the current number of nodes allocated to the instance. + * This might be zero in API responses for instances that are not yet in the + * `READY` state. + * For more information, see + * [Compute capacity, nodes, and processing + * units](https://cloud.google.com/spanner/docs/compute-capacity). + * @type int $processing_units + * The number of processing units allocated to this instance. At most, one of + * either `processing_units` or `node_count` should be present in the message. + * Users can set the `processing_units` field to specify the target number of + * processing units allocated to the instance. + * If autoscaling is enabled, `processing_units` is treated as an + * `OUTPUT_ONLY` field and reflects the current number of processing units + * allocated to the instance. + * This might be zero in API responses for instances that are not yet in the + * `READY` state. + * For more information, see + * [Compute capacity, nodes and processing + * units](https://cloud.google.com/spanner/docs/compute-capacity). + * @type array<\Google\Cloud\Spanner\Admin\Instance\V1\ReplicaComputeCapacity>|\Google\Protobuf\Internal\RepeatedField $replica_compute_capacity + * Output only. Lists the compute capacity per ReplicaSelection. A replica + * selection identifies a set of replicas with common properties. Replicas + * identified by a ReplicaSelection are scaled with the same compute capacity. + * @type \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig $autoscaling_config + * Optional. The autoscaling configuration. Autoscaling is enabled if this + * field is set. When autoscaling is enabled, node_count and processing_units + * are treated as OUTPUT_ONLY fields and reflect the current compute capacity + * allocated to the instance. + * @type int $state + * Output only. The current instance state. For + * [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance], + * the state must be either omitted or set to `CREATING`. For + * [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance], + * the state must be either omitted or set to `READY`. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Cloud Labels are a flexible and lightweight mechanism for organizing cloud + * resources into groups that reflect a customer's organizational needs and + * deployment strategies. Cloud Labels can be used to filter collections of + * resources. They can be used to control how resource metrics are aggregated. + * And they can be used as arguments to policy management rules (e.g. route, + * firewall, load balancing, etc.). + * * Label keys must be between 1 and 63 characters long and must conform to + * the following regular expression: `[a-z][a-z0-9_-]{0,62}`. + * * Label values must be between 0 and 63 characters long and must conform + * to the regular expression `[a-z0-9_-]{0,63}`. + * * No more than 64 labels can be associated with a given resource. + * See https://goo.gl/xmQnxf for more information on and examples of labels. + * If you plan to use labels in your own code, please note that additional + * characters may be allowed in the future. And so you are advised to use an + * internal label representation, such as JSON, which doesn't rely upon + * specific characters being disallowed. For example, representing labels + * as the string: name + "_" + value would prove problematic if we were to + * allow "_" in a future release. + * @type int $instance_type + * The `InstanceType` of the current instance. + * @type array|\Google\Protobuf\Internal\RepeatedField $endpoint_uris + * Deprecated. This field is not populated. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time at which the instance was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time at which the instance was most recently updated. + * @type \Google\Cloud\Spanner\Admin\Instance\V1\FreeInstanceMetadata $free_instance_metadata + * Free instance metadata. Only populated for free instances. + * @type int $edition + * Optional. The `Edition` of the current instance. + * @type int $default_backup_schedule_type + * Optional. Controls the default backup schedule behavior for new databases + * within the instance. By default, a backup schedule is created automatically + * when a new database is created in a new instance. + * Note that the `AUTOMATIC` value isn't permitted for free instances, + * as backups and backup schedules aren't supported for free instances. + * In the `GetInstance` or `ListInstances` response, if the value of + * `default_backup_schedule_type` isn't set, or set to `NONE`, Spanner doesn't + * create a default backup schedule for new databases in the instance. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. A unique identifier for the instance, which cannot be changed + * after the instance is created. Values are of the form + * `projects//instances/[a-z][-a-z0-9]*[a-z0-9]`. The final + * segment of the name must be between 2 and 64 characters in length. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A unique identifier for the instance, which cannot be changed + * after the instance is created. Values are of the form + * `projects//instances/[a-z][-a-z0-9]*[a-z0-9]`. The final + * segment of the name must be between 2 and 64 characters in length. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The name of the instance's configuration. Values are of the form + * `projects//instanceConfigs/`. See + * also [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and + * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. + * + * Generated from protobuf field string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getConfig() + { + return $this->config; + } + + /** + * Required. The name of the instance's configuration. Values are of the form + * `projects//instanceConfigs/`. See + * also [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and + * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. + * + * Generated from protobuf field string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setConfig($var) + { + GPBUtil::checkString($var, True); + $this->config = $var; + + return $this; + } + + /** + * Required. The descriptive name for this instance as it appears in UIs. + * Must be unique per project and between 4 and 30 characters in length. + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. The descriptive name for this instance as it appears in UIs. + * Must be unique per project and between 4 and 30 characters in length. + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The number of nodes allocated to this instance. At most, one of either + * `node_count` or `processing_units` should be present in the message. + * Users can set the `node_count` field to specify the target number of nodes + * allocated to the instance. + * If autoscaling is enabled, `node_count` is treated as an `OUTPUT_ONLY` + * field and reflects the current number of nodes allocated to the instance. + * This might be zero in API responses for instances that are not yet in the + * `READY` state. + * For more information, see + * [Compute capacity, nodes, and processing + * units](https://cloud.google.com/spanner/docs/compute-capacity). + * + * Generated from protobuf field int32 node_count = 5; + * @return int + */ + public function getNodeCount() + { + return $this->node_count; + } + + /** + * The number of nodes allocated to this instance. At most, one of either + * `node_count` or `processing_units` should be present in the message. + * Users can set the `node_count` field to specify the target number of nodes + * allocated to the instance. + * If autoscaling is enabled, `node_count` is treated as an `OUTPUT_ONLY` + * field and reflects the current number of nodes allocated to the instance. + * This might be zero in API responses for instances that are not yet in the + * `READY` state. + * For more information, see + * [Compute capacity, nodes, and processing + * units](https://cloud.google.com/spanner/docs/compute-capacity). + * + * Generated from protobuf field int32 node_count = 5; + * @param int $var + * @return $this + */ + public function setNodeCount($var) + { + GPBUtil::checkInt32($var); + $this->node_count = $var; + + return $this; + } + + /** + * The number of processing units allocated to this instance. At most, one of + * either `processing_units` or `node_count` should be present in the message. + * Users can set the `processing_units` field to specify the target number of + * processing units allocated to the instance. + * If autoscaling is enabled, `processing_units` is treated as an + * `OUTPUT_ONLY` field and reflects the current number of processing units + * allocated to the instance. + * This might be zero in API responses for instances that are not yet in the + * `READY` state. + * For more information, see + * [Compute capacity, nodes and processing + * units](https://cloud.google.com/spanner/docs/compute-capacity). + * + * Generated from protobuf field int32 processing_units = 9; + * @return int + */ + public function getProcessingUnits() + { + return $this->processing_units; + } + + /** + * The number of processing units allocated to this instance. At most, one of + * either `processing_units` or `node_count` should be present in the message. + * Users can set the `processing_units` field to specify the target number of + * processing units allocated to the instance. + * If autoscaling is enabled, `processing_units` is treated as an + * `OUTPUT_ONLY` field and reflects the current number of processing units + * allocated to the instance. + * This might be zero in API responses for instances that are not yet in the + * `READY` state. + * For more information, see + * [Compute capacity, nodes and processing + * units](https://cloud.google.com/spanner/docs/compute-capacity). + * + * Generated from protobuf field int32 processing_units = 9; + * @param int $var + * @return $this + */ + public function setProcessingUnits($var) + { + GPBUtil::checkInt32($var); + $this->processing_units = $var; + + return $this; + } + + /** + * Output only. Lists the compute capacity per ReplicaSelection. A replica + * selection identifies a set of replicas with common properties. Replicas + * identified by a ReplicaSelection are scaled with the same compute capacity. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReplicaComputeCapacity() + { + return $this->replica_compute_capacity; + } + + /** + * Output only. Lists the compute capacity per ReplicaSelection. A replica + * selection identifies a set of replicas with common properties. Replicas + * identified by a ReplicaSelection are scaled with the same compute capacity. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Spanner\Admin\Instance\V1\ReplicaComputeCapacity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReplicaComputeCapacity($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaComputeCapacity::class); + $this->replica_compute_capacity = $arr; + + return $this; + } + + /** + * Optional. The autoscaling configuration. Autoscaling is enabled if this + * field is set. When autoscaling is enabled, node_count and processing_units + * are treated as OUTPUT_ONLY fields and reflect the current compute capacity + * allocated to the instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig autoscaling_config = 17 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig|null + */ + public function getAutoscalingConfig() + { + return $this->autoscaling_config; + } + + public function hasAutoscalingConfig() + { + return isset($this->autoscaling_config); + } + + public function clearAutoscalingConfig() + { + unset($this->autoscaling_config); + } + + /** + * Optional. The autoscaling configuration. Autoscaling is enabled if this + * field is set. When autoscaling is enabled, node_count and processing_units + * are treated as OUTPUT_ONLY fields and reflect the current compute capacity + * allocated to the instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig autoscaling_config = 17 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig $var + * @return $this + */ + public function setAutoscalingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig::class); + $this->autoscaling_config = $var; + + return $this; + } + + /** + * Output only. The current instance state. For + * [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance], + * the state must be either omitted or set to `CREATING`. For + * [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance], + * the state must be either omitted or set to `READY`. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current instance state. For + * [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance], + * the state must be either omitted or set to `CREATING`. For + * [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance], + * the state must be either omitted or set to `READY`. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\Instance\State::class); + $this->state = $var; + + return $this; + } + + /** + * Cloud Labels are a flexible and lightweight mechanism for organizing cloud + * resources into groups that reflect a customer's organizational needs and + * deployment strategies. Cloud Labels can be used to filter collections of + * resources. They can be used to control how resource metrics are aggregated. + * And they can be used as arguments to policy management rules (e.g. route, + * firewall, load balancing, etc.). + * * Label keys must be between 1 and 63 characters long and must conform to + * the following regular expression: `[a-z][a-z0-9_-]{0,62}`. + * * Label values must be between 0 and 63 characters long and must conform + * to the regular expression `[a-z0-9_-]{0,63}`. + * * No more than 64 labels can be associated with a given resource. + * See https://goo.gl/xmQnxf for more information on and examples of labels. + * If you plan to use labels in your own code, please note that additional + * characters may be allowed in the future. And so you are advised to use an + * internal label representation, such as JSON, which doesn't rely upon + * specific characters being disallowed. For example, representing labels + * as the string: name + "_" + value would prove problematic if we were to + * allow "_" in a future release. + * + * Generated from protobuf field map labels = 7; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Cloud Labels are a flexible and lightweight mechanism for organizing cloud + * resources into groups that reflect a customer's organizational needs and + * deployment strategies. Cloud Labels can be used to filter collections of + * resources. They can be used to control how resource metrics are aggregated. + * And they can be used as arguments to policy management rules (e.g. route, + * firewall, load balancing, etc.). + * * Label keys must be between 1 and 63 characters long and must conform to + * the following regular expression: `[a-z][a-z0-9_-]{0,62}`. + * * Label values must be between 0 and 63 characters long and must conform + * to the regular expression `[a-z0-9_-]{0,63}`. + * * No more than 64 labels can be associated with a given resource. + * See https://goo.gl/xmQnxf for more information on and examples of labels. + * If you plan to use labels in your own code, please note that additional + * characters may be allowed in the future. And so you are advised to use an + * internal label representation, such as JSON, which doesn't rely upon + * specific characters being disallowed. For example, representing labels + * as the string: name + "_" + value would prove problematic if we were to + * allow "_" in a future release. + * + * Generated from protobuf field map labels = 7; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * The `InstanceType` of the current instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.InstanceType instance_type = 10; + * @return int + */ + public function getInstanceType() + { + return $this->instance_type; + } + + /** + * The `InstanceType` of the current instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.InstanceType instance_type = 10; + * @param int $var + * @return $this + */ + public function setInstanceType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\Instance\InstanceType::class); + $this->instance_type = $var; + + return $this; + } + + /** + * Deprecated. This field is not populated. + * + * Generated from protobuf field repeated string endpoint_uris = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEndpointUris() + { + return $this->endpoint_uris; + } + + /** + * Deprecated. This field is not populated. + * + * Generated from protobuf field repeated string endpoint_uris = 8; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEndpointUris($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->endpoint_uris = $arr; + + return $this; + } + + /** + * Output only. The time at which the instance was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The time at which the instance was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The time at which the instance was most recently updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The time at which the instance was most recently updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Free instance metadata. Only populated for free instances. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.FreeInstanceMetadata free_instance_metadata = 13; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\FreeInstanceMetadata|null + */ + public function getFreeInstanceMetadata() + { + return $this->free_instance_metadata; + } + + public function hasFreeInstanceMetadata() + { + return isset($this->free_instance_metadata); + } + + public function clearFreeInstanceMetadata() + { + unset($this->free_instance_metadata); + } + + /** + * Free instance metadata. Only populated for free instances. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.FreeInstanceMetadata free_instance_metadata = 13; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\FreeInstanceMetadata $var + * @return $this + */ + public function setFreeInstanceMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\FreeInstanceMetadata::class); + $this->free_instance_metadata = $var; + + return $this; + } + + /** + * Optional. The `Edition` of the current instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.Edition edition = 20 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getEdition() + { + return $this->edition; + } + + /** + * Optional. The `Edition` of the current instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.Edition edition = 20 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setEdition($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\Instance\Edition::class); + $this->edition = $var; + + return $this; + } + + /** + * Optional. Controls the default backup schedule behavior for new databases + * within the instance. By default, a backup schedule is created automatically + * when a new database is created in a new instance. + * Note that the `AUTOMATIC` value isn't permitted for free instances, + * as backups and backup schedules aren't supported for free instances. + * In the `GetInstance` or `ListInstances` response, if the value of + * `default_backup_schedule_type` isn't set, or set to `NONE`, Spanner doesn't + * create a default backup schedule for new databases in the instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.DefaultBackupScheduleType default_backup_schedule_type = 23 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getDefaultBackupScheduleType() + { + return $this->default_backup_schedule_type; + } + + /** + * Optional. Controls the default backup schedule behavior for new databases + * within the instance. By default, a backup schedule is created automatically + * when a new database is created in a new instance. + * Note that the `AUTOMATIC` value isn't permitted for free instances, + * as backups and backup schedules aren't supported for free instances. + * In the `GetInstance` or `ListInstances` response, if the value of + * `default_backup_schedule_type` isn't set, or set to `NONE`, Spanner doesn't + * create a default backup schedule for new databases in the instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.DefaultBackupScheduleType default_backup_schedule_type = 23 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setDefaultBackupScheduleType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\Instance\DefaultBackupScheduleType::class); + $this->default_backup_schedule_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/DefaultBackupScheduleType.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/DefaultBackupScheduleType.php new file mode 100644 index 000000000000..ca0a5ec8fd95 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/DefaultBackupScheduleType.php @@ -0,0 +1,71 @@ +google.spanner.admin.instance.v1.Instance.DefaultBackupScheduleType + */ +class DefaultBackupScheduleType +{ + /** + * Not specified. + * + * Generated from protobuf enum DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIED = 0; + */ + const DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIED = 0; + /** + * A default backup schedule isn't created automatically when a new database + * is created in the instance. + * + * Generated from protobuf enum NONE = 1; + */ + const NONE = 1; + /** + * A default backup schedule is created automatically when a new database + * is created in the instance. The default backup schedule creates a full + * backup every 24 hours. These full backups are retained for 7 days. + * You can edit or delete the default backup schedule once it's created. + * + * Generated from protobuf enum AUTOMATIC = 2; + */ + const AUTOMATIC = 2; + + private static $valueToName = [ + self::DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIED => 'DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIED', + self::NONE => 'NONE', + self::AUTOMATIC => 'AUTOMATIC', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DefaultBackupScheduleType::class, \Google\Cloud\Spanner\Admin\Instance\V1\Instance_DefaultBackupScheduleType::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/Edition.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/Edition.php new file mode 100644 index 000000000000..f05fa2f3b48d --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/Edition.php @@ -0,0 +1,72 @@ +google.spanner.admin.instance.v1.Instance.Edition + */ +class Edition +{ + /** + * Edition not specified. + * + * Generated from protobuf enum EDITION_UNSPECIFIED = 0; + */ + const EDITION_UNSPECIFIED = 0; + /** + * Standard edition. + * + * Generated from protobuf enum STANDARD = 1; + */ + const STANDARD = 1; + /** + * Enterprise edition. + * + * Generated from protobuf enum ENTERPRISE = 2; + */ + const ENTERPRISE = 2; + /** + * Enterprise Plus edition. + * + * Generated from protobuf enum ENTERPRISE_PLUS = 3; + */ + const ENTERPRISE_PLUS = 3; + + private static $valueToName = [ + self::EDITION_UNSPECIFIED => 'EDITION_UNSPECIFIED', + self::STANDARD => 'STANDARD', + self::ENTERPRISE => 'ENTERPRISE', + self::ENTERPRISE_PLUS => 'ENTERPRISE_PLUS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Edition::class, \Google\Cloud\Spanner\Admin\Instance\V1\Instance_Edition::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/InstanceType.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/InstanceType.php new file mode 100644 index 000000000000..6e29f52acf69 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/InstanceType.php @@ -0,0 +1,70 @@ +google.spanner.admin.instance.v1.Instance.InstanceType + */ +class InstanceType +{ + /** + * Not specified. + * + * Generated from protobuf enum INSTANCE_TYPE_UNSPECIFIED = 0; + */ + const INSTANCE_TYPE_UNSPECIFIED = 0; + /** + * Provisioned instances have dedicated resources, standard usage limits and + * support. + * + * Generated from protobuf enum PROVISIONED = 1; + */ + const PROVISIONED = 1; + /** + * Free instances provide no guarantee for dedicated resources, + * [node_count, processing_units] should be 0. They come + * with stricter usage limits and limited support. + * + * Generated from protobuf enum FREE_INSTANCE = 2; + */ + const FREE_INSTANCE = 2; + + private static $valueToName = [ + self::INSTANCE_TYPE_UNSPECIFIED => 'INSTANCE_TYPE_UNSPECIFIED', + self::PROVISIONED => 'PROVISIONED', + self::FREE_INSTANCE => 'FREE_INSTANCE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(InstanceType::class, \Google\Cloud\Spanner\Admin\Instance\V1\Instance_InstanceType::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/State.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/State.php new file mode 100644 index 000000000000..6490899edb93 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/State.php @@ -0,0 +1,67 @@ +google.spanner.admin.instance.v1.Instance.State + */ +class State +{ + /** + * Not specified. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The instance is still being created. Resources may not be + * available yet, and operations such as database creation may not + * work. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The instance is fully created and ready to do work such as + * creating databases. + * + * Generated from protobuf enum READY = 2; + */ + const READY = 2; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::READY => 'READY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Spanner\Admin\Instance\V1\Instance_State::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig.php new file mode 100644 index 000000000000..0fc49ee6a9a1 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig.php @@ -0,0 +1,690 @@ +google.spanner.admin.instance.v1.InstanceConfig + */ +class InstanceConfig extends \Google\Protobuf\Internal\Message +{ + /** + * A unique identifier for the instance configuration. Values + * are of the form + * `projects//instanceConfigs/[a-z][-a-z0-9]*`. + * User instance configuration must start with `custom-`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The name of this instance configuration as it appears in UIs. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * Output only. Whether this instance configuration is a Google-managed or + * user-managed configuration. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.Type config_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $config_type = 0; + /** + * The geographic placement of nodes in this instance configuration and their + * replication properties. + * To create user-managed configurations, input + * `replicas` must include all replicas in `replicas` of the `base_config` + * and include one or more replicas in the `optional_replicas` of the + * `base_config`. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaInfo replicas = 3; + */ + private $replicas; + /** + * Output only. The available optional replicas to choose from for + * user-managed configurations. Populated for Google-managed configurations. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaInfo optional_replicas = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $optional_replicas; + /** + * Base configuration name, e.g. projects//instanceConfigs/nam3, + * based on which this configuration is created. Only set for user-managed + * configurations. `base_config` must refer to a configuration of type + * `GOOGLE_MANAGED` in the same project as this configuration. + * + * Generated from protobuf field string base_config = 7 [(.google.api.resource_reference) = { + */ + protected $base_config = ''; + /** + * Cloud Labels are a flexible and lightweight mechanism for organizing cloud + * resources into groups that reflect a customer's organizational needs and + * deployment strategies. Cloud Labels can be used to filter collections of + * resources. They can be used to control how resource metrics are aggregated. + * And they can be used as arguments to policy management rules (e.g. route, + * firewall, load balancing, etc.). + * * Label keys must be between 1 and 63 characters long and must conform to + * the following regular expression: `[a-z][a-z0-9_-]{0,62}`. + * * Label values must be between 0 and 63 characters long and must conform + * to the regular expression `[a-z0-9_-]{0,63}`. + * * No more than 64 labels can be associated with a given resource. + * See https://goo.gl/xmQnxf for more information on and examples of labels. + * If you plan to use labels in your own code, please note that additional + * characters may be allowed in the future. Therefore, you are advised to use + * an internal label representation, such as JSON, which doesn't rely upon + * specific characters being disallowed. For example, representing labels + * as the string: name + "_" + value would prove problematic if we were to + * allow "_" in a future release. + * + * Generated from protobuf field map labels = 8; + */ + private $labels; + /** + * etag is used for optimistic concurrency control as a way + * to help prevent simultaneous updates of a instance configuration from + * overwriting each other. It is strongly suggested that systems make use of + * the etag in the read-modify-write cycle to perform instance configuration + * updates in order to avoid race conditions: An etag is returned in the + * response which contains instance configurations, and systems are expected + * to put that etag in the request to update instance configuration to ensure + * that their change is applied to the same version of the instance + * configuration. If no etag is provided in the call to update the instance + * configuration, then the existing instance configuration is overwritten + * blindly. + * + * Generated from protobuf field string etag = 9; + */ + protected $etag = ''; + /** + * Allowed values of the "default_leader" schema option for databases in + * instances that use this instance configuration. + * + * Generated from protobuf field repeated string leader_options = 4; + */ + private $leader_options; + /** + * Output only. If true, the instance configuration is being created or + * updated. If false, there are no ongoing operations for the instance + * configuration. + * + * Generated from protobuf field bool reconciling = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reconciling = false; + /** + * Output only. The current instance configuration state. Applicable only for + * `USER_MANAGED` configurations. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.State state = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. Describes whether free instances are available to be created + * in this instance configuration. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.FreeInstanceAvailability free_instance_availability = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $free_instance_availability = 0; + /** + * Output only. The `QuorumType` of the instance configuration. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.QuorumType quorum_type = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $quorum_type = 0; + /** + * Output only. The storage limit in bytes per processing unit. + * + * Generated from protobuf field int64 storage_limit_per_processing_unit = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $storage_limit_per_processing_unit = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * A unique identifier for the instance configuration. Values + * are of the form + * `projects//instanceConfigs/[a-z][-a-z0-9]*`. + * User instance configuration must start with `custom-`. + * @type string $display_name + * The name of this instance configuration as it appears in UIs. + * @type int $config_type + * Output only. Whether this instance configuration is a Google-managed or + * user-managed configuration. + * @type array<\Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo>|\Google\Protobuf\Internal\RepeatedField $replicas + * The geographic placement of nodes in this instance configuration and their + * replication properties. + * To create user-managed configurations, input + * `replicas` must include all replicas in `replicas` of the `base_config` + * and include one or more replicas in the `optional_replicas` of the + * `base_config`. + * @type array<\Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo>|\Google\Protobuf\Internal\RepeatedField $optional_replicas + * Output only. The available optional replicas to choose from for + * user-managed configurations. Populated for Google-managed configurations. + * @type string $base_config + * Base configuration name, e.g. projects//instanceConfigs/nam3, + * based on which this configuration is created. Only set for user-managed + * configurations. `base_config` must refer to a configuration of type + * `GOOGLE_MANAGED` in the same project as this configuration. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Cloud Labels are a flexible and lightweight mechanism for organizing cloud + * resources into groups that reflect a customer's organizational needs and + * deployment strategies. Cloud Labels can be used to filter collections of + * resources. They can be used to control how resource metrics are aggregated. + * And they can be used as arguments to policy management rules (e.g. route, + * firewall, load balancing, etc.). + * * Label keys must be between 1 and 63 characters long and must conform to + * the following regular expression: `[a-z][a-z0-9_-]{0,62}`. + * * Label values must be between 0 and 63 characters long and must conform + * to the regular expression `[a-z0-9_-]{0,63}`. + * * No more than 64 labels can be associated with a given resource. + * See https://goo.gl/xmQnxf for more information on and examples of labels. + * If you plan to use labels in your own code, please note that additional + * characters may be allowed in the future. Therefore, you are advised to use + * an internal label representation, such as JSON, which doesn't rely upon + * specific characters being disallowed. For example, representing labels + * as the string: name + "_" + value would prove problematic if we were to + * allow "_" in a future release. + * @type string $etag + * etag is used for optimistic concurrency control as a way + * to help prevent simultaneous updates of a instance configuration from + * overwriting each other. It is strongly suggested that systems make use of + * the etag in the read-modify-write cycle to perform instance configuration + * updates in order to avoid race conditions: An etag is returned in the + * response which contains instance configurations, and systems are expected + * to put that etag in the request to update instance configuration to ensure + * that their change is applied to the same version of the instance + * configuration. If no etag is provided in the call to update the instance + * configuration, then the existing instance configuration is overwritten + * blindly. + * @type array|\Google\Protobuf\Internal\RepeatedField $leader_options + * Allowed values of the "default_leader" schema option for databases in + * instances that use this instance configuration. + * @type bool $reconciling + * Output only. If true, the instance configuration is being created or + * updated. If false, there are no ongoing operations for the instance + * configuration. + * @type int $state + * Output only. The current instance configuration state. Applicable only for + * `USER_MANAGED` configurations. + * @type int $free_instance_availability + * Output only. Describes whether free instances are available to be created + * in this instance configuration. + * @type int $quorum_type + * Output only. The `QuorumType` of the instance configuration. + * @type int|string $storage_limit_per_processing_unit + * Output only. The storage limit in bytes per processing unit. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * A unique identifier for the instance configuration. Values + * are of the form + * `projects//instanceConfigs/[a-z][-a-z0-9]*`. + * User instance configuration must start with `custom-`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * A unique identifier for the instance configuration. Values + * are of the form + * `projects//instanceConfigs/[a-z][-a-z0-9]*`. + * User instance configuration must start with `custom-`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The name of this instance configuration as it appears in UIs. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The name of this instance configuration as it appears in UIs. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Output only. Whether this instance configuration is a Google-managed or + * user-managed configuration. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.Type config_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getConfigType() + { + return $this->config_type; + } + + /** + * Output only. Whether this instance configuration is a Google-managed or + * user-managed configuration. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.Type config_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setConfigType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig\Type::class); + $this->config_type = $var; + + return $this; + } + + /** + * The geographic placement of nodes in this instance configuration and their + * replication properties. + * To create user-managed configurations, input + * `replicas` must include all replicas in `replicas` of the `base_config` + * and include one or more replicas in the `optional_replicas` of the + * `base_config`. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaInfo replicas = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReplicas() + { + return $this->replicas; + } + + /** + * The geographic placement of nodes in this instance configuration and their + * replication properties. + * To create user-managed configurations, input + * `replicas` must include all replicas in `replicas` of the `base_config` + * and include one or more replicas in the `optional_replicas` of the + * `base_config`. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaInfo replicas = 3; + * @param array<\Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReplicas($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo::class); + $this->replicas = $arr; + + return $this; + } + + /** + * Output only. The available optional replicas to choose from for + * user-managed configurations. Populated for Google-managed configurations. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaInfo optional_replicas = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOptionalReplicas() + { + return $this->optional_replicas; + } + + /** + * Output only. The available optional replicas to choose from for + * user-managed configurations. Populated for Google-managed configurations. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaInfo optional_replicas = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOptionalReplicas($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo::class); + $this->optional_replicas = $arr; + + return $this; + } + + /** + * Base configuration name, e.g. projects//instanceConfigs/nam3, + * based on which this configuration is created. Only set for user-managed + * configurations. `base_config` must refer to a configuration of type + * `GOOGLE_MANAGED` in the same project as this configuration. + * + * Generated from protobuf field string base_config = 7 [(.google.api.resource_reference) = { + * @return string + */ + public function getBaseConfig() + { + return $this->base_config; + } + + /** + * Base configuration name, e.g. projects//instanceConfigs/nam3, + * based on which this configuration is created. Only set for user-managed + * configurations. `base_config` must refer to a configuration of type + * `GOOGLE_MANAGED` in the same project as this configuration. + * + * Generated from protobuf field string base_config = 7 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setBaseConfig($var) + { + GPBUtil::checkString($var, True); + $this->base_config = $var; + + return $this; + } + + /** + * Cloud Labels are a flexible and lightweight mechanism for organizing cloud + * resources into groups that reflect a customer's organizational needs and + * deployment strategies. Cloud Labels can be used to filter collections of + * resources. They can be used to control how resource metrics are aggregated. + * And they can be used as arguments to policy management rules (e.g. route, + * firewall, load balancing, etc.). + * * Label keys must be between 1 and 63 characters long and must conform to + * the following regular expression: `[a-z][a-z0-9_-]{0,62}`. + * * Label values must be between 0 and 63 characters long and must conform + * to the regular expression `[a-z0-9_-]{0,63}`. + * * No more than 64 labels can be associated with a given resource. + * See https://goo.gl/xmQnxf for more information on and examples of labels. + * If you plan to use labels in your own code, please note that additional + * characters may be allowed in the future. Therefore, you are advised to use + * an internal label representation, such as JSON, which doesn't rely upon + * specific characters being disallowed. For example, representing labels + * as the string: name + "_" + value would prove problematic if we were to + * allow "_" in a future release. + * + * Generated from protobuf field map labels = 8; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Cloud Labels are a flexible and lightweight mechanism for organizing cloud + * resources into groups that reflect a customer's organizational needs and + * deployment strategies. Cloud Labels can be used to filter collections of + * resources. They can be used to control how resource metrics are aggregated. + * And they can be used as arguments to policy management rules (e.g. route, + * firewall, load balancing, etc.). + * * Label keys must be between 1 and 63 characters long and must conform to + * the following regular expression: `[a-z][a-z0-9_-]{0,62}`. + * * Label values must be between 0 and 63 characters long and must conform + * to the regular expression `[a-z0-9_-]{0,63}`. + * * No more than 64 labels can be associated with a given resource. + * See https://goo.gl/xmQnxf for more information on and examples of labels. + * If you plan to use labels in your own code, please note that additional + * characters may be allowed in the future. Therefore, you are advised to use + * an internal label representation, such as JSON, which doesn't rely upon + * specific characters being disallowed. For example, representing labels + * as the string: name + "_" + value would prove problematic if we were to + * allow "_" in a future release. + * + * Generated from protobuf field map labels = 8; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * etag is used for optimistic concurrency control as a way + * to help prevent simultaneous updates of a instance configuration from + * overwriting each other. It is strongly suggested that systems make use of + * the etag in the read-modify-write cycle to perform instance configuration + * updates in order to avoid race conditions: An etag is returned in the + * response which contains instance configurations, and systems are expected + * to put that etag in the request to update instance configuration to ensure + * that their change is applied to the same version of the instance + * configuration. If no etag is provided in the call to update the instance + * configuration, then the existing instance configuration is overwritten + * blindly. + * + * Generated from protobuf field string etag = 9; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * etag is used for optimistic concurrency control as a way + * to help prevent simultaneous updates of a instance configuration from + * overwriting each other. It is strongly suggested that systems make use of + * the etag in the read-modify-write cycle to perform instance configuration + * updates in order to avoid race conditions: An etag is returned in the + * response which contains instance configurations, and systems are expected + * to put that etag in the request to update instance configuration to ensure + * that their change is applied to the same version of the instance + * configuration. If no etag is provided in the call to update the instance + * configuration, then the existing instance configuration is overwritten + * blindly. + * + * Generated from protobuf field string etag = 9; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Allowed values of the "default_leader" schema option for databases in + * instances that use this instance configuration. + * + * Generated from protobuf field repeated string leader_options = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLeaderOptions() + { + return $this->leader_options; + } + + /** + * Allowed values of the "default_leader" schema option for databases in + * instances that use this instance configuration. + * + * Generated from protobuf field repeated string leader_options = 4; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLeaderOptions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->leader_options = $arr; + + return $this; + } + + /** + * Output only. If true, the instance configuration is being created or + * updated. If false, there are no ongoing operations for the instance + * configuration. + * + * Generated from protobuf field bool reconciling = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getReconciling() + { + return $this->reconciling; + } + + /** + * Output only. If true, the instance configuration is being created or + * updated. If false, there are no ongoing operations for the instance + * configuration. + * + * Generated from protobuf field bool reconciling = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setReconciling($var) + { + GPBUtil::checkBool($var); + $this->reconciling = $var; + + return $this; + } + + /** + * Output only. The current instance configuration state. Applicable only for + * `USER_MANAGED` configurations. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.State state = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current instance configuration state. Applicable only for + * `USER_MANAGED` configurations. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.State state = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. Describes whether free instances are available to be created + * in this instance configuration. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.FreeInstanceAvailability free_instance_availability = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getFreeInstanceAvailability() + { + return $this->free_instance_availability; + } + + /** + * Output only. Describes whether free instances are available to be created + * in this instance configuration. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.FreeInstanceAvailability free_instance_availability = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setFreeInstanceAvailability($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig\FreeInstanceAvailability::class); + $this->free_instance_availability = $var; + + return $this; + } + + /** + * Output only. The `QuorumType` of the instance configuration. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.QuorumType quorum_type = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getQuorumType() + { + return $this->quorum_type; + } + + /** + * Output only. The `QuorumType` of the instance configuration. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.QuorumType quorum_type = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setQuorumType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig\QuorumType::class); + $this->quorum_type = $var; + + return $this; + } + + /** + * Output only. The storage limit in bytes per processing unit. + * + * Generated from protobuf field int64 storage_limit_per_processing_unit = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getStorageLimitPerProcessingUnit() + { + return $this->storage_limit_per_processing_unit; + } + + /** + * Output only. The storage limit in bytes per processing unit. + * + * Generated from protobuf field int64 storage_limit_per_processing_unit = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setStorageLimitPerProcessingUnit($var) + { + GPBUtil::checkInt64($var); + $this->storage_limit_per_processing_unit = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/FreeInstanceAvailability.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/FreeInstanceAvailability.php new file mode 100644 index 000000000000..ae20bdcc9e24 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/FreeInstanceAvailability.php @@ -0,0 +1,84 @@ +google.spanner.admin.instance.v1.InstanceConfig.FreeInstanceAvailability + */ +class FreeInstanceAvailability +{ + /** + * Not specified. + * + * Generated from protobuf enum FREE_INSTANCE_AVAILABILITY_UNSPECIFIED = 0; + */ + const FREE_INSTANCE_AVAILABILITY_UNSPECIFIED = 0; + /** + * Indicates that free instances are available to be created in this + * instance configuration. + * + * Generated from protobuf enum AVAILABLE = 1; + */ + const AVAILABLE = 1; + /** + * Indicates that free instances are not supported in this instance + * configuration. + * + * Generated from protobuf enum UNSUPPORTED = 2; + */ + const UNSUPPORTED = 2; + /** + * Indicates that free instances are currently not available to be created + * in this instance configuration. + * + * Generated from protobuf enum DISABLED = 3; + */ + const DISABLED = 3; + /** + * Indicates that additional free instances cannot be created in this + * instance configuration because the project has reached its limit of free + * instances. + * + * Generated from protobuf enum QUOTA_EXCEEDED = 4; + */ + const QUOTA_EXCEEDED = 4; + + private static $valueToName = [ + self::FREE_INSTANCE_AVAILABILITY_UNSPECIFIED => 'FREE_INSTANCE_AVAILABILITY_UNSPECIFIED', + self::AVAILABLE => 'AVAILABLE', + self::UNSUPPORTED => 'UNSUPPORTED', + self::DISABLED => 'DISABLED', + self::QUOTA_EXCEEDED => 'QUOTA_EXCEEDED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(FreeInstanceAvailability::class, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig_FreeInstanceAvailability::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/QuorumType.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/QuorumType.php new file mode 100644 index 000000000000..19b056f5c710 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/QuorumType.php @@ -0,0 +1,78 @@ +google.spanner.admin.instance.v1.InstanceConfig.QuorumType + */ +class QuorumType +{ + /** + * Quorum type not specified. + * + * Generated from protobuf enum QUORUM_TYPE_UNSPECIFIED = 0; + */ + const QUORUM_TYPE_UNSPECIFIED = 0; + /** + * An instance configuration tagged with `REGION` quorum type forms a write + * quorum in a single region. + * + * Generated from protobuf enum REGION = 1; + */ + const REGION = 1; + /** + * An instance configuration tagged with the `DUAL_REGION` quorum type forms + * a write quorum with exactly two read-write regions in a multi-region + * configuration. + * This instance configuration requires failover in the event of + * regional failures. + * + * Generated from protobuf enum DUAL_REGION = 2; + */ + const DUAL_REGION = 2; + /** + * An instance configuration tagged with the `MULTI_REGION` quorum type + * forms a write quorum from replicas that are spread across more than one + * region in a multi-region configuration. + * + * Generated from protobuf enum MULTI_REGION = 3; + */ + const MULTI_REGION = 3; + + private static $valueToName = [ + self::QUORUM_TYPE_UNSPECIFIED => 'QUORUM_TYPE_UNSPECIFIED', + self::REGION => 'REGION', + self::DUAL_REGION => 'DUAL_REGION', + self::MULTI_REGION => 'MULTI_REGION', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(QuorumType::class, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig_QuorumType::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/State.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/State.php new file mode 100644 index 000000000000..99a17baaa4f8 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/State.php @@ -0,0 +1,65 @@ +google.spanner.admin.instance.v1.InstanceConfig.State + */ +class State +{ + /** + * Not specified. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The instance configuration is still being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The instance configuration is fully created and ready to be used to + * create instances. + * + * Generated from protobuf enum READY = 2; + */ + const READY = 2; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::READY => 'READY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig_State::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/Type.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/Type.php new file mode 100644 index 000000000000..08f5079da568 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/Type.php @@ -0,0 +1,64 @@ +google.spanner.admin.instance.v1.InstanceConfig.Type + */ +class Type +{ + /** + * Unspecified. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Google-managed configuration. + * + * Generated from protobuf enum GOOGLE_MANAGED = 1; + */ + const GOOGLE_MANAGED = 1; + /** + * User-managed configuration. + * + * Generated from protobuf enum USER_MANAGED = 2; + */ + const USER_MANAGED = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::GOOGLE_MANAGED => 'GOOGLE_MANAGED', + self::USER_MANAGED => 'USER_MANAGED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig_Type::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstancePartition.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstancePartition.php new file mode 100644 index 000000000000..b912f776285f --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstancePartition.php @@ -0,0 +1,568 @@ +google.spanner.admin.instance.v1.InstancePartition + */ +class InstancePartition extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A unique identifier for the instance partition. Values are of the + * form + * `projects//instances//instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`. + * The final segment of the name must be between 2 and 64 characters in + * length. An instance partition's name cannot be changed after the instance + * partition is created. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Required. The name of the instance partition's configuration. Values are of + * the form `projects//instanceConfigs/`. See also + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and + * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. + * + * Generated from protobuf field string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $config = ''; + /** + * Required. The descriptive name for this instance partition as it appears in + * UIs. Must be unique per project and between 4 and 30 characters in length. + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + /** + * Output only. The current instance partition state. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The time at which the instance partition was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time at which the instance partition was most recently + * updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. The names of the databases that reference this + * instance partition. Referencing databases should share the parent instance. + * The existence of any referencing database prevents the instance partition + * from being deleted. + * + * Generated from protobuf field repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $referencing_databases; + /** + * Output only. Deprecated: This field is not populated. + * Output only. The names of the backups that reference this instance + * partition. Referencing backups should share the parent instance. The + * existence of any referencing backup prevents the instance partition from + * being deleted. + * + * Generated from protobuf field repeated string referencing_backups = 11 [deprecated = true, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @deprecated + */ + private $referencing_backups; + /** + * Used for optimistic concurrency control as a way + * to help prevent simultaneous updates of a instance partition from + * overwriting each other. It is strongly suggested that systems make use of + * the etag in the read-modify-write cycle to perform instance partition + * updates in order to avoid race conditions: An etag is returned in the + * response which contains instance partitions, and systems are expected to + * put that etag in the request to update instance partitions to ensure that + * their change will be applied to the same version of the instance partition. + * If no etag is provided in the call to update instance partition, then the + * existing instance partition is overwritten blindly. + * + * Generated from protobuf field string etag = 12; + */ + protected $etag = ''; + protected $compute_capacity; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. A unique identifier for the instance partition. Values are of the + * form + * `projects//instances//instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`. + * The final segment of the name must be between 2 and 64 characters in + * length. An instance partition's name cannot be changed after the instance + * partition is created. + * @type string $config + * Required. The name of the instance partition's configuration. Values are of + * the form `projects//instanceConfigs/`. See also + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and + * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. + * @type string $display_name + * Required. The descriptive name for this instance partition as it appears in + * UIs. Must be unique per project and between 4 and 30 characters in length. + * @type int $node_count + * The number of nodes allocated to this instance partition. + * Users can set the `node_count` field to specify the target number of + * nodes allocated to the instance partition. + * This may be zero in API responses for instance partitions that are not + * yet in state `READY`. + * @type int $processing_units + * The number of processing units allocated to this instance partition. + * Users can set the `processing_units` field to specify the target number + * of processing units allocated to the instance partition. + * This might be zero in API responses for instance partitions that are not + * yet in the `READY` state. + * @type int $state + * Output only. The current instance partition state. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time at which the instance partition was created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. The time at which the instance partition was most recently + * updated. + * @type array|\Google\Protobuf\Internal\RepeatedField $referencing_databases + * Output only. The names of the databases that reference this + * instance partition. Referencing databases should share the parent instance. + * The existence of any referencing database prevents the instance partition + * from being deleted. + * @type array|\Google\Protobuf\Internal\RepeatedField $referencing_backups + * Output only. Deprecated: This field is not populated. + * Output only. The names of the backups that reference this instance + * partition. Referencing backups should share the parent instance. The + * existence of any referencing backup prevents the instance partition from + * being deleted. + * @type string $etag + * Used for optimistic concurrency control as a way + * to help prevent simultaneous updates of a instance partition from + * overwriting each other. It is strongly suggested that systems make use of + * the etag in the read-modify-write cycle to perform instance partition + * updates in order to avoid race conditions: An etag is returned in the + * response which contains instance partitions, and systems are expected to + * put that etag in the request to update instance partitions to ensure that + * their change will be applied to the same version of the instance partition. + * If no etag is provided in the call to update instance partition, then the + * existing instance partition is overwritten blindly. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. A unique identifier for the instance partition. Values are of the + * form + * `projects//instances//instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`. + * The final segment of the name must be between 2 and 64 characters in + * length. An instance partition's name cannot be changed after the instance + * partition is created. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. A unique identifier for the instance partition. Values are of the + * form + * `projects//instances//instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`. + * The final segment of the name must be between 2 and 64 characters in + * length. An instance partition's name cannot be changed after the instance + * partition is created. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The name of the instance partition's configuration. Values are of + * the form `projects//instanceConfigs/`. See also + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and + * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. + * + * Generated from protobuf field string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getConfig() + { + return $this->config; + } + + /** + * Required. The name of the instance partition's configuration. Values are of + * the form `projects//instanceConfigs/`. See also + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and + * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. + * + * Generated from protobuf field string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setConfig($var) + { + GPBUtil::checkString($var, True); + $this->config = $var; + + return $this; + } + + /** + * Required. The descriptive name for this instance partition as it appears in + * UIs. Must be unique per project and between 4 and 30 characters in length. + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. The descriptive name for this instance partition as it appears in + * UIs. Must be unique per project and between 4 and 30 characters in length. + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The number of nodes allocated to this instance partition. + * Users can set the `node_count` field to specify the target number of + * nodes allocated to the instance partition. + * This may be zero in API responses for instance partitions that are not + * yet in state `READY`. + * + * Generated from protobuf field int32 node_count = 5; + * @return int + */ + public function getNodeCount() + { + return $this->readOneof(5); + } + + public function hasNodeCount() + { + return $this->hasOneof(5); + } + + /** + * The number of nodes allocated to this instance partition. + * Users can set the `node_count` field to specify the target number of + * nodes allocated to the instance partition. + * This may be zero in API responses for instance partitions that are not + * yet in state `READY`. + * + * Generated from protobuf field int32 node_count = 5; + * @param int $var + * @return $this + */ + public function setNodeCount($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * The number of processing units allocated to this instance partition. + * Users can set the `processing_units` field to specify the target number + * of processing units allocated to the instance partition. + * This might be zero in API responses for instance partitions that are not + * yet in the `READY` state. + * + * Generated from protobuf field int32 processing_units = 6; + * @return int + */ + public function getProcessingUnits() + { + return $this->readOneof(6); + } + + public function hasProcessingUnits() + { + return $this->hasOneof(6); + } + + /** + * The number of processing units allocated to this instance partition. + * Users can set the `processing_units` field to specify the target number + * of processing units allocated to the instance partition. + * This might be zero in API responses for instance partitions that are not + * yet in the `READY` state. + * + * Generated from protobuf field int32 processing_units = 6; + * @param int $var + * @return $this + */ + public function setProcessingUnits($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Output only. The current instance partition state. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current instance partition state. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The time at which the instance partition was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The time at which the instance partition was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The time at which the instance partition was most recently + * updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. The time at which the instance partition was most recently + * updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Output only. The names of the databases that reference this + * instance partition. Referencing databases should share the parent instance. + * The existence of any referencing database prevents the instance partition + * from being deleted. + * + * Generated from protobuf field repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReferencingDatabases() + { + return $this->referencing_databases; + } + + /** + * Output only. The names of the databases that reference this + * instance partition. Referencing databases should share the parent instance. + * The existence of any referencing database prevents the instance partition + * from being deleted. + * + * Generated from protobuf field repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReferencingDatabases($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->referencing_databases = $arr; + + return $this; + } + + /** + * Output only. Deprecated: This field is not populated. + * Output only. The names of the backups that reference this instance + * partition. Referencing backups should share the parent instance. The + * existence of any referencing backup prevents the instance partition from + * being deleted. + * + * Generated from protobuf field repeated string referencing_backups = 11 [deprecated = true, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getReferencingBackups() + { + @trigger_error('referencing_backups is deprecated.', E_USER_DEPRECATED); + return $this->referencing_backups; + } + + /** + * Output only. Deprecated: This field is not populated. + * Output only. The names of the backups that reference this instance + * partition. Referencing backups should share the parent instance. The + * existence of any referencing backup prevents the instance partition from + * being deleted. + * + * Generated from protobuf field repeated string referencing_backups = 11 [deprecated = true, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setReferencingBackups($var) + { + @trigger_error('referencing_backups is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->referencing_backups = $arr; + + return $this; + } + + /** + * Used for optimistic concurrency control as a way + * to help prevent simultaneous updates of a instance partition from + * overwriting each other. It is strongly suggested that systems make use of + * the etag in the read-modify-write cycle to perform instance partition + * updates in order to avoid race conditions: An etag is returned in the + * response which contains instance partitions, and systems are expected to + * put that etag in the request to update instance partitions to ensure that + * their change will be applied to the same version of the instance partition. + * If no etag is provided in the call to update instance partition, then the + * existing instance partition is overwritten blindly. + * + * Generated from protobuf field string etag = 12; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Used for optimistic concurrency control as a way + * to help prevent simultaneous updates of a instance partition from + * overwriting each other. It is strongly suggested that systems make use of + * the etag in the read-modify-write cycle to perform instance partition + * updates in order to avoid race conditions: An etag is returned in the + * response which contains instance partitions, and systems are expected to + * put that etag in the request to update instance partitions to ensure that + * their change will be applied to the same version of the instance partition. + * If no etag is provided in the call to update instance partition, then the + * existing instance partition is overwritten blindly. + * + * Generated from protobuf field string etag = 12; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * @return string + */ + public function getComputeCapacity() + { + return $this->whichOneof("compute_capacity"); + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstancePartition/State.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstancePartition/State.php new file mode 100644 index 000000000000..01cf1218b69e --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstancePartition/State.php @@ -0,0 +1,67 @@ +google.spanner.admin.instance.v1.InstancePartition.State + */ +class State +{ + /** + * Not specified. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The instance partition is still being created. Resources may not be + * available yet, and operations such as creating placements using this + * instance partition may not work. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The instance partition is fully created and ready to do work such as + * creating placements and using in databases. + * + * Generated from protobuf enum READY = 2; + */ + const READY = 2; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::CREATING => 'CREATING', + self::READY => 'READY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition_State::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigOperationsRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigOperationsRequest.php new file mode 100644 index 000000000000..4f688ae83d94 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigOperationsRequest.php @@ -0,0 +1,349 @@ +google.spanner.admin.instance.v1.ListInstanceConfigOperationsRequest + */ +class ListInstanceConfigOperationsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project of the instance configuration operations. + * Values are of the form `projects/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * An expression that filters the list of returned operations. + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the Operation are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata] + * is + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=` \ + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) + * AND` \ + * `(metadata.instance_config.name:custom-config) AND` \ + * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. + * * The instance configuration name contains "custom-config". + * * The operation started before 2021-03-28T14:50:00Z. + * * The operation resulted in an error. + * + * Generated from protobuf field string filter = 2; + */ + protected $filter = ''; + /** + * Number of operations to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse.next_page_token] + * from a previous + * [ListInstanceConfigOperationsResponse][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse] + * to the same `parent` and with the same `filter`. + * + * Generated from protobuf field string page_token = 4; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The project of the instance configuration operations. + * Values are of the form `projects/`. Please see + * {@see InstanceAdminClient::projectName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Instance\V1\ListInstanceConfigOperationsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The project of the instance configuration operations. + * Values are of the form `projects/`. + * @type string $filter + * An expression that filters the list of returned operations. + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the Operation are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata] + * is + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=` \ + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) + * AND` \ + * `(metadata.instance_config.name:custom-config) AND` \ + * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. + * * The instance configuration name contains "custom-config". + * * The operation started before 2021-03-28T14:50:00Z. + * * The operation resulted in an error. + * @type int $page_size + * Number of operations to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * @type string $page_token + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse.next_page_token] + * from a previous + * [ListInstanceConfigOperationsResponse][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse] + * to the same `parent` and with the same `filter`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The project of the instance configuration operations. + * Values are of the form `projects/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The project of the instance configuration operations. + * Values are of the form `projects/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * An expression that filters the list of returned operations. + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the Operation are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata] + * is + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=` \ + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) + * AND` \ + * `(metadata.instance_config.name:custom-config) AND` \ + * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. + * * The instance configuration name contains "custom-config". + * * The operation started before 2021-03-28T14:50:00Z. + * * The operation resulted in an error. + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * An expression that filters the list of returned operations. + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the Operation are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata] + * is + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=` \ + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) + * AND` \ + * `(metadata.instance_config.name:custom-config) AND` \ + * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. + * * The instance configuration name contains "custom-config". + * * The operation started before 2021-03-28T14:50:00Z. + * * The operation resulted in an error. + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Number of operations to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Number of operations to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse.next_page_token] + * from a previous + * [ListInstanceConfigOperationsResponse][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse] + * to the same `parent` and with the same `filter`. + * + * Generated from protobuf field string page_token = 4; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse.next_page_token] + * from a previous + * [ListInstanceConfigOperationsResponse][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse] + * to the same `parent` and with the same `filter`. + * + * Generated from protobuf field string page_token = 4; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigOperationsResponse.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigOperationsResponse.php new file mode 100644 index 000000000000..b21040c453ec --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigOperationsResponse.php @@ -0,0 +1,126 @@ +google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse + */ +class ListInstanceConfigOperationsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of matching instance configuration long-running operations. Each + * operation's name will be + * prefixed by the name of the instance configuration. The operation's + * metadata field type + * `metadata.type_url` describes the type of the metadata. + * + * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; + */ + private $operations; + /** + * `next_page_token` can be sent in a subsequent + * [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations] + * call to fetch more of the matching metadata. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\LongRunning\Operation>|\Google\Protobuf\Internal\RepeatedField $operations + * The list of matching instance configuration long-running operations. Each + * operation's name will be + * prefixed by the name of the instance configuration. The operation's + * metadata field type + * `metadata.type_url` describes the type of the metadata. + * @type string $next_page_token + * `next_page_token` can be sent in a subsequent + * [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations] + * call to fetch more of the matching metadata. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The list of matching instance configuration long-running operations. Each + * operation's name will be + * prefixed by the name of the instance configuration. The operation's + * metadata field type + * `metadata.type_url` describes the type of the metadata. + * + * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOperations() + { + return $this->operations; + } + + /** + * The list of matching instance configuration long-running operations. Each + * operation's name will be + * prefixed by the name of the instance configuration. The operation's + * metadata field type + * `metadata.type_url` describes the type of the metadata. + * + * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; + * @param array<\Google\LongRunning\Operation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOperations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\LongRunning\Operation::class); + $this->operations = $arr; + + return $this; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations] + * call to fetch more of the matching metadata. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations] + * call to fetch more of the matching metadata. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigsRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigsRequest.php new file mode 100644 index 000000000000..8a0b73a6192b --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigsRequest.php @@ -0,0 +1,176 @@ +google.spanner.admin.instance.v1.ListInstanceConfigsRequest + */ +class ListInstanceConfigsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the project for which a list of supported instance + * configurations is requested. Values are of the form + * `projects/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Number of instance configurations to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigsResponse.next_page_token] + * from a previous + * [ListInstanceConfigsResponse][google.spanner.admin.instance.v1.ListInstanceConfigsResponse]. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The name of the project for which a list of supported instance + * configurations is requested. Values are of the form + * `projects/`. Please see + * {@see InstanceAdminClient::projectName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Instance\V1\ListInstanceConfigsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the project for which a list of supported instance + * configurations is requested. Values are of the form + * `projects/`. + * @type int $page_size + * Number of instance configurations to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * @type string $page_token + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigsResponse.next_page_token] + * from a previous + * [ListInstanceConfigsResponse][google.spanner.admin.instance.v1.ListInstanceConfigsResponse]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the project for which a list of supported instance + * configurations is requested. Values are of the form + * `projects/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The name of the project for which a list of supported instance + * configurations is requested. Values are of the form + * `projects/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Number of instance configurations to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Number of instance configurations to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigsResponse.next_page_token] + * from a previous + * [ListInstanceConfigsResponse][google.spanner.admin.instance.v1.ListInstanceConfigsResponse]. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigsResponse.next_page_token] + * from a previous + * [ListInstanceConfigsResponse][google.spanner.admin.instance.v1.ListInstanceConfigsResponse]. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigsResponse.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigsResponse.php new file mode 100644 index 000000000000..73241c4da20d --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigsResponse.php @@ -0,0 +1,110 @@ +google.spanner.admin.instance.v1.ListInstanceConfigsResponse + */ +class ListInstanceConfigsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of requested instance configurations. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.InstanceConfig instance_configs = 1; + */ + private $instance_configs; + /** + * `next_page_token` can be sent in a subsequent + * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs] + * call to fetch more of the matching instance configurations. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig>|\Google\Protobuf\Internal\RepeatedField $instance_configs + * The list of requested instance configurations. + * @type string $next_page_token + * `next_page_token` can be sent in a subsequent + * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs] + * call to fetch more of the matching instance configurations. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The list of requested instance configurations. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.InstanceConfig instance_configs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInstanceConfigs() + { + return $this->instance_configs; + } + + /** + * The list of requested instance configurations. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.InstanceConfig instance_configs = 1; + * @param array<\Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInstanceConfigs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig::class); + $this->instance_configs = $arr; + + return $this; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs] + * call to fetch more of the matching instance configurations. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs] + * call to fetch more of the matching instance configurations. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionOperationsRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionOperationsRequest.php new file mode 100644 index 000000000000..7df93edd57dc --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionOperationsRequest.php @@ -0,0 +1,413 @@ +google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest + */ +class ListInstancePartitionOperationsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent instance of the instance partition operations. + * Values are of the form `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. An expression that filters the list of returned operations. + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the Operation are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] + * is + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=` \ + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) + * AND` \ + * `(metadata.instance_partition.name:custom-instance-partition) AND` \ + * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * * The instance partition name contains "custom-instance-partition". + * * The operation started before 2021-03-28T14:50:00Z. + * * The operation resulted in an error. + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Number of operations to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token] + * from a previous + * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse] + * to the same `parent` and with the same `filter`. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Deadline used while retrieving metadata for instance partition + * operations. Instance partitions whose operation metadata cannot be + * retrieved within this deadline will be added to + * [unreachable_instance_partitions][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions] + * in + * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]. + * + * Generated from protobuf field .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $instance_partition_deadline = null; + + /** + * @param string $parent Required. The parent instance of the instance partition operations. + * Values are of the form `projects//instances/`. Please see + * {@see InstanceAdminClient::instanceName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Instance\V1\ListInstancePartitionOperationsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent instance of the instance partition operations. + * Values are of the form `projects//instances/`. + * @type string $filter + * Optional. An expression that filters the list of returned operations. + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the Operation are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] + * is + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=` \ + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) + * AND` \ + * `(metadata.instance_partition.name:custom-instance-partition) AND` \ + * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * * The instance partition name contains "custom-instance-partition". + * * The operation started before 2021-03-28T14:50:00Z. + * * The operation resulted in an error. + * @type int $page_size + * Optional. Number of operations to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * @type string $page_token + * Optional. If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token] + * from a previous + * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse] + * to the same `parent` and with the same `filter`. + * @type \Google\Protobuf\Timestamp $instance_partition_deadline + * Optional. Deadline used while retrieving metadata for instance partition + * operations. Instance partitions whose operation metadata cannot be + * retrieved within this deadline will be added to + * [unreachable_instance_partitions][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions] + * in + * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent instance of the instance partition operations. + * Values are of the form `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent instance of the instance partition operations. + * Values are of the form `projects//instances/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. An expression that filters the list of returned operations. + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the Operation are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] + * is + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=` \ + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) + * AND` \ + * `(metadata.instance_partition.name:custom-instance-partition) AND` \ + * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * * The instance partition name contains "custom-instance-partition". + * * The operation started before 2021-03-28T14:50:00Z. + * * The operation resulted in an error. + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. An expression that filters the list of returned operations. + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * The following fields in the Operation are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] + * is + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=` \ + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) + * AND` \ + * `(metadata.instance_partition.name:custom-instance-partition) AND` \ + * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * * The instance partition name contains "custom-instance-partition". + * * The operation started before 2021-03-28T14:50:00Z. + * * The operation resulted in an error. + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Number of operations to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Number of operations to be returned in the response. If 0 or + * less, defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token] + * from a previous + * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse] + * to the same `parent` and with the same `filter`. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token] + * from a previous + * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse] + * to the same `parent` and with the same `filter`. + * + * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. Deadline used while retrieving metadata for instance partition + * operations. Instance partitions whose operation metadata cannot be + * retrieved within this deadline will be added to + * [unreachable_instance_partitions][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions] + * in + * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]. + * + * Generated from protobuf field .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getInstancePartitionDeadline() + { + return $this->instance_partition_deadline; + } + + public function hasInstancePartitionDeadline() + { + return isset($this->instance_partition_deadline); + } + + public function clearInstancePartitionDeadline() + { + unset($this->instance_partition_deadline); + } + + /** + * Optional. Deadline used while retrieving metadata for instance partition + * operations. Instance partitions whose operation metadata cannot be + * retrieved within this deadline will be added to + * [unreachable_instance_partitions][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions] + * in + * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]. + * + * Generated from protobuf field .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setInstancePartitionDeadline($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->instance_partition_deadline = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionOperationsResponse.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionOperationsResponse.php new file mode 100644 index 000000000000..06b112bd09d0 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionOperationsResponse.php @@ -0,0 +1,172 @@ +google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse + */ +class ListInstancePartitionOperationsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of matching instance partition long-running operations. Each + * operation's name will be + * prefixed by the instance partition's name. The operation's + * metadata field type + * `metadata.type_url` describes the type of the metadata. + * + * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; + */ + private $operations; + /** + * `next_page_token` can be sent in a subsequent + * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations] + * call to fetch more of the matching metadata. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * The list of unreachable instance partitions. + * It includes the names of instance partitions whose operation metadata could + * not be retrieved within + * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline]. + * + * Generated from protobuf field repeated string unreachable_instance_partitions = 3; + */ + private $unreachable_instance_partitions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\LongRunning\Operation>|\Google\Protobuf\Internal\RepeatedField $operations + * The list of matching instance partition long-running operations. Each + * operation's name will be + * prefixed by the instance partition's name. The operation's + * metadata field type + * `metadata.type_url` describes the type of the metadata. + * @type string $next_page_token + * `next_page_token` can be sent in a subsequent + * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations] + * call to fetch more of the matching metadata. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable_instance_partitions + * The list of unreachable instance partitions. + * It includes the names of instance partitions whose operation metadata could + * not be retrieved within + * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The list of matching instance partition long-running operations. Each + * operation's name will be + * prefixed by the instance partition's name. The operation's + * metadata field type + * `metadata.type_url` describes the type of the metadata. + * + * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOperations() + { + return $this->operations; + } + + /** + * The list of matching instance partition long-running operations. Each + * operation's name will be + * prefixed by the instance partition's name. The operation's + * metadata field type + * `metadata.type_url` describes the type of the metadata. + * + * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; + * @param array<\Google\LongRunning\Operation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOperations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\LongRunning\Operation::class); + $this->operations = $arr; + + return $this; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations] + * call to fetch more of the matching metadata. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations] + * call to fetch more of the matching metadata. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * The list of unreachable instance partitions. + * It includes the names of instance partitions whose operation metadata could + * not be retrieved within + * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline]. + * + * Generated from protobuf field repeated string unreachable_instance_partitions = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachableInstancePartitions() + { + return $this->unreachable_instance_partitions; + } + + /** + * The list of unreachable instance partitions. + * It includes the names of instance partitions whose operation metadata could + * not be retrieved within + * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline]. + * + * Generated from protobuf field repeated string unreachable_instance_partitions = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachableInstancePartitions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable_instance_partitions = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionsRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionsRequest.php new file mode 100644 index 000000000000..73977cce1e50 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionsRequest.php @@ -0,0 +1,245 @@ +google.spanner.admin.instance.v1.ListInstancePartitionsRequest + */ +class ListInstancePartitionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The instance whose instance partitions should be listed. Values + * are of the form `projects//instances/`. Use `{instance} + * = '-'` to list instance partitions for all Instances in a project, e.g., + * `projects/myproject/instances/-`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Number of instance partitions to be returned in the response. If 0 or less, + * defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token] + * from a previous + * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Optional. Deadline used while retrieving metadata for instance partitions. + * Instance partitions whose metadata cannot be retrieved within this deadline + * will be added to + * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable] + * in + * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. + * + * Generated from protobuf field .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $instance_partition_deadline = null; + + /** + * @param string $parent Required. The instance whose instance partitions should be listed. Values + * are of the form `projects//instances/`. Use `{instance} + * = '-'` to list instance partitions for all Instances in a project, e.g., + * `projects/myproject/instances/-`. Please see + * {@see InstanceAdminClient::instanceName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Instance\V1\ListInstancePartitionsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The instance whose instance partitions should be listed. Values + * are of the form `projects//instances/`. Use `{instance} + * = '-'` to list instance partitions for all Instances in a project, e.g., + * `projects/myproject/instances/-`. + * @type int $page_size + * Number of instance partitions to be returned in the response. If 0 or less, + * defaults to the server's maximum allowed page size. + * @type string $page_token + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token] + * from a previous + * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. + * @type \Google\Protobuf\Timestamp $instance_partition_deadline + * Optional. Deadline used while retrieving metadata for instance partitions. + * Instance partitions whose metadata cannot be retrieved within this deadline + * will be added to + * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable] + * in + * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The instance whose instance partitions should be listed. Values + * are of the form `projects//instances/`. Use `{instance} + * = '-'` to list instance partitions for all Instances in a project, e.g., + * `projects/myproject/instances/-`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The instance whose instance partitions should be listed. Values + * are of the form `projects//instances/`. Use `{instance} + * = '-'` to list instance partitions for all Instances in a project, e.g., + * `projects/myproject/instances/-`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Number of instance partitions to be returned in the response. If 0 or less, + * defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Number of instance partitions to be returned in the response. If 0 or less, + * defaults to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token] + * from a previous + * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token] + * from a previous + * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. Deadline used while retrieving metadata for instance partitions. + * Instance partitions whose metadata cannot be retrieved within this deadline + * will be added to + * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable] + * in + * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. + * + * Generated from protobuf field .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getInstancePartitionDeadline() + { + return $this->instance_partition_deadline; + } + + public function hasInstancePartitionDeadline() + { + return isset($this->instance_partition_deadline); + } + + public function clearInstancePartitionDeadline() + { + unset($this->instance_partition_deadline); + } + + /** + * Optional. Deadline used while retrieving metadata for instance partitions. + * Instance partitions whose metadata cannot be retrieved within this deadline + * will be added to + * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable] + * in + * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. + * + * Generated from protobuf field .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setInstancePartitionDeadline($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->instance_partition_deadline = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionsResponse.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionsResponse.php new file mode 100644 index 000000000000..1aa093dc210b --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionsResponse.php @@ -0,0 +1,156 @@ +google.spanner.admin.instance.v1.ListInstancePartitionsResponse + */ +class ListInstancePartitionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of requested instancePartitions. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + */ + private $instance_partitions; + /** + * `next_page_token` can be sent in a subsequent + * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions] + * call to fetch more of the matching instance partitions. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * The list of unreachable instances or instance partitions. + * It includes the names of instances or instance partitions whose metadata + * could not be retrieved within + * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline]. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition>|\Google\Protobuf\Internal\RepeatedField $instance_partitions + * The list of requested instancePartitions. + * @type string $next_page_token + * `next_page_token` can be sent in a subsequent + * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions] + * call to fetch more of the matching instance partitions. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * The list of unreachable instances or instance partitions. + * It includes the names of instances or instance partitions whose metadata + * could not be retrieved within + * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The list of requested instancePartitions. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInstancePartitions() + { + return $this->instance_partitions; + } + + /** + * The list of requested instancePartitions. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; + * @param array<\Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInstancePartitions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition::class); + $this->instance_partitions = $arr; + + return $this; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions] + * call to fetch more of the matching instance partitions. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions] + * call to fetch more of the matching instance partitions. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * The list of unreachable instances or instance partitions. + * It includes the names of instances or instance partitions whose metadata + * could not be retrieved within + * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline]. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * The list of unreachable instances or instance partitions. + * It includes the names of instances or instance partitions whose metadata + * could not be retrieved within + * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline]. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancesRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancesRequest.php new file mode 100644 index 000000000000..acf67c1d3534 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancesRequest.php @@ -0,0 +1,329 @@ +google.spanner.admin.instance.v1.ListInstancesRequest + */ +class ListInstancesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the project for which a list of instances is + * requested. Values are of the form `projects/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Number of instances to be returned in the response. If 0 or less, defaults + * to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.instance.v1.ListInstancesResponse.next_page_token] + * from a previous + * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * * `name` + * * `display_name` + * * `labels.key` where key is the name of a label + * Some examples of using filters are: + * * `name:*` --> The instance has a name. + * * `name:Howl` --> The instance's name contains the string "howl". + * * `name:HOWL` --> Equivalent to above. + * * `NAME:howl` --> Equivalent to above. + * * `labels.env:*` --> The instance has the label "env". + * * `labels.env:dev` --> The instance has the label "env" and the value of + * the label contains the string "dev". + * * `name:howl labels.env:dev` --> The instance's name contains "howl" and + * it has the label "env" with its value + * containing "dev". + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Deadline used while retrieving metadata for instances. + * Instances whose metadata cannot be retrieved within this deadline will be + * added to + * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable] + * in + * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. + * + * Generated from protobuf field .google.protobuf.Timestamp instance_deadline = 5; + */ + protected $instance_deadline = null; + + /** + * @param string $parent Required. The name of the project for which a list of instances is + * requested. Values are of the form `projects/`. Please see + * {@see InstanceAdminClient::projectName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\Admin\Instance\V1\ListInstancesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the project for which a list of instances is + * requested. Values are of the form `projects/`. + * @type int $page_size + * Number of instances to be returned in the response. If 0 or less, defaults + * to the server's maximum allowed page size. + * @type string $page_token + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.instance.v1.ListInstancesResponse.next_page_token] + * from a previous + * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. + * @type string $filter + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * * `name` + * * `display_name` + * * `labels.key` where key is the name of a label + * Some examples of using filters are: + * * `name:*` --> The instance has a name. + * * `name:Howl` --> The instance's name contains the string "howl". + * * `name:HOWL` --> Equivalent to above. + * * `NAME:howl` --> Equivalent to above. + * * `labels.env:*` --> The instance has the label "env". + * * `labels.env:dev` --> The instance has the label "env" and the value of + * the label contains the string "dev". + * * `name:howl labels.env:dev` --> The instance's name contains "howl" and + * it has the label "env" with its value + * containing "dev". + * @type \Google\Protobuf\Timestamp $instance_deadline + * Deadline used while retrieving metadata for instances. + * Instances whose metadata cannot be retrieved within this deadline will be + * added to + * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable] + * in + * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the project for which a list of instances is + * requested. Values are of the form `projects/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The name of the project for which a list of instances is + * requested. Values are of the form `projects/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Number of instances to be returned in the response. If 0 or less, defaults + * to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Number of instances to be returned in the response. If 0 or less, defaults + * to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.instance.v1.ListInstancesResponse.next_page_token] + * from a previous + * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.admin.instance.v1.ListInstancesResponse.next_page_token] + * from a previous + * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * * `name` + * * `display_name` + * * `labels.key` where key is the name of a label + * Some examples of using filters are: + * * `name:*` --> The instance has a name. + * * `name:Howl` --> The instance's name contains the string "howl". + * * `name:HOWL` --> Equivalent to above. + * * `NAME:howl` --> Equivalent to above. + * * `labels.env:*` --> The instance has the label "env". + * * `labels.env:dev` --> The instance has the label "env" and the value of + * the label contains the string "dev". + * * `name:howl labels.env:dev` --> The instance's name contains "howl" and + * it has the label "env" with its value + * containing "dev". + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * * `name` + * * `display_name` + * * `labels.key` where key is the name of a label + * Some examples of using filters are: + * * `name:*` --> The instance has a name. + * * `name:Howl` --> The instance's name contains the string "howl". + * * `name:HOWL` --> Equivalent to above. + * * `NAME:howl` --> Equivalent to above. + * * `labels.env:*` --> The instance has the label "env". + * * `labels.env:dev` --> The instance has the label "env" and the value of + * the label contains the string "dev". + * * `name:howl labels.env:dev` --> The instance's name contains "howl" and + * it has the label "env" with its value + * containing "dev". + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Deadline used while retrieving metadata for instances. + * Instances whose metadata cannot be retrieved within this deadline will be + * added to + * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable] + * in + * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. + * + * Generated from protobuf field .google.protobuf.Timestamp instance_deadline = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getInstanceDeadline() + { + return $this->instance_deadline; + } + + public function hasInstanceDeadline() + { + return isset($this->instance_deadline); + } + + public function clearInstanceDeadline() + { + unset($this->instance_deadline); + } + + /** + * Deadline used while retrieving metadata for instances. + * Instances whose metadata cannot be retrieved within this deadline will be + * added to + * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable] + * in + * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. + * + * Generated from protobuf field .google.protobuf.Timestamp instance_deadline = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setInstanceDeadline($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->instance_deadline = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancesResponse.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancesResponse.php new file mode 100644 index 000000000000..cc134da2aac1 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancesResponse.php @@ -0,0 +1,156 @@ +google.spanner.admin.instance.v1.ListInstancesResponse + */ +class ListInstancesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of requested instances. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.Instance instances = 1; + */ + private $instances; + /** + * `next_page_token` can be sent in a subsequent + * [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances] + * call to fetch more of the matching instances. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * The list of unreachable instances. + * It includes the names of instances whose metadata could not be retrieved + * within + * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline]. + * + * Generated from protobuf field repeated string unreachable = 3; + */ + private $unreachable; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Spanner\Admin\Instance\V1\Instance>|\Google\Protobuf\Internal\RepeatedField $instances + * The list of requested instances. + * @type string $next_page_token + * `next_page_token` can be sent in a subsequent + * [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances] + * call to fetch more of the matching instances. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * The list of unreachable instances. + * It includes the names of instances whose metadata could not be retrieved + * within + * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The list of requested instances. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.Instance instances = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInstances() + { + return $this->instances; + } + + /** + * The list of requested instances. + * + * Generated from protobuf field repeated .google.spanner.admin.instance.v1.Instance instances = 1; + * @param array<\Google\Cloud\Spanner\Admin\Instance\V1\Instance>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInstances($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Instance\V1\Instance::class); + $this->instances = $arr; + + return $this; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances] + * call to fetch more of the matching instances. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances] + * call to fetch more of the matching instances. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + + /** + * The list of unreachable instances. + * It includes the names of instances whose metadata could not be retrieved + * within + * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline]. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * The list of unreachable instances. + * It includes the names of instances whose metadata could not be retrieved + * within + * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline]. + * + * Generated from protobuf field repeated string unreachable = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUnreachable($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->unreachable = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceMetadata.php new file mode 100644 index 000000000000..e28ddbb7dc57 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceMetadata.php @@ -0,0 +1,176 @@ +google.spanner.admin.instance.v1.MoveInstanceMetadata + */ +class MoveInstanceMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The target instance configuration where to move the instance. + * Values are of the form `projects//instanceConfigs/`. + * + * Generated from protobuf field string target_config = 1; + */ + protected $target_config = ''; + /** + * The progress of the + * [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance] + * operation. + * [progress_percent][google.spanner.admin.instance.v1.OperationProgress.progress_percent] + * is reset when cancellation is requested. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.OperationProgress progress = 2; + */ + protected $progress = null; + /** + * The time at which this operation was cancelled. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + */ + protected $cancel_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $target_config + * The target instance configuration where to move the instance. + * Values are of the form `projects//instanceConfigs/`. + * @type \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress $progress + * The progress of the + * [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance] + * operation. + * [progress_percent][google.spanner.admin.instance.v1.OperationProgress.progress_percent] + * is reset when cancellation is requested. + * @type \Google\Protobuf\Timestamp $cancel_time + * The time at which this operation was cancelled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The target instance configuration where to move the instance. + * Values are of the form `projects//instanceConfigs/`. + * + * Generated from protobuf field string target_config = 1; + * @return string + */ + public function getTargetConfig() + { + return $this->target_config; + } + + /** + * The target instance configuration where to move the instance. + * Values are of the form `projects//instanceConfigs/`. + * + * Generated from protobuf field string target_config = 1; + * @param string $var + * @return $this + */ + public function setTargetConfig($var) + { + GPBUtil::checkString($var, True); + $this->target_config = $var; + + return $this; + } + + /** + * The progress of the + * [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance] + * operation. + * [progress_percent][google.spanner.admin.instance.v1.OperationProgress.progress_percent] + * is reset when cancellation is requested. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.OperationProgress progress = 2; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress|null + */ + public function getProgress() + { + return $this->progress; + } + + public function hasProgress() + { + return isset($this->progress); + } + + public function clearProgress() + { + unset($this->progress); + } + + /** + * The progress of the + * [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance] + * operation. + * [progress_percent][google.spanner.admin.instance.v1.OperationProgress.progress_percent] + * is reset when cancellation is requested. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.OperationProgress progress = 2; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress $var + * @return $this + */ + public function setProgress($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress::class); + $this->progress = $var; + + return $this; + } + + /** + * The time at which this operation was cancelled. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCancelTime() + { + return $this->cancel_time; + } + + public function hasCancelTime() + { + return isset($this->cancel_time); + } + + public function clearCancelTime() + { + unset($this->cancel_time); + } + + /** + * The time at which this operation was cancelled. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCancelTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->cancel_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceRequest.php new file mode 100644 index 000000000000..eb41cd923ea1 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceRequest.php @@ -0,0 +1,110 @@ +google.spanner.admin.instance.v1.MoveInstanceRequest + */ +class MoveInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The instance to move. + * Values are of the form `projects//instances/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. The target instance configuration where to move the instance. + * Values are of the form `projects//instanceConfigs/`. + * + * Generated from protobuf field string target_config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $target_config = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The instance to move. + * Values are of the form `projects//instances/`. + * @type string $target_config + * Required. The target instance configuration where to move the instance. + * Values are of the form `projects//instanceConfigs/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The instance to move. + * Values are of the form `projects//instances/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The instance to move. + * Values are of the form `projects//instances/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The target instance configuration where to move the instance. + * Values are of the form `projects//instanceConfigs/`. + * + * Generated from protobuf field string target_config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getTargetConfig() + { + return $this->target_config; + } + + /** + * Required. The target instance configuration where to move the instance. + * Values are of the form `projects//instanceConfigs/`. + * + * Generated from protobuf field string target_config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTargetConfig($var) + { + GPBUtil::checkString($var, True); + $this->target_config = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceResponse.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceResponse.php new file mode 100644 index 000000000000..650c679eb1ba --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceResponse.php @@ -0,0 +1,34 @@ +google.spanner.admin.instance.v1.MoveInstanceResponse + */ +class MoveInstanceResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/OperationProgress.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/OperationProgress.php new file mode 100644 index 000000000000..e6b2e6c751d6 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/OperationProgress.php @@ -0,0 +1,164 @@ +google.spanner.admin.instance.v1.OperationProgress + */ +class OperationProgress extends \Google\Protobuf\Internal\Message +{ + /** + * Percent completion of the operation. + * Values are between 0 and 100 inclusive. + * + * Generated from protobuf field int32 progress_percent = 1; + */ + protected $progress_percent = 0; + /** + * Time the request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + */ + protected $start_time = null; + /** + * If set, the time at which this operation failed or was completed + * successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + */ + protected $end_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $progress_percent + * Percent completion of the operation. + * Values are between 0 and 100 inclusive. + * @type \Google\Protobuf\Timestamp $start_time + * Time the request was received. + * @type \Google\Protobuf\Timestamp $end_time + * If set, the time at which this operation failed or was completed + * successfully. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * Percent completion of the operation. + * Values are between 0 and 100 inclusive. + * + * Generated from protobuf field int32 progress_percent = 1; + * @return int + */ + public function getProgressPercent() + { + return $this->progress_percent; + } + + /** + * Percent completion of the operation. + * Values are between 0 and 100 inclusive. + * + * Generated from protobuf field int32 progress_percent = 1; + * @param int $var + * @return $this + */ + public function setProgressPercent($var) + { + GPBUtil::checkInt32($var); + $this->progress_percent = $var; + + return $this; + } + + /** + * Time the request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Time the request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * If set, the time at which this operation failed or was completed + * successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * If set, the time at which this operation failed or was completed + * successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaComputeCapacity.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaComputeCapacity.php new file mode 100644 index 000000000000..551f8e34bf3a --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaComputeCapacity.php @@ -0,0 +1,169 @@ +google.spanner.admin.instance.v1.ReplicaComputeCapacity + */ +class ReplicaComputeCapacity extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Identifies replicas by specified properties. + * All replicas in the selection have the same amount of compute capacity. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $replica_selection = null; + protected $compute_capacity; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaSelection $replica_selection + * Required. Identifies replicas by specified properties. + * All replicas in the selection have the same amount of compute capacity. + * @type int $node_count + * The number of nodes allocated to each replica. + * This may be zero in API responses for instances that are not yet in + * state `READY`. + * @type int $processing_units + * The number of processing units allocated to each replica. + * This may be zero in API responses for instances that are not yet in + * state `READY`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. Identifies replicas by specified properties. + * All replicas in the selection have the same amount of compute capacity. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaSelection|null + */ + public function getReplicaSelection() + { + return $this->replica_selection; + } + + public function hasReplicaSelection() + { + return isset($this->replica_selection); + } + + public function clearReplicaSelection() + { + unset($this->replica_selection); + } + + /** + * Required. Identifies replicas by specified properties. + * All replicas in the selection have the same amount of compute capacity. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaSelection $var + * @return $this + */ + public function setReplicaSelection($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaSelection::class); + $this->replica_selection = $var; + + return $this; + } + + /** + * The number of nodes allocated to each replica. + * This may be zero in API responses for instances that are not yet in + * state `READY`. + * + * Generated from protobuf field int32 node_count = 2; + * @return int + */ + public function getNodeCount() + { + return $this->readOneof(2); + } + + public function hasNodeCount() + { + return $this->hasOneof(2); + } + + /** + * The number of nodes allocated to each replica. + * This may be zero in API responses for instances that are not yet in + * state `READY`. + * + * Generated from protobuf field int32 node_count = 2; + * @param int $var + * @return $this + */ + public function setNodeCount($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * The number of processing units allocated to each replica. + * This may be zero in API responses for instances that are not yet in + * state `READY`. + * + * Generated from protobuf field int32 processing_units = 3; + * @return int + */ + public function getProcessingUnits() + { + return $this->readOneof(3); + } + + public function hasProcessingUnits() + { + return $this->hasOneof(3); + } + + /** + * The number of processing units allocated to each replica. + * This may be zero in API responses for instances that are not yet in + * state `READY`. + * + * Generated from protobuf field int32 processing_units = 3; + * @param int $var + * @return $this + */ + public function setProcessingUnits($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getComputeCapacity() + { + return $this->whichOneof("compute_capacity"); + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaInfo.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaInfo.php new file mode 100644 index 000000000000..c15ef502635c --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaInfo.php @@ -0,0 +1,145 @@ +google.spanner.admin.instance.v1.ReplicaInfo + */ +class ReplicaInfo extends \Google\Protobuf\Internal\Message +{ + /** + * The location of the serving resources, e.g., "us-central1". + * + * Generated from protobuf field string location = 1; + */ + protected $location = ''; + /** + * The type of replica. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.ReplicaInfo.ReplicaType type = 2; + */ + protected $type = 0; + /** + * If true, this location is designated as the default leader location where + * leader replicas are placed. See the [region types + * documentation](https://cloud.google.com/spanner/docs/instances#region_types) + * for more details. + * + * Generated from protobuf field bool default_leader_location = 3; + */ + protected $default_leader_location = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $location + * The location of the serving resources, e.g., "us-central1". + * @type int $type + * The type of replica. + * @type bool $default_leader_location + * If true, this location is designated as the default leader location where + * leader replicas are placed. See the [region types + * documentation](https://cloud.google.com/spanner/docs/instances#region_types) + * for more details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The location of the serving resources, e.g., "us-central1". + * + * Generated from protobuf field string location = 1; + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * The location of the serving resources, e.g., "us-central1". + * + * Generated from protobuf field string location = 1; + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + + /** + * The type of replica. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.ReplicaInfo.ReplicaType type = 2; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The type of replica. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.ReplicaInfo.ReplicaType type = 2; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo\ReplicaType::class); + $this->type = $var; + + return $this; + } + + /** + * If true, this location is designated as the default leader location where + * leader replicas are placed. See the [region types + * documentation](https://cloud.google.com/spanner/docs/instances#region_types) + * for more details. + * + * Generated from protobuf field bool default_leader_location = 3; + * @return bool + */ + public function getDefaultLeaderLocation() + { + return $this->default_leader_location; + } + + /** + * If true, this location is designated as the default leader location where + * leader replicas are placed. See the [region types + * documentation](https://cloud.google.com/spanner/docs/instances#region_types) + * for more details. + * + * Generated from protobuf field bool default_leader_location = 3; + * @param bool $var + * @return $this + */ + public function setDefaultLeaderLocation($var) + { + GPBUtil::checkBool($var); + $this->default_leader_location = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaInfo/ReplicaType.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaInfo/ReplicaType.php new file mode 100644 index 000000000000..dbf12281acfc --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaInfo/ReplicaType.php @@ -0,0 +1,87 @@ +google.spanner.admin.instance.v1.ReplicaInfo.ReplicaType + */ +class ReplicaType +{ + /** + * Not specified. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Read-write replicas support both reads and writes. These replicas: + * * Maintain a full copy of your data. + * * Serve reads. + * * Can vote whether to commit a write. + * * Participate in leadership election. + * * Are eligible to become a leader. + * + * Generated from protobuf enum READ_WRITE = 1; + */ + const READ_WRITE = 1; + /** + * Read-only replicas only support reads (not writes). Read-only replicas: + * * Maintain a full copy of your data. + * * Serve reads. + * * Do not participate in voting to commit writes. + * * Are not eligible to become a leader. + * + * Generated from protobuf enum READ_ONLY = 2; + */ + const READ_ONLY = 2; + /** + * Witness replicas don't support reads but do participate in voting to + * commit writes. Witness replicas: + * * Do not maintain a full copy of data. + * * Do not serve reads. + * * Vote whether to commit writes. + * * Participate in leader election but are not eligible to become leader. + * + * Generated from protobuf enum WITNESS = 3; + */ + const WITNESS = 3; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::READ_WRITE => 'READ_WRITE', + self::READ_ONLY => 'READ_ONLY', + self::WITNESS => 'WITNESS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ReplicaType::class, \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo_ReplicaType::class); + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaSelection.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaSelection.php new file mode 100644 index 000000000000..3485719a4c58 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaSelection.php @@ -0,0 +1,67 @@ +google.spanner.admin.instance.v1.ReplicaSelection + */ +class ReplicaSelection extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the location of the replicas (e.g., "us-central1"). + * + * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $location = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $location + * Required. Name of the location of the replicas (e.g., "us-central1"). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\Common::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the location of the replicas (e.g., "us-central1"). + * + * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * Required. Name of the location of the replicas (e.g., "us-central1"). + * + * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceConfigMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceConfigMetadata.php new file mode 100644 index 000000000000..7f0c794b98c7 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceConfigMetadata.php @@ -0,0 +1,174 @@ +google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata + */ +class UpdateInstanceConfigMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The desired instance configuration after updating. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 1; + */ + protected $instance_config = null; + /** + * The progress of the + * [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig] + * operation. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.OperationProgress progress = 2; + */ + protected $progress = null; + /** + * The time at which this operation was cancelled. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + */ + protected $cancel_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $instance_config + * The desired instance configuration after updating. + * @type \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress $progress + * The progress of the + * [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig] + * operation. + * @type \Google\Protobuf\Timestamp $cancel_time + * The time at which this operation was cancelled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The desired instance configuration after updating. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 1; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig|null + */ + public function getInstanceConfig() + { + return $this->instance_config; + } + + public function hasInstanceConfig() + { + return isset($this->instance_config); + } + + public function clearInstanceConfig() + { + unset($this->instance_config); + } + + /** + * The desired instance configuration after updating. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 1; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $var + * @return $this + */ + public function setInstanceConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig::class); + $this->instance_config = $var; + + return $this; + } + + /** + * The progress of the + * [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig] + * operation. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.OperationProgress progress = 2; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress|null + */ + public function getProgress() + { + return $this->progress; + } + + public function hasProgress() + { + return isset($this->progress); + } + + public function clearProgress() + { + unset($this->progress); + } + + /** + * The progress of the + * [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig] + * operation. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.OperationProgress progress = 2; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress $var + * @return $this + */ + public function setProgress($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress::class); + $this->progress = $var; + + return $this; + } + + /** + * The time at which this operation was cancelled. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCancelTime() + { + return $this->cancel_time; + } + + public function hasCancelTime() + { + return isset($this->cancel_time); + } + + public function clearCancelTime() + { + unset($this->cancel_time); + } + + /** + * The time at which this operation was cancelled. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCancelTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->cancel_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceConfigRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceConfigRequest.php new file mode 100644 index 000000000000..c4078624f9fc --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceConfigRequest.php @@ -0,0 +1,230 @@ +google.spanner.admin.instance.v1.UpdateInstanceConfigRequest + */ +class UpdateInstanceConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The user instance configuration to update, which must always + * include the instance configuration name. Otherwise, only fields mentioned + * in + * [update_mask][google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask] + * need be included. To prevent conflicts of concurrent updates, + * [etag][google.spanner.admin.instance.v1.InstanceConfig.reconciling] can + * be used. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance_config = null; + /** + * Required. A mask specifying which fields in + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] should be + * updated. The field mask must always be specified; this prevents any future + * fields in [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] + * from being erased accidentally by clients that do not know about them. Only + * display_name and labels can be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $update_mask = null; + /** + * An option to validate, but not actually execute, a request, + * and provide the same response. + * + * Generated from protobuf field bool validate_only = 3; + */ + protected $validate_only = false; + + /** + * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $instanceConfig Required. The user instance configuration to update, which must always + * include the instance configuration name. Otherwise, only fields mentioned + * in + * [update_mask][google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask] + * need be included. To prevent conflicts of concurrent updates, + * [etag][google.spanner.admin.instance.v1.InstanceConfig.reconciling] can + * be used. + * @param \Google\Protobuf\FieldMask $updateMask Required. A mask specifying which fields in + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] should be + * updated. The field mask must always be specified; this prevents any future + * fields in [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] + * from being erased accidentally by clients that do not know about them. Only + * display_name and labels can be updated. + * + * @return \Google\Cloud\Spanner\Admin\Instance\V1\UpdateInstanceConfigRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $instanceConfig, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setInstanceConfig($instanceConfig) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $instance_config + * Required. The user instance configuration to update, which must always + * include the instance configuration name. Otherwise, only fields mentioned + * in + * [update_mask][google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask] + * need be included. To prevent conflicts of concurrent updates, + * [etag][google.spanner.admin.instance.v1.InstanceConfig.reconciling] can + * be used. + * @type \Google\Protobuf\FieldMask $update_mask + * Required. A mask specifying which fields in + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] should be + * updated. The field mask must always be specified; this prevents any future + * fields in [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] + * from being erased accidentally by clients that do not know about them. Only + * display_name and labels can be updated. + * @type bool $validate_only + * An option to validate, but not actually execute, a request, + * and provide the same response. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The user instance configuration to update, which must always + * include the instance configuration name. Otherwise, only fields mentioned + * in + * [update_mask][google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask] + * need be included. To prevent conflicts of concurrent updates, + * [etag][google.spanner.admin.instance.v1.InstanceConfig.reconciling] can + * be used. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig|null + */ + public function getInstanceConfig() + { + return $this->instance_config; + } + + public function hasInstanceConfig() + { + return isset($this->instance_config); + } + + public function clearInstanceConfig() + { + unset($this->instance_config); + } + + /** + * Required. The user instance configuration to update, which must always + * include the instance configuration name. Otherwise, only fields mentioned + * in + * [update_mask][google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask] + * need be included. To prevent conflicts of concurrent updates, + * [etag][google.spanner.admin.instance.v1.InstanceConfig.reconciling] can + * be used. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $var + * @return $this + */ + public function setInstanceConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig::class); + $this->instance_config = $var; + + return $this; + } + + /** + * Required. A mask specifying which fields in + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] should be + * updated. The field mask must always be specified; this prevents any future + * fields in [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] + * from being erased accidentally by clients that do not know about them. Only + * display_name and labels can be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Required. A mask specifying which fields in + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] should be + * updated. The field mask must always be specified; this prevents any future + * fields in [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] + * from being erased accidentally by clients that do not know about them. Only + * display_name and labels can be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * An option to validate, but not actually execute, a request, + * and provide the same response. + * + * Generated from protobuf field bool validate_only = 3; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * An option to validate, but not actually execute, a request, + * and provide the same response. + * + * Generated from protobuf field bool validate_only = 3; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceMetadata.php new file mode 100644 index 000000000000..75231230c5bc --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceMetadata.php @@ -0,0 +1,260 @@ +google.spanner.admin.instance.v1.UpdateInstanceMetadata + */ +class UpdateInstanceMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The desired end state of the update. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1; + */ + protected $instance = null; + /** + * The time at which + * [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance] + * request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + */ + protected $start_time = null; + /** + * The time at which this operation was cancelled. If set, this operation is + * in the process of undoing itself (which is guaranteed to succeed) and + * cannot be cancelled again. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + */ + protected $cancel_time = null; + /** + * The time at which this operation failed or was completed successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; + */ + protected $end_time = null; + /** + * The expected fulfillment period of this update operation. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.FulfillmentPeriod expected_fulfillment_period = 5; + */ + protected $expected_fulfillment_period = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\Admin\Instance\V1\Instance $instance + * The desired end state of the update. + * @type \Google\Protobuf\Timestamp $start_time + * The time at which + * [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance] + * request was received. + * @type \Google\Protobuf\Timestamp $cancel_time + * The time at which this operation was cancelled. If set, this operation is + * in the process of undoing itself (which is guaranteed to succeed) and + * cannot be cancelled again. + * @type \Google\Protobuf\Timestamp $end_time + * The time at which this operation failed or was completed successfully. + * @type int $expected_fulfillment_period + * The expected fulfillment period of this update operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The desired end state of the update. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\Instance|null + */ + public function getInstance() + { + return $this->instance; + } + + public function hasInstance() + { + return isset($this->instance); + } + + public function clearInstance() + { + unset($this->instance); + } + + /** + * The desired end state of the update. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\Instance $var + * @return $this + */ + public function setInstance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\Instance::class); + $this->instance = $var; + + return $this; + } + + /** + * The time at which + * [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance] + * request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * The time at which + * [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance] + * request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * The time at which this operation was cancelled. If set, this operation is + * in the process of undoing itself (which is guaranteed to succeed) and + * cannot be cancelled again. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCancelTime() + { + return $this->cancel_time; + } + + public function hasCancelTime() + { + return isset($this->cancel_time); + } + + public function clearCancelTime() + { + unset($this->cancel_time); + } + + /** + * The time at which this operation was cancelled. If set, this operation is + * in the process of undoing itself (which is guaranteed to succeed) and + * cannot be cancelled again. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCancelTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->cancel_time = $var; + + return $this; + } + + /** + * The time at which this operation failed or was completed successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time at which this operation failed or was completed successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * The expected fulfillment period of this update operation. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.FulfillmentPeriod expected_fulfillment_period = 5; + * @return int + */ + public function getExpectedFulfillmentPeriod() + { + return $this->expected_fulfillment_period; + } + + /** + * The expected fulfillment period of this update operation. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.FulfillmentPeriod expected_fulfillment_period = 5; + * @param int $var + * @return $this + */ + public function setExpectedFulfillmentPeriod($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\FulfillmentPeriod::class); + $this->expected_fulfillment_period = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstancePartitionMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstancePartitionMetadata.php new file mode 100644 index 000000000000..7d36e9dc23bd --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstancePartitionMetadata.php @@ -0,0 +1,226 @@ +google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata + */ +class UpdateInstancePartitionMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The desired end state of the update. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + */ + protected $instance_partition = null; + /** + * The time at which + * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition] + * request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + */ + protected $start_time = null; + /** + * The time at which this operation was cancelled. If set, this operation is + * in the process of undoing itself (which is guaranteed to succeed) and + * cannot be cancelled again. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + */ + protected $cancel_time = null; + /** + * The time at which this operation failed or was completed successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; + */ + protected $end_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $instance_partition + * The desired end state of the update. + * @type \Google\Protobuf\Timestamp $start_time + * The time at which + * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition] + * request was received. + * @type \Google\Protobuf\Timestamp $cancel_time + * The time at which this operation was cancelled. If set, this operation is + * in the process of undoing itself (which is guaranteed to succeed) and + * cannot be cancelled again. + * @type \Google\Protobuf\Timestamp $end_time + * The time at which this operation failed or was completed successfully. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The desired end state of the update. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition|null + */ + public function getInstancePartition() + { + return $this->instance_partition; + } + + public function hasInstancePartition() + { + return isset($this->instance_partition); + } + + public function clearInstancePartition() + { + unset($this->instance_partition); + } + + /** + * The desired end state of the update. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $var + * @return $this + */ + public function setInstancePartition($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition::class); + $this->instance_partition = $var; + + return $this; + } + + /** + * The time at which + * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition] + * request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * The time at which + * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition] + * request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * The time at which this operation was cancelled. If set, this operation is + * in the process of undoing itself (which is guaranteed to succeed) and + * cannot be cancelled again. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCancelTime() + { + return $this->cancel_time; + } + + public function hasCancelTime() + { + return isset($this->cancel_time); + } + + public function clearCancelTime() + { + unset($this->cancel_time); + } + + /** + * The time at which this operation was cancelled. If set, this operation is + * in the process of undoing itself (which is guaranteed to succeed) and + * cannot be cancelled again. + * + * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCancelTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->cancel_time = $var; + + return $this; + } + + /** + * The time at which this operation failed or was completed successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * The time at which this operation failed or was completed successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstancePartitionRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstancePartitionRequest.php new file mode 100644 index 000000000000..8cab2a4ee3fa --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstancePartitionRequest.php @@ -0,0 +1,177 @@ +google.spanner.admin.instance.v1.UpdateInstancePartitionRequest + */ +class UpdateInstancePartitionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The instance partition to update, which must always include the + * instance partition name. Otherwise, only fields mentioned in + * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask] + * need be included. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance_partition = null; + /** + * Required. A mask specifying which fields in + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] + * should be updated. The field mask must always be specified; this prevents + * any future fields in + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] + * from being erased accidentally by clients that do not know about them. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $field_mask = null; + + /** + * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $instancePartition Required. The instance partition to update, which must always include the + * instance partition name. Otherwise, only fields mentioned in + * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask] + * need be included. + * @param \Google\Protobuf\FieldMask $fieldMask Required. A mask specifying which fields in + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] + * should be updated. The field mask must always be specified; this prevents + * any future fields in + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] + * from being erased accidentally by clients that do not know about them. + * + * @return \Google\Cloud\Spanner\Admin\Instance\V1\UpdateInstancePartitionRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $instancePartition, \Google\Protobuf\FieldMask $fieldMask): self + { + return (new self()) + ->setInstancePartition($instancePartition) + ->setFieldMask($fieldMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $instance_partition + * Required. The instance partition to update, which must always include the + * instance partition name. Otherwise, only fields mentioned in + * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask] + * need be included. + * @type \Google\Protobuf\FieldMask $field_mask + * Required. A mask specifying which fields in + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] + * should be updated. The field mask must always be specified; this prevents + * any future fields in + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] + * from being erased accidentally by clients that do not know about them. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The instance partition to update, which must always include the + * instance partition name. Otherwise, only fields mentioned in + * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask] + * need be included. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition|null + */ + public function getInstancePartition() + { + return $this->instance_partition; + } + + public function hasInstancePartition() + { + return isset($this->instance_partition); + } + + public function clearInstancePartition() + { + unset($this->instance_partition); + } + + /** + * Required. The instance partition to update, which must always include the + * instance partition name. Otherwise, only fields mentioned in + * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask] + * need be included. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $var + * @return $this + */ + public function setInstancePartition($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition::class); + $this->instance_partition = $var; + + return $this; + } + + /** + * Required. A mask specifying which fields in + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] + * should be updated. The field mask must always be specified; this prevents + * any future fields in + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] + * from being erased accidentally by clients that do not know about them. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getFieldMask() + { + return $this->field_mask; + } + + public function hasFieldMask() + { + return isset($this->field_mask); + } + + public function clearFieldMask() + { + unset($this->field_mask); + } + + /** + * Required. A mask specifying which fields in + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] + * should be updated. The field mask must always be specified; this prevents + * any future fields in + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] + * from being erased accidentally by clients that do not know about them. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setFieldMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->field_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceRequest.php new file mode 100644 index 000000000000..f787f2e812ec --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceRequest.php @@ -0,0 +1,172 @@ +google.spanner.admin.instance.v1.UpdateInstanceRequest + */ +class UpdateInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The instance to update, which must always include the instance + * name. Otherwise, only fields mentioned in + * [field_mask][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] + * need be included. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance = null; + /** + * Required. A mask specifying which fields in + * [Instance][google.spanner.admin.instance.v1.Instance] should be updated. + * The field mask must always be specified; this prevents any future fields in + * [Instance][google.spanner.admin.instance.v1.Instance] from being erased + * accidentally by clients that do not know about them. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $field_mask = null; + + /** + * @param \Google\Cloud\Spanner\Admin\Instance\V1\Instance $instance Required. The instance to update, which must always include the instance + * name. Otherwise, only fields mentioned in + * [field_mask][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] + * need be included. + * @param \Google\Protobuf\FieldMask $fieldMask Required. A mask specifying which fields in + * [Instance][google.spanner.admin.instance.v1.Instance] should be updated. + * The field mask must always be specified; this prevents any future fields in + * [Instance][google.spanner.admin.instance.v1.Instance] from being erased + * accidentally by clients that do not know about them. + * + * @return \Google\Cloud\Spanner\Admin\Instance\V1\UpdateInstanceRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Spanner\Admin\Instance\V1\Instance $instance, \Google\Protobuf\FieldMask $fieldMask): self + { + return (new self()) + ->setInstance($instance) + ->setFieldMask($fieldMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\Admin\Instance\V1\Instance $instance + * Required. The instance to update, which must always include the instance + * name. Otherwise, only fields mentioned in + * [field_mask][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] + * need be included. + * @type \Google\Protobuf\FieldMask $field_mask + * Required. A mask specifying which fields in + * [Instance][google.spanner.admin.instance.v1.Instance] should be updated. + * The field mask must always be specified; this prevents any future fields in + * [Instance][google.spanner.admin.instance.v1.Instance] from being erased + * accidentally by clients that do not know about them. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The instance to update, which must always include the instance + * name. Otherwise, only fields mentioned in + * [field_mask][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] + * need be included. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\Instance|null + */ + public function getInstance() + { + return $this->instance; + } + + public function hasInstance() + { + return isset($this->instance); + } + + public function clearInstance() + { + unset($this->instance); + } + + /** + * Required. The instance to update, which must always include the instance + * name. Otherwise, only fields mentioned in + * [field_mask][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] + * need be included. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\Instance $var + * @return $this + */ + public function setInstance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\Instance::class); + $this->instance = $var; + + return $this; + } + + /** + * Required. A mask specifying which fields in + * [Instance][google.spanner.admin.instance.v1.Instance] should be updated. + * The field mask must always be specified; this prevents any future fields in + * [Instance][google.spanner.admin.instance.v1.Instance] from being erased + * accidentally by clients that do not know about them. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getFieldMask() + { + return $this->field_mask; + } + + public function hasFieldMask() + { + return isset($this->field_mask); + } + + public function clearFieldMask() + { + unset($this->field_mask); + } + + /** + * Required. A mask specifying which fields in + * [Instance][google.spanner.admin.instance.v1.Instance] should be updated. + * The field mask must always be specified; this prevents any future fields in + * [Instance][google.spanner.admin.instance.v1.Instance] from being erased + * accidentally by clients that do not know about them. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setFieldMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->field_mask = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance.php new file mode 100644 index 000000000000..c3d315021f0d --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance.php @@ -0,0 +1,155 @@ +/operations/` and + * can be used to track creation of the instance. The + * metadata field type is + * [CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata]. + * The response field type is + * [Instance][google.spanner.admin.instance.v1.Instance], if successful. + * + * @param string $formattedParent The name of the project in which to create the instance. Values + * are of the form `projects/`. Please see + * {@see InstanceAdminClient::projectName()} for help formatting this field. + * @param string $instanceId The ID of the instance to create. Valid identifiers are of the + * form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in + * length. + * @param string $instanceName A unique identifier for the instance, which cannot be changed + * after the instance is created. Values are of the form + * `projects//instances/[a-z][-a-z0-9]*[a-z0-9]`. The final + * segment of the name must be between 2 and 64 characters in length. + * @param string $formattedInstanceConfig The name of the instance's configuration. Values are of the form + * `projects//instanceConfigs/`. See + * also [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and + * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. Please see + * {@see InstanceAdminClient::instanceConfigName()} for help formatting this field. + * @param string $instanceDisplayName The descriptive name for this instance as it appears in UIs. + * Must be unique per project and between 4 and 30 characters in length. + */ +function create_instance_sample( + string $formattedParent, + string $instanceId, + string $instanceName, + string $formattedInstanceConfig, + string $instanceDisplayName +): void { + // Create a client. + $instanceAdminClient = new InstanceAdminClient(); + + // Prepare the request message. + $instance = (new Instance()) + ->setName($instanceName) + ->setConfig($formattedInstanceConfig) + ->setDisplayName($instanceDisplayName); + $request = (new CreateInstanceRequest()) + ->setParent($formattedParent) + ->setInstanceId($instanceId) + ->setInstance($instance); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $instanceAdminClient->createInstance($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Instance $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = InstanceAdminClient::projectName('[PROJECT]'); + $instanceId = '[INSTANCE_ID]'; + $instanceName = '[NAME]'; + $formattedInstanceConfig = InstanceAdminClient::instanceConfigName( + '[PROJECT]', + '[INSTANCE_CONFIG]' + ); + $instanceDisplayName = '[DISPLAY_NAME]'; + + create_instance_sample( + $formattedParent, + $instanceId, + $instanceName, + $formattedInstanceConfig, + $instanceDisplayName + ); +} +// [END spanner_v1_generated_InstanceAdmin_CreateInstance_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance_config.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance_config.php new file mode 100644 index 000000000000..a84bb609082a --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance_config.php @@ -0,0 +1,132 @@ +/operations/` and can be used to track + * creation of the instance configuration. The + * metadata field type is + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. + * The response field type is + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if + * successful. + * + * Authorization requires `spanner.instanceConfigs.create` permission on + * the resource + * [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.parent]. + * + * @param string $formattedParent The name of the project in which to create the instance + * configuration. Values are of the form `projects/`. Please see + * {@see InstanceAdminClient::projectName()} for help formatting this field. + * @param string $instanceConfigId The ID of the instance configuration to create. Valid identifiers + * are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + * characters in length. The `custom-` prefix is required to avoid name + * conflicts with Google-managed configurations. + */ +function create_instance_config_sample(string $formattedParent, string $instanceConfigId): void +{ + // Create a client. + $instanceAdminClient = new InstanceAdminClient(); + + // Prepare the request message. + $instanceConfig = new InstanceConfig(); + $request = (new CreateInstanceConfigRequest()) + ->setParent($formattedParent) + ->setInstanceConfigId($instanceConfigId) + ->setInstanceConfig($instanceConfig); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $instanceAdminClient->createInstanceConfig($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var InstanceConfig $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = InstanceAdminClient::projectName('[PROJECT]'); + $instanceConfigId = '[INSTANCE_CONFIG_ID]'; + + create_instance_config_sample($formattedParent, $instanceConfigId); +} +// [END spanner_v1_generated_InstanceAdmin_CreateInstanceConfig_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance_partition.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance_partition.php new file mode 100644 index 000000000000..09ac8d5ecbf3 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance_partition.php @@ -0,0 +1,161 @@ +/operations/` and can be used to + * track creation of the instance partition. The + * metadata field type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * The response field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if + * successful. + * + * @param string $formattedParent The name of the instance in which to create the instance + * partition. Values are of the form + * `projects//instances/`. Please see + * {@see InstanceAdminClient::instanceName()} for help formatting this field. + * @param string $instancePartitionId The ID of the instance partition to create. Valid identifiers are + * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + * characters in length. + * @param string $instancePartitionName A unique identifier for the instance partition. Values are of the + * form + * `projects//instances//instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`. + * The final segment of the name must be between 2 and 64 characters in + * length. An instance partition's name cannot be changed after the instance + * partition is created. + * @param string $formattedInstancePartitionConfig The name of the instance partition's configuration. Values are of + * the form `projects//instanceConfigs/`. See also + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and + * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. Please see + * {@see InstanceAdminClient::instanceConfigName()} for help formatting this field. + * @param string $instancePartitionDisplayName The descriptive name for this instance partition as it appears in + * UIs. Must be unique per project and between 4 and 30 characters in length. + */ +function create_instance_partition_sample( + string $formattedParent, + string $instancePartitionId, + string $instancePartitionName, + string $formattedInstancePartitionConfig, + string $instancePartitionDisplayName +): void { + // Create a client. + $instanceAdminClient = new InstanceAdminClient(); + + // Prepare the request message. + $instancePartition = (new InstancePartition()) + ->setName($instancePartitionName) + ->setConfig($formattedInstancePartitionConfig) + ->setDisplayName($instancePartitionDisplayName); + $request = (new CreateInstancePartitionRequest()) + ->setParent($formattedParent) + ->setInstancePartitionId($instancePartitionId) + ->setInstancePartition($instancePartition); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $instanceAdminClient->createInstancePartition($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var InstancePartition $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = InstanceAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); + $instancePartitionId = '[INSTANCE_PARTITION_ID]'; + $instancePartitionName = '[NAME]'; + $formattedInstancePartitionConfig = InstanceAdminClient::instanceConfigName( + '[PROJECT]', + '[INSTANCE_CONFIG]' + ); + $instancePartitionDisplayName = '[DISPLAY_NAME]'; + + create_instance_partition_sample( + $formattedParent, + $instancePartitionId, + $instancePartitionName, + $formattedInstancePartitionConfig, + $instancePartitionDisplayName + ); +} +// [END spanner_v1_generated_InstanceAdmin_CreateInstancePartition_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance.php new file mode 100644 index 000000000000..acf410ee2dd3 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance.php @@ -0,0 +1,80 @@ +/instances/` + * Please see {@see InstanceAdminClient::instanceName()} for help formatting this field. + */ +function delete_instance_sample(string $formattedName): void +{ + // Create a client. + $instanceAdminClient = new InstanceAdminClient(); + + // Prepare the request message. + $request = (new DeleteInstanceRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + $instanceAdminClient->deleteInstance($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = InstanceAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); + + delete_instance_sample($formattedName); +} +// [END spanner_v1_generated_InstanceAdmin_DeleteInstance_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance_config.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance_config.php new file mode 100644 index 000000000000..e017057244f2 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance_config.php @@ -0,0 +1,78 @@ +/instanceConfigs/` + * Please see {@see InstanceAdminClient::instanceConfigName()} for help formatting this field. + */ +function delete_instance_config_sample(string $formattedName): void +{ + // Create a client. + $instanceAdminClient = new InstanceAdminClient(); + + // Prepare the request message. + $request = (new DeleteInstanceConfigRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + $instanceAdminClient->deleteInstanceConfig($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = InstanceAdminClient::instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + + delete_instance_config_sample($formattedName); +} +// [END spanner_v1_generated_InstanceAdmin_DeleteInstanceConfig_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance_partition.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance_partition.php new file mode 100644 index 000000000000..fd8162657462 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance_partition.php @@ -0,0 +1,81 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $instanceAdminClient->deleteInstancePartition($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = InstanceAdminClient::instancePartitionName( + '[PROJECT]', + '[INSTANCE]', + '[INSTANCE_PARTITION]' + ); + + delete_instance_partition_sample($formattedName); +} +// [END spanner_v1_generated_InstanceAdmin_DeleteInstancePartition_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_iam_policy.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_iam_policy.php new file mode 100644 index 000000000000..617ecc2df332 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_iam_policy.php @@ -0,0 +1,75 @@ +setResource($resource); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $instanceAdminClient->getIamPolicy($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + + get_iam_policy_sample($resource); +} +// [END spanner_v1_generated_InstanceAdmin_GetIamPolicy_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance.php new file mode 100644 index 000000000000..2ab84c8c825c --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance.php @@ -0,0 +1,72 @@ +/instances/`. Please see + * {@see InstanceAdminClient::instanceName()} for help formatting this field. + */ +function get_instance_sample(string $formattedName): void +{ + // Create a client. + $instanceAdminClient = new InstanceAdminClient(); + + // Prepare the request message. + $request = (new GetInstanceRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Instance $response */ + $response = $instanceAdminClient->getInstance($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = InstanceAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); + + get_instance_sample($formattedName); +} +// [END spanner_v1_generated_InstanceAdmin_GetInstance_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance_config.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance_config.php new file mode 100644 index 000000000000..087415caa6da --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance_config.php @@ -0,0 +1,72 @@ +/instanceConfigs/`. Please see + * {@see InstanceAdminClient::instanceConfigName()} for help formatting this field. + */ +function get_instance_config_sample(string $formattedName): void +{ + // Create a client. + $instanceAdminClient = new InstanceAdminClient(); + + // Prepare the request message. + $request = (new GetInstanceConfigRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var InstanceConfig $response */ + $response = $instanceAdminClient->getInstanceConfig($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = InstanceAdminClient::instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + + get_instance_config_sample($formattedName); +} +// [END spanner_v1_generated_InstanceAdmin_GetInstanceConfig_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance_partition.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance_partition.php new file mode 100644 index 000000000000..54ee5059cd63 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance_partition.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var InstancePartition $response */ + $response = $instanceAdminClient->getInstancePartition($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = InstanceAdminClient::instancePartitionName( + '[PROJECT]', + '[INSTANCE]', + '[INSTANCE_PARTITION]' + ); + + get_instance_partition_sample($formattedName); +} +// [END spanner_v1_generated_InstanceAdmin_GetInstancePartition_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_config_operations.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_config_operations.php new file mode 100644 index 000000000000..cdd490164b0f --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_config_operations.php @@ -0,0 +1,87 @@ +/instanceConfigs//operations/`. + * The long-running operation + * metadata field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that have completed/failed/canceled within the last 7 days, + * and pending operations. Operations returned are ordered by + * `operation.metadata.value.start_time` in descending order starting + * from the most recently started operation. + * + * @param string $formattedParent The project of the instance configuration operations. + * Values are of the form `projects/`. Please see + * {@see InstanceAdminClient::projectName()} for help formatting this field. + */ +function list_instance_config_operations_sample(string $formattedParent): void +{ + // Create a client. + $instanceAdminClient = new InstanceAdminClient(); + + // Prepare the request message. + $request = (new ListInstanceConfigOperationsRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $instanceAdminClient->listInstanceConfigOperations($request); + + /** @var Operation $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = InstanceAdminClient::projectName('[PROJECT]'); + + list_instance_config_operations_sample($formattedParent); +} +// [END spanner_v1_generated_InstanceAdmin_ListInstanceConfigOperations_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_configs.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_configs.php new file mode 100644 index 000000000000..a68208ba7873 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_configs.php @@ -0,0 +1,81 @@ +`. Please see + * {@see InstanceAdminClient::projectName()} for help formatting this field. + */ +function list_instance_configs_sample(string $formattedParent): void +{ + // Create a client. + $instanceAdminClient = new InstanceAdminClient(); + + // Prepare the request message. + $request = (new ListInstanceConfigsRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $instanceAdminClient->listInstanceConfigs($request); + + /** @var InstanceConfig $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = InstanceAdminClient::projectName('[PROJECT]'); + + list_instance_configs_sample($formattedParent); +} +// [END spanner_v1_generated_InstanceAdmin_ListInstanceConfigs_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_partition_operations.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_partition_operations.php new file mode 100644 index 000000000000..0ef611f61375 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_partition_operations.php @@ -0,0 +1,90 @@ +/instances//instancePartitions//operations/`. + * The long-running operation + * metadata field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that have completed/failed/canceled within the last 7 days, + * and pending operations. Operations returned are ordered by + * `operation.metadata.value.start_time` in descending order starting from the + * most recently started operation. + * + * Authorization requires `spanner.instancePartitionOperations.list` + * permission on the resource + * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]. + * + * @param string $formattedParent The parent instance of the instance partition operations. + * Values are of the form `projects//instances/`. Please see + * {@see InstanceAdminClient::instanceName()} for help formatting this field. + */ +function list_instance_partition_operations_sample(string $formattedParent): void +{ + // Create a client. + $instanceAdminClient = new InstanceAdminClient(); + + // Prepare the request message. + $request = (new ListInstancePartitionOperationsRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $instanceAdminClient->listInstancePartitionOperations($request); + + /** @var Operation $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = InstanceAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); + + list_instance_partition_operations_sample($formattedParent); +} +// [END spanner_v1_generated_InstanceAdmin_ListInstancePartitionOperations_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_partitions.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_partitions.php new file mode 100644 index 000000000000..a8651e105f97 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_partitions.php @@ -0,0 +1,79 @@ +/instances/`. Use `{instance} + * = '-'` to list instance partitions for all Instances in a project, e.g., + * `projects/myproject/instances/-`. Please see + * {@see InstanceAdminClient::instanceName()} for help formatting this field. + */ +function list_instance_partitions_sample(string $formattedParent): void +{ + // Create a client. + $instanceAdminClient = new InstanceAdminClient(); + + // Prepare the request message. + $request = (new ListInstancePartitionsRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $instanceAdminClient->listInstancePartitions($request); + + /** @var InstancePartition $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = InstanceAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); + + list_instance_partitions_sample($formattedParent); +} +// [END spanner_v1_generated_InstanceAdmin_ListInstancePartitions_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instances.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instances.php new file mode 100644 index 000000000000..4017eba45eef --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instances.php @@ -0,0 +1,77 @@ +`. Please see + * {@see InstanceAdminClient::projectName()} for help formatting this field. + */ +function list_instances_sample(string $formattedParent): void +{ + // Create a client. + $instanceAdminClient = new InstanceAdminClient(); + + // Prepare the request message. + $request = (new ListInstancesRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $instanceAdminClient->listInstances($request); + + /** @var Instance $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = InstanceAdminClient::projectName('[PROJECT]'); + + list_instances_sample($formattedParent); +} +// [END spanner_v1_generated_InstanceAdmin_ListInstances_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/move_instance.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/move_instance.php new file mode 100644 index 000000000000..b8dd949e9572 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/move_instance.php @@ -0,0 +1,149 @@ +/operations/` and can be used to track + * the move instance operation. The + * metadata field type is + * [MoveInstanceMetadata][google.spanner.admin.instance.v1.MoveInstanceMetadata]. + * The response field type is + * [Instance][google.spanner.admin.instance.v1.Instance], + * if successful. + * Cancelling the operation sets its metadata's + * [cancel_time][google.spanner.admin.instance.v1.MoveInstanceMetadata.cancel_time]. + * Cancellation is not immediate because it involves moving any data + * previously moved to the target instance configuration back to the original + * instance configuration. You can use this operation to track the progress of + * the cancellation. Upon successful completion of the cancellation, the + * operation terminates with `CANCELLED` status. + * + * If not cancelled, upon completion of the returned operation: + * + * * The instance successfully moves to the target instance + * configuration. + * * You are billed for compute and storage in target instance + * configuration. + * + * Authorization requires the `spanner.instances.update` permission on + * the resource [instance][google.spanner.admin.instance.v1.Instance]. + * + * For more details, see + * [Move an instance](https://cloud.google.com/spanner/docs/move-instance). + * + * @param string $formattedName The instance to move. + * Values are of the form `projects//instances/`. Please see + * {@see InstanceAdminClient::instanceName()} for help formatting this field. + * @param string $formattedTargetConfig The target instance configuration where to move the instance. + * Values are of the form `projects//instanceConfigs/`. Please see + * {@see InstanceAdminClient::instanceConfigName()} for help formatting this field. + */ +function move_instance_sample(string $formattedName, string $formattedTargetConfig): void +{ + // Create a client. + $instanceAdminClient = new InstanceAdminClient(); + + // Prepare the request message. + $request = (new MoveInstanceRequest()) + ->setName($formattedName) + ->setTargetConfig($formattedTargetConfig); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $instanceAdminClient->moveInstance($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var MoveInstanceResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = InstanceAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); + $formattedTargetConfig = InstanceAdminClient::instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + + move_instance_sample($formattedName, $formattedTargetConfig); +} +// [END spanner_v1_generated_InstanceAdmin_MoveInstance_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/set_iam_policy.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/set_iam_policy.php new file mode 100644 index 000000000000..29f85e9f6741 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/set_iam_policy.php @@ -0,0 +1,77 @@ +setResource($resource) + ->setPolicy($policy); + + // Call the API and handle any network failures. + try { + /** @var Policy $response */ + $response = $instanceAdminClient->setIamPolicy($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + + set_iam_policy_sample($resource); +} +// [END spanner_v1_generated_InstanceAdmin_SetIamPolicy_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/test_iam_permissions.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/test_iam_permissions.php new file mode 100644 index 000000000000..583d9f9dc77c --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/test_iam_permissions.php @@ -0,0 +1,83 @@ +setResource($resource) + ->setPermissions($permissions); + + // Call the API and handle any network failures. + try { + /** @var TestIamPermissionsResponse $response */ + $response = $instanceAdminClient->testIamPermissions($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $resource = '[RESOURCE]'; + $permissionsElement = '[PERMISSIONS]'; + + test_iam_permissions_sample($resource, $permissionsElement); +} +// [END spanner_v1_generated_InstanceAdmin_TestIamPermissions_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance.php new file mode 100644 index 000000000000..f30c0c375cbc --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance.php @@ -0,0 +1,145 @@ +/operations/` and + * can be used to track the instance modification. The + * metadata field type is + * [UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. + * The response field type is + * [Instance][google.spanner.admin.instance.v1.Instance], if successful. + * + * Authorization requires `spanner.instances.update` permission on + * the resource [name][google.spanner.admin.instance.v1.Instance.name]. + * + * @param string $instanceName A unique identifier for the instance, which cannot be changed + * after the instance is created. Values are of the form + * `projects//instances/[a-z][-a-z0-9]*[a-z0-9]`. The final + * segment of the name must be between 2 and 64 characters in length. + * @param string $formattedInstanceConfig The name of the instance's configuration. Values are of the form + * `projects//instanceConfigs/`. See + * also [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and + * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. Please see + * {@see InstanceAdminClient::instanceConfigName()} for help formatting this field. + * @param string $instanceDisplayName The descriptive name for this instance as it appears in UIs. + * Must be unique per project and between 4 and 30 characters in length. + */ +function update_instance_sample( + string $instanceName, + string $formattedInstanceConfig, + string $instanceDisplayName +): void { + // Create a client. + $instanceAdminClient = new InstanceAdminClient(); + + // Prepare the request message. + $instance = (new Instance()) + ->setName($instanceName) + ->setConfig($formattedInstanceConfig) + ->setDisplayName($instanceDisplayName); + $fieldMask = new FieldMask(); + $request = (new UpdateInstanceRequest()) + ->setInstance($instance) + ->setFieldMask($fieldMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $instanceAdminClient->updateInstance($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Instance $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $instanceName = '[NAME]'; + $formattedInstanceConfig = InstanceAdminClient::instanceConfigName( + '[PROJECT]', + '[INSTANCE_CONFIG]' + ); + $instanceDisplayName = '[DISPLAY_NAME]'; + + update_instance_sample($instanceName, $formattedInstanceConfig, $instanceDisplayName); +} +// [END spanner_v1_generated_InstanceAdmin_UpdateInstance_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance_config.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance_config.php new file mode 100644 index 000000000000..edf4ddd0b4f9 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance_config.php @@ -0,0 +1,117 @@ +/operations/` and can be used to track + * the instance configuration modification. The + * metadata field type is + * [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]. + * The response field type is + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if + * successful. + * + * Authorization requires `spanner.instanceConfigs.update` permission on + * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function update_instance_config_sample(): void +{ + // Create a client. + $instanceAdminClient = new InstanceAdminClient(); + + // Prepare the request message. + $instanceConfig = new InstanceConfig(); + $updateMask = new FieldMask(); + $request = (new UpdateInstanceConfigRequest()) + ->setInstanceConfig($instanceConfig) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $instanceAdminClient->updateInstanceConfig($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var InstanceConfig $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END spanner_v1_generated_InstanceAdmin_UpdateInstanceConfig_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance_partition.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance_partition.php new file mode 100644 index 000000000000..2f61f333c720 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance_partition.php @@ -0,0 +1,155 @@ +/operations/` and can be used to + * track the instance partition modification. The + * metadata field type is + * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. + * The response field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if + * successful. + * + * Authorization requires `spanner.instancePartitions.update` permission on + * the resource + * [name][google.spanner.admin.instance.v1.InstancePartition.name]. + * + * @param string $instancePartitionName A unique identifier for the instance partition. Values are of the + * form + * `projects//instances//instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`. + * The final segment of the name must be between 2 and 64 characters in + * length. An instance partition's name cannot be changed after the instance + * partition is created. + * @param string $formattedInstancePartitionConfig The name of the instance partition's configuration. Values are of + * the form `projects//instanceConfigs/`. See also + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and + * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. Please see + * {@see InstanceAdminClient::instanceConfigName()} for help formatting this field. + * @param string $instancePartitionDisplayName The descriptive name for this instance partition as it appears in + * UIs. Must be unique per project and between 4 and 30 characters in length. + */ +function update_instance_partition_sample( + string $instancePartitionName, + string $formattedInstancePartitionConfig, + string $instancePartitionDisplayName +): void { + // Create a client. + $instanceAdminClient = new InstanceAdminClient(); + + // Prepare the request message. + $instancePartition = (new InstancePartition()) + ->setName($instancePartitionName) + ->setConfig($formattedInstancePartitionConfig) + ->setDisplayName($instancePartitionDisplayName); + $fieldMask = new FieldMask(); + $request = (new UpdateInstancePartitionRequest()) + ->setInstancePartition($instancePartition) + ->setFieldMask($fieldMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $instanceAdminClient->updateInstancePartition($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var InstancePartition $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $instancePartitionName = '[NAME]'; + $formattedInstancePartitionConfig = InstanceAdminClient::instanceConfigName( + '[PROJECT]', + '[INSTANCE_CONFIG]' + ); + $instancePartitionDisplayName = '[DISPLAY_NAME]'; + + update_instance_partition_sample( + $instancePartitionName, + $formattedInstancePartitionConfig, + $instancePartitionDisplayName + ); +} +// [END spanner_v1_generated_InstanceAdmin_UpdateInstancePartition_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/Client/InstanceAdminClient.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/Client/InstanceAdminClient.php new file mode 100644 index 000000000000..c1f1fc7a5355 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/Client/InstanceAdminClient.php @@ -0,0 +1,1302 @@ + createInstanceAsync(CreateInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface createInstanceConfigAsync(CreateInstanceConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface createInstancePartitionAsync(CreateInstancePartitionRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteInstanceAsync(DeleteInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteInstanceConfigAsync(DeleteInstanceConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteInstancePartitionAsync(DeleteInstancePartitionRequest $request, array $optionalArgs = []) + * @method PromiseInterface getIamPolicyAsync(GetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface getInstanceAsync(GetInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface getInstanceConfigAsync(GetInstanceConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface getInstancePartitionAsync(GetInstancePartitionRequest $request, array $optionalArgs = []) + * @method PromiseInterface listInstanceConfigOperationsAsync(ListInstanceConfigOperationsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listInstanceConfigsAsync(ListInstanceConfigsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listInstancePartitionOperationsAsync(ListInstancePartitionOperationsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listInstancePartitionsAsync(ListInstancePartitionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listInstancesAsync(ListInstancesRequest $request, array $optionalArgs = []) + * @method PromiseInterface moveInstanceAsync(MoveInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface setIamPolicyAsync(SetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface testIamPermissionsAsync(TestIamPermissionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateInstanceAsync(UpdateInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateInstanceConfigAsync(UpdateInstanceConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateInstancePartitionAsync(UpdateInstancePartitionRequest $request, array $optionalArgs = []) + */ +final class InstanceAdminClient +{ + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.spanner.admin.instance.v1.InstanceAdmin'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + private const SERVICE_ADDRESS = 'spanner.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'spanner.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/spanner.admin', + ]; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/instance_admin_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/instance_admin_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/instance_admin_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/instance_admin_rest_client_config.php', + ], + ], + ]; + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Formats a string containing the fully-qualified path to represent a instance + * resource. + * + * @param string $project + * @param string $instance + * + * @return string The formatted instance resource. + */ + public static function instanceName(string $project, string $instance): string + { + return self::getPathTemplate('instance')->render([ + 'project' => $project, + 'instance' => $instance, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * instance_config resource. + * + * @param string $project + * @param string $instanceConfig + * + * @return string The formatted instance_config resource. + */ + public static function instanceConfigName(string $project, string $instanceConfig): string + { + return self::getPathTemplate('instanceConfig')->render([ + 'project' => $project, + 'instance_config' => $instanceConfig, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * instance_partition resource. + * + * @param string $project + * @param string $instance + * @param string $instancePartition + * + * @return string The formatted instance_partition resource. + */ + public static function instancePartitionName(string $project, string $instance, string $instancePartition): string + { + return self::getPathTemplate('instancePartition')->render([ + 'project' => $project, + 'instance' => $instance, + 'instance_partition' => $instancePartition, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName(string $project): string + { + return self::getPathTemplate('project')->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - instance: projects/{project}/instances/{instance} + * - instanceConfig: projects/{project}/instanceConfigs/{instance_config} + * - instancePartition: projects/{project}/instances/{instance}/instancePartitions/{instance_partition} + * - project: projects/{project} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, ?string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * Setting the "SPANNER_EMULATOR_HOST" environment variable will automatically set + * the API Endpoint to the value specified in the variable, as well as ensure that + * empty credentials are used in the transport layer. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'spanner.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * @type false|LoggerInterface $logger + * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the + * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $options = $this->setDefaultEmulatorConfig($options); + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates an instance and begins preparing it to begin serving. The + * returned long-running operation + * can be used to track the progress of preparing the new + * instance. The instance name is assigned by the caller. If the + * named instance already exists, `CreateInstance` returns + * `ALREADY_EXISTS`. + * + * Immediately upon completion of this request: + * + * * The instance is readable via the API, with all requested attributes + * but no allocated resources. Its state is `CREATING`. + * + * Until completion of the returned operation: + * + * * Cancelling the operation renders the instance immediately unreadable + * via the API. + * * The instance can be deleted. + * * All other attempts to modify the instance are rejected. + * + * Upon completion of the returned operation: + * + * * Billing for all successfully-allocated resources begins (some types + * may have lower than the requested levels). + * * Databases can be created in the instance. + * * The instance's allocated resource levels are readable via the API. + * * The instance's state becomes `READY`. + * + * The returned long-running operation will + * have a name of the format `/operations/` and + * can be used to track creation of the instance. The + * metadata field type is + * [CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata]. + * The response field type is + * [Instance][google.spanner.admin.instance.v1.Instance], if successful. + * + * The async variant is {@see InstanceAdminClient::createInstanceAsync()} . + * + * @example samples/V1/InstanceAdminClient/create_instance.php + * + * @param CreateInstanceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createInstance(CreateInstanceRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateInstance', $request, $callOptions)->wait(); + } + + /** + * Creates an instance configuration and begins preparing it to be used. The + * returned long-running operation + * can be used to track the progress of preparing the new + * instance configuration. The instance configuration name is assigned by the + * caller. If the named instance configuration already exists, + * `CreateInstanceConfig` returns `ALREADY_EXISTS`. + * + * Immediately after the request returns: + * + * * The instance configuration is readable via the API, with all requested + * attributes. The instance configuration's + * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] + * field is set to true. Its state is `CREATING`. + * + * While the operation is pending: + * + * * Cancelling the operation renders the instance configuration immediately + * unreadable via the API. + * * Except for deleting the creating resource, all other attempts to modify + * the instance configuration are rejected. + * + * Upon completion of the returned operation: + * + * * Instances can be created using the instance configuration. + * * The instance configuration's + * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] + * field becomes false. Its state becomes `READY`. + * + * The returned long-running operation will + * have a name of the format + * `/operations/` and can be used to track + * creation of the instance configuration. The + * metadata field type is + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. + * The response field type is + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if + * successful. + * + * Authorization requires `spanner.instanceConfigs.create` permission on + * the resource + * [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.parent]. + * + * The async variant is {@see InstanceAdminClient::createInstanceConfigAsync()} . + * + * @example samples/V1/InstanceAdminClient/create_instance_config.php + * + * @param CreateInstanceConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createInstanceConfig(CreateInstanceConfigRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateInstanceConfig', $request, $callOptions)->wait(); + } + + /** + * Creates an instance partition and begins preparing it to be used. The + * returned long-running operation + * can be used to track the progress of preparing the new instance partition. + * The instance partition name is assigned by the caller. If the named + * instance partition already exists, `CreateInstancePartition` returns + * `ALREADY_EXISTS`. + * + * Immediately upon completion of this request: + * + * * The instance partition is readable via the API, with all requested + * attributes but no allocated resources. Its state is `CREATING`. + * + * Until completion of the returned operation: + * + * * Cancelling the operation renders the instance partition immediately + * unreadable via the API. + * * The instance partition can be deleted. + * * All other attempts to modify the instance partition are rejected. + * + * Upon completion of the returned operation: + * + * * Billing for all successfully-allocated resources begins (some types + * may have lower than the requested levels). + * * Databases can start using this instance partition. + * * The instance partition's allocated resource levels are readable via the + * API. + * * The instance partition's state becomes `READY`. + * + * The returned long-running operation will + * have a name of the format + * `/operations/` and can be used to + * track creation of the instance partition. The + * metadata field type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * The response field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if + * successful. + * + * The async variant is {@see InstanceAdminClient::createInstancePartitionAsync()} + * . + * + * @example samples/V1/InstanceAdminClient/create_instance_partition.php + * + * @param CreateInstancePartitionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createInstancePartition(CreateInstancePartitionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateInstancePartition', $request, $callOptions)->wait(); + } + + /** + * Deletes an instance. + * + * Immediately upon completion of the request: + * + * * Billing ceases for all of the instance's reserved resources. + * + * Soon afterward: + * + * * The instance and *all of its databases* immediately and + * irrevocably disappear from the API. All data in the databases + * is permanently deleted. + * + * The async variant is {@see InstanceAdminClient::deleteInstanceAsync()} . + * + * @example samples/V1/InstanceAdminClient/delete_instance.php + * + * @param DeleteInstanceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteInstance(DeleteInstanceRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteInstance', $request, $callOptions)->wait(); + } + + /** + * Deletes the instance configuration. Deletion is only allowed when no + * instances are using the configuration. If any instances are using + * the configuration, returns `FAILED_PRECONDITION`. + * + * Only user-managed configurations can be deleted. + * + * Authorization requires `spanner.instanceConfigs.delete` permission on + * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. + * + * The async variant is {@see InstanceAdminClient::deleteInstanceConfigAsync()} . + * + * @example samples/V1/InstanceAdminClient/delete_instance_config.php + * + * @param DeleteInstanceConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteInstanceConfig(DeleteInstanceConfigRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteInstanceConfig', $request, $callOptions)->wait(); + } + + /** + * Deletes an existing instance partition. Requires that the + * instance partition is not used by any database or backup and is not the + * default instance partition of an instance. + * + * Authorization requires `spanner.instancePartitions.delete` permission on + * the resource + * [name][google.spanner.admin.instance.v1.InstancePartition.name]. + * + * The async variant is {@see InstanceAdminClient::deleteInstancePartitionAsync()} + * . + * + * @example samples/V1/InstanceAdminClient/delete_instance_partition.php + * + * @param DeleteInstancePartitionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteInstancePartition(DeleteInstancePartitionRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteInstancePartition', $request, $callOptions)->wait(); + } + + /** + * Gets the access control policy for an instance resource. Returns an empty + * policy if an instance exists but does not have a policy set. + * + * Authorization requires `spanner.instances.getIamPolicy` on + * [resource][google.iam.v1.GetIamPolicyRequest.resource]. + * + * The async variant is {@see InstanceAdminClient::getIamPolicyAsync()} . + * + * @example samples/V1/InstanceAdminClient/get_iam_policy.php + * + * @param GetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Gets information about a particular instance. + * + * The async variant is {@see InstanceAdminClient::getInstanceAsync()} . + * + * @example samples/V1/InstanceAdminClient/get_instance.php + * + * @param GetInstanceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Instance + * + * @throws ApiException Thrown if the API call fails. + */ + public function getInstance(GetInstanceRequest $request, array $callOptions = []): Instance + { + return $this->startApiCall('GetInstance', $request, $callOptions)->wait(); + } + + /** + * Gets information about a particular instance configuration. + * + * The async variant is {@see InstanceAdminClient::getInstanceConfigAsync()} . + * + * @example samples/V1/InstanceAdminClient/get_instance_config.php + * + * @param GetInstanceConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return InstanceConfig + * + * @throws ApiException Thrown if the API call fails. + */ + public function getInstanceConfig(GetInstanceConfigRequest $request, array $callOptions = []): InstanceConfig + { + return $this->startApiCall('GetInstanceConfig', $request, $callOptions)->wait(); + } + + /** + * Gets information about a particular instance partition. + * + * The async variant is {@see InstanceAdminClient::getInstancePartitionAsync()} . + * + * @example samples/V1/InstanceAdminClient/get_instance_partition.php + * + * @param GetInstancePartitionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return InstancePartition + * + * @throws ApiException Thrown if the API call fails. + */ + public function getInstancePartition(GetInstancePartitionRequest $request, array $callOptions = []): InstancePartition + { + return $this->startApiCall('GetInstancePartition', $request, $callOptions)->wait(); + } + + /** + * Lists the user-managed instance configuration long-running + * operations in the given project. An instance + * configuration operation has a name of the form + * `projects//instanceConfigs//operations/`. + * The long-running operation + * metadata field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that have completed/failed/canceled within the last 7 days, + * and pending operations. Operations returned are ordered by + * `operation.metadata.value.start_time` in descending order starting + * from the most recently started operation. + * + * The async variant is + * {@see InstanceAdminClient::listInstanceConfigOperationsAsync()} . + * + * @example samples/V1/InstanceAdminClient/list_instance_config_operations.php + * + * @param ListInstanceConfigOperationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listInstanceConfigOperations(ListInstanceConfigOperationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListInstanceConfigOperations', $request, $callOptions); + } + + /** + * Lists the supported instance configurations for a given project. + * + * Returns both Google-managed configurations and user-managed + * configurations. + * + * The async variant is {@see InstanceAdminClient::listInstanceConfigsAsync()} . + * + * @example samples/V1/InstanceAdminClient/list_instance_configs.php + * + * @param ListInstanceConfigsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listInstanceConfigs(ListInstanceConfigsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListInstanceConfigs', $request, $callOptions); + } + + /** + * Lists instance partition long-running operations in the given instance. + * An instance partition operation has a name of the form + * `projects//instances//instancePartitions//operations/`. + * The long-running operation + * metadata field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that have completed/failed/canceled within the last 7 days, + * and pending operations. Operations returned are ordered by + * `operation.metadata.value.start_time` in descending order starting from the + * most recently started operation. + * + * Authorization requires `spanner.instancePartitionOperations.list` + * permission on the resource + * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]. + * + * The async variant is + * {@see InstanceAdminClient::listInstancePartitionOperationsAsync()} . + * + * @example samples/V1/InstanceAdminClient/list_instance_partition_operations.php + * + * @param ListInstancePartitionOperationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listInstancePartitionOperations(ListInstancePartitionOperationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListInstancePartitionOperations', $request, $callOptions); + } + + /** + * Lists all instance partitions for the given instance. + * + * The async variant is {@see InstanceAdminClient::listInstancePartitionsAsync()} . + * + * @example samples/V1/InstanceAdminClient/list_instance_partitions.php + * + * @param ListInstancePartitionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listInstancePartitions(ListInstancePartitionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListInstancePartitions', $request, $callOptions); + } + + /** + * Lists all instances in the given project. + * + * The async variant is {@see InstanceAdminClient::listInstancesAsync()} . + * + * @example samples/V1/InstanceAdminClient/list_instances.php + * + * @param ListInstancesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listInstances(ListInstancesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListInstances', $request, $callOptions); + } + + /** + * Moves an instance to the target instance configuration. You can use the + * returned long-running operation to track + * the progress of moving the instance. + * + * `MoveInstance` returns `FAILED_PRECONDITION` if the instance meets any of + * the following criteria: + * + * * Is undergoing a move to a different instance configuration + * * Has backups + * * Has an ongoing update + * * Contains any CMEK-enabled databases + * * Is a free trial instance + * + * While the operation is pending: + * + * * All other attempts to modify the instance, including changes to its + * compute capacity, are rejected. + * * The following database and backup admin operations are rejected: + * + * * `DatabaseAdmin.CreateDatabase` + * * `DatabaseAdmin.UpdateDatabaseDdl` (disabled if default_leader is + * specified in the request.) + * * `DatabaseAdmin.RestoreDatabase` + * * `DatabaseAdmin.CreateBackup` + * * `DatabaseAdmin.CopyBackup` + * + * * Both the source and target instance configurations are subject to + * hourly compute and storage charges. + * * The instance might experience higher read-write latencies and a higher + * transaction abort rate. However, moving an instance doesn't cause any + * downtime. + * + * The returned long-running operation has + * a name of the format + * `/operations/` and can be used to track + * the move instance operation. The + * metadata field type is + * [MoveInstanceMetadata][google.spanner.admin.instance.v1.MoveInstanceMetadata]. + * The response field type is + * [Instance][google.spanner.admin.instance.v1.Instance], + * if successful. + * Cancelling the operation sets its metadata's + * [cancel_time][google.spanner.admin.instance.v1.MoveInstanceMetadata.cancel_time]. + * Cancellation is not immediate because it involves moving any data + * previously moved to the target instance configuration back to the original + * instance configuration. You can use this operation to track the progress of + * the cancellation. Upon successful completion of the cancellation, the + * operation terminates with `CANCELLED` status. + * + * If not cancelled, upon completion of the returned operation: + * + * * The instance successfully moves to the target instance + * configuration. + * * You are billed for compute and storage in target instance + * configuration. + * + * Authorization requires the `spanner.instances.update` permission on + * the resource [instance][google.spanner.admin.instance.v1.Instance]. + * + * For more details, see + * [Move an instance](https://cloud.google.com/spanner/docs/move-instance). + * + * The async variant is {@see InstanceAdminClient::moveInstanceAsync()} . + * + * @example samples/V1/InstanceAdminClient/move_instance.php + * + * @param MoveInstanceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function moveInstance(MoveInstanceRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('MoveInstance', $request, $callOptions)->wait(); + } + + /** + * Sets the access control policy on an instance resource. Replaces any + * existing policy. + * + * Authorization requires `spanner.instances.setIamPolicy` on + * [resource][google.iam.v1.SetIamPolicyRequest.resource]. + * + * The async variant is {@see InstanceAdminClient::setIamPolicyAsync()} . + * + * @example samples/V1/InstanceAdminClient/set_iam_policy.php + * + * @param SetIamPolicyRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Policy + * + * @throws ApiException Thrown if the API call fails. + */ + public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy + { + return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); + } + + /** + * Returns permissions that the caller has on the specified instance resource. + * + * Attempting this RPC on a non-existent Cloud Spanner instance resource will + * result in a NOT_FOUND error if the user has `spanner.instances.list` + * permission on the containing Google Cloud Project. Otherwise returns an + * empty set of permissions. + * + * The async variant is {@see InstanceAdminClient::testIamPermissionsAsync()} . + * + * @example samples/V1/InstanceAdminClient/test_iam_permissions.php + * + * @param TestIamPermissionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return TestIamPermissionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse + { + return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); + } + + /** + * Updates an instance, and begins allocating or releasing resources + * as requested. The returned long-running operation can be used to track the + * progress of updating the instance. If the named instance does not + * exist, returns `NOT_FOUND`. + * + * Immediately upon completion of this request: + * + * * For resource types for which a decrease in the instance's allocation + * has been requested, billing is based on the newly-requested level. + * + * Until completion of the returned operation: + * + * * Cancelling the operation sets its metadata's + * [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time], + * and begins restoring resources to their pre-request values. The + * operation is guaranteed to succeed at undoing all resource changes, + * after which point it terminates with a `CANCELLED` status. + * * All other attempts to modify the instance are rejected. + * * Reading the instance via the API continues to give the pre-request + * resource levels. + * + * Upon completion of the returned operation: + * + * * Billing begins for all successfully-allocated resources (some types + * may have lower than the requested levels). + * * All newly-reserved resources are available for serving the instance's + * tables. + * * The instance's new resource levels are readable via the API. + * + * The returned long-running operation will + * have a name of the format `/operations/` and + * can be used to track the instance modification. The + * metadata field type is + * [UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. + * The response field type is + * [Instance][google.spanner.admin.instance.v1.Instance], if successful. + * + * Authorization requires `spanner.instances.update` permission on + * the resource [name][google.spanner.admin.instance.v1.Instance.name]. + * + * The async variant is {@see InstanceAdminClient::updateInstanceAsync()} . + * + * @example samples/V1/InstanceAdminClient/update_instance.php + * + * @param UpdateInstanceRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateInstance(UpdateInstanceRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateInstance', $request, $callOptions)->wait(); + } + + /** + * Updates an instance configuration. The returned + * long-running operation can be used to track + * the progress of updating the instance. If the named instance configuration + * does not exist, returns `NOT_FOUND`. + * + * Only user-managed configurations can be updated. + * + * Immediately after the request returns: + * + * * The instance configuration's + * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] + * field is set to true. + * + * While the operation is pending: + * + * * Cancelling the operation sets its metadata's + * [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.cancel_time]. + * The operation is guaranteed to succeed at undoing all changes, after + * which point it terminates with a `CANCELLED` status. + * * All other attempts to modify the instance configuration are rejected. + * * Reading the instance configuration via the API continues to give the + * pre-request values. + * + * Upon completion of the returned operation: + * + * * Creating instances using the instance configuration uses the new + * values. + * * The new values of the instance configuration are readable via the API. + * * The instance configuration's + * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] + * field becomes false. + * + * The returned long-running operation will + * have a name of the format + * `/operations/` and can be used to track + * the instance configuration modification. The + * metadata field type is + * [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]. + * The response field type is + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if + * successful. + * + * Authorization requires `spanner.instanceConfigs.update` permission on + * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. + * + * The async variant is {@see InstanceAdminClient::updateInstanceConfigAsync()} . + * + * @example samples/V1/InstanceAdminClient/update_instance_config.php + * + * @param UpdateInstanceConfigRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateInstanceConfig(UpdateInstanceConfigRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateInstanceConfig', $request, $callOptions)->wait(); + } + + /** + * Updates an instance partition, and begins allocating or releasing resources + * as requested. The returned long-running operation can be used to track the + * progress of updating the instance partition. If the named instance + * partition does not exist, returns `NOT_FOUND`. + * + * Immediately upon completion of this request: + * + * * For resource types for which a decrease in the instance partition's + * allocation has been requested, billing is based on the newly-requested + * level. + * + * Until completion of the returned operation: + * + * * Cancelling the operation sets its metadata's + * [cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time], + * and begins restoring resources to their pre-request values. The + * operation is guaranteed to succeed at undoing all resource changes, + * after which point it terminates with a `CANCELLED` status. + * * All other attempts to modify the instance partition are rejected. + * * Reading the instance partition via the API continues to give the + * pre-request resource levels. + * + * Upon completion of the returned operation: + * + * * Billing begins for all successfully-allocated resources (some types + * may have lower than the requested levels). + * * All newly-reserved resources are available for serving the instance + * partition's tables. + * * The instance partition's new resource levels are readable via the API. + * + * The returned long-running operation will + * have a name of the format + * `/operations/` and can be used to + * track the instance partition modification. The + * metadata field type is + * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. + * The response field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if + * successful. + * + * Authorization requires `spanner.instancePartitions.update` permission on + * the resource + * [name][google.spanner.admin.instance.v1.InstancePartition.name]. + * + * The async variant is {@see InstanceAdminClient::updateInstancePartitionAsync()} + * . + * + * @example samples/V1/InstanceAdminClient/update_instance_partition.php + * + * @param UpdateInstancePartitionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateInstancePartition(UpdateInstancePartitionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateInstancePartition', $request, $callOptions)->wait(); + } + + /** Configure the gapic configuration to use a service emulator. */ + private function setDefaultEmulatorConfig(array $options): array + { + $emulatorHost = getenv('SPANNER_EMULATOR_HOST'); + if (empty($emulatorHost)) { + return $options; + } + + if ($scheme = parse_url($emulatorHost, PHP_URL_SCHEME)) { + $search = $scheme . '://'; + $emulatorHost = str_replace($search, '', $emulatorHost); + } + + $options['apiEndpoint'] ??= $emulatorHost; + $options['transportConfig']['grpc']['stubOpts']['credentials'] ??= ChannelCredentials::createInsecure(); + $options['credentials'] ??= new InsecureCredentialsWrapper(); + return $options; + } +} diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/Gapic/InstanceAdminGapicClient.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/Gapic/InstanceAdminGapicClient.php new file mode 100644 index 000000000000..63fccc62ceb7 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/Gapic/InstanceAdminGapicClient.php @@ -0,0 +1,2277 @@ +projectName('[PROJECT]'); + * $instanceId = 'instance_id'; + * $instance = new Instance(); + * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'createInstance'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\Spanner\Admin\Instance\V1\Client\InstanceAdminClient}. + */ +class InstanceAdminGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.spanner.admin.instance.v1.InstanceAdmin'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'spanner.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'spanner.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/spanner.admin', + ]; + + private static $instanceNameTemplate; + + private static $instanceConfigNameTemplate; + + private static $instancePartitionNameTemplate; + + private static $projectNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/instance_admin_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/instance_admin_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/instance_admin_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/instance_admin_rest_client_config.php', + ], + ], + ]; + } + + private static function getInstanceNameTemplate() + { + if (self::$instanceNameTemplate == null) { + self::$instanceNameTemplate = new PathTemplate('projects/{project}/instances/{instance}'); + } + + return self::$instanceNameTemplate; + } + + private static function getInstanceConfigNameTemplate() + { + if (self::$instanceConfigNameTemplate == null) { + self::$instanceConfigNameTemplate = new PathTemplate('projects/{project}/instanceConfigs/{instance_config}'); + } + + return self::$instanceConfigNameTemplate; + } + + private static function getInstancePartitionNameTemplate() + { + if (self::$instancePartitionNameTemplate == null) { + self::$instancePartitionNameTemplate = new PathTemplate('projects/{project}/instances/{instance}/instancePartitions/{instance_partition}'); + } + + return self::$instancePartitionNameTemplate; + } + + private static function getProjectNameTemplate() + { + if (self::$projectNameTemplate == null) { + self::$projectNameTemplate = new PathTemplate('projects/{project}'); + } + + return self::$projectNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'instance' => self::getInstanceNameTemplate(), + 'instanceConfig' => self::getInstanceConfigNameTemplate(), + 'instancePartition' => self::getInstancePartitionNameTemplate(), + 'project' => self::getProjectNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a instance + * resource. + * + * @param string $project + * @param string $instance + * + * @return string The formatted instance resource. + */ + public static function instanceName($project, $instance) + { + return self::getInstanceNameTemplate()->render([ + 'project' => $project, + 'instance' => $instance, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * instance_config resource. + * + * @param string $project + * @param string $instanceConfig + * + * @return string The formatted instance_config resource. + */ + public static function instanceConfigName($project, $instanceConfig) + { + return self::getInstanceConfigNameTemplate()->render([ + 'project' => $project, + 'instance_config' => $instanceConfig, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * instance_partition resource. + * + * @param string $project + * @param string $instance + * @param string $instancePartition + * + * @return string The formatted instance_partition resource. + */ + public static function instancePartitionName($project, $instance, $instancePartition) + { + return self::getInstancePartitionNameTemplate()->render([ + 'project' => $project, + 'instance' => $instance, + 'instance_partition' => $instancePartition, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName($project) + { + return self::getProjectNameTemplate()->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - instance: projects/{project}/instances/{instance} + * - instanceConfig: projects/{project}/instanceConfigs/{instance_config} + * - instancePartition: projects/{project}/instances/{instance}/instancePartitions/{instance_partition} + * - project: projects/{project} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'spanner.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Creates an instance and begins preparing it to begin serving. The + * returned long-running operation + * can be used to track the progress of preparing the new + * instance. The instance name is assigned by the caller. If the + * named instance already exists, `CreateInstance` returns + * `ALREADY_EXISTS`. + * + * Immediately upon completion of this request: + * + * * The instance is readable via the API, with all requested attributes + * but no allocated resources. Its state is `CREATING`. + * + * Until completion of the returned operation: + * + * * Cancelling the operation renders the instance immediately unreadable + * via the API. + * * The instance can be deleted. + * * All other attempts to modify the instance are rejected. + * + * Upon completion of the returned operation: + * + * * Billing for all successfully-allocated resources begins (some types + * may have lower than the requested levels). + * * Databases can be created in the instance. + * * The instance's allocated resource levels are readable via the API. + * * The instance's state becomes `READY`. + * + * The returned long-running operation will + * have a name of the format `/operations/` and + * can be used to track creation of the instance. The + * metadata field type is + * [CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata]. + * The response field type is + * [Instance][google.spanner.admin.instance.v1.Instance], if successful. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedParent = $instanceAdminClient->projectName('[PROJECT]'); + * $instanceId = 'instance_id'; + * $instance = new Instance(); + * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'createInstance'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the project in which to create the instance. Values + * are of the form `projects/`. + * @param string $instanceId Required. The ID of the instance to create. Valid identifiers are of the + * form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in + * length. + * @param Instance $instance Required. The instance to create. The name may be omitted, but if + * specified must be `/instances/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createInstance($parent, $instanceId, $instance, array $optionalArgs = []) + { + $request = new CreateInstanceRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setInstanceId($instanceId); + $request->setInstance($instance); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateInstance', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates an instance configuration and begins preparing it to be used. The + * returned long-running operation + * can be used to track the progress of preparing the new + * instance configuration. The instance configuration name is assigned by the + * caller. If the named instance configuration already exists, + * `CreateInstanceConfig` returns `ALREADY_EXISTS`. + * + * Immediately after the request returns: + * + * * The instance configuration is readable via the API, with all requested + * attributes. The instance configuration's + * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] + * field is set to true. Its state is `CREATING`. + * + * While the operation is pending: + * + * * Cancelling the operation renders the instance configuration immediately + * unreadable via the API. + * * Except for deleting the creating resource, all other attempts to modify + * the instance configuration are rejected. + * + * Upon completion of the returned operation: + * + * * Instances can be created using the instance configuration. + * * The instance configuration's + * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] + * field becomes false. Its state becomes `READY`. + * + * The returned long-running operation will + * have a name of the format + * `/operations/` and can be used to track + * creation of the instance configuration. The + * metadata field type is + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. + * The response field type is + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if + * successful. + * + * Authorization requires `spanner.instanceConfigs.create` permission on + * the resource + * [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.parent]. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedParent = $instanceAdminClient->projectName('[PROJECT]'); + * $instanceConfigId = 'instance_config_id'; + * $instanceConfig = new InstanceConfig(); + * $operationResponse = $instanceAdminClient->createInstanceConfig($formattedParent, $instanceConfigId, $instanceConfig); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $instanceAdminClient->createInstanceConfig($formattedParent, $instanceConfigId, $instanceConfig); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'createInstanceConfig'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the project in which to create the instance + * configuration. Values are of the form `projects/`. + * @param string $instanceConfigId Required. The ID of the instance configuration to create. Valid identifiers + * are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + * characters in length. The `custom-` prefix is required to avoid name + * conflicts with Google-managed configurations. + * @param InstanceConfig $instanceConfig Required. The `InstanceConfig` proto of the configuration to create. + * `instance_config.name` must be + * `/instanceConfigs/`. + * `instance_config.base_config` must be a Google-managed configuration name, + * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * An option to validate, but not actually execute, a request, + * and provide the same response. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createInstanceConfig($parent, $instanceConfigId, $instanceConfig, array $optionalArgs = []) + { + $request = new CreateInstanceConfigRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setInstanceConfigId($instanceConfigId); + $request->setInstanceConfig($instanceConfig); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateInstanceConfig', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates an instance partition and begins preparing it to be used. The + * returned long-running operation + * can be used to track the progress of preparing the new instance partition. + * The instance partition name is assigned by the caller. If the named + * instance partition already exists, `CreateInstancePartition` returns + * `ALREADY_EXISTS`. + * + * Immediately upon completion of this request: + * + * * The instance partition is readable via the API, with all requested + * attributes but no allocated resources. Its state is `CREATING`. + * + * Until completion of the returned operation: + * + * * Cancelling the operation renders the instance partition immediately + * unreadable via the API. + * * The instance partition can be deleted. + * * All other attempts to modify the instance partition are rejected. + * + * Upon completion of the returned operation: + * + * * Billing for all successfully-allocated resources begins (some types + * may have lower than the requested levels). + * * Databases can start using this instance partition. + * * The instance partition's allocated resource levels are readable via the + * API. + * * The instance partition's state becomes `READY`. + * + * The returned long-running operation will + * have a name of the format + * `/operations/` and can be used to + * track creation of the instance partition. The + * metadata field type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * The response field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if + * successful. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedParent = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); + * $instancePartitionId = 'instance_partition_id'; + * $instancePartition = new InstancePartition(); + * $operationResponse = $instanceAdminClient->createInstancePartition($formattedParent, $instancePartitionId, $instancePartition); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $instanceAdminClient->createInstancePartition($formattedParent, $instancePartitionId, $instancePartition); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'createInstancePartition'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the instance in which to create the instance + * partition. Values are of the form + * `projects//instances/`. + * @param string $instancePartitionId Required. The ID of the instance partition to create. Valid identifiers are + * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + * characters in length. + * @param InstancePartition $instancePartition Required. The instance partition to create. The instance_partition.name may + * be omitted, but if specified must be + * `/instancePartitions/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createInstancePartition($parent, $instancePartitionId, $instancePartition, array $optionalArgs = []) + { + $request = new CreateInstancePartitionRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setInstancePartitionId($instancePartitionId); + $request->setInstancePartition($instancePartition); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateInstancePartition', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes an instance. + * + * Immediately upon completion of the request: + * + * * Billing ceases for all of the instance's reserved resources. + * + * Soon afterward: + * + * * The instance and *all of its databases* immediately and + * irrevocably disappear from the API. All data in the databases + * is permanently deleted. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedName = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); + * $instanceAdminClient->deleteInstance($formattedName); + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the instance to be deleted. Values are of the form + * `projects//instances/` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteInstance($name, array $optionalArgs = []) + { + $request = new DeleteInstanceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteInstance', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes the instance configuration. Deletion is only allowed when no + * instances are using the configuration. If any instances are using + * the configuration, returns `FAILED_PRECONDITION`. + * + * Only user-managed configurations can be deleted. + * + * Authorization requires `spanner.instanceConfigs.delete` permission on + * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedName = $instanceAdminClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + * $instanceAdminClient->deleteInstanceConfig($formattedName); + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the instance configuration to be deleted. + * Values are of the form + * `projects//instanceConfigs/` + * @param array $optionalArgs { + * Optional. + * + * @type string $etag + * Used for optimistic concurrency control as a way to help prevent + * simultaneous deletes of an instance configuration from overwriting each + * other. If not empty, the API + * only deletes the instance configuration when the etag provided matches the + * current status of the requested instance configuration. Otherwise, deletes + * the instance configuration without checking the current status of the + * requested instance configuration. + * @type bool $validateOnly + * An option to validate, but not actually execute, a request, + * and provide the same response. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteInstanceConfig($name, array $optionalArgs = []) + { + $request = new DeleteInstanceConfigRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteInstanceConfig', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes an existing instance partition. Requires that the + * instance partition is not used by any database or backup and is not the + * default instance partition of an instance. + * + * Authorization requires `spanner.instancePartitions.delete` permission on + * the resource + * [name][google.spanner.admin.instance.v1.InstancePartition.name]. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedName = $instanceAdminClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]'); + * $instanceAdminClient->deleteInstancePartition($formattedName); + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the instance partition to be deleted. + * Values are of the form + * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}` + * @param array $optionalArgs { + * Optional. + * + * @type string $etag + * Optional. If not empty, the API only deletes the instance partition when + * the etag provided matches the current status of the requested instance + * partition. Otherwise, deletes the instance partition without checking the + * current status of the requested instance partition. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteInstancePartition($name, array $optionalArgs = []) + { + $request = new DeleteInstancePartitionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteInstancePartition', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the access control policy for an instance resource. Returns an empty + * policy if an instance exists but does not have a policy set. + * + * Authorization requires `spanner.instances.getIamPolicy` on + * [resource][google.iam.v1.GetIamPolicyRequest.resource]. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $resource = 'resource'; + * $response = $instanceAdminClient->getIamPolicy($resource); + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param array $optionalArgs { + * Optional. + * + * @type GetPolicyOptions $options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function getIamPolicy($resource, array $optionalArgs = []) + { + $request = new GetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['options'])) { + $request->setOptions($optionalArgs['options']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets information about a particular instance. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedName = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); + * $response = $instanceAdminClient->getInstance($formattedName); + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the requested instance. Values are of the form + * `projects//instances/`. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $fieldMask + * If field_mask is present, specifies the subset of + * [Instance][google.spanner.admin.instance.v1.Instance] fields that should be + * returned. If absent, all + * [Instance][google.spanner.admin.instance.v1.Instance] fields are returned. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\Admin\Instance\V1\Instance + * + * @throws ApiException if the remote call fails + */ + public function getInstance($name, array $optionalArgs = []) + { + $request = new GetInstanceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['fieldMask'])) { + $request->setFieldMask($optionalArgs['fieldMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetInstance', Instance::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets information about a particular instance configuration. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedName = $instanceAdminClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + * $response = $instanceAdminClient->getInstanceConfig($formattedName); + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the requested instance configuration. Values are of + * the form `projects//instanceConfigs/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig + * + * @throws ApiException if the remote call fails + */ + public function getInstanceConfig($name, array $optionalArgs = []) + { + $request = new GetInstanceConfigRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetInstanceConfig', InstanceConfig::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets information about a particular instance partition. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedName = $instanceAdminClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]'); + * $response = $instanceAdminClient->getInstancePartition($formattedName); + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the requested instance partition. Values are of + * the form + * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition + * + * @throws ApiException if the remote call fails + */ + public function getInstancePartition($name, array $optionalArgs = []) + { + $request = new GetInstancePartitionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetInstancePartition', InstancePartition::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists the user-managed instance configuration long-running + * operations in the given project. An instance + * configuration operation has a name of the form + * `projects//instanceConfigs//operations/`. + * The long-running operation + * metadata field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that have completed/failed/canceled within the last 7 days, + * and pending operations. Operations returned are ordered by + * `operation.metadata.value.start_time` in descending order starting + * from the most recently started operation. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedParent = $instanceAdminClient->projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $instanceAdminClient->listInstanceConfigOperations($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $instanceAdminClient->listInstanceConfigOperations($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The project of the instance configuration operations. + * Values are of the form `projects/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * An expression that filters the list of returned operations. + * + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * + * The following fields in the Operation are eligible for filtering: + * + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata] + * is + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * + * Here are a few examples: + * + * * `done:true` - The operation is complete. + * * `(metadata.@type=` \ + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) + * AND` \ + * `(metadata.instance_config.name:custom-config) AND` \ + * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. + * * The instance configuration name contains "custom-config". + * * The operation started before 2021-03-28T14:50:00Z. + * * The operation resulted in an error. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listInstanceConfigOperations($parent, array $optionalArgs = []) + { + $request = new ListInstanceConfigOperationsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListInstanceConfigOperations', $optionalArgs, ListInstanceConfigOperationsResponse::class, $request); + } + + /** + * Lists the supported instance configurations for a given project. + * + * Returns both Google-managed configurations and user-managed + * configurations. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedParent = $instanceAdminClient->projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $instanceAdminClient->listInstanceConfigs($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $instanceAdminClient->listInstanceConfigs($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the project for which a list of supported instance + * configurations is requested. Values are of the form + * `projects/`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listInstanceConfigs($parent, array $optionalArgs = []) + { + $request = new ListInstanceConfigsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListInstanceConfigs', $optionalArgs, ListInstanceConfigsResponse::class, $request); + } + + /** + * Lists instance partition long-running operations in the given instance. + * An instance partition operation has a name of the form + * `projects//instances//instancePartitions//operations/`. + * The long-running operation + * metadata field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that have completed/failed/canceled within the last 7 days, + * and pending operations. Operations returned are ordered by + * `operation.metadata.value.start_time` in descending order starting from the + * most recently started operation. + * + * Authorization requires `spanner.instancePartitionOperations.list` + * permission on the resource + * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedParent = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); + * // Iterate over pages of elements + * $pagedResponse = $instanceAdminClient->listInstancePartitionOperations($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $instanceAdminClient->listInstancePartitionOperations($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent instance of the instance partition operations. + * Values are of the form `projects//instances/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * Optional. An expression that filters the list of returned operations. + * + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * + * The following fields in the Operation are eligible for filtering: + * + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] + * is + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * + * Here are a few examples: + * + * * `done:true` - The operation is complete. + * * `(metadata.@type=` \ + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) + * AND` \ + * `(metadata.instance_partition.name:custom-instance-partition) AND` \ + * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * * The instance partition name contains "custom-instance-partition". + * * The operation started before 2021-03-28T14:50:00Z. + * * The operation resulted in an error. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type Timestamp $instancePartitionDeadline + * Optional. Deadline used while retrieving metadata for instance partition + * operations. Instance partitions whose operation metadata cannot be + * retrieved within this deadline will be added to + * [unreachable_instance_partitions][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions] + * in + * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listInstancePartitionOperations($parent, array $optionalArgs = []) + { + $request = new ListInstancePartitionOperationsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['instancePartitionDeadline'])) { + $request->setInstancePartitionDeadline($optionalArgs['instancePartitionDeadline']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListInstancePartitionOperations', $optionalArgs, ListInstancePartitionOperationsResponse::class, $request); + } + + /** + * Lists all instance partitions for the given instance. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedParent = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); + * // Iterate over pages of elements + * $pagedResponse = $instanceAdminClient->listInstancePartitions($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $instanceAdminClient->listInstancePartitions($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The instance whose instance partitions should be listed. Values + * are of the form `projects//instances/`. Use `{instance} + * = '-'` to list instance partitions for all Instances in a project, e.g., + * `projects/myproject/instances/-`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type Timestamp $instancePartitionDeadline + * Optional. Deadline used while retrieving metadata for instance partitions. + * Instance partitions whose metadata cannot be retrieved within this deadline + * will be added to + * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable] + * in + * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listInstancePartitions($parent, array $optionalArgs = []) + { + $request = new ListInstancePartitionsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['instancePartitionDeadline'])) { + $request->setInstancePartitionDeadline($optionalArgs['instancePartitionDeadline']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListInstancePartitions', $optionalArgs, ListInstancePartitionsResponse::class, $request); + } + + /** + * Lists all instances in the given project. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedParent = $instanceAdminClient->projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $instanceAdminClient->listInstances($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $instanceAdminClient->listInstances($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the project for which a list of instances is + * requested. Values are of the form `projects/`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * + * * `name` + * * `display_name` + * * `labels.key` where key is the name of a label + * + * Some examples of using filters are: + * + * * `name:*` --> The instance has a name. + * * `name:Howl` --> The instance's name contains the string "howl". + * * `name:HOWL` --> Equivalent to above. + * * `NAME:howl` --> Equivalent to above. + * * `labels.env:*` --> The instance has the label "env". + * * `labels.env:dev` --> The instance has the label "env" and the value of + * the label contains the string "dev". + * * `name:howl labels.env:dev` --> The instance's name contains "howl" and + * it has the label "env" with its value + * containing "dev". + * @type Timestamp $instanceDeadline + * Deadline used while retrieving metadata for instances. + * Instances whose metadata cannot be retrieved within this deadline will be + * added to + * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable] + * in + * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listInstances($parent, array $optionalArgs = []) + { + $request = new ListInstancesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['instanceDeadline'])) { + $request->setInstanceDeadline($optionalArgs['instanceDeadline']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListInstances', $optionalArgs, ListInstancesResponse::class, $request); + } + + /** + * Moves an instance to the target instance configuration. You can use the + * returned long-running operation to track + * the progress of moving the instance. + * + * `MoveInstance` returns `FAILED_PRECONDITION` if the instance meets any of + * the following criteria: + * + * * Is undergoing a move to a different instance configuration + * * Has backups + * * Has an ongoing update + * * Contains any CMEK-enabled databases + * * Is a free trial instance + * + * While the operation is pending: + * + * * All other attempts to modify the instance, including changes to its + * compute capacity, are rejected. + * * The following database and backup admin operations are rejected: + * + * * `DatabaseAdmin.CreateDatabase` + * * `DatabaseAdmin.UpdateDatabaseDdl` (disabled if default_leader is + * specified in the request.) + * * `DatabaseAdmin.RestoreDatabase` + * * `DatabaseAdmin.CreateBackup` + * * `DatabaseAdmin.CopyBackup` + * + * * Both the source and target instance configurations are subject to + * hourly compute and storage charges. + * * The instance might experience higher read-write latencies and a higher + * transaction abort rate. However, moving an instance doesn't cause any + * downtime. + * + * The returned long-running operation has + * a name of the format + * `/operations/` and can be used to track + * the move instance operation. The + * metadata field type is + * [MoveInstanceMetadata][google.spanner.admin.instance.v1.MoveInstanceMetadata]. + * The response field type is + * [Instance][google.spanner.admin.instance.v1.Instance], + * if successful. + * Cancelling the operation sets its metadata's + * [cancel_time][google.spanner.admin.instance.v1.MoveInstanceMetadata.cancel_time]. + * Cancellation is not immediate because it involves moving any data + * previously moved to the target instance configuration back to the original + * instance configuration. You can use this operation to track the progress of + * the cancellation. Upon successful completion of the cancellation, the + * operation terminates with `CANCELLED` status. + * + * If not cancelled, upon completion of the returned operation: + * + * * The instance successfully moves to the target instance + * configuration. + * * You are billed for compute and storage in target instance + * configuration. + * + * Authorization requires the `spanner.instances.update` permission on + * the resource [instance][google.spanner.admin.instance.v1.Instance]. + * + * For more details, see + * [Move an instance](https://cloud.google.com/spanner/docs/move-instance). + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedName = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); + * $formattedTargetConfig = $instanceAdminClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + * $operationResponse = $instanceAdminClient->moveInstance($formattedName, $formattedTargetConfig); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $instanceAdminClient->moveInstance($formattedName, $formattedTargetConfig); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'moveInstance'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The instance to move. + * Values are of the form `projects//instances/`. + * @param string $targetConfig Required. The target instance configuration where to move the instance. + * Values are of the form `projects//instanceConfigs/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function moveInstance($name, $targetConfig, array $optionalArgs = []) + { + $request = new MoveInstanceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setTargetConfig($targetConfig); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('MoveInstance', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Sets the access control policy on an instance resource. Replaces any + * existing policy. + * + * Authorization requires `spanner.instances.setIamPolicy` on + * [resource][google.iam.v1.SetIamPolicyRequest.resource]. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $instanceAdminClient->setIamPolicy($resource, $policy); + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function setIamPolicy($resource, $policy, array $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPolicy($policy); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns permissions that the caller has on the specified instance resource. + * + * Attempting this RPC on a non-existent Cloud Spanner instance resource will + * result in a NOT_FOUND error if the user has `spanner.instances.list` + * permission on the containing Google Cloud Project. Otherwise returns an + * empty set of permissions. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $instanceAdminClient->testIamPermissions($resource, $permissions); + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + */ + public function testIamPermissions($resource, $permissions, array $optionalArgs = []) + { + $request = new TestIamPermissionsRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPermissions($permissions); + $requestParamHeaders['resource'] = $resource; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates an instance, and begins allocating or releasing resources + * as requested. The returned long-running operation can be used to track the + * progress of updating the instance. If the named instance does not + * exist, returns `NOT_FOUND`. + * + * Immediately upon completion of this request: + * + * * For resource types for which a decrease in the instance's allocation + * has been requested, billing is based on the newly-requested level. + * + * Until completion of the returned operation: + * + * * Cancelling the operation sets its metadata's + * [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time], + * and begins restoring resources to their pre-request values. The + * operation is guaranteed to succeed at undoing all resource changes, + * after which point it terminates with a `CANCELLED` status. + * * All other attempts to modify the instance are rejected. + * * Reading the instance via the API continues to give the pre-request + * resource levels. + * + * Upon completion of the returned operation: + * + * * Billing begins for all successfully-allocated resources (some types + * may have lower than the requested levels). + * * All newly-reserved resources are available for serving the instance's + * tables. + * * The instance's new resource levels are readable via the API. + * + * The returned long-running operation will + * have a name of the format `/operations/` and + * can be used to track the instance modification. The + * metadata field type is + * [UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. + * The response field type is + * [Instance][google.spanner.admin.instance.v1.Instance], if successful. + * + * Authorization requires `spanner.instances.update` permission on + * the resource [name][google.spanner.admin.instance.v1.Instance.name]. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $instance = new Instance(); + * $fieldMask = new FieldMask(); + * $operationResponse = $instanceAdminClient->updateInstance($instance, $fieldMask); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $instanceAdminClient->updateInstance($instance, $fieldMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'updateInstance'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param Instance $instance Required. The instance to update, which must always include the instance + * name. Otherwise, only fields mentioned in + * [field_mask][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] + * need be included. + * @param FieldMask $fieldMask Required. A mask specifying which fields in + * [Instance][google.spanner.admin.instance.v1.Instance] should be updated. + * The field mask must always be specified; this prevents any future fields in + * [Instance][google.spanner.admin.instance.v1.Instance] from being erased + * accidentally by clients that do not know about them. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateInstance($instance, $fieldMask, array $optionalArgs = []) + { + $request = new UpdateInstanceRequest(); + $requestParamHeaders = []; + $request->setInstance($instance); + $request->setFieldMask($fieldMask); + $requestParamHeaders['instance.name'] = $instance->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateInstance', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates an instance configuration. The returned + * long-running operation can be used to track + * the progress of updating the instance. If the named instance configuration + * does not exist, returns `NOT_FOUND`. + * + * Only user-managed configurations can be updated. + * + * Immediately after the request returns: + * + * * The instance configuration's + * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] + * field is set to true. + * + * While the operation is pending: + * + * * Cancelling the operation sets its metadata's + * [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.cancel_time]. + * The operation is guaranteed to succeed at undoing all changes, after + * which point it terminates with a `CANCELLED` status. + * * All other attempts to modify the instance configuration are rejected. + * * Reading the instance configuration via the API continues to give the + * pre-request values. + * + * Upon completion of the returned operation: + * + * * Creating instances using the instance configuration uses the new + * values. + * * The new values of the instance configuration are readable via the API. + * * The instance configuration's + * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] + * field becomes false. + * + * The returned long-running operation will + * have a name of the format + * `/operations/` and can be used to track + * the instance configuration modification. The + * metadata field type is + * [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]. + * The response field type is + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if + * successful. + * + * Authorization requires `spanner.instanceConfigs.update` permission on + * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $instanceConfig = new InstanceConfig(); + * $updateMask = new FieldMask(); + * $operationResponse = $instanceAdminClient->updateInstanceConfig($instanceConfig, $updateMask); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $instanceAdminClient->updateInstanceConfig($instanceConfig, $updateMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'updateInstanceConfig'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param InstanceConfig $instanceConfig Required. The user instance configuration to update, which must always + * include the instance configuration name. Otherwise, only fields mentioned + * in + * [update_mask][google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask] + * need be included. To prevent conflicts of concurrent updates, + * [etag][google.spanner.admin.instance.v1.InstanceConfig.reconciling] can + * be used. + * @param FieldMask $updateMask Required. A mask specifying which fields in + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] should be + * updated. The field mask must always be specified; this prevents any future + * fields in [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] + * from being erased accidentally by clients that do not know about them. Only + * display_name and labels can be updated. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * An option to validate, but not actually execute, a request, + * and provide the same response. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateInstanceConfig($instanceConfig, $updateMask, array $optionalArgs = []) + { + $request = new UpdateInstanceConfigRequest(); + $requestParamHeaders = []; + $request->setInstanceConfig($instanceConfig); + $request->setUpdateMask($updateMask); + $requestParamHeaders['instance_config.name'] = $instanceConfig->getName(); + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateInstanceConfig', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates an instance partition, and begins allocating or releasing resources + * as requested. The returned long-running operation can be used to track the + * progress of updating the instance partition. If the named instance + * partition does not exist, returns `NOT_FOUND`. + * + * Immediately upon completion of this request: + * + * * For resource types for which a decrease in the instance partition's + * allocation has been requested, billing is based on the newly-requested + * level. + * + * Until completion of the returned operation: + * + * * Cancelling the operation sets its metadata's + * [cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time], + * and begins restoring resources to their pre-request values. The + * operation is guaranteed to succeed at undoing all resource changes, + * after which point it terminates with a `CANCELLED` status. + * * All other attempts to modify the instance partition are rejected. + * * Reading the instance partition via the API continues to give the + * pre-request resource levels. + * + * Upon completion of the returned operation: + * + * * Billing begins for all successfully-allocated resources (some types + * may have lower than the requested levels). + * * All newly-reserved resources are available for serving the instance + * partition's tables. + * * The instance partition's new resource levels are readable via the API. + * + * The returned long-running operation will + * have a name of the format + * `/operations/` and can be used to + * track the instance partition modification. The + * metadata field type is + * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. + * The response field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if + * successful. + * + * Authorization requires `spanner.instancePartitions.update` permission on + * the resource + * [name][google.spanner.admin.instance.v1.InstancePartition.name]. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $instancePartition = new InstancePartition(); + * $fieldMask = new FieldMask(); + * $operationResponse = $instanceAdminClient->updateInstancePartition($instancePartition, $fieldMask); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $instanceAdminClient->updateInstancePartition($instancePartition, $fieldMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'updateInstancePartition'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param InstancePartition $instancePartition Required. The instance partition to update, which must always include the + * instance partition name. Otherwise, only fields mentioned in + * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask] + * need be included. + * @param FieldMask $fieldMask Required. A mask specifying which fields in + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] + * should be updated. The field mask must always be specified; this prevents + * any future fields in + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] + * from being erased accidentally by clients that do not know about them. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateInstancePartition($instancePartition, $fieldMask, array $optionalArgs = []) + { + $request = new UpdateInstancePartitionRequest(); + $requestParamHeaders = []; + $request->setInstancePartition($instancePartition); + $request->setFieldMask($fieldMask); + $requestParamHeaders['instance_partition.name'] = $instancePartition->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateInstancePartition', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } +} diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/InstanceAdminClient.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/InstanceAdminClient.php new file mode 100644 index 000000000000..0c7e3e10d313 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/InstanceAdminClient.php @@ -0,0 +1,34 @@ + [ + 'google.spanner.admin.instance.v1.InstanceAdmin' => [ + 'CreateInstance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\Instance', + 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\CreateInstanceMetadata', + 'initialPollDelayMillis' => '20000', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '45000', + 'totalPollTimeoutMillis' => '86400000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateInstanceConfig' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig', + 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\CreateInstanceConfigMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateInstancePartition' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition', + 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\CreateInstancePartitionMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'MoveInstance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\MoveInstanceResponse', + 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\MoveInstanceMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateInstance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\Instance', + 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\UpdateInstanceMetadata', + 'initialPollDelayMillis' => '20000', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '45000', + 'totalPollTimeoutMillis' => '86400000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'instance.name', + 'fieldAccessors' => [ + 'getInstance', + 'getName', + ], + ], + ], + ], + 'UpdateInstanceConfig' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig', + 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\UpdateInstanceConfigMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'instance_config.name', + 'fieldAccessors' => [ + 'getInstanceConfig', + 'getName', + ], + ], + ], + ], + 'UpdateInstancePartition' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition', + 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\UpdateInstancePartitionMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'instance_partition.name', + 'fieldAccessors' => [ + 'getInstancePartition', + 'getName', + ], + ], + ], + ], + 'DeleteInstance' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteInstanceConfig' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteInstancePartition' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + ], + 'GetInstance' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Instance\V1\Instance', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetInstanceConfig' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetInstancePartition' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListInstanceConfigOperations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getOperations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Instance\V1\ListInstanceConfigOperationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListInstanceConfigs' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getInstanceConfigs', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Instance\V1\ListInstanceConfigsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListInstancePartitionOperations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getOperations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Instance\V1\ListInstancePartitionOperationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListInstancePartitions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getInstancePartitions', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Instance\V1\ListInstancePartitionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListInstances' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getInstances', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Spanner\Admin\Instance\V1\ListInstancesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\Policy', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Iam\V1\TestIamPermissionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'resource', + 'fieldAccessors' => [ + 'getResource', + ], + ], + ], + ], + 'templateMap' => [ + 'instance' => 'projects/{project}/instances/{instance}', + 'instanceConfig' => 'projects/{project}/instanceConfigs/{instance_config}', + 'instancePartition' => 'projects/{project}/instances/{instance}/instancePartitions/{instance_partition}', + 'project' => 'projects/{project}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/resources/instance_admin_rest_client_config.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/resources/instance_admin_rest_client_config.php new file mode 100644 index 000000000000..1f11b12ff0d9 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/resources/instance_admin_rest_client_config.php @@ -0,0 +1,343 @@ + [ + 'google.longrunning.Operations' => [ + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations/*}:cancel', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations/*}:cancel', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.spanner.admin.instance.v1.InstanceAdmin' => [ + 'CreateInstance' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/instances', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateInstanceConfig' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*}/instanceConfigs', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateInstancePartition' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/instancePartitions', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteInstance' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/instances/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteInstanceConfig' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/instanceConfigs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteInstancePartition' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/instancePartitions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/instances/*}:getIamPolicy', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'GetInstance' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetInstanceConfig' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instanceConfigs/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetInstancePartition' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/instancePartitions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListInstanceConfigOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*}/instanceConfigOperations', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListInstanceConfigs' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*}/instanceConfigs', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListInstancePartitionOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/instancePartitionOperations', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListInstancePartitions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/instancePartitions', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListInstances' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*}/instances', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'MoveInstance' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/instances/*}:move', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'SetIamPolicy' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/instances/*}:setIamPolicy', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'TestIamPermissions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{resource=projects/*/instances/*}:testIamPermissions', + 'body' => '*', + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'UpdateInstance' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{instance.name=projects/*/instances/*}', + 'body' => '*', + 'placeholders' => [ + 'instance.name' => [ + 'getters' => [ + 'getInstance', + 'getName', + ], + ], + ], + ], + 'UpdateInstanceConfig' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{instance_config.name=projects/*/instanceConfigs/*}', + 'body' => '*', + 'placeholders' => [ + 'instance_config.name' => [ + 'getters' => [ + 'getInstanceConfig', + 'getName', + ], + ], + ], + ], + 'UpdateInstancePartition' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{instance_partition.name=projects/*/instances/*/instancePartitions/*}', + 'body' => '*', + 'placeholders' => [ + 'instance_partition.name' => [ + 'getters' => [ + 'getInstancePartition', + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/tests/Unit/V1/Client/InstanceAdminClientTest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/tests/Unit/V1/Client/InstanceAdminClientTest.php new file mode 100644 index 000000000000..8af298f11c03 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/tests/Unit/V1/Client/InstanceAdminClientTest.php @@ -0,0 +1,2172 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return InstanceAdminClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new InstanceAdminClient($options); + } + + /** @test */ + public function createInstanceTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $config = 'config-1354792126'; + $displayName = 'displayName1615086568'; + $nodeCount = 1539922066; + $processingUnits = 329117885; + $expectedResponse = new Instance(); + $expectedResponse->setName($name); + $expectedResponse->setConfig($config); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setNodeCount($nodeCount); + $expectedResponse->setProcessingUnits($processingUnits); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createInstanceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $instanceId = 'instanceId-2101995259'; + $instance = new Instance(); + $instanceName = 'instanceName-737857344'; + $instance->setName($instanceName); + $instanceConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $instance->setConfig($instanceConfig); + $instanceDisplayName = 'instanceDisplayName1824500376'; + $instance->setDisplayName($instanceDisplayName); + $request = (new CreateInstanceRequest()) + ->setParent($formattedParent) + ->setInstanceId($instanceId) + ->setInstance($instance); + $response = $gapicClient->createInstance($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/CreateInstance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getInstanceId(); + $this->assertProtobufEquals($instanceId, $actualValue); + $actualValue = $actualApiRequestObject->getInstance(); + $this->assertProtobufEquals($instance, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createInstanceTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createInstanceExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $instanceId = 'instanceId-2101995259'; + $instance = new Instance(); + $instanceName = 'instanceName-737857344'; + $instance->setName($instanceName); + $instanceConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $instance->setConfig($instanceConfig); + $instanceDisplayName = 'instanceDisplayName1824500376'; + $instance->setDisplayName($instanceDisplayName); + $request = (new CreateInstanceRequest()) + ->setParent($formattedParent) + ->setInstanceId($instanceId) + ->setInstance($instance); + $response = $gapicClient->createInstance($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createInstanceTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createInstanceConfigTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createInstanceConfigTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $baseConfig = 'baseConfig1990483056'; + $etag = 'etag3123477'; + $reconciling = false; + $storageLimitPerProcessingUnit = 1769187130; + $expectedResponse = new InstanceConfig(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setBaseConfig($baseConfig); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setStorageLimitPerProcessingUnit($storageLimitPerProcessingUnit); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createInstanceConfigTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $instanceConfigId = 'instanceConfigId-1789417458'; + $instanceConfig = new InstanceConfig(); + $request = (new CreateInstanceConfigRequest()) + ->setParent($formattedParent) + ->setInstanceConfigId($instanceConfigId) + ->setInstanceConfig($instanceConfig); + $response = $gapicClient->createInstanceConfig($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/CreateInstanceConfig', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getInstanceConfigId(); + $this->assertProtobufEquals($instanceConfigId, $actualValue); + $actualValue = $actualApiRequestObject->getInstanceConfig(); + $this->assertProtobufEquals($instanceConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createInstanceConfigTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createInstanceConfigExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createInstanceConfigTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $instanceConfigId = 'instanceConfigId-1789417458'; + $instanceConfig = new InstanceConfig(); + $request = (new CreateInstanceConfigRequest()) + ->setParent($formattedParent) + ->setInstanceConfigId($instanceConfigId) + ->setInstanceConfig($instanceConfig); + $response = $gapicClient->createInstanceConfig($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createInstanceConfigTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createInstancePartitionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createInstancePartitionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $config = 'config-1354792126'; + $displayName = 'displayName1615086568'; + $nodeCount = 1539922066; + $etag = 'etag3123477'; + $expectedResponse = new InstancePartition(); + $expectedResponse->setName($name); + $expectedResponse->setConfig($config); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setNodeCount($nodeCount); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createInstancePartitionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $instancePartitionId = 'instancePartitionId288435706'; + $instancePartition = new InstancePartition(); + $instancePartitionName = 'instancePartitionName1272312320'; + $instancePartition->setName($instancePartitionName); + $instancePartitionConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $instancePartition->setConfig($instancePartitionConfig); + $instancePartitionDisplayName = 'instancePartitionDisplayName1175388504'; + $instancePartition->setDisplayName($instancePartitionDisplayName); + $request = (new CreateInstancePartitionRequest()) + ->setParent($formattedParent) + ->setInstancePartitionId($instancePartitionId) + ->setInstancePartition($instancePartition); + $response = $gapicClient->createInstancePartition($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/CreateInstancePartition', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getInstancePartitionId(); + $this->assertProtobufEquals($instancePartitionId, $actualValue); + $actualValue = $actualApiRequestObject->getInstancePartition(); + $this->assertProtobufEquals($instancePartition, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createInstancePartitionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createInstancePartitionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createInstancePartitionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $instancePartitionId = 'instancePartitionId288435706'; + $instancePartition = new InstancePartition(); + $instancePartitionName = 'instancePartitionName1272312320'; + $instancePartition->setName($instancePartitionName); + $instancePartitionConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $instancePartition->setConfig($instancePartitionConfig); + $instancePartitionDisplayName = 'instancePartitionDisplayName1175388504'; + $instancePartition->setDisplayName($instancePartitionDisplayName); + $request = (new CreateInstancePartitionRequest()) + ->setParent($formattedParent) + ->setInstancePartitionId($instancePartitionId) + ->setInstancePartition($instancePartition); + $response = $gapicClient->createInstancePartition($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createInstancePartitionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteInstanceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $request = (new DeleteInstanceRequest()) + ->setName($formattedName); + $gapicClient->deleteInstance($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstance', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteInstanceExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $request = (new DeleteInstanceRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteInstance($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteInstanceConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $request = (new DeleteInstanceConfigRequest()) + ->setName($formattedName); + $gapicClient->deleteInstanceConfig($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstanceConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteInstanceConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $request = (new DeleteInstanceConfigRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteInstanceConfig($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteInstancePartitionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]'); + $request = (new DeleteInstancePartitionRequest()) + ->setName($formattedName); + $gapicClient->deleteInstancePartition($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstancePartition', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteInstancePartitionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]'); + $request = (new DeleteInstancePartitionRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteInstancePartition($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + $response = $gapicClient->getIamPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $request = (new GetIamPolicyRequest()) + ->setResource($resource); + try { + $gapicClient->getIamPolicy($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInstanceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $config = 'config-1354792126'; + $displayName = 'displayName1615086568'; + $nodeCount = 1539922066; + $processingUnits = 329117885; + $expectedResponse = new Instance(); + $expectedResponse->setName($name2); + $expectedResponse->setConfig($config); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setNodeCount($nodeCount); + $expectedResponse->setProcessingUnits($processingUnits); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $request = (new GetInstanceRequest()) + ->setName($formattedName); + $response = $gapicClient->getInstance($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/GetInstance', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInstanceExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $request = (new GetInstanceRequest()) + ->setName($formattedName); + try { + $gapicClient->getInstance($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInstanceConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $baseConfig = 'baseConfig1990483056'; + $etag = 'etag3123477'; + $reconciling = false; + $storageLimitPerProcessingUnit = 1769187130; + $expectedResponse = new InstanceConfig(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setBaseConfig($baseConfig); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setStorageLimitPerProcessingUnit($storageLimitPerProcessingUnit); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $request = (new GetInstanceConfigRequest()) + ->setName($formattedName); + $response = $gapicClient->getInstanceConfig($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/GetInstanceConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInstanceConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $request = (new GetInstanceConfigRequest()) + ->setName($formattedName); + try { + $gapicClient->getInstanceConfig($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInstancePartitionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $config = 'config-1354792126'; + $displayName = 'displayName1615086568'; + $nodeCount = 1539922066; + $etag = 'etag3123477'; + $expectedResponse = new InstancePartition(); + $expectedResponse->setName($name2); + $expectedResponse->setConfig($config); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setNodeCount($nodeCount); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]'); + $request = (new GetInstancePartitionRequest()) + ->setName($formattedName); + $response = $gapicClient->getInstancePartition($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/GetInstancePartition', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInstancePartitionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]'); + $request = (new GetInstancePartitionRequest()) + ->setName($formattedName); + try { + $gapicClient->getInstancePartition($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInstanceConfigOperationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $operationsElement = new Operation(); + $operations = [ + $operationsElement, + ]; + $expectedResponse = new ListInstanceConfigOperationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setOperations($operations); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $request = (new ListInstanceConfigOperationsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listInstanceConfigOperations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getOperations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstanceConfigOperations', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInstanceConfigOperationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $request = (new ListInstanceConfigOperationsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listInstanceConfigOperations($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInstanceConfigsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $instanceConfigsElement = new InstanceConfig(); + $instanceConfigs = [ + $instanceConfigsElement, + ]; + $expectedResponse = new ListInstanceConfigsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setInstanceConfigs($instanceConfigs); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $request = (new ListInstanceConfigsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listInstanceConfigs($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getInstanceConfigs()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstanceConfigs', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInstanceConfigsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $request = (new ListInstanceConfigsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listInstanceConfigs($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInstancePartitionOperationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $operationsElement = new Operation(); + $operations = [ + $operationsElement, + ]; + $expectedResponse = new ListInstancePartitionOperationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setOperations($operations); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $request = (new ListInstancePartitionOperationsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listInstancePartitionOperations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getOperations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstancePartitionOperations', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInstancePartitionOperationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $request = (new ListInstancePartitionOperationsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listInstancePartitionOperations($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInstancePartitionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $instancePartitionsElement = new InstancePartition(); + $instancePartitions = [ + $instancePartitionsElement, + ]; + $expectedResponse = new ListInstancePartitionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setInstancePartitions($instancePartitions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $request = (new ListInstancePartitionsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listInstancePartitions($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getInstancePartitions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstancePartitions', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInstancePartitionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $request = (new ListInstancePartitionsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listInstancePartitions($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInstancesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $instancesElement = new Instance(); + $instances = [ + $instancesElement, + ]; + $expectedResponse = new ListInstancesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setInstances($instances); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $request = (new ListInstancesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listInstances($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getInstances()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstances', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInstancesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $request = (new ListInstancesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listInstances($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function moveInstanceTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/moveInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new MoveInstanceResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/moveInstanceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $formattedTargetConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $request = (new MoveInstanceRequest()) + ->setName($formattedName) + ->setTargetConfig($formattedTargetConfig); + $response = $gapicClient->moveInstance($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/MoveInstance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualApiRequestObject->getTargetConfig(); + $this->assertProtobufEquals($formattedTargetConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/moveInstanceTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function moveInstanceExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/moveInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $formattedTargetConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $request = (new MoveInstanceRequest()) + ->setName($formattedName) + ->setTargetConfig($formattedTargetConfig); + $response = $gapicClient->moveInstance($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/moveInstanceTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + $response = $gapicClient->setIamPolicy($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $request = (new SetIamPolicyRequest()) + ->setResource($resource) + ->setPolicy($policy); + try { + $gapicClient->setIamPolicy($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + $response = $gapicClient->testIamPermissions($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $request = (new TestIamPermissionsRequest()) + ->setResource($resource) + ->setPermissions($permissions); + try { + $gapicClient->testIamPermissions($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateInstanceTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $config = 'config-1354792126'; + $displayName = 'displayName1615086568'; + $nodeCount = 1539922066; + $processingUnits = 329117885; + $expectedResponse = new Instance(); + $expectedResponse->setName($name); + $expectedResponse->setConfig($config); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setNodeCount($nodeCount); + $expectedResponse->setProcessingUnits($processingUnits); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateInstanceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $instance = new Instance(); + $instanceName = 'instanceName-737857344'; + $instance->setName($instanceName); + $instanceConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $instance->setConfig($instanceConfig); + $instanceDisplayName = 'instanceDisplayName1824500376'; + $instance->setDisplayName($instanceDisplayName); + $fieldMask = new FieldMask(); + $request = (new UpdateInstanceRequest()) + ->setInstance($instance) + ->setFieldMask($fieldMask); + $response = $gapicClient->updateInstance($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getInstance(); + $this->assertProtobufEquals($instance, $actualValue); + $actualValue = $actualApiRequestObject->getFieldMask(); + $this->assertProtobufEquals($fieldMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateInstanceTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateInstanceExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $instance = new Instance(); + $instanceName = 'instanceName-737857344'; + $instance->setName($instanceName); + $instanceConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $instance->setConfig($instanceConfig); + $instanceDisplayName = 'instanceDisplayName1824500376'; + $instance->setDisplayName($instanceDisplayName); + $fieldMask = new FieldMask(); + $request = (new UpdateInstanceRequest()) + ->setInstance($instance) + ->setFieldMask($fieldMask); + $response = $gapicClient->updateInstance($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateInstanceTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateInstanceConfigTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateInstanceConfigTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $baseConfig = 'baseConfig1990483056'; + $etag = 'etag3123477'; + $reconciling = false; + $storageLimitPerProcessingUnit = 1769187130; + $expectedResponse = new InstanceConfig(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setBaseConfig($baseConfig); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setStorageLimitPerProcessingUnit($storageLimitPerProcessingUnit); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateInstanceConfigTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $instanceConfig = new InstanceConfig(); + $updateMask = new FieldMask(); + $request = (new UpdateInstanceConfigRequest()) + ->setInstanceConfig($instanceConfig) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateInstanceConfig($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstanceConfig', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getInstanceConfig(); + $this->assertProtobufEquals($instanceConfig, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateInstanceConfigTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateInstanceConfigExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateInstanceConfigTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $instanceConfig = new InstanceConfig(); + $updateMask = new FieldMask(); + $request = (new UpdateInstanceConfigRequest()) + ->setInstanceConfig($instanceConfig) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateInstanceConfig($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateInstanceConfigTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateInstancePartitionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateInstancePartitionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $config = 'config-1354792126'; + $displayName = 'displayName1615086568'; + $nodeCount = 1539922066; + $etag = 'etag3123477'; + $expectedResponse = new InstancePartition(); + $expectedResponse->setName($name); + $expectedResponse->setConfig($config); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setNodeCount($nodeCount); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateInstancePartitionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $instancePartition = new InstancePartition(); + $instancePartitionName = 'instancePartitionName1272312320'; + $instancePartition->setName($instancePartitionName); + $instancePartitionConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $instancePartition->setConfig($instancePartitionConfig); + $instancePartitionDisplayName = 'instancePartitionDisplayName1175388504'; + $instancePartition->setDisplayName($instancePartitionDisplayName); + $fieldMask = new FieldMask(); + $request = (new UpdateInstancePartitionRequest()) + ->setInstancePartition($instancePartition) + ->setFieldMask($fieldMask); + $response = $gapicClient->updateInstancePartition($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstancePartition', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getInstancePartition(); + $this->assertProtobufEquals($instancePartition, $actualValue); + $actualValue = $actualApiRequestObject->getFieldMask(); + $this->assertProtobufEquals($fieldMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateInstancePartitionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateInstancePartitionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateInstancePartitionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $instancePartition = new InstancePartition(); + $instancePartitionName = 'instancePartitionName1272312320'; + $instancePartition->setName($instancePartitionName); + $instancePartitionConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $instancePartition->setConfig($instancePartitionConfig); + $instancePartitionDisplayName = 'instancePartitionDisplayName1175388504'; + $instancePartition->setDisplayName($instancePartitionDisplayName); + $fieldMask = new FieldMask(); + $request = (new UpdateInstancePartitionRequest()) + ->setInstancePartition($instancePartition) + ->setFieldMask($fieldMask); + $response = $gapicClient->updateInstancePartition($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateInstancePartitionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createInstanceAsyncTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $config = 'config-1354792126'; + $displayName = 'displayName1615086568'; + $nodeCount = 1539922066; + $processingUnits = 329117885; + $expectedResponse = new Instance(); + $expectedResponse->setName($name); + $expectedResponse->setConfig($config); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setNodeCount($nodeCount); + $expectedResponse->setProcessingUnits($processingUnits); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createInstanceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $instanceId = 'instanceId-2101995259'; + $instance = new Instance(); + $instanceName = 'instanceName-737857344'; + $instance->setName($instanceName); + $instanceConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $instance->setConfig($instanceConfig); + $instanceDisplayName = 'instanceDisplayName1824500376'; + $instance->setDisplayName($instanceDisplayName); + $request = (new CreateInstanceRequest()) + ->setParent($formattedParent) + ->setInstanceId($instanceId) + ->setInstance($instance); + $response = $gapicClient->createInstanceAsync($request)->wait(); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/CreateInstance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getInstanceId(); + $this->assertProtobufEquals($instanceId, $actualValue); + $actualValue = $actualApiRequestObject->getInstance(); + $this->assertProtobufEquals($instance, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createInstanceTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } +} diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/tests/Unit/V1/InstanceAdminClientTest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/tests/Unit/V1/InstanceAdminClientTest.php new file mode 100644 index 000000000000..dbe048dd5628 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/tests/Unit/V1/InstanceAdminClientTest.php @@ -0,0 +1,1955 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return InstanceAdminClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new InstanceAdminClient($options); + } + + /** @test */ + public function createInstanceTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $config = 'config-1354792126'; + $displayName = 'displayName1615086568'; + $nodeCount = 1539922066; + $processingUnits = 329117885; + $expectedResponse = new Instance(); + $expectedResponse->setName($name); + $expectedResponse->setConfig($config); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setNodeCount($nodeCount); + $expectedResponse->setProcessingUnits($processingUnits); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createInstanceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $instanceId = 'instanceId-2101995259'; + $instance = new Instance(); + $instanceName = 'instanceName-737857344'; + $instance->setName($instanceName); + $instanceConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $instance->setConfig($instanceConfig); + $instanceDisplayName = 'instanceDisplayName1824500376'; + $instance->setDisplayName($instanceDisplayName); + $response = $gapicClient->createInstance($formattedParent, $instanceId, $instance); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/CreateInstance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getInstanceId(); + $this->assertProtobufEquals($instanceId, $actualValue); + $actualValue = $actualApiRequestObject->getInstance(); + $this->assertProtobufEquals($instance, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createInstanceTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createInstanceExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $instanceId = 'instanceId-2101995259'; + $instance = new Instance(); + $instanceName = 'instanceName-737857344'; + $instance->setName($instanceName); + $instanceConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $instance->setConfig($instanceConfig); + $instanceDisplayName = 'instanceDisplayName1824500376'; + $instance->setDisplayName($instanceDisplayName); + $response = $gapicClient->createInstance($formattedParent, $instanceId, $instance); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createInstanceTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createInstanceConfigTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createInstanceConfigTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $baseConfig = 'baseConfig1990483056'; + $etag = 'etag3123477'; + $reconciling = false; + $storageLimitPerProcessingUnit = 1769187130; + $expectedResponse = new InstanceConfig(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setBaseConfig($baseConfig); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setStorageLimitPerProcessingUnit($storageLimitPerProcessingUnit); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createInstanceConfigTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $instanceConfigId = 'instanceConfigId-1789417458'; + $instanceConfig = new InstanceConfig(); + $response = $gapicClient->createInstanceConfig($formattedParent, $instanceConfigId, $instanceConfig); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/CreateInstanceConfig', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getInstanceConfigId(); + $this->assertProtobufEquals($instanceConfigId, $actualValue); + $actualValue = $actualApiRequestObject->getInstanceConfig(); + $this->assertProtobufEquals($instanceConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createInstanceConfigTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createInstanceConfigExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createInstanceConfigTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $instanceConfigId = 'instanceConfigId-1789417458'; + $instanceConfig = new InstanceConfig(); + $response = $gapicClient->createInstanceConfig($formattedParent, $instanceConfigId, $instanceConfig); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createInstanceConfigTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createInstancePartitionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createInstancePartitionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $config = 'config-1354792126'; + $displayName = 'displayName1615086568'; + $nodeCount = 1539922066; + $etag = 'etag3123477'; + $expectedResponse = new InstancePartition(); + $expectedResponse->setName($name); + $expectedResponse->setConfig($config); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setNodeCount($nodeCount); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createInstancePartitionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $instancePartitionId = 'instancePartitionId288435706'; + $instancePartition = new InstancePartition(); + $instancePartitionName = 'instancePartitionName1272312320'; + $instancePartition->setName($instancePartitionName); + $instancePartitionConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $instancePartition->setConfig($instancePartitionConfig); + $instancePartitionDisplayName = 'instancePartitionDisplayName1175388504'; + $instancePartition->setDisplayName($instancePartitionDisplayName); + $response = $gapicClient->createInstancePartition($formattedParent, $instancePartitionId, $instancePartition); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/CreateInstancePartition', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getInstancePartitionId(); + $this->assertProtobufEquals($instancePartitionId, $actualValue); + $actualValue = $actualApiRequestObject->getInstancePartition(); + $this->assertProtobufEquals($instancePartition, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createInstancePartitionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createInstancePartitionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createInstancePartitionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $instancePartitionId = 'instancePartitionId288435706'; + $instancePartition = new InstancePartition(); + $instancePartitionName = 'instancePartitionName1272312320'; + $instancePartition->setName($instancePartitionName); + $instancePartitionConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $instancePartition->setConfig($instancePartitionConfig); + $instancePartitionDisplayName = 'instancePartitionDisplayName1175388504'; + $instancePartition->setDisplayName($instancePartitionDisplayName); + $response = $gapicClient->createInstancePartition($formattedParent, $instancePartitionId, $instancePartition); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createInstancePartitionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteInstanceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $gapicClient->deleteInstance($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstance', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteInstanceExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + try { + $gapicClient->deleteInstance($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteInstanceConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $gapicClient->deleteInstanceConfig($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstanceConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteInstanceConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + try { + $gapicClient->deleteInstanceConfig($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteInstancePartitionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]'); + $gapicClient->deleteInstancePartition($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstancePartition', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteInstancePartitionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]'); + try { + $gapicClient->deleteInstancePartition($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $response = $gapicClient->getIamPolicy($resource); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/GetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + try { + $gapicClient->getIamPolicy($resource); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInstanceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $config = 'config-1354792126'; + $displayName = 'displayName1615086568'; + $nodeCount = 1539922066; + $processingUnits = 329117885; + $expectedResponse = new Instance(); + $expectedResponse->setName($name2); + $expectedResponse->setConfig($config); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setNodeCount($nodeCount); + $expectedResponse->setProcessingUnits($processingUnits); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $response = $gapicClient->getInstance($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/GetInstance', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInstanceExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + try { + $gapicClient->getInstance($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInstanceConfigTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $baseConfig = 'baseConfig1990483056'; + $etag = 'etag3123477'; + $reconciling = false; + $storageLimitPerProcessingUnit = 1769187130; + $expectedResponse = new InstanceConfig(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setBaseConfig($baseConfig); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setStorageLimitPerProcessingUnit($storageLimitPerProcessingUnit); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $response = $gapicClient->getInstanceConfig($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/GetInstanceConfig', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInstanceConfigExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + try { + $gapicClient->getInstanceConfig($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInstancePartitionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $config = 'config-1354792126'; + $displayName = 'displayName1615086568'; + $nodeCount = 1539922066; + $etag = 'etag3123477'; + $expectedResponse = new InstancePartition(); + $expectedResponse->setName($name2); + $expectedResponse->setConfig($config); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setNodeCount($nodeCount); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]'); + $response = $gapicClient->getInstancePartition($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/GetInstancePartition', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getInstancePartitionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]'); + try { + $gapicClient->getInstancePartition($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInstanceConfigOperationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $operationsElement = new Operation(); + $operations = [ + $operationsElement, + ]; + $expectedResponse = new ListInstanceConfigOperationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setOperations($operations); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $response = $gapicClient->listInstanceConfigOperations($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getOperations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstanceConfigOperations', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInstanceConfigOperationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + try { + $gapicClient->listInstanceConfigOperations($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInstanceConfigsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $instanceConfigsElement = new InstanceConfig(); + $instanceConfigs = [ + $instanceConfigsElement, + ]; + $expectedResponse = new ListInstanceConfigsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setInstanceConfigs($instanceConfigs); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $response = $gapicClient->listInstanceConfigs($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getInstanceConfigs()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstanceConfigs', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInstanceConfigsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + try { + $gapicClient->listInstanceConfigs($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInstancePartitionOperationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $operationsElement = new Operation(); + $operations = [ + $operationsElement, + ]; + $expectedResponse = new ListInstancePartitionOperationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setOperations($operations); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $response = $gapicClient->listInstancePartitionOperations($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getOperations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstancePartitionOperations', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInstancePartitionOperationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + try { + $gapicClient->listInstancePartitionOperations($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInstancePartitionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $instancePartitionsElement = new InstancePartition(); + $instancePartitions = [ + $instancePartitionsElement, + ]; + $expectedResponse = new ListInstancePartitionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setInstancePartitions($instancePartitions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $response = $gapicClient->listInstancePartitions($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getInstancePartitions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstancePartitions', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInstancePartitionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + try { + $gapicClient->listInstancePartitions($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInstancesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $instancesElement = new Instance(); + $instances = [ + $instancesElement, + ]; + $expectedResponse = new ListInstancesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setInstances($instances); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + $response = $gapicClient->listInstances($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getInstances()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstances', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listInstancesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->projectName('[PROJECT]'); + try { + $gapicClient->listInstances($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function moveInstanceTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/moveInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new MoveInstanceResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/moveInstanceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $formattedTargetConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $response = $gapicClient->moveInstance($formattedName, $formattedTargetConfig); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/MoveInstance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualApiRequestObject->getTargetConfig(); + $this->assertProtobufEquals($formattedTargetConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/moveInstanceTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function moveInstanceExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/moveInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); + $formattedTargetConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $response = $gapicClient->moveInstance($formattedName, $formattedTargetConfig); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/moveInstanceTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function setIamPolicyTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $version = 351608024; + $etag = '21'; + $expectedResponse = new Policy(); + $expectedResponse->setVersion($version); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + $response = $gapicClient->setIamPolicy($resource, $policy); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/SetIamPolicy', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPolicy(); + $this->assertProtobufEquals($policy, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function setIamPolicyExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $policy = new Policy(); + try { + $gapicClient->setIamPolicy($resource, $policy); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new TestIamPermissionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + $response = $gapicClient->testIamPermissions($resource, $permissions); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/TestIamPermissions', $actualFuncCall); + $actualValue = $actualRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $actualValue = $actualRequestObject->getPermissions(); + $this->assertProtobufEquals($permissions, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function testIamPermissionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $resource = 'resource-341064690'; + $permissions = []; + try { + $gapicClient->testIamPermissions($resource, $permissions); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateInstanceTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $config = 'config-1354792126'; + $displayName = 'displayName1615086568'; + $nodeCount = 1539922066; + $processingUnits = 329117885; + $expectedResponse = new Instance(); + $expectedResponse->setName($name); + $expectedResponse->setConfig($config); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setNodeCount($nodeCount); + $expectedResponse->setProcessingUnits($processingUnits); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateInstanceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $instance = new Instance(); + $instanceName = 'instanceName-737857344'; + $instance->setName($instanceName); + $instanceConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $instance->setConfig($instanceConfig); + $instanceDisplayName = 'instanceDisplayName1824500376'; + $instance->setDisplayName($instanceDisplayName); + $fieldMask = new FieldMask(); + $response = $gapicClient->updateInstance($instance, $fieldMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getInstance(); + $this->assertProtobufEquals($instance, $actualValue); + $actualValue = $actualApiRequestObject->getFieldMask(); + $this->assertProtobufEquals($fieldMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateInstanceTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateInstanceExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $instance = new Instance(); + $instanceName = 'instanceName-737857344'; + $instance->setName($instanceName); + $instanceConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $instance->setConfig($instanceConfig); + $instanceDisplayName = 'instanceDisplayName1824500376'; + $instance->setDisplayName($instanceDisplayName); + $fieldMask = new FieldMask(); + $response = $gapicClient->updateInstance($instance, $fieldMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateInstanceTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateInstanceConfigTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateInstanceConfigTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $baseConfig = 'baseConfig1990483056'; + $etag = 'etag3123477'; + $reconciling = false; + $storageLimitPerProcessingUnit = 1769187130; + $expectedResponse = new InstanceConfig(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setBaseConfig($baseConfig); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setStorageLimitPerProcessingUnit($storageLimitPerProcessingUnit); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateInstanceConfigTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $instanceConfig = new InstanceConfig(); + $updateMask = new FieldMask(); + $response = $gapicClient->updateInstanceConfig($instanceConfig, $updateMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstanceConfig', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getInstanceConfig(); + $this->assertProtobufEquals($instanceConfig, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateInstanceConfigTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateInstanceConfigExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateInstanceConfigTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $instanceConfig = new InstanceConfig(); + $updateMask = new FieldMask(); + $response = $gapicClient->updateInstanceConfig($instanceConfig, $updateMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateInstanceConfigTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateInstancePartitionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateInstancePartitionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $config = 'config-1354792126'; + $displayName = 'displayName1615086568'; + $nodeCount = 1539922066; + $etag = 'etag3123477'; + $expectedResponse = new InstancePartition(); + $expectedResponse->setName($name); + $expectedResponse->setConfig($config); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setNodeCount($nodeCount); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateInstancePartitionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $instancePartition = new InstancePartition(); + $instancePartitionName = 'instancePartitionName1272312320'; + $instancePartition->setName($instancePartitionName); + $instancePartitionConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $instancePartition->setConfig($instancePartitionConfig); + $instancePartitionDisplayName = 'instancePartitionDisplayName1175388504'; + $instancePartition->setDisplayName($instancePartitionDisplayName); + $fieldMask = new FieldMask(); + $response = $gapicClient->updateInstancePartition($instancePartition, $fieldMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstancePartition', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getInstancePartition(); + $this->assertProtobufEquals($instancePartition, $actualValue); + $actualValue = $actualApiRequestObject->getFieldMask(); + $this->assertProtobufEquals($fieldMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateInstancePartitionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateInstancePartitionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateInstancePartitionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $instancePartition = new InstancePartition(); + $instancePartitionName = 'instancePartitionName1272312320'; + $instancePartition->setName($instancePartitionName); + $instancePartitionConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); + $instancePartition->setConfig($instancePartitionConfig); + $instancePartitionDisplayName = 'instancePartitionDisplayName1175388504'; + $instancePartition->setDisplayName($instancePartitionDisplayName); + $fieldMask = new FieldMask(); + $response = $gapicClient->updateInstancePartition($instancePartition, $fieldMask); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateInstancePartitionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } +} diff --git a/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/CommitResponse.php b/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/CommitResponse.php new file mode 100644 index 0000000000000000000000000000000000000000..b5451ada8ff4d3bfe0d4b58d7492dfdfb04719dd GIT binary patch literal 1251 zcma)5%We}f6eXcz;i3XT(2|v*MM)((Q7CL&3L-6pF4{&-)CC$Ta%OH)i-~R7o{EC{ zDf|E*zz4A8Q}_yO&m)bJ1=(a~e9yV(9-sT>oxG4}6L*1wq6T6-y29oHuvEf`NF;ca zj>n*IB&L!jpaP5!Pw~m=0Dm|<8a%a7Em9Q$!4n}S3AD7N+;X)p+bxTkGBZ@5rQjL@ z&xsJHQ~QNRfV;iUF&G+CL&L6zhy4s5p11c9iV~_dKJYYWIScxZu>Hw&l&}bELyi60 zVtU9pGmIwen;l{wk7=U8QY_YvQyv*6ICg+j9zk;(XPmBfOA0&mJ}&h1oDbH6@Q52w zoF?HR=twbXgzDK+LMC8J_uQA}cHY*}u`zCD8VOktxsQ!X;bwP?6_`}F!S?bLURMgW25#>5l$?QhwUdYj2`Si28-u0^+9C&y?Tj1cl{iiqyLw^*O x%Wb#&Z?&Gm2=Rx6-`q$_hp?^+`p@IMa literal 0 HcmV?d00001 diff --git a/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Keys.php b/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Keys.php new file mode 100644 index 0000000000000000000000000000000000000000..07acede2f29a224b40d712f6ca728e0236ac999d GIT binary patch literal 1173 zcma)5+iuf95XEg3g>6+qBt%tsSW2b30vuAr%a(!&g-~%xM5;VgmZFV4Nmp!lt=)B{ zfcis-FG1o*c;*8b+p$|I(2|$fo;hdc%*=WAA~{aTecAy9hC7JqXiD8N(8Oq`BQ5DD z9go4#NS`D^f(aXaIAsZqOm-xBBhM_3_>7zp@&|(xcQpV2 literal 0 HcmV?d00001 diff --git a/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Mutation.php b/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Mutation.php new file mode 100644 index 0000000000000000000000000000000000000000..cf7179a94320969ece0420a975c63f2b9062aced GIT binary patch literal 1480 zcmb7EU2hUW6fIz>9b!}xBN88`wMnVbCA9jo6-^QQ5v?VmL1Q){!*Zb$hn>mHEJ-ze z^Vj&~@9^DspZyii&VJAY)XEcZ@45G$d(WI_FT|NZ5AXp5Ac=+{9-L!+23Sb0xz8CM zgrgBi?DL7B45Wi``vku|ImNHqN2hBBs(2`UaPgS)F@w4iBrvt=(?)#~YN9C*99s;b zfK0%IeZU8u)-h-@B${{!7Uy+ioY!mYBIGlo6h2Py=rh9RBfC$P68ilTR5&6ZG1kH$b%@Dr6I&gLy?=_sO#X!5p$Iof9w7ual+tI#JPAy{< zaoj{-is+w`Dc_Do9Pf_|BYVTW*#n8-=k$qwOmHanhY4&<*c>}Klk$Gn`p&2LO2POVPB}N zmLHMPL6V(+D;W~XFna_EjRsCh{1MtVW3{Z8(~Q=jp0m}VMKeath@B7z#hBptb)%=cR>rW3zI4jqhp1^K8h=jLbOMuY5IzxvmYmZUS`OUSm+STiV&o9>$~C94>ju PAAQ7T#;^SXT_E%ueDK(w literal 0 HcmV?d00001 diff --git a/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/QueryPlan.php b/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/QueryPlan.php new file mode 100644 index 0000000000000000000000000000000000000000..4b17b952279ce8da5d1245e2651647ab7a8470e7 GIT binary patch literal 1535 zcmah}T~E_c7;+*K49mPZP7EW_&S6YQ0dZ`DEZ{a7a$%Y*U3<2jP)_UV>B2Pp zA>)ny41bEhz)R0*yAB0$H*0&|=Xt-L^X%-o0~em4LrgImpR-q9UFE1 zUJo;5Iu|anF;fw$Hc_K_ifYyR>0<%)9G{t3Lw(2T+qmet1{GYzVX64h$86MbZG)-- z9RM{hum~_QI&AH~#oVwAZs>;rQg4Sy{j9VNVA_V~p?8v@B?#a%An|kku1!qjaf6G$ zHR5#$C7c*G`6No;MLomzut498?fKN?#Gyz6n$*OF4HR<9*frM?t?r_6DJ|K(=v=Q; zju|yuV+VyVeT`!9n>ue zuHq;CmO;hUwFQ&OHEq(+@WI6d$=bm}gqaz}(Pa#OT`5q;lUAuzXwDg3O8pESs0hNh@st&+p1hO0Xv= zId~&HFHl{1URW3mrv`>M)^3CPylAymGW`o3XhYD1&@5EMTxJ0;JG%>fk9Y1|Z zu7=*GRswiCbU5{_^kaOY>%oy8yPvSXpUGSZ)3o4F(;}dzot3&XfzV#A#~1inXeihG Q=bzpaM1~%51y=yS0Ze(|tpET3 literal 0 HcmV?d00001 diff --git a/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/ResultSet.php b/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/ResultSet.php new file mode 100644 index 0000000000000000000000000000000000000000..f702c5d7c9b996b7be3244ba42e87fc6bc90906b GIT binary patch literal 2130 zcmbtVL2naB6z(Q~!h{xBk>W~f;Dc`9yX*^+>{gvh{0A4XeDdB`<#qe?`~&i z18J3?z`x+sbET?(p}(T%9((GsZ)SF9EyZf9;EOHK_q}=F_ujns@SEbWAh+l)WFVM= zgpQA?Is{sXT;*||(s4PNfS_?cEqDqdpmb-CKHD48?{*#!Zz5IZrHCP<2YG&wLPr)X z!&sf8ZbyJDQ#F#H0uzpqj7!;A)&8SQsB35ioCC4FHc3_y{e z2*poPj#C~}shGmAbuLFdAp10SQf9H@c}6v1FN>jlm)e*byI$ld zb&J-i^tF0a9zD(!h>WGt4#-&WLgk{5&@emzwC`5e>TrBQ+cw8AJeA}YRicF1 z+bI>GN|9}vymf#R_bZxX)ONw6M;y|m2Z!v4=OPRnRZWn2R3~hJNyO^^6Pw~h&r1-; z{gh>AVh;t&Br~-*8~?a~`9xF1`(N{_WZOyND)b0jx9vRD4&Nbf30eE^p7pOYSiIXvancT2^6hoxWH#zEq(4n(Ai#q7;g^r)z(CE*YiQ$36Mmq9{&RA<5P*YY%GF5auOMrkH{6Xm+^0Axc#*;zNCqG!zSMrr9cpTC z@sDk9?cD;o(q}@yc&Fve+HaE!M_O8~{^L3=r`{@GAs@zvW%de^k--}Wmi%kvlECpa zg-Y8w)OM+{$x1z&O-t`-)2|-6>iluF?vN#{^+@+n)gzzQif4*w2g49S{svi|=}PPo z-B+K@;mo{g{~=i^vjlK{3pA`?0!Kd1(7JE_{mQl9Jo1st+_upJLYnteC4OU05^gN{ z_sFtk*oL)vU#}^yx>l+G3AwCoiSsg3BY1&-;1d z`mR}*!M7&Dz%I>Tzx#WA5=G`HatjqV>Yod%mKKKQFbpeV818q+7mOzxcie=$XLr=h UO4C;Ic+NUANV{}S$O$3;0RBb0i2wiq literal 0 HcmV?d00001 diff --git a/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Spanner.php b/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Spanner.php new file mode 100644 index 0000000000000000000000000000000000000000..bd5f04d2a43bfda996ec17610cdaeae0bde9a0ac GIT binary patch literal 12024 zcmdT~O>7&-6%IvNA|Lfbt!0~*4TssdvEtffthk9w+et`?mS{^NP0@CovRy36m9#Or zOYbgiDS=R+1=>T=L(oG}^cbK(i?(Qi0=)$VdTDbgiuPvokV8*N&pq_iH-F0|HL@wm zMG;?2?aaJ+|L=Pqc_1 zlv^=8y`g)0b&)QsuCZm+yO*v4)SJ5NCiy4$5R&+>-KjOrdeZfD5C1!Bx|(U3o~bv@ z50LBY$#uQy8n|}%-1UxC_e|SLk_APpZp^-#WHia#vuzutyq*+{l!)LcbhTi4hGXf? z>Vo0c9kcD(P6?-GG8=~HtBZV@eU)!Z$eHWOS;k`~vx~{=NzdsR!QGQd$M8Cib(Qi> z2<-U3s!vr@b>42ZOs|Y8wJq1kWV+IIiOEQ0+h#RuSvFB5uH4_k`KD=D-u~9yFpXv- zXKd<^OxxMtQk0H)*TB;G=3D5XKcj$yZ|E;Yz2{qPZ~FjC*U-TAedx#EvtnX!czUZn z_@?D{y}E{0?Cisa-7u@(GPV!4aHYdsXK+pfyP`!qO>fQEhmHcPD~@itI*sN7?Oxe# z?-4094P1Q7RyVo^WD5K?vlu>uHh{J8mCct{PG-9-uq&QAsIjai8NeRL*o@J&KKv zrMZU3=e)doj@Nacy&3V)N7$(P-4IOAI|kOpHN$l=nUsx(9Sl?D>kuKutERg~B9six zMswA3pJj*slYI$Z6y|2zqsiP97SHqopRc?Iqb{SC7{aBoxtSE38gP^p-!B(Ns_M@} zFq6~0`eqL=?(<;gGQ>GEnumsOqNva2N|}Liv8rx&EH4p8L5?tHZ^9`ludGZdU+qdC zN`{{eQ+l zaahWHzzV{fQ+`S&f`yeFoYdPmxMj9bOBzBHPwTh_qcPlT$-QVy!x-J!b~MLs8i^ys zca#LgTIjoGyJ>70jl>9kjF3G;GZ!HiWIP683=^gTWgLz?(wiM-uV`lIN+{!fo_z>s z_HaO<$RaZLzEStw^oRV{PTI6EJP{e;H}P{PEj%1Qik~}aZg>2~f97dxAuui!Kk+y??%k-GTOw65^gh%h9REe)pjzY{~xlZ%+4XU;%5hjp9=>Q4*sQN94 z_$w1IT`Cufd538RK!_fuPL8mnuWkYWW8Osnit$MT5Ff_+#V|$>xG&o{&Z%Aa7P)HTn@-kn& z^n!vkjjcYKEKd(gGtZWHY0msA1abc78XBGA7gR^2Y1b)6@ohDq_E+MbxZHlPUo zgi{3Ms8?Z_{I5(yymG&k?=!^&KsldX(C(p`@@R;0h|<4{tIPM}Lo?qC!DOFilr>Ns zrX{SgTn3_T5&>@>kX7Xj9M?OZt*z^3(|%+)TElepS`(8XQF&x$9VYv<`9I+!2N2=H zx#|x`VJg36)H@iP51XRMz8S1r=<~S&Q<`!WVu7Hca>*-I0NXMru^sf0u=}vdG88SZ zO7$F!v~@>sxinA3=1vIR`!$F4AW8vZbfQLl%EeMcEOlAT7DeLGrPMBAQzfziaUYiz zOe|XjUbV2;(Tqtd)EE{-Ks4lRYc0EBBu4Su#9V41`nSol6gE~`Ejtm#Kf}rrjI+ILmfjM8pJQ{E2H#HPj0{YQ%qD2XD6N+yw0hH{l80jro`x{t z=nYL!n4}bB_(PI(5I!lSplUVSMhszC%;V!oBchyw35qNTTsB(RYbU12cLoQFFh*4; zWH|{_go74VHb=woArO`4lCyBSJ4A?KRW<7_7NYtCtcEP3&)mcW+-K_^jPXhkV+4FH z;621m2>4L%L9}aEfRWW=c_q7yc|QWfrRD4@rkNOwmdeE&h2=cvdCWog3Y8^ot&*** z#lz?dN9o^Wu9jV0-~+?zC&O@@`zS@03$4RPB3?&YTuxc`ILfMfl*EokCCQ}<%N7%%k_8O z!4d4OSF+{%+O7P3L}bTc%3rfu)adW{5K@hZZIqL6Y`HjpOIs?eR{GjVY%aS)YfITO z_W2%$X(L z#j5lG5bF&X6Q|M|IhA8afTtw8iwhHGvA>34T-@DZPlKn)2ktEsFyVENv^A5p&0~0q zu?WXq)57~$c0}2oM3Z-HZZIVwp%g@gl%(S%DEDb1V*hfK-DqkY`w*l=ssV|XD-b7m zgpV|groK(HLZB@8U97mjV}T+u6f4RD7)k=gSV57&^?{&RZoDV)s~a#`wwuiw_Ev}X zXKVmvHl_Zm{$&WJXb*G`&-IK$?q$d#Latbd(f1i0z*fvbS?fg6DH-IM=J z=)Ce7p3_sk_3+{<7bWaU<_V@{r$y4~%r5HtPqN3wRm25;3Xj5PIKc)@hFIP4czQr~_iSBtJWAsa zGSv4d*A=x$J@b%U2Y5vGUkfRJz&iyl01a_G#Zz7twhbh$zBxkSvdgPoQ@QuvrGk{y zThBod!7H)BM2vRZ^HUp07Yio{z<|QWU3FKd)0iBo#d{2f%gSel-ug^VMM9* zwJk*TUxZ+U0eK}Uabz|m_?F>RF@wA9PeV_#Nx^$B2D~7kmir_-E2hW+es?OBdr{3D zMs9{^h_t^6K}3LDMU}`a28G0XCGJfu;zER8DJjDRb>T1!wnpF|Wg7)~ zEj07^Q*=}Qa$cOn@T}=# zAA)Uj9}U4V47=Tqnj2eV{FKO3zEbGDuhDJ9L|l{Ju*IY6G&0nEg59oN<$JVizZg2P zNZ(wi<_VW6PBeA*(x+miTBSo(|5Y|V%l>?5hAqov=wK$p7iKaznAM*B@a>x4WgOt) nQR#)+2t|OepYxw$USQ9u1Fx^iVS`zhyu79}*}Lc+*a7%2OM#)p literal 0 HcmV?d00001 diff --git a/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Transaction.php b/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Transaction.php new file mode 100644 index 0000000000000000000000000000000000000000..d7fd2b4b2856ca6c6f997e98272764124bdcd02f GIT binary patch literal 2283 zcmbVNU2hvj6s_GRq&Fr>7gY_GXos{YserYT22^btP#inKBB`y~q*ArgYP>skM%|rV zc4k8g$}j0F4~SR(1rPiNo)JHSyR#oQb!a2}Vz2j}bMHO(%-knmN2d|oCx=Y1m@4Lx z;VYs}8HwUhg>LARVKN%An7CmOai7H|A+0WX+8vN~t26i*p)yQjmsw;ShGU;KWJCpW zHO@90DyBkGSMgAonh!wGfMJBo$YHN}%oO#gqV}PN+Wib_pKR^`xIUGV3?>xt6A=7F z$+vsW9$gsAY|rDrHOm*?5?zP3icEY-BZB)=ZJRM8yf4&Q3_o zR1%9FU3W@wQU0i{TKsS(#ieMedz?DmkG19_2lXmXkoNO zM@Vvv9L8h#G)R2KBcGk4Mv_U1YB^EN(ASA{rfw03d%Edb^ZK8Am9;L^(&9>{yHJ1D z-fKBW-TiN!<8G_%eD}29YwvdsI_=iVHDehTd+mO|bKL0^TF`);j_BRoSf!~GL*<*4u_6S-E8 z3auvhfq6V}Qa>|NufPsc=-ST}_+YBKKJ%H2H@bmWx8wpBn3Krjz<+W{f+=i%SKwf3 zy2bQ3*6`^|m>aS&FUq_sOA}y0=H;v%0eM#|#+_MVGL@I%J;}azL=tFu=bFD&;5G_4 z+fH+3svo@=dX*PnxPF*;MKIzTYYQq#?5^V?`O;0JlXuc zcw^i8m0d1+-1L7{>lw_l^h?XiftGc$Ih@yL=h1q(Fh0vR=hUM8&n2rPvsHKj7XbeN D?#1Va literal 0 HcmV?d00001 diff --git a/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Type.php b/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Type.php new file mode 100644 index 0000000000000000000000000000000000000000..e58489a57e215b43fddd20e26082183cfd926510 GIT binary patch literal 1525 zcma)6+iuf95G9vhGNtX-QfVn5EwokB3S6ZD9^4CZ5+^chVk>bX6FoIc96bF*}8Q0Nb^q2pg0Op8?ZfFzmUGjicC#>EDJE zbsf)%9m{n-QN4$FV7U>Y#JkwR(6eL5_b?-9o=x)GcodUiHv*s5cZjc5=&WQ~uBm!4 z2|dd-D1ar-55W?eXbC`mU}-2~x9y*hHnCCL4LqPR-umrruAj9c(+2A=+F zaKh5)R2+|0yePc*lY%T8k03(U_WNWtg;V*3y(i)wsK{Vt3MplN$!Vbof)$3=WtX_* zoOp4UU69o@WzX%c+`|_3U@oG)v&ZNRM?af@ZgCVBb_9zobeG;lpWPbYTg`Hfn-h49 zAtyklR(J#p{MvGX-N8q1b&Aq+FTMcW%2I^s0UJm}8<3$TtWOAj0~h)5)(&8bFNBAX zWp9EvFDGn5_CK1j^D_mrOfOgY7?zC_UFnv!iqdU2TDnqJtEy5#4}@9BmNe}crGy+z zsSV@pYm^q|V5WMk$!wEJHpM-(D9l67Q0q#|kn1|iGIm8a6f`9OOt*}t+Nhyv7O8Y% zC@nO@mU6QxpP<<>qFpvnj>T-W>q=8CBVa+^x3mVDV`#mp85){r9~BBg3$*-Ms!M5h zmT-hN?9tRlNY9*Sgmd(kutvGZiITF|CE}G@2z_ z`ksPi>S%WdR?4yL+zIs5hc~wC5Bt|BO4vR16N9q?hkD%jT?D=TWc4+@GV(RC%;{ry z6FY?;*C(dQkIcmRsP+9$uZ?Ju#1AEDOq8Tfp*PJhWN|Bbzb{9Qa?613H6M-~S;Q4w G0sIBIAHoCx literal 0 HcmV?d00001 diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchCreateSessionsRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchCreateSessionsRequest.php new file mode 100644 index 000000000000..f76a48fe2104 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchCreateSessionsRequest.php @@ -0,0 +1,187 @@ +google.spanner.v1.BatchCreateSessionsRequest + */ +class BatchCreateSessionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The database in which the new sessions are created. + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $database = ''; + /** + * Parameters to be applied to each created session. + * + * Generated from protobuf field .google.spanner.v1.Session session_template = 2; + */ + protected $session_template = null; + /** + * Required. The number of sessions to be created in this batch call. + * The API may return fewer than the requested number of sessions. If a + * specific number of sessions are desired, the client can make additional + * calls to BatchCreateSessions (adjusting + * [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count] + * as necessary). + * + * Generated from protobuf field int32 session_count = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $session_count = 0; + + /** + * @param string $database Required. The database in which the new sessions are created. Please see + * {@see SpannerClient::databaseName()} for help formatting this field. + * @param int $sessionCount Required. The number of sessions to be created in this batch call. + * The API may return fewer than the requested number of sessions. If a + * specific number of sessions are desired, the client can make additional + * calls to BatchCreateSessions (adjusting + * [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count] + * as necessary). + * + * @return \Google\Cloud\Spanner\V1\BatchCreateSessionsRequest + * + * @experimental + */ + public static function build(string $database, int $sessionCount): self + { + return (new self()) + ->setDatabase($database) + ->setSessionCount($sessionCount); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $database + * Required. The database in which the new sessions are created. + * @type \Google\Cloud\Spanner\V1\Session $session_template + * Parameters to be applied to each created session. + * @type int $session_count + * Required. The number of sessions to be created in this batch call. + * The API may return fewer than the requested number of sessions. If a + * specific number of sessions are desired, the client can make additional + * calls to BatchCreateSessions (adjusting + * [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count] + * as necessary). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The database in which the new sessions are created. + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getDatabase() + { + return $this->database; + } + + /** + * Required. The database in which the new sessions are created. + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDatabase($var) + { + GPBUtil::checkString($var, True); + $this->database = $var; + + return $this; + } + + /** + * Parameters to be applied to each created session. + * + * Generated from protobuf field .google.spanner.v1.Session session_template = 2; + * @return \Google\Cloud\Spanner\V1\Session|null + */ + public function getSessionTemplate() + { + return $this->session_template; + } + + public function hasSessionTemplate() + { + return isset($this->session_template); + } + + public function clearSessionTemplate() + { + unset($this->session_template); + } + + /** + * Parameters to be applied to each created session. + * + * Generated from protobuf field .google.spanner.v1.Session session_template = 2; + * @param \Google\Cloud\Spanner\V1\Session $var + * @return $this + */ + public function setSessionTemplate($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Session::class); + $this->session_template = $var; + + return $this; + } + + /** + * Required. The number of sessions to be created in this batch call. + * The API may return fewer than the requested number of sessions. If a + * specific number of sessions are desired, the client can make additional + * calls to BatchCreateSessions (adjusting + * [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count] + * as necessary). + * + * Generated from protobuf field int32 session_count = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getSessionCount() + { + return $this->session_count; + } + + /** + * Required. The number of sessions to be created in this batch call. + * The API may return fewer than the requested number of sessions. If a + * specific number of sessions are desired, the client can make additional + * calls to BatchCreateSessions (adjusting + * [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count] + * as necessary). + * + * Generated from protobuf field int32 session_count = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setSessionCount($var) + { + GPBUtil::checkInt32($var); + $this->session_count = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchCreateSessionsResponse.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchCreateSessionsResponse.php new file mode 100644 index 000000000000..ff411489ae3b --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchCreateSessionsResponse.php @@ -0,0 +1,68 @@ +google.spanner.v1.BatchCreateSessionsResponse + */ +class BatchCreateSessionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The freshly created sessions. + * + * Generated from protobuf field repeated .google.spanner.v1.Session session = 1; + */ + private $session; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Spanner\V1\Session>|\Google\Protobuf\Internal\RepeatedField $session + * The freshly created sessions. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * The freshly created sessions. + * + * Generated from protobuf field repeated .google.spanner.v1.Session session = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSession() + { + return $this->session; + } + + /** + * The freshly created sessions. + * + * Generated from protobuf field repeated .google.spanner.v1.Session session = 1; + * @param array<\Google\Cloud\Spanner\V1\Session>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSession($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Session::class); + $this->session = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteRequest.php new file mode 100644 index 000000000000..d5467dbbe1e9 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteRequest.php @@ -0,0 +1,235 @@ +google.spanner.v1.BatchWriteRequest + */ +class BatchWriteRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The session in which the batch request is to be run. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $session = ''; + /** + * Common options for this request. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 3; + */ + protected $request_options = null; + /** + * Required. The groups of mutations to be applied. + * + * Generated from protobuf field repeated .google.spanner.v1.BatchWriteRequest.MutationGroup mutation_groups = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + private $mutation_groups; + /** + * Optional. When `exclude_txn_from_change_streams` is set to `true`: + * * Mutations from all transactions in this batch write operation will not + * be recorded in change streams with DDL option `allow_txn_exclusion=true` + * that are tracking columns modified by these transactions. + * * Mutations from all transactions in this batch write operation will be + * recorded in change streams with DDL option `allow_txn_exclusion=false or + * not set` that are tracking columns modified by these transactions. + * When `exclude_txn_from_change_streams` is set to `false` or not set, + * mutations from all transactions in this batch write operation will be + * recorded in all change streams that are tracking columns modified by these + * transactions. + * + * Generated from protobuf field bool exclude_txn_from_change_streams = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $exclude_txn_from_change_streams = false; + + /** + * @param string $session Required. The session in which the batch request is to be run. Please see + * {@see SpannerClient::sessionName()} for help formatting this field. + * @param \Google\Cloud\Spanner\V1\BatchWriteRequest\MutationGroup[] $mutationGroups Required. The groups of mutations to be applied. + * + * @return \Google\Cloud\Spanner\V1\BatchWriteRequest + * + * @experimental + */ + public static function build(string $session, array $mutationGroups): self + { + return (new self()) + ->setSession($session) + ->setMutationGroups($mutationGroups); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $session + * Required. The session in which the batch request is to be run. + * @type \Google\Cloud\Spanner\V1\RequestOptions $request_options + * Common options for this request. + * @type array<\Google\Cloud\Spanner\V1\BatchWriteRequest\MutationGroup>|\Google\Protobuf\Internal\RepeatedField $mutation_groups + * Required. The groups of mutations to be applied. + * @type bool $exclude_txn_from_change_streams + * Optional. When `exclude_txn_from_change_streams` is set to `true`: + * * Mutations from all transactions in this batch write operation will not + * be recorded in change streams with DDL option `allow_txn_exclusion=true` + * that are tracking columns modified by these transactions. + * * Mutations from all transactions in this batch write operation will be + * recorded in change streams with DDL option `allow_txn_exclusion=false or + * not set` that are tracking columns modified by these transactions. + * When `exclude_txn_from_change_streams` is set to `false` or not set, + * mutations from all transactions in this batch write operation will be + * recorded in all change streams that are tracking columns modified by these + * transactions. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The session in which the batch request is to be run. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSession() + { + return $this->session; + } + + /** + * Required. The session in which the batch request is to be run. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSession($var) + { + GPBUtil::checkString($var, True); + $this->session = $var; + + return $this; + } + + /** + * Common options for this request. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 3; + * @return \Google\Cloud\Spanner\V1\RequestOptions|null + */ + public function getRequestOptions() + { + return $this->request_options; + } + + public function hasRequestOptions() + { + return isset($this->request_options); + } + + public function clearRequestOptions() + { + unset($this->request_options); + } + + /** + * Common options for this request. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 3; + * @param \Google\Cloud\Spanner\V1\RequestOptions $var + * @return $this + */ + public function setRequestOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\RequestOptions::class); + $this->request_options = $var; + + return $this; + } + + /** + * Required. The groups of mutations to be applied. + * + * Generated from protobuf field repeated .google.spanner.v1.BatchWriteRequest.MutationGroup mutation_groups = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMutationGroups() + { + return $this->mutation_groups; + } + + /** + * Required. The groups of mutations to be applied. + * + * Generated from protobuf field repeated .google.spanner.v1.BatchWriteRequest.MutationGroup mutation_groups = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\Spanner\V1\BatchWriteRequest\MutationGroup>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMutationGroups($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\BatchWriteRequest\MutationGroup::class); + $this->mutation_groups = $arr; + + return $this; + } + + /** + * Optional. When `exclude_txn_from_change_streams` is set to `true`: + * * Mutations from all transactions in this batch write operation will not + * be recorded in change streams with DDL option `allow_txn_exclusion=true` + * that are tracking columns modified by these transactions. + * * Mutations from all transactions in this batch write operation will be + * recorded in change streams with DDL option `allow_txn_exclusion=false or + * not set` that are tracking columns modified by these transactions. + * When `exclude_txn_from_change_streams` is set to `false` or not set, + * mutations from all transactions in this batch write operation will be + * recorded in all change streams that are tracking columns modified by these + * transactions. + * + * Generated from protobuf field bool exclude_txn_from_change_streams = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getExcludeTxnFromChangeStreams() + { + return $this->exclude_txn_from_change_streams; + } + + /** + * Optional. When `exclude_txn_from_change_streams` is set to `true`: + * * Mutations from all transactions in this batch write operation will not + * be recorded in change streams with DDL option `allow_txn_exclusion=true` + * that are tracking columns modified by these transactions. + * * Mutations from all transactions in this batch write operation will be + * recorded in change streams with DDL option `allow_txn_exclusion=false or + * not set` that are tracking columns modified by these transactions. + * When `exclude_txn_from_change_streams` is set to `false` or not set, + * mutations from all transactions in this batch write operation will be + * recorded in all change streams that are tracking columns modified by these + * transactions. + * + * Generated from protobuf field bool exclude_txn_from_change_streams = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setExcludeTxnFromChangeStreams($var) + { + GPBUtil::checkBool($var); + $this->exclude_txn_from_change_streams = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteRequest/MutationGroup.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteRequest/MutationGroup.php new file mode 100644 index 000000000000..22d04c7f4b91 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteRequest/MutationGroup.php @@ -0,0 +1,72 @@ +google.spanner.v1.BatchWriteRequest.MutationGroup + */ +class MutationGroup extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The mutations in this group. + * + * Generated from protobuf field repeated .google.spanner.v1.Mutation mutations = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $mutations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Spanner\V1\Mutation>|\Google\Protobuf\Internal\RepeatedField $mutations + * Required. The mutations in this group. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The mutations in this group. + * + * Generated from protobuf field repeated .google.spanner.v1.Mutation mutations = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMutations() + { + return $this->mutations; + } + + /** + * Required. The mutations in this group. + * + * Generated from protobuf field repeated .google.spanner.v1.Mutation mutations = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\Spanner\V1\Mutation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMutations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Mutation::class); + $this->mutations = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MutationGroup::class, \Google\Cloud\Spanner\V1\BatchWriteRequest_MutationGroup::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteResponse.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteResponse.php new file mode 100644 index 000000000000..efcb9bc2ddb9 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteResponse.php @@ -0,0 +1,163 @@ +google.spanner.v1.BatchWriteResponse + */ +class BatchWriteResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The mutation groups applied in this batch. The values index into the + * `mutation_groups` field in the corresponding `BatchWriteRequest`. + * + * Generated from protobuf field repeated int32 indexes = 1; + */ + private $indexes; + /** + * An `OK` status indicates success. Any other status indicates a failure. + * + * Generated from protobuf field .google.rpc.Status status = 2; + */ + protected $status = null; + /** + * The commit timestamp of the transaction that applied this batch. + * Present if `status` is `OK`, absent otherwise. + * + * Generated from protobuf field .google.protobuf.Timestamp commit_timestamp = 3; + */ + protected $commit_timestamp = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $indexes + * The mutation groups applied in this batch. The values index into the + * `mutation_groups` field in the corresponding `BatchWriteRequest`. + * @type \Google\Rpc\Status $status + * An `OK` status indicates success. Any other status indicates a failure. + * @type \Google\Protobuf\Timestamp $commit_timestamp + * The commit timestamp of the transaction that applied this batch. + * Present if `status` is `OK`, absent otherwise. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * The mutation groups applied in this batch. The values index into the + * `mutation_groups` field in the corresponding `BatchWriteRequest`. + * + * Generated from protobuf field repeated int32 indexes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIndexes() + { + return $this->indexes; + } + + /** + * The mutation groups applied in this batch. The values index into the + * `mutation_groups` field in the corresponding `BatchWriteRequest`. + * + * Generated from protobuf field repeated int32 indexes = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIndexes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->indexes = $arr; + + return $this; + } + + /** + * An `OK` status indicates success. Any other status indicates a failure. + * + * Generated from protobuf field .google.rpc.Status status = 2; + * @return \Google\Rpc\Status|null + */ + public function getStatus() + { + return $this->status; + } + + public function hasStatus() + { + return isset($this->status); + } + + public function clearStatus() + { + unset($this->status); + } + + /** + * An `OK` status indicates success. Any other status indicates a failure. + * + * Generated from protobuf field .google.rpc.Status status = 2; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setStatus($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->status = $var; + + return $this; + } + + /** + * The commit timestamp of the transaction that applied this batch. + * Present if `status` is `OK`, absent otherwise. + * + * Generated from protobuf field .google.protobuf.Timestamp commit_timestamp = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCommitTimestamp() + { + return $this->commit_timestamp; + } + + public function hasCommitTimestamp() + { + return isset($this->commit_timestamp); + } + + public function clearCommitTimestamp() + { + unset($this->commit_timestamp); + } + + /** + * The commit timestamp of the transaction that applied this batch. + * Present if `status` is `OK`, absent otherwise. + * + * Generated from protobuf field .google.protobuf.Timestamp commit_timestamp = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCommitTimestamp($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->commit_timestamp = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BeginTransactionRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BeginTransactionRequest.php new file mode 100644 index 000000000000..835d6d602d59 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BeginTransactionRequest.php @@ -0,0 +1,252 @@ +google.spanner.v1.BeginTransactionRequest + */ +class BeginTransactionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The session in which the transaction runs. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $session = ''; + /** + * Required. Options for the new transaction. + * + * Generated from protobuf field .google.spanner.v1.TransactionOptions options = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $options = null; + /** + * Common options for this request. + * Priority is ignored for this request. Setting the priority in this + * request_options struct will not do anything. To set the priority for a + * transaction, set it on the reads and writes that are part of this + * transaction instead. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 3; + */ + protected $request_options = null; + /** + * Optional. Required for read-write transactions on a multiplexed session + * that commit mutations but do not perform any reads or queries. Clients + * should randomly select one of the mutations from the mutation set and send + * it as a part of this request. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $mutation_key = null; + + /** + * @param string $session Required. The session in which the transaction runs. Please see + * {@see SpannerClient::sessionName()} for help formatting this field. + * @param \Google\Cloud\Spanner\V1\TransactionOptions $options Required. Options for the new transaction. + * + * @return \Google\Cloud\Spanner\V1\BeginTransactionRequest + * + * @experimental + */ + public static function build(string $session, \Google\Cloud\Spanner\V1\TransactionOptions $options): self + { + return (new self()) + ->setSession($session) + ->setOptions($options); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $session + * Required. The session in which the transaction runs. + * @type \Google\Cloud\Spanner\V1\TransactionOptions $options + * Required. Options for the new transaction. + * @type \Google\Cloud\Spanner\V1\RequestOptions $request_options + * Common options for this request. + * Priority is ignored for this request. Setting the priority in this + * request_options struct will not do anything. To set the priority for a + * transaction, set it on the reads and writes that are part of this + * transaction instead. + * @type \Google\Cloud\Spanner\V1\Mutation $mutation_key + * Optional. Required for read-write transactions on a multiplexed session + * that commit mutations but do not perform any reads or queries. Clients + * should randomly select one of the mutations from the mutation set and send + * it as a part of this request. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The session in which the transaction runs. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSession() + { + return $this->session; + } + + /** + * Required. The session in which the transaction runs. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSession($var) + { + GPBUtil::checkString($var, True); + $this->session = $var; + + return $this; + } + + /** + * Required. Options for the new transaction. + * + * Generated from protobuf field .google.spanner.v1.TransactionOptions options = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\V1\TransactionOptions|null + */ + public function getOptions() + { + return $this->options; + } + + public function hasOptions() + { + return isset($this->options); + } + + public function clearOptions() + { + unset($this->options); + } + + /** + * Required. Options for the new transaction. + * + * Generated from protobuf field .google.spanner.v1.TransactionOptions options = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\V1\TransactionOptions $var + * @return $this + */ + public function setOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionOptions::class); + $this->options = $var; + + return $this; + } + + /** + * Common options for this request. + * Priority is ignored for this request. Setting the priority in this + * request_options struct will not do anything. To set the priority for a + * transaction, set it on the reads and writes that are part of this + * transaction instead. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 3; + * @return \Google\Cloud\Spanner\V1\RequestOptions|null + */ + public function getRequestOptions() + { + return $this->request_options; + } + + public function hasRequestOptions() + { + return isset($this->request_options); + } + + public function clearRequestOptions() + { + unset($this->request_options); + } + + /** + * Common options for this request. + * Priority is ignored for this request. Setting the priority in this + * request_options struct will not do anything. To set the priority for a + * transaction, set it on the reads and writes that are part of this + * transaction instead. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 3; + * @param \Google\Cloud\Spanner\V1\RequestOptions $var + * @return $this + */ + public function setRequestOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\RequestOptions::class); + $this->request_options = $var; + + return $this; + } + + /** + * Optional. Required for read-write transactions on a multiplexed session + * that commit mutations but do not perform any reads or queries. Clients + * should randomly select one of the mutations from the mutation set and send + * it as a part of this request. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Spanner\V1\Mutation|null + */ + public function getMutationKey() + { + return $this->mutation_key; + } + + public function hasMutationKey() + { + return isset($this->mutation_key); + } + + public function clearMutationKey() + { + unset($this->mutation_key); + } + + /** + * Optional. Required for read-write transactions on a multiplexed session + * that commit mutations but do not perform any reads or queries. Clients + * should randomly select one of the mutations from the mutation set and send + * it as a part of this request. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Spanner\V1\Mutation $var + * @return $this + */ + public function setMutationKey($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Mutation::class); + $this->mutation_key = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitRequest.php new file mode 100644 index 000000000000..1c5bec6a1abc --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitRequest.php @@ -0,0 +1,466 @@ +google.spanner.v1.CommitRequest + */ +class CommitRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The session in which the transaction to be committed is running. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $session = ''; + /** + * The mutations to be executed when this transaction commits. All + * mutations are applied atomically, in the order they appear in + * this list. + * + * Generated from protobuf field repeated .google.spanner.v1.Mutation mutations = 4; + */ + private $mutations; + /** + * If `true`, then statistics related to the transaction will be included in + * the [CommitResponse][google.spanner.v1.CommitResponse.commit_stats]. + * Default value is `false`. + * + * Generated from protobuf field bool return_commit_stats = 5; + */ + protected $return_commit_stats = false; + /** + * Optional. The amount of latency this request is willing to incur in order + * to improve throughput. If this field is not set, Spanner assumes requests + * are relatively latency sensitive and automatically determines an + * appropriate delay time. You can specify a batching delay value between 0 + * and 500 ms. + * + * Generated from protobuf field .google.protobuf.Duration max_commit_delay = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $max_commit_delay = null; + /** + * Common options for this request. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 6; + */ + protected $request_options = null; + /** + * Optional. If the read-write transaction was executed on a multiplexed + * session, the precommit token with the highest sequence number received in + * this transaction attempt, should be included here. Failing to do so will + * result in a FailedPrecondition error. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $precommit_token = null; + protected $transaction; + + /** + * @param string $session Required. The session in which the transaction to be committed is running. Please see + * {@see SpannerClient::sessionName()} for help formatting this field. + * @param string $transactionId Commit a previously-started transaction. + * @param \Google\Cloud\Spanner\V1\Mutation[] $mutations The mutations to be executed when this transaction commits. All + * mutations are applied atomically, in the order they appear in + * this list. + * + * @return \Google\Cloud\Spanner\V1\CommitRequest + * + * @experimental + */ + public static function build(string $session, string $transactionId, array $mutations): self + { + return (new self()) + ->setSession($session) + ->setTransactionId($transactionId) + ->setMutations($mutations); + } + + /** + * @param string $session Required. The session in which the transaction to be committed is running. Please see + * {@see SpannerClient::sessionName()} for help formatting this field. + * @param \Google\Cloud\Spanner\V1\TransactionOptions $singleUseTransaction Execute mutations in a temporary transaction. Note that unlike + * commit of a previously-started transaction, commit with a + * temporary transaction is non-idempotent. That is, if the + * `CommitRequest` is sent to Cloud Spanner more than once (for + * instance, due to retries in the application, or in the + * transport library), it is possible that the mutations are + * executed more than once. If this is undesirable, use + * [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction] and + * [Commit][google.spanner.v1.Spanner.Commit] instead. + * @param \Google\Cloud\Spanner\V1\Mutation[] $mutations The mutations to be executed when this transaction commits. All + * mutations are applied atomically, in the order they appear in + * this list. + * + * @return \Google\Cloud\Spanner\V1\CommitRequest + * + * @experimental + */ + public static function buildFromSessionSingleUseTransactionMutations(string $session, \Google\Cloud\Spanner\V1\TransactionOptions $singleUseTransaction, array $mutations): self + { + return (new self()) + ->setSession($session) + ->setSingleUseTransaction($singleUseTransaction) + ->setMutations($mutations); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $session + * Required. The session in which the transaction to be committed is running. + * @type string $transaction_id + * Commit a previously-started transaction. + * @type \Google\Cloud\Spanner\V1\TransactionOptions $single_use_transaction + * Execute mutations in a temporary transaction. Note that unlike + * commit of a previously-started transaction, commit with a + * temporary transaction is non-idempotent. That is, if the + * `CommitRequest` is sent to Cloud Spanner more than once (for + * instance, due to retries in the application, or in the + * transport library), it is possible that the mutations are + * executed more than once. If this is undesirable, use + * [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction] and + * [Commit][google.spanner.v1.Spanner.Commit] instead. + * @type array<\Google\Cloud\Spanner\V1\Mutation>|\Google\Protobuf\Internal\RepeatedField $mutations + * The mutations to be executed when this transaction commits. All + * mutations are applied atomically, in the order they appear in + * this list. + * @type bool $return_commit_stats + * If `true`, then statistics related to the transaction will be included in + * the [CommitResponse][google.spanner.v1.CommitResponse.commit_stats]. + * Default value is `false`. + * @type \Google\Protobuf\Duration $max_commit_delay + * Optional. The amount of latency this request is willing to incur in order + * to improve throughput. If this field is not set, Spanner assumes requests + * are relatively latency sensitive and automatically determines an + * appropriate delay time. You can specify a batching delay value between 0 + * and 500 ms. + * @type \Google\Cloud\Spanner\V1\RequestOptions $request_options + * Common options for this request. + * @type \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $precommit_token + * Optional. If the read-write transaction was executed on a multiplexed + * session, the precommit token with the highest sequence number received in + * this transaction attempt, should be included here. Failing to do so will + * result in a FailedPrecondition error. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The session in which the transaction to be committed is running. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSession() + { + return $this->session; + } + + /** + * Required. The session in which the transaction to be committed is running. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSession($var) + { + GPBUtil::checkString($var, True); + $this->session = $var; + + return $this; + } + + /** + * Commit a previously-started transaction. + * + * Generated from protobuf field bytes transaction_id = 2; + * @return string + */ + public function getTransactionId() + { + return $this->readOneof(2); + } + + public function hasTransactionId() + { + return $this->hasOneof(2); + } + + /** + * Commit a previously-started transaction. + * + * Generated from protobuf field bytes transaction_id = 2; + * @param string $var + * @return $this + */ + public function setTransactionId($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Execute mutations in a temporary transaction. Note that unlike + * commit of a previously-started transaction, commit with a + * temporary transaction is non-idempotent. That is, if the + * `CommitRequest` is sent to Cloud Spanner more than once (for + * instance, due to retries in the application, or in the + * transport library), it is possible that the mutations are + * executed more than once. If this is undesirable, use + * [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction] and + * [Commit][google.spanner.v1.Spanner.Commit] instead. + * + * Generated from protobuf field .google.spanner.v1.TransactionOptions single_use_transaction = 3; + * @return \Google\Cloud\Spanner\V1\TransactionOptions|null + */ + public function getSingleUseTransaction() + { + return $this->readOneof(3); + } + + public function hasSingleUseTransaction() + { + return $this->hasOneof(3); + } + + /** + * Execute mutations in a temporary transaction. Note that unlike + * commit of a previously-started transaction, commit with a + * temporary transaction is non-idempotent. That is, if the + * `CommitRequest` is sent to Cloud Spanner more than once (for + * instance, due to retries in the application, or in the + * transport library), it is possible that the mutations are + * executed more than once. If this is undesirable, use + * [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction] and + * [Commit][google.spanner.v1.Spanner.Commit] instead. + * + * Generated from protobuf field .google.spanner.v1.TransactionOptions single_use_transaction = 3; + * @param \Google\Cloud\Spanner\V1\TransactionOptions $var + * @return $this + */ + public function setSingleUseTransaction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionOptions::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * The mutations to be executed when this transaction commits. All + * mutations are applied atomically, in the order they appear in + * this list. + * + * Generated from protobuf field repeated .google.spanner.v1.Mutation mutations = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMutations() + { + return $this->mutations; + } + + /** + * The mutations to be executed when this transaction commits. All + * mutations are applied atomically, in the order they appear in + * this list. + * + * Generated from protobuf field repeated .google.spanner.v1.Mutation mutations = 4; + * @param array<\Google\Cloud\Spanner\V1\Mutation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMutations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Mutation::class); + $this->mutations = $arr; + + return $this; + } + + /** + * If `true`, then statistics related to the transaction will be included in + * the [CommitResponse][google.spanner.v1.CommitResponse.commit_stats]. + * Default value is `false`. + * + * Generated from protobuf field bool return_commit_stats = 5; + * @return bool + */ + public function getReturnCommitStats() + { + return $this->return_commit_stats; + } + + /** + * If `true`, then statistics related to the transaction will be included in + * the [CommitResponse][google.spanner.v1.CommitResponse.commit_stats]. + * Default value is `false`. + * + * Generated from protobuf field bool return_commit_stats = 5; + * @param bool $var + * @return $this + */ + public function setReturnCommitStats($var) + { + GPBUtil::checkBool($var); + $this->return_commit_stats = $var; + + return $this; + } + + /** + * Optional. The amount of latency this request is willing to incur in order + * to improve throughput. If this field is not set, Spanner assumes requests + * are relatively latency sensitive and automatically determines an + * appropriate delay time. You can specify a batching delay value between 0 + * and 500 ms. + * + * Generated from protobuf field .google.protobuf.Duration max_commit_delay = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Duration|null + */ + public function getMaxCommitDelay() + { + return $this->max_commit_delay; + } + + public function hasMaxCommitDelay() + { + return isset($this->max_commit_delay); + } + + public function clearMaxCommitDelay() + { + unset($this->max_commit_delay); + } + + /** + * Optional. The amount of latency this request is willing to incur in order + * to improve throughput. If this field is not set, Spanner assumes requests + * are relatively latency sensitive and automatically determines an + * appropriate delay time. You can specify a batching delay value between 0 + * and 500 ms. + * + * Generated from protobuf field .google.protobuf.Duration max_commit_delay = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMaxCommitDelay($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->max_commit_delay = $var; + + return $this; + } + + /** + * Common options for this request. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 6; + * @return \Google\Cloud\Spanner\V1\RequestOptions|null + */ + public function getRequestOptions() + { + return $this->request_options; + } + + public function hasRequestOptions() + { + return isset($this->request_options); + } + + public function clearRequestOptions() + { + unset($this->request_options); + } + + /** + * Common options for this request. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 6; + * @param \Google\Cloud\Spanner\V1\RequestOptions $var + * @return $this + */ + public function setRequestOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\RequestOptions::class); + $this->request_options = $var; + + return $this; + } + + /** + * Optional. If the read-write transaction was executed on a multiplexed + * session, the precommit token with the highest sequence number received in + * this transaction attempt, should be included here. Failing to do so will + * result in a FailedPrecondition error. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken|null + */ + public function getPrecommitToken() + { + return $this->precommit_token; + } + + public function hasPrecommitToken() + { + return isset($this->precommit_token); + } + + public function clearPrecommitToken() + { + unset($this->precommit_token); + } + + /** + * Optional. If the read-write transaction was executed on a multiplexed + * session, the precommit token with the highest sequence number received in + * this transaction attempt, should be included here. Failing to do so will + * result in a FailedPrecondition error. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $var + * @return $this + */ + public function setPrecommitToken($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken::class); + $this->precommit_token = $var; + + return $this; + } + + /** + * @return string + */ + public function getTransaction() + { + return $this->whichOneof("transaction"); + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitResponse.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitResponse.php new file mode 100644 index 000000000000..2259fc08d33c --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitResponse.php @@ -0,0 +1,174 @@ +google.spanner.v1.CommitResponse + */ +class CommitResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The Cloud Spanner timestamp at which the transaction committed. + * + * Generated from protobuf field .google.protobuf.Timestamp commit_timestamp = 1; + */ + protected $commit_timestamp = null; + /** + * The statistics about this Commit. Not returned by default. + * For more information, see + * [CommitRequest.return_commit_stats][google.spanner.v1.CommitRequest.return_commit_stats]. + * + * Generated from protobuf field .google.spanner.v1.CommitResponse.CommitStats commit_stats = 2; + */ + protected $commit_stats = null; + protected $MultiplexedSessionRetry; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $commit_timestamp + * The Cloud Spanner timestamp at which the transaction committed. + * @type \Google\Cloud\Spanner\V1\CommitResponse\CommitStats $commit_stats + * The statistics about this Commit. Not returned by default. + * For more information, see + * [CommitRequest.return_commit_stats][google.spanner.v1.CommitRequest.return_commit_stats]. + * @type \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $precommit_token + * If specified, transaction has not committed yet. + * Clients must retry the commit with the new precommit token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\CommitResponse::initOnce(); + parent::__construct($data); + } + + /** + * The Cloud Spanner timestamp at which the transaction committed. + * + * Generated from protobuf field .google.protobuf.Timestamp commit_timestamp = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCommitTimestamp() + { + return $this->commit_timestamp; + } + + public function hasCommitTimestamp() + { + return isset($this->commit_timestamp); + } + + public function clearCommitTimestamp() + { + unset($this->commit_timestamp); + } + + /** + * The Cloud Spanner timestamp at which the transaction committed. + * + * Generated from protobuf field .google.protobuf.Timestamp commit_timestamp = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCommitTimestamp($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->commit_timestamp = $var; + + return $this; + } + + /** + * The statistics about this Commit. Not returned by default. + * For more information, see + * [CommitRequest.return_commit_stats][google.spanner.v1.CommitRequest.return_commit_stats]. + * + * Generated from protobuf field .google.spanner.v1.CommitResponse.CommitStats commit_stats = 2; + * @return \Google\Cloud\Spanner\V1\CommitResponse\CommitStats|null + */ + public function getCommitStats() + { + return $this->commit_stats; + } + + public function hasCommitStats() + { + return isset($this->commit_stats); + } + + public function clearCommitStats() + { + unset($this->commit_stats); + } + + /** + * The statistics about this Commit. Not returned by default. + * For more information, see + * [CommitRequest.return_commit_stats][google.spanner.v1.CommitRequest.return_commit_stats]. + * + * Generated from protobuf field .google.spanner.v1.CommitResponse.CommitStats commit_stats = 2; + * @param \Google\Cloud\Spanner\V1\CommitResponse\CommitStats $var + * @return $this + */ + public function setCommitStats($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\CommitResponse\CommitStats::class); + $this->commit_stats = $var; + + return $this; + } + + /** + * If specified, transaction has not committed yet. + * Clients must retry the commit with the new precommit token. + * + * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + * @return \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken|null + */ + public function getPrecommitToken() + { + return $this->readOneof(4); + } + + public function hasPrecommitToken() + { + return $this->hasOneof(4); + } + + /** + * If specified, transaction has not committed yet. + * Clients must retry the commit with the new precommit token. + * + * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + * @param \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $var + * @return $this + */ + public function setPrecommitToken($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * @return string + */ + public function getMultiplexedSessionRetry() + { + return $this->whichOneof("MultiplexedSessionRetry"); + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitResponse/CommitStats.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitResponse/CommitStats.php new file mode 100644 index 000000000000..0f853f3c78fa --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitResponse/CommitStats.php @@ -0,0 +1,94 @@ +google.spanner.v1.CommitResponse.CommitStats + */ +class CommitStats extends \Google\Protobuf\Internal\Message +{ + /** + * The total number of mutations for the transaction. Knowing the + * `mutation_count` value can help you maximize the number of mutations + * in a transaction and minimize the number of API round trips. You can + * also monitor this value to prevent transactions from exceeding the system + * [limit](https://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data). + * If the number of mutations exceeds the limit, the server returns + * [INVALID_ARGUMENT](https://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT). + * + * Generated from protobuf field int64 mutation_count = 1; + */ + protected $mutation_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $mutation_count + * The total number of mutations for the transaction. Knowing the + * `mutation_count` value can help you maximize the number of mutations + * in a transaction and minimize the number of API round trips. You can + * also monitor this value to prevent transactions from exceeding the system + * [limit](https://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data). + * If the number of mutations exceeds the limit, the server returns + * [INVALID_ARGUMENT](https://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\CommitResponse::initOnce(); + parent::__construct($data); + } + + /** + * The total number of mutations for the transaction. Knowing the + * `mutation_count` value can help you maximize the number of mutations + * in a transaction and minimize the number of API round trips. You can + * also monitor this value to prevent transactions from exceeding the system + * [limit](https://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data). + * If the number of mutations exceeds the limit, the server returns + * [INVALID_ARGUMENT](https://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT). + * + * Generated from protobuf field int64 mutation_count = 1; + * @return int|string + */ + public function getMutationCount() + { + return $this->mutation_count; + } + + /** + * The total number of mutations for the transaction. Knowing the + * `mutation_count` value can help you maximize the number of mutations + * in a transaction and minimize the number of API round trips. You can + * also monitor this value to prevent transactions from exceeding the system + * [limit](https://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data). + * If the number of mutations exceeds the limit, the server returns + * [INVALID_ARGUMENT](https://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT). + * + * Generated from protobuf field int64 mutation_count = 1; + * @param int|string $var + * @return $this + */ + public function setMutationCount($var) + { + GPBUtil::checkInt64($var); + $this->mutation_count = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CommitStats::class, \Google\Cloud\Spanner\V1\CommitResponse_CommitStats::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CreateSessionRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CreateSessionRequest.php new file mode 100644 index 000000000000..f76760ba06a8 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CreateSessionRequest.php @@ -0,0 +1,125 @@ +google.spanner.v1.CreateSessionRequest + */ +class CreateSessionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The database in which the new session is created. + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $database = ''; + /** + * Required. The session to create. + * + * Generated from protobuf field .google.spanner.v1.Session session = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $session = null; + + /** + * @param string $database Required. The database in which the new session is created. Please see + * {@see SpannerClient::databaseName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\V1\CreateSessionRequest + * + * @experimental + */ + public static function build(string $database): self + { + return (new self()) + ->setDatabase($database); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $database + * Required. The database in which the new session is created. + * @type \Google\Cloud\Spanner\V1\Session $session + * Required. The session to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The database in which the new session is created. + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getDatabase() + { + return $this->database; + } + + /** + * Required. The database in which the new session is created. + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDatabase($var) + { + GPBUtil::checkString($var, True); + $this->database = $var; + + return $this; + } + + /** + * Required. The session to create. + * + * Generated from protobuf field .google.spanner.v1.Session session = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\V1\Session|null + */ + public function getSession() + { + return $this->session; + } + + public function hasSession() + { + return isset($this->session); + } + + public function clearSession() + { + unset($this->session); + } + + /** + * Required. The session to create. + * + * Generated from protobuf field .google.spanner.v1.Session session = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\V1\Session $var + * @return $this + */ + public function setSession($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Session::class); + $this->session = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DeleteSessionRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DeleteSessionRequest.php new file mode 100644 index 000000000000..0bf9497d1ccc --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DeleteSessionRequest.php @@ -0,0 +1,81 @@ +google.spanner.v1.DeleteSessionRequest + */ +class DeleteSessionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the session to delete. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the session to delete. Please see + * {@see SpannerClient::sessionName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\V1\DeleteSessionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the session to delete. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the session to delete. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the session to delete. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions.php new file mode 100644 index 000000000000..c6983461e086 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions.php @@ -0,0 +1,129 @@ +google.spanner.v1.DirectedReadOptions + */ +class DirectedReadOptions extends \Google\Protobuf\Internal\Message +{ + protected $replicas; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\V1\DirectedReadOptions\IncludeReplicas $include_replicas + * Include_replicas indicates the order of replicas (as they appear in + * this list) to process the request. If auto_failover_disabled is set to + * true and all replicas are exhausted without finding a healthy replica, + * Spanner will wait for a replica in the list to become available, requests + * may fail due to `DEADLINE_EXCEEDED` errors. + * @type \Google\Cloud\Spanner\V1\DirectedReadOptions\ExcludeReplicas $exclude_replicas + * Exclude_replicas indicates that specified replicas should be excluded + * from serving requests. Spanner will not route requests to the replicas + * in this list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Include_replicas indicates the order of replicas (as they appear in + * this list) to process the request. If auto_failover_disabled is set to + * true and all replicas are exhausted without finding a healthy replica, + * Spanner will wait for a replica in the list to become available, requests + * may fail due to `DEADLINE_EXCEEDED` errors. + * + * Generated from protobuf field .google.spanner.v1.DirectedReadOptions.IncludeReplicas include_replicas = 1; + * @return \Google\Cloud\Spanner\V1\DirectedReadOptions\IncludeReplicas|null + */ + public function getIncludeReplicas() + { + return $this->readOneof(1); + } + + public function hasIncludeReplicas() + { + return $this->hasOneof(1); + } + + /** + * Include_replicas indicates the order of replicas (as they appear in + * this list) to process the request. If auto_failover_disabled is set to + * true and all replicas are exhausted without finding a healthy replica, + * Spanner will wait for a replica in the list to become available, requests + * may fail due to `DEADLINE_EXCEEDED` errors. + * + * Generated from protobuf field .google.spanner.v1.DirectedReadOptions.IncludeReplicas include_replicas = 1; + * @param \Google\Cloud\Spanner\V1\DirectedReadOptions\IncludeReplicas $var + * @return $this + */ + public function setIncludeReplicas($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\DirectedReadOptions\IncludeReplicas::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Exclude_replicas indicates that specified replicas should be excluded + * from serving requests. Spanner will not route requests to the replicas + * in this list. + * + * Generated from protobuf field .google.spanner.v1.DirectedReadOptions.ExcludeReplicas exclude_replicas = 2; + * @return \Google\Cloud\Spanner\V1\DirectedReadOptions\ExcludeReplicas|null + */ + public function getExcludeReplicas() + { + return $this->readOneof(2); + } + + public function hasExcludeReplicas() + { + return $this->hasOneof(2); + } + + /** + * Exclude_replicas indicates that specified replicas should be excluded + * from serving requests. Spanner will not route requests to the replicas + * in this list. + * + * Generated from protobuf field .google.spanner.v1.DirectedReadOptions.ExcludeReplicas exclude_replicas = 2; + * @param \Google\Cloud\Spanner\V1\DirectedReadOptions\ExcludeReplicas $var + * @return $this + */ + public function setExcludeReplicas($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\DirectedReadOptions\ExcludeReplicas::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getReplicas() + { + return $this->whichOneof("replicas"); + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ExcludeReplicas.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ExcludeReplicas.php new file mode 100644 index 000000000000..913c6fba2724 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ExcludeReplicas.php @@ -0,0 +1,71 @@ +google.spanner.v1.DirectedReadOptions.ExcludeReplicas + */ +class ExcludeReplicas extends \Google\Protobuf\Internal\Message +{ + /** + * The directed read replica selector. + * + * Generated from protobuf field repeated .google.spanner.v1.DirectedReadOptions.ReplicaSelection replica_selections = 1; + */ + private $replica_selections; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Spanner\V1\DirectedReadOptions\ReplicaSelection>|\Google\Protobuf\Internal\RepeatedField $replica_selections + * The directed read replica selector. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * The directed read replica selector. + * + * Generated from protobuf field repeated .google.spanner.v1.DirectedReadOptions.ReplicaSelection replica_selections = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReplicaSelections() + { + return $this->replica_selections; + } + + /** + * The directed read replica selector. + * + * Generated from protobuf field repeated .google.spanner.v1.DirectedReadOptions.ReplicaSelection replica_selections = 1; + * @param array<\Google\Cloud\Spanner\V1\DirectedReadOptions\ReplicaSelection>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReplicaSelections($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\DirectedReadOptions\ReplicaSelection::class); + $this->replica_selections = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ExcludeReplicas::class, \Google\Cloud\Spanner\V1\DirectedReadOptions_ExcludeReplicas::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/IncludeReplicas.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/IncludeReplicas.php new file mode 100644 index 000000000000..82047d57919f --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/IncludeReplicas.php @@ -0,0 +1,113 @@ +google.spanner.v1.DirectedReadOptions.IncludeReplicas + */ +class IncludeReplicas extends \Google\Protobuf\Internal\Message +{ + /** + * The directed read replica selector. + * + * Generated from protobuf field repeated .google.spanner.v1.DirectedReadOptions.ReplicaSelection replica_selections = 1; + */ + private $replica_selections; + /** + * If true, Spanner will not route requests to a replica outside the + * include_replicas list when all of the specified replicas are unavailable + * or unhealthy. Default value is `false`. + * + * Generated from protobuf field bool auto_failover_disabled = 2; + */ + protected $auto_failover_disabled = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Spanner\V1\DirectedReadOptions\ReplicaSelection>|\Google\Protobuf\Internal\RepeatedField $replica_selections + * The directed read replica selector. + * @type bool $auto_failover_disabled + * If true, Spanner will not route requests to a replica outside the + * include_replicas list when all of the specified replicas are unavailable + * or unhealthy. Default value is `false`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * The directed read replica selector. + * + * Generated from protobuf field repeated .google.spanner.v1.DirectedReadOptions.ReplicaSelection replica_selections = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReplicaSelections() + { + return $this->replica_selections; + } + + /** + * The directed read replica selector. + * + * Generated from protobuf field repeated .google.spanner.v1.DirectedReadOptions.ReplicaSelection replica_selections = 1; + * @param array<\Google\Cloud\Spanner\V1\DirectedReadOptions\ReplicaSelection>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReplicaSelections($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\DirectedReadOptions\ReplicaSelection::class); + $this->replica_selections = $arr; + + return $this; + } + + /** + * If true, Spanner will not route requests to a replica outside the + * include_replicas list when all of the specified replicas are unavailable + * or unhealthy. Default value is `false`. + * + * Generated from protobuf field bool auto_failover_disabled = 2; + * @return bool + */ + public function getAutoFailoverDisabled() + { + return $this->auto_failover_disabled; + } + + /** + * If true, Spanner will not route requests to a replica outside the + * include_replicas list when all of the specified replicas are unavailable + * or unhealthy. Default value is `false`. + * + * Generated from protobuf field bool auto_failover_disabled = 2; + * @param bool $var + * @return $this + */ + public function setAutoFailoverDisabled($var) + { + GPBUtil::checkBool($var); + $this->auto_failover_disabled = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(IncludeReplicas::class, \Google\Cloud\Spanner\V1\DirectedReadOptions_IncludeReplicas::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ReplicaSelection.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ReplicaSelection.php new file mode 100644 index 000000000000..634c7345e1a1 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ReplicaSelection.php @@ -0,0 +1,118 @@ + The "us-east1" replica(s) of any available type + * will be used to process the request. + * * `type:READ_ONLY` --> The "READ_ONLY" type replica(s) in nearest + * available location will be used to process the + * request. + * * `location:us-east1 type:READ_ONLY` --> The "READ_ONLY" type replica(s) + * in location "us-east1" will be used to process + * the request. + * + * Generated from protobuf message google.spanner.v1.DirectedReadOptions.ReplicaSelection + */ +class ReplicaSelection extends \Google\Protobuf\Internal\Message +{ + /** + * The location or region of the serving requests, e.g. "us-east1". + * + * Generated from protobuf field string location = 1; + */ + protected $location = ''; + /** + * The type of replica. + * + * Generated from protobuf field .google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type type = 2; + */ + protected $type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $location + * The location or region of the serving requests, e.g. "us-east1". + * @type int $type + * The type of replica. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * The location or region of the serving requests, e.g. "us-east1". + * + * Generated from protobuf field string location = 1; + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * The location or region of the serving requests, e.g. "us-east1". + * + * Generated from protobuf field string location = 1; + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + + /** + * The type of replica. + * + * Generated from protobuf field .google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type type = 2; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The type of replica. + * + * Generated from protobuf field .google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type type = 2; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\V1\DirectedReadOptions\ReplicaSelection\Type::class); + $this->type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ReplicaSelection::class, \Google\Cloud\Spanner\V1\DirectedReadOptions_ReplicaSelection::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ReplicaSelection/Type.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ReplicaSelection/Type.php new file mode 100644 index 000000000000..94b7d304ad1b --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ReplicaSelection/Type.php @@ -0,0 +1,64 @@ +google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type + */ +class Type +{ + /** + * Not specified. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Read-write replicas support both reads and writes. + * + * Generated from protobuf enum READ_WRITE = 1; + */ + const READ_WRITE = 1; + /** + * Read-only replicas only support reads (not writes). + * + * Generated from protobuf enum READ_ONLY = 2; + */ + const READ_ONLY = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::READ_WRITE => 'READ_WRITE', + self::READ_ONLY => 'READ_ONLY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\Spanner\V1\DirectedReadOptions_ReplicaSelection_Type::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlRequest.php new file mode 100644 index 000000000000..37c878c7e14a --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlRequest.php @@ -0,0 +1,337 @@ +google.spanner.v1.ExecuteBatchDmlRequest + */ +class ExecuteBatchDmlRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The session in which the DML statements should be performed. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $session = ''; + /** + * Required. The transaction to use. Must be a read-write transaction. + * To protect against replays, single-use transactions are not supported. The + * caller must either supply an existing transaction ID or begin a new + * transaction. + * + * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $transaction = null; + /** + * Required. The list of statements to execute in this batch. Statements are + * executed serially, such that the effects of statement `i` are visible to + * statement `i+1`. Each statement must be a DML statement. Execution stops at + * the first failed statement; the remaining statements are not executed. + * Callers must provide at least one statement. + * + * Generated from protobuf field repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $statements; + /** + * Required. A per-transaction sequence number used to identify this request. + * This field makes each request idempotent such that if the request is + * received multiple times, at most one will succeed. + * The sequence number must be monotonically increasing within the + * transaction. If a request arrives for the first time with an out-of-order + * sequence number, the transaction may be aborted. Replays of previously + * handled requests will yield the same response as the first execution. + * + * Generated from protobuf field int64 seqno = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $seqno = 0; + /** + * Common options for this request. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 5; + */ + protected $request_options = null; + /** + * Optional. If set to true, this request marks the end of the transaction. + * The transaction should be committed or aborted after these statements + * execute, and attempts to execute any other requests against this + * transaction (including reads and queries) will be rejected. + * Setting this option may cause some error reporting to be deferred until + * commit time (e.g. validation of unique constraints). Given this, successful + * execution of statements should not be assumed until a subsequent Commit + * call completes successfully. + * + * Generated from protobuf field bool last_statements = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $last_statements = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $session + * Required. The session in which the DML statements should be performed. + * @type \Google\Cloud\Spanner\V1\TransactionSelector $transaction + * Required. The transaction to use. Must be a read-write transaction. + * To protect against replays, single-use transactions are not supported. The + * caller must either supply an existing transaction ID or begin a new + * transaction. + * @type array<\Google\Cloud\Spanner\V1\ExecuteBatchDmlRequest\Statement>|\Google\Protobuf\Internal\RepeatedField $statements + * Required. The list of statements to execute in this batch. Statements are + * executed serially, such that the effects of statement `i` are visible to + * statement `i+1`. Each statement must be a DML statement. Execution stops at + * the first failed statement; the remaining statements are not executed. + * Callers must provide at least one statement. + * @type int|string $seqno + * Required. A per-transaction sequence number used to identify this request. + * This field makes each request idempotent such that if the request is + * received multiple times, at most one will succeed. + * The sequence number must be monotonically increasing within the + * transaction. If a request arrives for the first time with an out-of-order + * sequence number, the transaction may be aborted. Replays of previously + * handled requests will yield the same response as the first execution. + * @type \Google\Cloud\Spanner\V1\RequestOptions $request_options + * Common options for this request. + * @type bool $last_statements + * Optional. If set to true, this request marks the end of the transaction. + * The transaction should be committed or aborted after these statements + * execute, and attempts to execute any other requests against this + * transaction (including reads and queries) will be rejected. + * Setting this option may cause some error reporting to be deferred until + * commit time (e.g. validation of unique constraints). Given this, successful + * execution of statements should not be assumed until a subsequent Commit + * call completes successfully. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The session in which the DML statements should be performed. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSession() + { + return $this->session; + } + + /** + * Required. The session in which the DML statements should be performed. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSession($var) + { + GPBUtil::checkString($var, True); + $this->session = $var; + + return $this; + } + + /** + * Required. The transaction to use. Must be a read-write transaction. + * To protect against replays, single-use transactions are not supported. The + * caller must either supply an existing transaction ID or begin a new + * transaction. + * + * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\V1\TransactionSelector|null + */ + public function getTransaction() + { + return $this->transaction; + } + + public function hasTransaction() + { + return isset($this->transaction); + } + + public function clearTransaction() + { + unset($this->transaction); + } + + /** + * Required. The transaction to use. Must be a read-write transaction. + * To protect against replays, single-use transactions are not supported. The + * caller must either supply an existing transaction ID or begin a new + * transaction. + * + * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\V1\TransactionSelector $var + * @return $this + */ + public function setTransaction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionSelector::class); + $this->transaction = $var; + + return $this; + } + + /** + * Required. The list of statements to execute in this batch. Statements are + * executed serially, such that the effects of statement `i` are visible to + * statement `i+1`. Each statement must be a DML statement. Execution stops at + * the first failed statement; the remaining statements are not executed. + * Callers must provide at least one statement. + * + * Generated from protobuf field repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStatements() + { + return $this->statements; + } + + /** + * Required. The list of statements to execute in this batch. Statements are + * executed serially, such that the effects of statement `i` are visible to + * statement `i+1`. Each statement must be a DML statement. Execution stops at + * the first failed statement; the remaining statements are not executed. + * Callers must provide at least one statement. + * + * Generated from protobuf field repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\Spanner\V1\ExecuteBatchDmlRequest\Statement>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStatements($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\ExecuteBatchDmlRequest\Statement::class); + $this->statements = $arr; + + return $this; + } + + /** + * Required. A per-transaction sequence number used to identify this request. + * This field makes each request idempotent such that if the request is + * received multiple times, at most one will succeed. + * The sequence number must be monotonically increasing within the + * transaction. If a request arrives for the first time with an out-of-order + * sequence number, the transaction may be aborted. Replays of previously + * handled requests will yield the same response as the first execution. + * + * Generated from protobuf field int64 seqno = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return int|string + */ + public function getSeqno() + { + return $this->seqno; + } + + /** + * Required. A per-transaction sequence number used to identify this request. + * This field makes each request idempotent such that if the request is + * received multiple times, at most one will succeed. + * The sequence number must be monotonically increasing within the + * transaction. If a request arrives for the first time with an out-of-order + * sequence number, the transaction may be aborted. Replays of previously + * handled requests will yield the same response as the first execution. + * + * Generated from protobuf field int64 seqno = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param int|string $var + * @return $this + */ + public function setSeqno($var) + { + GPBUtil::checkInt64($var); + $this->seqno = $var; + + return $this; + } + + /** + * Common options for this request. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 5; + * @return \Google\Cloud\Spanner\V1\RequestOptions|null + */ + public function getRequestOptions() + { + return $this->request_options; + } + + public function hasRequestOptions() + { + return isset($this->request_options); + } + + public function clearRequestOptions() + { + unset($this->request_options); + } + + /** + * Common options for this request. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 5; + * @param \Google\Cloud\Spanner\V1\RequestOptions $var + * @return $this + */ + public function setRequestOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\RequestOptions::class); + $this->request_options = $var; + + return $this; + } + + /** + * Optional. If set to true, this request marks the end of the transaction. + * The transaction should be committed or aborted after these statements + * execute, and attempts to execute any other requests against this + * transaction (including reads and queries) will be rejected. + * Setting this option may cause some error reporting to be deferred until + * commit time (e.g. validation of unique constraints). Given this, successful + * execution of statements should not be assumed until a subsequent Commit + * call completes successfully. + * + * Generated from protobuf field bool last_statements = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getLastStatements() + { + return $this->last_statements; + } + + /** + * Optional. If set to true, this request marks the end of the transaction. + * The transaction should be committed or aborted after these statements + * execute, and attempts to execute any other requests against this + * transaction (including reads and queries) will be rejected. + * Setting this option may cause some error reporting to be deferred until + * commit time (e.g. validation of unique constraints). Given this, successful + * execution of statements should not be assumed until a subsequent Commit + * call completes successfully. + * + * Generated from protobuf field bool last_statements = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setLastStatements($var) + { + GPBUtil::checkBool($var); + $this->last_statements = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlRequest/Statement.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlRequest/Statement.php new file mode 100644 index 000000000000..aba8c0bd42cd --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlRequest/Statement.php @@ -0,0 +1,208 @@ +google.spanner.v1.ExecuteBatchDmlRequest.Statement + */ +class Statement extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The DML string. + * + * Generated from protobuf field string sql = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $sql = ''; + /** + * Parameter names and values that bind to placeholders in the DML string. + * A parameter placeholder consists of the `@` character followed by the + * parameter name (for example, `@firstName`). Parameter names can contain + * letters, numbers, and underscores. + * Parameters can appear anywhere that a literal value is expected. The + * same parameter name can be used more than once, for example: + * `"WHERE id > @msg_id AND id < @msg_id + 100"` + * It is an error to execute a SQL statement with unbound parameters. + * + * Generated from protobuf field .google.protobuf.Struct params = 2; + */ + protected $params = null; + /** + * It is not always possible for Cloud Spanner to infer the right SQL type + * from a JSON value. For example, values of type `BYTES` and values + * of type `STRING` both appear in + * [params][google.spanner.v1.ExecuteBatchDmlRequest.Statement.params] as + * JSON strings. + * In these cases, `param_types` can be used to specify the exact + * SQL type for some or all of the SQL statement parameters. See the + * definition of [Type][google.spanner.v1.Type] for more information + * about SQL types. + * + * Generated from protobuf field map param_types = 3; + */ + private $param_types; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $sql + * Required. The DML string. + * @type \Google\Protobuf\Struct $params + * Parameter names and values that bind to placeholders in the DML string. + * A parameter placeholder consists of the `@` character followed by the + * parameter name (for example, `@firstName`). Parameter names can contain + * letters, numbers, and underscores. + * Parameters can appear anywhere that a literal value is expected. The + * same parameter name can be used more than once, for example: + * `"WHERE id > @msg_id AND id < @msg_id + 100"` + * It is an error to execute a SQL statement with unbound parameters. + * @type array|\Google\Protobuf\Internal\MapField $param_types + * It is not always possible for Cloud Spanner to infer the right SQL type + * from a JSON value. For example, values of type `BYTES` and values + * of type `STRING` both appear in + * [params][google.spanner.v1.ExecuteBatchDmlRequest.Statement.params] as + * JSON strings. + * In these cases, `param_types` can be used to specify the exact + * SQL type for some or all of the SQL statement parameters. See the + * definition of [Type][google.spanner.v1.Type] for more information + * about SQL types. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The DML string. + * + * Generated from protobuf field string sql = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getSql() + { + return $this->sql; + } + + /** + * Required. The DML string. + * + * Generated from protobuf field string sql = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setSql($var) + { + GPBUtil::checkString($var, True); + $this->sql = $var; + + return $this; + } + + /** + * Parameter names and values that bind to placeholders in the DML string. + * A parameter placeholder consists of the `@` character followed by the + * parameter name (for example, `@firstName`). Parameter names can contain + * letters, numbers, and underscores. + * Parameters can appear anywhere that a literal value is expected. The + * same parameter name can be used more than once, for example: + * `"WHERE id > @msg_id AND id < @msg_id + 100"` + * It is an error to execute a SQL statement with unbound parameters. + * + * Generated from protobuf field .google.protobuf.Struct params = 2; + * @return \Google\Protobuf\Struct|null + */ + public function getParams() + { + return $this->params; + } + + public function hasParams() + { + return isset($this->params); + } + + public function clearParams() + { + unset($this->params); + } + + /** + * Parameter names and values that bind to placeholders in the DML string. + * A parameter placeholder consists of the `@` character followed by the + * parameter name (for example, `@firstName`). Parameter names can contain + * letters, numbers, and underscores. + * Parameters can appear anywhere that a literal value is expected. The + * same parameter name can be used more than once, for example: + * `"WHERE id > @msg_id AND id < @msg_id + 100"` + * It is an error to execute a SQL statement with unbound parameters. + * + * Generated from protobuf field .google.protobuf.Struct params = 2; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setParams($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->params = $var; + + return $this; + } + + /** + * It is not always possible for Cloud Spanner to infer the right SQL type + * from a JSON value. For example, values of type `BYTES` and values + * of type `STRING` both appear in + * [params][google.spanner.v1.ExecuteBatchDmlRequest.Statement.params] as + * JSON strings. + * In these cases, `param_types` can be used to specify the exact + * SQL type for some or all of the SQL statement parameters. See the + * definition of [Type][google.spanner.v1.Type] for more information + * about SQL types. + * + * Generated from protobuf field map param_types = 3; + * @return \Google\Protobuf\Internal\MapField + */ + public function getParamTypes() + { + return $this->param_types; + } + + /** + * It is not always possible for Cloud Spanner to infer the right SQL type + * from a JSON value. For example, values of type `BYTES` and values + * of type `STRING` both appear in + * [params][google.spanner.v1.ExecuteBatchDmlRequest.Statement.params] as + * JSON strings. + * In these cases, `param_types` can be used to specify the exact + * SQL type for some or all of the SQL statement parameters. See the + * definition of [Type][google.spanner.v1.Type] for more information + * about SQL types. + * + * Generated from protobuf field map param_types = 3; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setParamTypes($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Type::class); + $this->param_types = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Statement::class, \Google\Cloud\Spanner\V1\ExecuteBatchDmlRequest_Statement::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlResponse.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlResponse.php new file mode 100644 index 000000000000..af904f7019f8 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlResponse.php @@ -0,0 +1,235 @@ +google.spanner.v1.ExecuteBatchDmlResponse + */ +class ExecuteBatchDmlResponse extends \Google\Protobuf\Internal\Message +{ + /** + * One [ResultSet][google.spanner.v1.ResultSet] for each statement in the + * request that ran successfully, in the same order as the statements in the + * request. Each [ResultSet][google.spanner.v1.ResultSet] does not contain any + * rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each + * [ResultSet][google.spanner.v1.ResultSet] contain the number of rows + * modified by the statement. + * Only the first [ResultSet][google.spanner.v1.ResultSet] in the response + * contains valid [ResultSetMetadata][google.spanner.v1.ResultSetMetadata]. + * + * Generated from protobuf field repeated .google.spanner.v1.ResultSet result_sets = 1; + */ + private $result_sets; + /** + * If all DML statements are executed successfully, the status is `OK`. + * Otherwise, the error status of the first failed statement. + * + * Generated from protobuf field .google.rpc.Status status = 2; + */ + protected $status = null; + /** + * Optional. A precommit token will be included if the read-write transaction + * is on a multiplexed session. + * The precommit token with the highest sequence number from this transaction + * attempt should be passed to the + * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $precommit_token = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Spanner\V1\ResultSet>|\Google\Protobuf\Internal\RepeatedField $result_sets + * One [ResultSet][google.spanner.v1.ResultSet] for each statement in the + * request that ran successfully, in the same order as the statements in the + * request. Each [ResultSet][google.spanner.v1.ResultSet] does not contain any + * rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each + * [ResultSet][google.spanner.v1.ResultSet] contain the number of rows + * modified by the statement. + * Only the first [ResultSet][google.spanner.v1.ResultSet] in the response + * contains valid [ResultSetMetadata][google.spanner.v1.ResultSetMetadata]. + * @type \Google\Rpc\Status $status + * If all DML statements are executed successfully, the status is `OK`. + * Otherwise, the error status of the first failed statement. + * @type \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $precommit_token + * Optional. A precommit token will be included if the read-write transaction + * is on a multiplexed session. + * The precommit token with the highest sequence number from this transaction + * attempt should be passed to the + * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * One [ResultSet][google.spanner.v1.ResultSet] for each statement in the + * request that ran successfully, in the same order as the statements in the + * request. Each [ResultSet][google.spanner.v1.ResultSet] does not contain any + * rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each + * [ResultSet][google.spanner.v1.ResultSet] contain the number of rows + * modified by the statement. + * Only the first [ResultSet][google.spanner.v1.ResultSet] in the response + * contains valid [ResultSetMetadata][google.spanner.v1.ResultSetMetadata]. + * + * Generated from protobuf field repeated .google.spanner.v1.ResultSet result_sets = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResultSets() + { + return $this->result_sets; + } + + /** + * One [ResultSet][google.spanner.v1.ResultSet] for each statement in the + * request that ran successfully, in the same order as the statements in the + * request. Each [ResultSet][google.spanner.v1.ResultSet] does not contain any + * rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each + * [ResultSet][google.spanner.v1.ResultSet] contain the number of rows + * modified by the statement. + * Only the first [ResultSet][google.spanner.v1.ResultSet] in the response + * contains valid [ResultSetMetadata][google.spanner.v1.ResultSetMetadata]. + * + * Generated from protobuf field repeated .google.spanner.v1.ResultSet result_sets = 1; + * @param array<\Google\Cloud\Spanner\V1\ResultSet>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResultSets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\ResultSet::class); + $this->result_sets = $arr; + + return $this; + } + + /** + * If all DML statements are executed successfully, the status is `OK`. + * Otherwise, the error status of the first failed statement. + * + * Generated from protobuf field .google.rpc.Status status = 2; + * @return \Google\Rpc\Status|null + */ + public function getStatus() + { + return $this->status; + } + + public function hasStatus() + { + return isset($this->status); + } + + public function clearStatus() + { + unset($this->status); + } + + /** + * If all DML statements are executed successfully, the status is `OK`. + * Otherwise, the error status of the first failed statement. + * + * Generated from protobuf field .google.rpc.Status status = 2; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setStatus($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->status = $var; + + return $this; + } + + /** + * Optional. A precommit token will be included if the read-write transaction + * is on a multiplexed session. + * The precommit token with the highest sequence number from this transaction + * attempt should be passed to the + * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken|null + */ + public function getPrecommitToken() + { + return $this->precommit_token; + } + + public function hasPrecommitToken() + { + return isset($this->precommit_token); + } + + public function clearPrecommitToken() + { + unset($this->precommit_token); + } + + /** + * Optional. A precommit token will be included if the read-write transaction + * is on a multiplexed session. + * The precommit token with the highest sequence number from this transaction + * attempt should be passed to the + * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $var + * @return $this + */ + public function setPrecommitToken($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken::class); + $this->precommit_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest.php new file mode 100644 index 000000000000..6733a35ca0b9 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest.php @@ -0,0 +1,764 @@ +google.spanner.v1.ExecuteSqlRequest + */ +class ExecuteSqlRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The session in which the SQL query should be performed. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $session = ''; + /** + * The transaction to use. + * For queries, if none is provided, the default is a temporary read-only + * transaction with strong concurrency. + * Standard DML statements require a read-write transaction. To protect + * against replays, single-use transactions are not supported. The caller + * must either supply an existing transaction ID or begin a new transaction. + * Partitioned DML requires an existing Partitioned DML transaction ID. + * + * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; + */ + protected $transaction = null; + /** + * Required. The SQL string. + * + * Generated from protobuf field string sql = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $sql = ''; + /** + * Parameter names and values that bind to placeholders in the SQL string. + * A parameter placeholder consists of the `@` character followed by the + * parameter name (for example, `@firstName`). Parameter names must conform + * to the naming requirements of identifiers as specified at + * https://cloud.google.com/spanner/docs/lexical#identifiers. + * Parameters can appear anywhere that a literal value is expected. The same + * parameter name can be used more than once, for example: + * `"WHERE id > @msg_id AND id < @msg_id + 100"` + * It is an error to execute a SQL statement with unbound parameters. + * + * Generated from protobuf field .google.protobuf.Struct params = 4; + */ + protected $params = null; + /** + * It is not always possible for Cloud Spanner to infer the right SQL type + * from a JSON value. For example, values of type `BYTES` and values + * of type `STRING` both appear in + * [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings. + * In these cases, `param_types` can be used to specify the exact + * SQL type for some or all of the SQL statement parameters. See the + * definition of [Type][google.spanner.v1.Type] for more information + * about SQL types. + * + * Generated from protobuf field map param_types = 5; + */ + private $param_types; + /** + * If this request is resuming a previously interrupted SQL statement + * execution, `resume_token` should be copied from the last + * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the + * interruption. Doing this enables the new SQL statement execution to resume + * where the last one left off. The rest of the request parameters must + * exactly match the request that yielded this token. + * + * Generated from protobuf field bytes resume_token = 6; + */ + protected $resume_token = ''; + /** + * Used to control the amount of debugging information returned in + * [ResultSetStats][google.spanner.v1.ResultSetStats]. If + * [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is + * set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only + * be set to + * [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL]. + * + * Generated from protobuf field .google.spanner.v1.ExecuteSqlRequest.QueryMode query_mode = 7; + */ + protected $query_mode = 0; + /** + * If present, results will be restricted to the specified partition + * previously created using PartitionQuery(). There must be an exact + * match for the values of fields common to this message and the + * PartitionQueryRequest message used to create this partition_token. + * + * Generated from protobuf field bytes partition_token = 8; + */ + protected $partition_token = ''; + /** + * A per-transaction sequence number used to identify this request. This field + * makes each request idempotent such that if the request is received multiple + * times, at most one will succeed. + * The sequence number must be monotonically increasing within the + * transaction. If a request arrives for the first time with an out-of-order + * sequence number, the transaction may be aborted. Replays of previously + * handled requests will yield the same response as the first execution. + * Required for DML statements. Ignored for queries. + * + * Generated from protobuf field int64 seqno = 9; + */ + protected $seqno = 0; + /** + * Query optimizer configuration to use for the given query. + * + * Generated from protobuf field .google.spanner.v1.ExecuteSqlRequest.QueryOptions query_options = 10; + */ + protected $query_options = null; + /** + * Common options for this request. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 11; + */ + protected $request_options = null; + /** + * Directed read options for this request. + * + * Generated from protobuf field .google.spanner.v1.DirectedReadOptions directed_read_options = 15; + */ + protected $directed_read_options = null; + /** + * If this is for a partitioned query and this field is set to `true`, the + * request is executed with Spanner Data Boost independent compute resources. + * If the field is set to `true` but the request does not set + * `partition_token`, the API returns an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field bool data_boost_enabled = 16; + */ + protected $data_boost_enabled = false; + /** + * Optional. If set to true, this statement marks the end of the transaction. + * The transaction should be committed or aborted after this statement + * executes, and attempts to execute any other requests against this + * transaction (including reads and queries) will be rejected. + * For DML statements, setting this option may cause some error reporting to + * be deferred until commit time (e.g. validation of unique constraints). + * Given this, successful execution of a DML statement should not be assumed + * until a subsequent Commit call completes successfully. + * + * Generated from protobuf field bool last_statement = 17 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $last_statement = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $session + * Required. The session in which the SQL query should be performed. + * @type \Google\Cloud\Spanner\V1\TransactionSelector $transaction + * The transaction to use. + * For queries, if none is provided, the default is a temporary read-only + * transaction with strong concurrency. + * Standard DML statements require a read-write transaction. To protect + * against replays, single-use transactions are not supported. The caller + * must either supply an existing transaction ID or begin a new transaction. + * Partitioned DML requires an existing Partitioned DML transaction ID. + * @type string $sql + * Required. The SQL string. + * @type \Google\Protobuf\Struct $params + * Parameter names and values that bind to placeholders in the SQL string. + * A parameter placeholder consists of the `@` character followed by the + * parameter name (for example, `@firstName`). Parameter names must conform + * to the naming requirements of identifiers as specified at + * https://cloud.google.com/spanner/docs/lexical#identifiers. + * Parameters can appear anywhere that a literal value is expected. The same + * parameter name can be used more than once, for example: + * `"WHERE id > @msg_id AND id < @msg_id + 100"` + * It is an error to execute a SQL statement with unbound parameters. + * @type array|\Google\Protobuf\Internal\MapField $param_types + * It is not always possible for Cloud Spanner to infer the right SQL type + * from a JSON value. For example, values of type `BYTES` and values + * of type `STRING` both appear in + * [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings. + * In these cases, `param_types` can be used to specify the exact + * SQL type for some or all of the SQL statement parameters. See the + * definition of [Type][google.spanner.v1.Type] for more information + * about SQL types. + * @type string $resume_token + * If this request is resuming a previously interrupted SQL statement + * execution, `resume_token` should be copied from the last + * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the + * interruption. Doing this enables the new SQL statement execution to resume + * where the last one left off. The rest of the request parameters must + * exactly match the request that yielded this token. + * @type int $query_mode + * Used to control the amount of debugging information returned in + * [ResultSetStats][google.spanner.v1.ResultSetStats]. If + * [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is + * set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only + * be set to + * [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL]. + * @type string $partition_token + * If present, results will be restricted to the specified partition + * previously created using PartitionQuery(). There must be an exact + * match for the values of fields common to this message and the + * PartitionQueryRequest message used to create this partition_token. + * @type int|string $seqno + * A per-transaction sequence number used to identify this request. This field + * makes each request idempotent such that if the request is received multiple + * times, at most one will succeed. + * The sequence number must be monotonically increasing within the + * transaction. If a request arrives for the first time with an out-of-order + * sequence number, the transaction may be aborted. Replays of previously + * handled requests will yield the same response as the first execution. + * Required for DML statements. Ignored for queries. + * @type \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryOptions $query_options + * Query optimizer configuration to use for the given query. + * @type \Google\Cloud\Spanner\V1\RequestOptions $request_options + * Common options for this request. + * @type \Google\Cloud\Spanner\V1\DirectedReadOptions $directed_read_options + * Directed read options for this request. + * @type bool $data_boost_enabled + * If this is for a partitioned query and this field is set to `true`, the + * request is executed with Spanner Data Boost independent compute resources. + * If the field is set to `true` but the request does not set + * `partition_token`, the API returns an `INVALID_ARGUMENT` error. + * @type bool $last_statement + * Optional. If set to true, this statement marks the end of the transaction. + * The transaction should be committed or aborted after this statement + * executes, and attempts to execute any other requests against this + * transaction (including reads and queries) will be rejected. + * For DML statements, setting this option may cause some error reporting to + * be deferred until commit time (e.g. validation of unique constraints). + * Given this, successful execution of a DML statement should not be assumed + * until a subsequent Commit call completes successfully. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The session in which the SQL query should be performed. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSession() + { + return $this->session; + } + + /** + * Required. The session in which the SQL query should be performed. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSession($var) + { + GPBUtil::checkString($var, True); + $this->session = $var; + + return $this; + } + + /** + * The transaction to use. + * For queries, if none is provided, the default is a temporary read-only + * transaction with strong concurrency. + * Standard DML statements require a read-write transaction. To protect + * against replays, single-use transactions are not supported. The caller + * must either supply an existing transaction ID or begin a new transaction. + * Partitioned DML requires an existing Partitioned DML transaction ID. + * + * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; + * @return \Google\Cloud\Spanner\V1\TransactionSelector|null + */ + public function getTransaction() + { + return $this->transaction; + } + + public function hasTransaction() + { + return isset($this->transaction); + } + + public function clearTransaction() + { + unset($this->transaction); + } + + /** + * The transaction to use. + * For queries, if none is provided, the default is a temporary read-only + * transaction with strong concurrency. + * Standard DML statements require a read-write transaction. To protect + * against replays, single-use transactions are not supported. The caller + * must either supply an existing transaction ID or begin a new transaction. + * Partitioned DML requires an existing Partitioned DML transaction ID. + * + * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; + * @param \Google\Cloud\Spanner\V1\TransactionSelector $var + * @return $this + */ + public function setTransaction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionSelector::class); + $this->transaction = $var; + + return $this; + } + + /** + * Required. The SQL string. + * + * Generated from protobuf field string sql = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getSql() + { + return $this->sql; + } + + /** + * Required. The SQL string. + * + * Generated from protobuf field string sql = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setSql($var) + { + GPBUtil::checkString($var, True); + $this->sql = $var; + + return $this; + } + + /** + * Parameter names and values that bind to placeholders in the SQL string. + * A parameter placeholder consists of the `@` character followed by the + * parameter name (for example, `@firstName`). Parameter names must conform + * to the naming requirements of identifiers as specified at + * https://cloud.google.com/spanner/docs/lexical#identifiers. + * Parameters can appear anywhere that a literal value is expected. The same + * parameter name can be used more than once, for example: + * `"WHERE id > @msg_id AND id < @msg_id + 100"` + * It is an error to execute a SQL statement with unbound parameters. + * + * Generated from protobuf field .google.protobuf.Struct params = 4; + * @return \Google\Protobuf\Struct|null + */ + public function getParams() + { + return $this->params; + } + + public function hasParams() + { + return isset($this->params); + } + + public function clearParams() + { + unset($this->params); + } + + /** + * Parameter names and values that bind to placeholders in the SQL string. + * A parameter placeholder consists of the `@` character followed by the + * parameter name (for example, `@firstName`). Parameter names must conform + * to the naming requirements of identifiers as specified at + * https://cloud.google.com/spanner/docs/lexical#identifiers. + * Parameters can appear anywhere that a literal value is expected. The same + * parameter name can be used more than once, for example: + * `"WHERE id > @msg_id AND id < @msg_id + 100"` + * It is an error to execute a SQL statement with unbound parameters. + * + * Generated from protobuf field .google.protobuf.Struct params = 4; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setParams($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->params = $var; + + return $this; + } + + /** + * It is not always possible for Cloud Spanner to infer the right SQL type + * from a JSON value. For example, values of type `BYTES` and values + * of type `STRING` both appear in + * [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings. + * In these cases, `param_types` can be used to specify the exact + * SQL type for some or all of the SQL statement parameters. See the + * definition of [Type][google.spanner.v1.Type] for more information + * about SQL types. + * + * Generated from protobuf field map param_types = 5; + * @return \Google\Protobuf\Internal\MapField + */ + public function getParamTypes() + { + return $this->param_types; + } + + /** + * It is not always possible for Cloud Spanner to infer the right SQL type + * from a JSON value. For example, values of type `BYTES` and values + * of type `STRING` both appear in + * [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings. + * In these cases, `param_types` can be used to specify the exact + * SQL type for some or all of the SQL statement parameters. See the + * definition of [Type][google.spanner.v1.Type] for more information + * about SQL types. + * + * Generated from protobuf field map param_types = 5; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setParamTypes($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Type::class); + $this->param_types = $arr; + + return $this; + } + + /** + * If this request is resuming a previously interrupted SQL statement + * execution, `resume_token` should be copied from the last + * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the + * interruption. Doing this enables the new SQL statement execution to resume + * where the last one left off. The rest of the request parameters must + * exactly match the request that yielded this token. + * + * Generated from protobuf field bytes resume_token = 6; + * @return string + */ + public function getResumeToken() + { + return $this->resume_token; + } + + /** + * If this request is resuming a previously interrupted SQL statement + * execution, `resume_token` should be copied from the last + * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the + * interruption. Doing this enables the new SQL statement execution to resume + * where the last one left off. The rest of the request parameters must + * exactly match the request that yielded this token. + * + * Generated from protobuf field bytes resume_token = 6; + * @param string $var + * @return $this + */ + public function setResumeToken($var) + { + GPBUtil::checkString($var, False); + $this->resume_token = $var; + + return $this; + } + + /** + * Used to control the amount of debugging information returned in + * [ResultSetStats][google.spanner.v1.ResultSetStats]. If + * [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is + * set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only + * be set to + * [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL]. + * + * Generated from protobuf field .google.spanner.v1.ExecuteSqlRequest.QueryMode query_mode = 7; + * @return int + */ + public function getQueryMode() + { + return $this->query_mode; + } + + /** + * Used to control the amount of debugging information returned in + * [ResultSetStats][google.spanner.v1.ResultSetStats]. If + * [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is + * set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only + * be set to + * [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL]. + * + * Generated from protobuf field .google.spanner.v1.ExecuteSqlRequest.QueryMode query_mode = 7; + * @param int $var + * @return $this + */ + public function setQueryMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryMode::class); + $this->query_mode = $var; + + return $this; + } + + /** + * If present, results will be restricted to the specified partition + * previously created using PartitionQuery(). There must be an exact + * match for the values of fields common to this message and the + * PartitionQueryRequest message used to create this partition_token. + * + * Generated from protobuf field bytes partition_token = 8; + * @return string + */ + public function getPartitionToken() + { + return $this->partition_token; + } + + /** + * If present, results will be restricted to the specified partition + * previously created using PartitionQuery(). There must be an exact + * match for the values of fields common to this message and the + * PartitionQueryRequest message used to create this partition_token. + * + * Generated from protobuf field bytes partition_token = 8; + * @param string $var + * @return $this + */ + public function setPartitionToken($var) + { + GPBUtil::checkString($var, False); + $this->partition_token = $var; + + return $this; + } + + /** + * A per-transaction sequence number used to identify this request. This field + * makes each request idempotent such that if the request is received multiple + * times, at most one will succeed. + * The sequence number must be monotonically increasing within the + * transaction. If a request arrives for the first time with an out-of-order + * sequence number, the transaction may be aborted. Replays of previously + * handled requests will yield the same response as the first execution. + * Required for DML statements. Ignored for queries. + * + * Generated from protobuf field int64 seqno = 9; + * @return int|string + */ + public function getSeqno() + { + return $this->seqno; + } + + /** + * A per-transaction sequence number used to identify this request. This field + * makes each request idempotent such that if the request is received multiple + * times, at most one will succeed. + * The sequence number must be monotonically increasing within the + * transaction. If a request arrives for the first time with an out-of-order + * sequence number, the transaction may be aborted. Replays of previously + * handled requests will yield the same response as the first execution. + * Required for DML statements. Ignored for queries. + * + * Generated from protobuf field int64 seqno = 9; + * @param int|string $var + * @return $this + */ + public function setSeqno($var) + { + GPBUtil::checkInt64($var); + $this->seqno = $var; + + return $this; + } + + /** + * Query optimizer configuration to use for the given query. + * + * Generated from protobuf field .google.spanner.v1.ExecuteSqlRequest.QueryOptions query_options = 10; + * @return \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryOptions|null + */ + public function getQueryOptions() + { + return $this->query_options; + } + + public function hasQueryOptions() + { + return isset($this->query_options); + } + + public function clearQueryOptions() + { + unset($this->query_options); + } + + /** + * Query optimizer configuration to use for the given query. + * + * Generated from protobuf field .google.spanner.v1.ExecuteSqlRequest.QueryOptions query_options = 10; + * @param \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryOptions $var + * @return $this + */ + public function setQueryOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryOptions::class); + $this->query_options = $var; + + return $this; + } + + /** + * Common options for this request. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 11; + * @return \Google\Cloud\Spanner\V1\RequestOptions|null + */ + public function getRequestOptions() + { + return $this->request_options; + } + + public function hasRequestOptions() + { + return isset($this->request_options); + } + + public function clearRequestOptions() + { + unset($this->request_options); + } + + /** + * Common options for this request. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 11; + * @param \Google\Cloud\Spanner\V1\RequestOptions $var + * @return $this + */ + public function setRequestOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\RequestOptions::class); + $this->request_options = $var; + + return $this; + } + + /** + * Directed read options for this request. + * + * Generated from protobuf field .google.spanner.v1.DirectedReadOptions directed_read_options = 15; + * @return \Google\Cloud\Spanner\V1\DirectedReadOptions|null + */ + public function getDirectedReadOptions() + { + return $this->directed_read_options; + } + + public function hasDirectedReadOptions() + { + return isset($this->directed_read_options); + } + + public function clearDirectedReadOptions() + { + unset($this->directed_read_options); + } + + /** + * Directed read options for this request. + * + * Generated from protobuf field .google.spanner.v1.DirectedReadOptions directed_read_options = 15; + * @param \Google\Cloud\Spanner\V1\DirectedReadOptions $var + * @return $this + */ + public function setDirectedReadOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\DirectedReadOptions::class); + $this->directed_read_options = $var; + + return $this; + } + + /** + * If this is for a partitioned query and this field is set to `true`, the + * request is executed with Spanner Data Boost independent compute resources. + * If the field is set to `true` but the request does not set + * `partition_token`, the API returns an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field bool data_boost_enabled = 16; + * @return bool + */ + public function getDataBoostEnabled() + { + return $this->data_boost_enabled; + } + + /** + * If this is for a partitioned query and this field is set to `true`, the + * request is executed with Spanner Data Boost independent compute resources. + * If the field is set to `true` but the request does not set + * `partition_token`, the API returns an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field bool data_boost_enabled = 16; + * @param bool $var + * @return $this + */ + public function setDataBoostEnabled($var) + { + GPBUtil::checkBool($var); + $this->data_boost_enabled = $var; + + return $this; + } + + /** + * Optional. If set to true, this statement marks the end of the transaction. + * The transaction should be committed or aborted after this statement + * executes, and attempts to execute any other requests against this + * transaction (including reads and queries) will be rejected. + * For DML statements, setting this option may cause some error reporting to + * be deferred until commit time (e.g. validation of unique constraints). + * Given this, successful execution of a DML statement should not be assumed + * until a subsequent Commit call completes successfully. + * + * Generated from protobuf field bool last_statement = 17 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getLastStatement() + { + return $this->last_statement; + } + + /** + * Optional. If set to true, this statement marks the end of the transaction. + * The transaction should be committed or aborted after this statement + * executes, and attempts to execute any other requests against this + * transaction (including reads and queries) will be rejected. + * For DML statements, setting this option may cause some error reporting to + * be deferred until commit time (e.g. validation of unique constraints). + * Given this, successful execution of a DML statement should not be assumed + * until a subsequent Commit call completes successfully. + * + * Generated from protobuf field bool last_statement = 17 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setLastStatement($var) + { + GPBUtil::checkBool($var); + $this->last_statement = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest/QueryMode.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest/QueryMode.php new file mode 100644 index 000000000000..43c3ed48f97b --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest/QueryMode.php @@ -0,0 +1,84 @@ +google.spanner.v1.ExecuteSqlRequest.QueryMode + */ +class QueryMode +{ + /** + * The default mode. Only the statement results are returned. + * + * Generated from protobuf enum NORMAL = 0; + */ + const NORMAL = 0; + /** + * This mode returns only the query plan, without any results or + * execution statistics information. + * + * Generated from protobuf enum PLAN = 1; + */ + const PLAN = 1; + /** + * This mode returns the query plan, overall execution statistics, + * operator level execution statistics along with the results. This has a + * performance overhead compared to the other modes. It is not recommended + * to use this mode for production traffic. + * + * Generated from protobuf enum PROFILE = 2; + */ + const PROFILE = 2; + /** + * This mode returns the overall (but not operator-level) execution + * statistics along with the results. + * + * Generated from protobuf enum WITH_STATS = 3; + */ + const WITH_STATS = 3; + /** + * This mode returns the query plan, overall (but not operator-level) + * execution statistics along with the results. + * + * Generated from protobuf enum WITH_PLAN_AND_STATS = 4; + */ + const WITH_PLAN_AND_STATS = 4; + + private static $valueToName = [ + self::NORMAL => 'NORMAL', + self::PLAN => 'PLAN', + self::PROFILE => 'PROFILE', + self::WITH_STATS => 'WITH_STATS', + self::WITH_PLAN_AND_STATS => 'WITH_PLAN_AND_STATS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(QueryMode::class, \Google\Cloud\Spanner\V1\ExecuteSqlRequest_QueryMode::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest/QueryOptions.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest/QueryOptions.php new file mode 100644 index 000000000000..d821f6f3bbef --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest/QueryOptions.php @@ -0,0 +1,232 @@ +google.spanner.v1.ExecuteSqlRequest.QueryOptions + */ +class QueryOptions extends \Google\Protobuf\Internal\Message +{ + /** + * An option to control the selection of optimizer version. + * This parameter allows individual queries to pick different query + * optimizer versions. + * Specifying `latest` as a value instructs Cloud Spanner to use the + * latest supported query optimizer version. If not specified, Cloud Spanner + * uses the optimizer version set at the database level options. Any other + * positive integer (from the list of supported optimizer versions) + * overrides the default optimizer version for query execution. + * The list of supported optimizer versions can be queried from + * SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS. + * Executing a SQL statement with an invalid optimizer version fails with + * an `INVALID_ARGUMENT` error. + * See + * https://cloud.google.com/spanner/docs/query-optimizer/manage-query-optimizer + * for more information on managing the query optimizer. + * The `optimizer_version` statement hint has precedence over this setting. + * + * Generated from protobuf field string optimizer_version = 1; + */ + protected $optimizer_version = ''; + /** + * An option to control the selection of optimizer statistics package. + * This parameter allows individual queries to use a different query + * optimizer statistics package. + * Specifying `latest` as a value instructs Cloud Spanner to use the latest + * generated statistics package. If not specified, Cloud Spanner uses + * the statistics package set at the database level options, or the latest + * package if the database option is not set. + * The statistics package requested by the query has to be exempt from + * garbage collection. This can be achieved with the following DDL + * statement: + * ``` + * ALTER STATISTICS SET OPTIONS (allow_gc=false) + * ``` + * The list of available statistics packages can be queried from + * `INFORMATION_SCHEMA.SPANNER_STATISTICS`. + * Executing a SQL statement with an invalid optimizer statistics package + * or with a statistics package that allows garbage collection fails with + * an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field string optimizer_statistics_package = 2; + */ + protected $optimizer_statistics_package = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $optimizer_version + * An option to control the selection of optimizer version. + * This parameter allows individual queries to pick different query + * optimizer versions. + * Specifying `latest` as a value instructs Cloud Spanner to use the + * latest supported query optimizer version. If not specified, Cloud Spanner + * uses the optimizer version set at the database level options. Any other + * positive integer (from the list of supported optimizer versions) + * overrides the default optimizer version for query execution. + * The list of supported optimizer versions can be queried from + * SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS. + * Executing a SQL statement with an invalid optimizer version fails with + * an `INVALID_ARGUMENT` error. + * See + * https://cloud.google.com/spanner/docs/query-optimizer/manage-query-optimizer + * for more information on managing the query optimizer. + * The `optimizer_version` statement hint has precedence over this setting. + * @type string $optimizer_statistics_package + * An option to control the selection of optimizer statistics package. + * This parameter allows individual queries to use a different query + * optimizer statistics package. + * Specifying `latest` as a value instructs Cloud Spanner to use the latest + * generated statistics package. If not specified, Cloud Spanner uses + * the statistics package set at the database level options, or the latest + * package if the database option is not set. + * The statistics package requested by the query has to be exempt from + * garbage collection. This can be achieved with the following DDL + * statement: + * ``` + * ALTER STATISTICS SET OPTIONS (allow_gc=false) + * ``` + * The list of available statistics packages can be queried from + * `INFORMATION_SCHEMA.SPANNER_STATISTICS`. + * Executing a SQL statement with an invalid optimizer statistics package + * or with a statistics package that allows garbage collection fails with + * an `INVALID_ARGUMENT` error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * An option to control the selection of optimizer version. + * This parameter allows individual queries to pick different query + * optimizer versions. + * Specifying `latest` as a value instructs Cloud Spanner to use the + * latest supported query optimizer version. If not specified, Cloud Spanner + * uses the optimizer version set at the database level options. Any other + * positive integer (from the list of supported optimizer versions) + * overrides the default optimizer version for query execution. + * The list of supported optimizer versions can be queried from + * SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS. + * Executing a SQL statement with an invalid optimizer version fails with + * an `INVALID_ARGUMENT` error. + * See + * https://cloud.google.com/spanner/docs/query-optimizer/manage-query-optimizer + * for more information on managing the query optimizer. + * The `optimizer_version` statement hint has precedence over this setting. + * + * Generated from protobuf field string optimizer_version = 1; + * @return string + */ + public function getOptimizerVersion() + { + return $this->optimizer_version; + } + + /** + * An option to control the selection of optimizer version. + * This parameter allows individual queries to pick different query + * optimizer versions. + * Specifying `latest` as a value instructs Cloud Spanner to use the + * latest supported query optimizer version. If not specified, Cloud Spanner + * uses the optimizer version set at the database level options. Any other + * positive integer (from the list of supported optimizer versions) + * overrides the default optimizer version for query execution. + * The list of supported optimizer versions can be queried from + * SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS. + * Executing a SQL statement with an invalid optimizer version fails with + * an `INVALID_ARGUMENT` error. + * See + * https://cloud.google.com/spanner/docs/query-optimizer/manage-query-optimizer + * for more information on managing the query optimizer. + * The `optimizer_version` statement hint has precedence over this setting. + * + * Generated from protobuf field string optimizer_version = 1; + * @param string $var + * @return $this + */ + public function setOptimizerVersion($var) + { + GPBUtil::checkString($var, True); + $this->optimizer_version = $var; + + return $this; + } + + /** + * An option to control the selection of optimizer statistics package. + * This parameter allows individual queries to use a different query + * optimizer statistics package. + * Specifying `latest` as a value instructs Cloud Spanner to use the latest + * generated statistics package. If not specified, Cloud Spanner uses + * the statistics package set at the database level options, or the latest + * package if the database option is not set. + * The statistics package requested by the query has to be exempt from + * garbage collection. This can be achieved with the following DDL + * statement: + * ``` + * ALTER STATISTICS SET OPTIONS (allow_gc=false) + * ``` + * The list of available statistics packages can be queried from + * `INFORMATION_SCHEMA.SPANNER_STATISTICS`. + * Executing a SQL statement with an invalid optimizer statistics package + * or with a statistics package that allows garbage collection fails with + * an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field string optimizer_statistics_package = 2; + * @return string + */ + public function getOptimizerStatisticsPackage() + { + return $this->optimizer_statistics_package; + } + + /** + * An option to control the selection of optimizer statistics package. + * This parameter allows individual queries to use a different query + * optimizer statistics package. + * Specifying `latest` as a value instructs Cloud Spanner to use the latest + * generated statistics package. If not specified, Cloud Spanner uses + * the statistics package set at the database level options, or the latest + * package if the database option is not set. + * The statistics package requested by the query has to be exempt from + * garbage collection. This can be achieved with the following DDL + * statement: + * ``` + * ALTER STATISTICS SET OPTIONS (allow_gc=false) + * ``` + * The list of available statistics packages can be queried from + * `INFORMATION_SCHEMA.SPANNER_STATISTICS`. + * Executing a SQL statement with an invalid optimizer statistics package + * or with a statistics package that allows garbage collection fails with + * an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field string optimizer_statistics_package = 2; + * @param string $var + * @return $this + */ + public function setOptimizerStatisticsPackage($var) + { + GPBUtil::checkString($var, True); + $this->optimizer_statistics_package = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(QueryOptions::class, \Google\Cloud\Spanner\V1\ExecuteSqlRequest_QueryOptions::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/GetSessionRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/GetSessionRequest.php new file mode 100644 index 000000000000..3e1ca94c5883 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/GetSessionRequest.php @@ -0,0 +1,81 @@ +google.spanner.v1.GetSessionRequest + */ +class GetSessionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the session to retrieve. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the session to retrieve. Please see + * {@see SpannerClient::sessionName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\V1\GetSessionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the session to retrieve. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the session to retrieve. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the session to retrieve. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/KeyRange.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/KeyRange.php new file mode 100644 index 000000000000..4b65e7b846ef --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/KeyRange.php @@ -0,0 +1,255 @@ +google.spanner.v1.KeyRange + */ +class KeyRange extends \Google\Protobuf\Internal\Message +{ + protected $start_key_type; + protected $end_key_type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\ListValue $start_closed + * If the start is closed, then the range includes all rows whose + * first `len(start_closed)` key columns exactly match `start_closed`. + * @type \Google\Protobuf\ListValue $start_open + * If the start is open, then the range excludes rows whose first + * `len(start_open)` key columns exactly match `start_open`. + * @type \Google\Protobuf\ListValue $end_closed + * If the end is closed, then the range includes all rows whose + * first `len(end_closed)` key columns exactly match `end_closed`. + * @type \Google\Protobuf\ListValue $end_open + * If the end is open, then the range excludes rows whose first + * `len(end_open)` key columns exactly match `end_open`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Keys::initOnce(); + parent::__construct($data); + } + + /** + * If the start is closed, then the range includes all rows whose + * first `len(start_closed)` key columns exactly match `start_closed`. + * + * Generated from protobuf field .google.protobuf.ListValue start_closed = 1; + * @return \Google\Protobuf\ListValue|null + */ + public function getStartClosed() + { + return $this->readOneof(1); + } + + public function hasStartClosed() + { + return $this->hasOneof(1); + } + + /** + * If the start is closed, then the range includes all rows whose + * first `len(start_closed)` key columns exactly match `start_closed`. + * + * Generated from protobuf field .google.protobuf.ListValue start_closed = 1; + * @param \Google\Protobuf\ListValue $var + * @return $this + */ + public function setStartClosed($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\ListValue::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * If the start is open, then the range excludes rows whose first + * `len(start_open)` key columns exactly match `start_open`. + * + * Generated from protobuf field .google.protobuf.ListValue start_open = 2; + * @return \Google\Protobuf\ListValue|null + */ + public function getStartOpen() + { + return $this->readOneof(2); + } + + public function hasStartOpen() + { + return $this->hasOneof(2); + } + + /** + * If the start is open, then the range excludes rows whose first + * `len(start_open)` key columns exactly match `start_open`. + * + * Generated from protobuf field .google.protobuf.ListValue start_open = 2; + * @param \Google\Protobuf\ListValue $var + * @return $this + */ + public function setStartOpen($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\ListValue::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * If the end is closed, then the range includes all rows whose + * first `len(end_closed)` key columns exactly match `end_closed`. + * + * Generated from protobuf field .google.protobuf.ListValue end_closed = 3; + * @return \Google\Protobuf\ListValue|null + */ + public function getEndClosed() + { + return $this->readOneof(3); + } + + public function hasEndClosed() + { + return $this->hasOneof(3); + } + + /** + * If the end is closed, then the range includes all rows whose + * first `len(end_closed)` key columns exactly match `end_closed`. + * + * Generated from protobuf field .google.protobuf.ListValue end_closed = 3; + * @param \Google\Protobuf\ListValue $var + * @return $this + */ + public function setEndClosed($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\ListValue::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * If the end is open, then the range excludes rows whose first + * `len(end_open)` key columns exactly match `end_open`. + * + * Generated from protobuf field .google.protobuf.ListValue end_open = 4; + * @return \Google\Protobuf\ListValue|null + */ + public function getEndOpen() + { + return $this->readOneof(4); + } + + public function hasEndOpen() + { + return $this->hasOneof(4); + } + + /** + * If the end is open, then the range excludes rows whose first + * `len(end_open)` key columns exactly match `end_open`. + * + * Generated from protobuf field .google.protobuf.ListValue end_open = 4; + * @param \Google\Protobuf\ListValue $var + * @return $this + */ + public function setEndOpen($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\ListValue::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * @return string + */ + public function getStartKeyType() + { + return $this->whichOneof("start_key_type"); + } + + /** + * @return string + */ + public function getEndKeyType() + { + return $this->whichOneof("end_key_type"); + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/KeySet.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/KeySet.php new file mode 100644 index 000000000000..29121208ba59 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/KeySet.php @@ -0,0 +1,164 @@ +google.spanner.v1.KeySet + */ +class KeySet extends \Google\Protobuf\Internal\Message +{ + /** + * A list of specific keys. Entries in `keys` should have exactly as + * many elements as there are columns in the primary or index key + * with which this `KeySet` is used. Individual key values are + * encoded as described [here][google.spanner.v1.TypeCode]. + * + * Generated from protobuf field repeated .google.protobuf.ListValue keys = 1; + */ + private $keys; + /** + * A list of key ranges. See [KeyRange][google.spanner.v1.KeyRange] for more information about + * key range specifications. + * + * Generated from protobuf field repeated .google.spanner.v1.KeyRange ranges = 2; + */ + private $ranges; + /** + * For convenience `all` can be set to `true` to indicate that this + * `KeySet` matches all keys in the table or index. Note that any keys + * specified in `keys` or `ranges` are only yielded once. + * + * Generated from protobuf field bool all = 3; + */ + protected $all = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Protobuf\ListValue>|\Google\Protobuf\Internal\RepeatedField $keys + * A list of specific keys. Entries in `keys` should have exactly as + * many elements as there are columns in the primary or index key + * with which this `KeySet` is used. Individual key values are + * encoded as described [here][google.spanner.v1.TypeCode]. + * @type array<\Google\Cloud\Spanner\V1\KeyRange>|\Google\Protobuf\Internal\RepeatedField $ranges + * A list of key ranges. See [KeyRange][google.spanner.v1.KeyRange] for more information about + * key range specifications. + * @type bool $all + * For convenience `all` can be set to `true` to indicate that this + * `KeySet` matches all keys in the table or index. Note that any keys + * specified in `keys` or `ranges` are only yielded once. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Keys::initOnce(); + parent::__construct($data); + } + + /** + * A list of specific keys. Entries in `keys` should have exactly as + * many elements as there are columns in the primary or index key + * with which this `KeySet` is used. Individual key values are + * encoded as described [here][google.spanner.v1.TypeCode]. + * + * Generated from protobuf field repeated .google.protobuf.ListValue keys = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getKeys() + { + return $this->keys; + } + + /** + * A list of specific keys. Entries in `keys` should have exactly as + * many elements as there are columns in the primary or index key + * with which this `KeySet` is used. Individual key values are + * encoded as described [here][google.spanner.v1.TypeCode]. + * + * Generated from protobuf field repeated .google.protobuf.ListValue keys = 1; + * @param array<\Google\Protobuf\ListValue>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setKeys($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\ListValue::class); + $this->keys = $arr; + + return $this; + } + + /** + * A list of key ranges. See [KeyRange][google.spanner.v1.KeyRange] for more information about + * key range specifications. + * + * Generated from protobuf field repeated .google.spanner.v1.KeyRange ranges = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRanges() + { + return $this->ranges; + } + + /** + * A list of key ranges. See [KeyRange][google.spanner.v1.KeyRange] for more information about + * key range specifications. + * + * Generated from protobuf field repeated .google.spanner.v1.KeyRange ranges = 2; + * @param array<\Google\Cloud\Spanner\V1\KeyRange>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRanges($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\KeyRange::class); + $this->ranges = $arr; + + return $this; + } + + /** + * For convenience `all` can be set to `true` to indicate that this + * `KeySet` matches all keys in the table or index. Note that any keys + * specified in `keys` or `ranges` are only yielded once. + * + * Generated from protobuf field bool all = 3; + * @return bool + */ + public function getAll() + { + return $this->all; + } + + /** + * For convenience `all` can be set to `true` to indicate that this + * `KeySet` matches all keys in the table or index. Note that any keys + * specified in `keys` or `ranges` are only yielded once. + * + * Generated from protobuf field bool all = 3; + * @param bool $var + * @return $this + */ + public function setAll($var) + { + GPBUtil::checkBool($var); + $this->all = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ListSessionsRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ListSessionsRequest.php new file mode 100644 index 000000000000..d3fd205fce8d --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ListSessionsRequest.php @@ -0,0 +1,223 @@ +google.spanner.v1.ListSessionsRequest + */ +class ListSessionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The database in which to list sessions. + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $database = ''; + /** + * Number of sessions to be returned in the response. If 0 or less, defaults + * to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.v1.ListSessionsResponse.next_page_token] + * from a previous + * [ListSessionsResponse][google.spanner.v1.ListSessionsResponse]. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * * `labels.key` where key is the name of a label + * Some examples of using filters are: + * * `labels.env:*` --> The session has the label "env". + * * `labels.env:dev` --> The session has the label "env" and the value of + * the label contains the string "dev". + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + + /** + * @param string $database Required. The database in which to list sessions. Please see + * {@see SpannerClient::databaseName()} for help formatting this field. + * + * @return \Google\Cloud\Spanner\V1\ListSessionsRequest + * + * @experimental + */ + public static function build(string $database): self + { + return (new self()) + ->setDatabase($database); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $database + * Required. The database in which to list sessions. + * @type int $page_size + * Number of sessions to be returned in the response. If 0 or less, defaults + * to the server's maximum allowed page size. + * @type string $page_token + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.v1.ListSessionsResponse.next_page_token] + * from a previous + * [ListSessionsResponse][google.spanner.v1.ListSessionsResponse]. + * @type string $filter + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * * `labels.key` where key is the name of a label + * Some examples of using filters are: + * * `labels.env:*` --> The session has the label "env". + * * `labels.env:dev` --> The session has the label "env" and the value of + * the label contains the string "dev". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The database in which to list sessions. + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getDatabase() + { + return $this->database; + } + + /** + * Required. The database in which to list sessions. + * + * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDatabase($var) + { + GPBUtil::checkString($var, True); + $this->database = $var; + + return $this; + } + + /** + * Number of sessions to be returned in the response. If 0 or less, defaults + * to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Number of sessions to be returned in the response. If 0 or less, defaults + * to the server's maximum allowed page size. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.v1.ListSessionsResponse.next_page_token] + * from a previous + * [ListSessionsResponse][google.spanner.v1.ListSessionsResponse]. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * If non-empty, `page_token` should contain a + * [next_page_token][google.spanner.v1.ListSessionsResponse.next_page_token] + * from a previous + * [ListSessionsResponse][google.spanner.v1.ListSessionsResponse]. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * * `labels.key` where key is the name of a label + * Some examples of using filters are: + * * `labels.env:*` --> The session has the label "env". + * * `labels.env:dev` --> The session has the label "env" and the value of + * the label contains the string "dev". + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * * `labels.key` where key is the name of a label + * Some examples of using filters are: + * * `labels.env:*` --> The session has the label "env". + * * `labels.env:dev` --> The session has the label "env" and the value of + * the label contains the string "dev". + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ListSessionsResponse.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ListSessionsResponse.php new file mode 100644 index 000000000000..0d8cff32a984 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ListSessionsResponse.php @@ -0,0 +1,109 @@ +google.spanner.v1.ListSessionsResponse + */ +class ListSessionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of requested sessions. + * + * Generated from protobuf field repeated .google.spanner.v1.Session sessions = 1; + */ + private $sessions; + /** + * `next_page_token` can be sent in a subsequent + * [ListSessions][google.spanner.v1.Spanner.ListSessions] call to fetch more + * of the matching sessions. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Spanner\V1\Session>|\Google\Protobuf\Internal\RepeatedField $sessions + * The list of requested sessions. + * @type string $next_page_token + * `next_page_token` can be sent in a subsequent + * [ListSessions][google.spanner.v1.Spanner.ListSessions] call to fetch more + * of the matching sessions. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * The list of requested sessions. + * + * Generated from protobuf field repeated .google.spanner.v1.Session sessions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSessions() + { + return $this->sessions; + } + + /** + * The list of requested sessions. + * + * Generated from protobuf field repeated .google.spanner.v1.Session sessions = 1; + * @param array<\Google\Cloud\Spanner\V1\Session>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSessions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Session::class); + $this->sessions = $arr; + + return $this; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListSessions][google.spanner.v1.Spanner.ListSessions] call to fetch more + * of the matching sessions. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * `next_page_token` can be sent in a subsequent + * [ListSessions][google.spanner.v1.Spanner.ListSessions] call to fetch more + * of the matching sessions. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/MultiplexedSessionPrecommitToken.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/MultiplexedSessionPrecommitToken.php new file mode 100644 index 000000000000..85495ac60b56 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/MultiplexedSessionPrecommitToken.php @@ -0,0 +1,112 @@ +google.spanner.v1.MultiplexedSessionPrecommitToken + */ +class MultiplexedSessionPrecommitToken extends \Google\Protobuf\Internal\Message +{ + /** + * Opaque precommit token. + * + * Generated from protobuf field bytes precommit_token = 1; + */ + protected $precommit_token = ''; + /** + * An incrementing seq number is generated on every precommit token + * that is returned. Clients should remember the precommit token with the + * highest sequence number from the current transaction attempt. + * + * Generated from protobuf field int32 seq_num = 2; + */ + protected $seq_num = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $precommit_token + * Opaque precommit token. + * @type int $seq_num + * An incrementing seq number is generated on every precommit token + * that is returned. Clients should remember the precommit token with the + * highest sequence number from the current transaction attempt. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Transaction::initOnce(); + parent::__construct($data); + } + + /** + * Opaque precommit token. + * + * Generated from protobuf field bytes precommit_token = 1; + * @return string + */ + public function getPrecommitToken() + { + return $this->precommit_token; + } + + /** + * Opaque precommit token. + * + * Generated from protobuf field bytes precommit_token = 1; + * @param string $var + * @return $this + */ + public function setPrecommitToken($var) + { + GPBUtil::checkString($var, False); + $this->precommit_token = $var; + + return $this; + } + + /** + * An incrementing seq number is generated on every precommit token + * that is returned. Clients should remember the precommit token with the + * highest sequence number from the current transaction attempt. + * + * Generated from protobuf field int32 seq_num = 2; + * @return int + */ + public function getSeqNum() + { + return $this->seq_num; + } + + /** + * An incrementing seq number is generated on every precommit token + * that is returned. Clients should remember the precommit token with the + * highest sequence number from the current transaction attempt. + * + * Generated from protobuf field int32 seq_num = 2; + * @param int $var + * @return $this + */ + public function setSeqNum($var) + { + GPBUtil::checkInt32($var); + $this->seq_num = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation.php new file mode 100644 index 000000000000..82cb3686bb9a --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation.php @@ -0,0 +1,254 @@ +google.spanner.v1.Mutation + */ +class Mutation extends \Google\Protobuf\Internal\Message +{ + protected $operation; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\V1\Mutation\Write $insert + * Insert new rows in a table. If any of the rows already exist, + * the write or transaction fails with error `ALREADY_EXISTS`. + * @type \Google\Cloud\Spanner\V1\Mutation\Write $update + * Update existing rows in a table. If any of the rows does not + * already exist, the transaction fails with error `NOT_FOUND`. + * @type \Google\Cloud\Spanner\V1\Mutation\Write $insert_or_update + * Like [insert][google.spanner.v1.Mutation.insert], except that if the row already exists, then + * its column values are overwritten with the ones provided. Any + * column values not explicitly written are preserved. + * When using [insert_or_update][google.spanner.v1.Mutation.insert_or_update], just as when using [insert][google.spanner.v1.Mutation.insert], all `NOT + * NULL` columns in the table must be given a value. This holds true + * even when the row already exists and will therefore actually be updated. + * @type \Google\Cloud\Spanner\V1\Mutation\Write $replace + * Like [insert][google.spanner.v1.Mutation.insert], except that if the row already exists, it is + * deleted, and the column values provided are inserted + * instead. Unlike [insert_or_update][google.spanner.v1.Mutation.insert_or_update], this means any values not + * explicitly written become `NULL`. + * In an interleaved table, if you create the child table with the + * `ON DELETE CASCADE` annotation, then replacing a parent row + * also deletes the child rows. Otherwise, you must delete the + * child rows before you replace the parent row. + * @type \Google\Cloud\Spanner\V1\Mutation\Delete $delete + * Delete rows from a table. Succeeds whether or not the named + * rows were present. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Mutation::initOnce(); + parent::__construct($data); + } + + /** + * Insert new rows in a table. If any of the rows already exist, + * the write or transaction fails with error `ALREADY_EXISTS`. + * + * Generated from protobuf field .google.spanner.v1.Mutation.Write insert = 1; + * @return \Google\Cloud\Spanner\V1\Mutation\Write|null + */ + public function getInsert() + { + return $this->readOneof(1); + } + + public function hasInsert() + { + return $this->hasOneof(1); + } + + /** + * Insert new rows in a table. If any of the rows already exist, + * the write or transaction fails with error `ALREADY_EXISTS`. + * + * Generated from protobuf field .google.spanner.v1.Mutation.Write insert = 1; + * @param \Google\Cloud\Spanner\V1\Mutation\Write $var + * @return $this + */ + public function setInsert($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Mutation\Write::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Update existing rows in a table. If any of the rows does not + * already exist, the transaction fails with error `NOT_FOUND`. + * + * Generated from protobuf field .google.spanner.v1.Mutation.Write update = 2; + * @return \Google\Cloud\Spanner\V1\Mutation\Write|null + */ + public function getUpdate() + { + return $this->readOneof(2); + } + + public function hasUpdate() + { + return $this->hasOneof(2); + } + + /** + * Update existing rows in a table. If any of the rows does not + * already exist, the transaction fails with error `NOT_FOUND`. + * + * Generated from protobuf field .google.spanner.v1.Mutation.Write update = 2; + * @param \Google\Cloud\Spanner\V1\Mutation\Write $var + * @return $this + */ + public function setUpdate($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Mutation\Write::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Like [insert][google.spanner.v1.Mutation.insert], except that if the row already exists, then + * its column values are overwritten with the ones provided. Any + * column values not explicitly written are preserved. + * When using [insert_or_update][google.spanner.v1.Mutation.insert_or_update], just as when using [insert][google.spanner.v1.Mutation.insert], all `NOT + * NULL` columns in the table must be given a value. This holds true + * even when the row already exists and will therefore actually be updated. + * + * Generated from protobuf field .google.spanner.v1.Mutation.Write insert_or_update = 3; + * @return \Google\Cloud\Spanner\V1\Mutation\Write|null + */ + public function getInsertOrUpdate() + { + return $this->readOneof(3); + } + + public function hasInsertOrUpdate() + { + return $this->hasOneof(3); + } + + /** + * Like [insert][google.spanner.v1.Mutation.insert], except that if the row already exists, then + * its column values are overwritten with the ones provided. Any + * column values not explicitly written are preserved. + * When using [insert_or_update][google.spanner.v1.Mutation.insert_or_update], just as when using [insert][google.spanner.v1.Mutation.insert], all `NOT + * NULL` columns in the table must be given a value. This holds true + * even when the row already exists and will therefore actually be updated. + * + * Generated from protobuf field .google.spanner.v1.Mutation.Write insert_or_update = 3; + * @param \Google\Cloud\Spanner\V1\Mutation\Write $var + * @return $this + */ + public function setInsertOrUpdate($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Mutation\Write::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Like [insert][google.spanner.v1.Mutation.insert], except that if the row already exists, it is + * deleted, and the column values provided are inserted + * instead. Unlike [insert_or_update][google.spanner.v1.Mutation.insert_or_update], this means any values not + * explicitly written become `NULL`. + * In an interleaved table, if you create the child table with the + * `ON DELETE CASCADE` annotation, then replacing a parent row + * also deletes the child rows. Otherwise, you must delete the + * child rows before you replace the parent row. + * + * Generated from protobuf field .google.spanner.v1.Mutation.Write replace = 4; + * @return \Google\Cloud\Spanner\V1\Mutation\Write|null + */ + public function getReplace() + { + return $this->readOneof(4); + } + + public function hasReplace() + { + return $this->hasOneof(4); + } + + /** + * Like [insert][google.spanner.v1.Mutation.insert], except that if the row already exists, it is + * deleted, and the column values provided are inserted + * instead. Unlike [insert_or_update][google.spanner.v1.Mutation.insert_or_update], this means any values not + * explicitly written become `NULL`. + * In an interleaved table, if you create the child table with the + * `ON DELETE CASCADE` annotation, then replacing a parent row + * also deletes the child rows. Otherwise, you must delete the + * child rows before you replace the parent row. + * + * Generated from protobuf field .google.spanner.v1.Mutation.Write replace = 4; + * @param \Google\Cloud\Spanner\V1\Mutation\Write $var + * @return $this + */ + public function setReplace($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Mutation\Write::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Delete rows from a table. Succeeds whether or not the named + * rows were present. + * + * Generated from protobuf field .google.spanner.v1.Mutation.Delete delete = 5; + * @return \Google\Cloud\Spanner\V1\Mutation\Delete|null + */ + public function getDelete() + { + return $this->readOneof(5); + } + + public function hasDelete() + { + return $this->hasOneof(5); + } + + /** + * Delete rows from a table. Succeeds whether or not the named + * rows were present. + * + * Generated from protobuf field .google.spanner.v1.Mutation.Delete delete = 5; + * @param \Google\Cloud\Spanner\V1\Mutation\Delete $var + * @return $this + */ + public function setDelete($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Mutation\Delete::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * @return string + */ + public function getOperation() + { + return $this->whichOneof("operation"); + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation/Delete.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation/Delete.php new file mode 100644 index 000000000000..db49cf9dc249 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation/Delete.php @@ -0,0 +1,134 @@ +google.spanner.v1.Mutation.Delete + */ +class Delete extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The table whose rows will be deleted. + * + * Generated from protobuf field string table = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $table = ''; + /** + * Required. The primary keys of the rows within [table][google.spanner.v1.Mutation.Delete.table] to delete. The + * primary keys must be specified in the order in which they appear in the + * `PRIMARY KEY()` clause of the table's equivalent DDL statement (the DDL + * statement used to create the table). + * Delete is idempotent. The transaction will succeed even if some or all + * rows do not exist. + * + * Generated from protobuf field .google.spanner.v1.KeySet key_set = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $key_set = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $table + * Required. The table whose rows will be deleted. + * @type \Google\Cloud\Spanner\V1\KeySet $key_set + * Required. The primary keys of the rows within [table][google.spanner.v1.Mutation.Delete.table] to delete. The + * primary keys must be specified in the order in which they appear in the + * `PRIMARY KEY()` clause of the table's equivalent DDL statement (the DDL + * statement used to create the table). + * Delete is idempotent. The transaction will succeed even if some or all + * rows do not exist. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Mutation::initOnce(); + parent::__construct($data); + } + + /** + * Required. The table whose rows will be deleted. + * + * Generated from protobuf field string table = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTable() + { + return $this->table; + } + + /** + * Required. The table whose rows will be deleted. + * + * Generated from protobuf field string table = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTable($var) + { + GPBUtil::checkString($var, True); + $this->table = $var; + + return $this; + } + + /** + * Required. The primary keys of the rows within [table][google.spanner.v1.Mutation.Delete.table] to delete. The + * primary keys must be specified in the order in which they appear in the + * `PRIMARY KEY()` clause of the table's equivalent DDL statement (the DDL + * statement used to create the table). + * Delete is idempotent. The transaction will succeed even if some or all + * rows do not exist. + * + * Generated from protobuf field .google.spanner.v1.KeySet key_set = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\V1\KeySet|null + */ + public function getKeySet() + { + return $this->key_set; + } + + public function hasKeySet() + { + return isset($this->key_set); + } + + public function clearKeySet() + { + unset($this->key_set); + } + + /** + * Required. The primary keys of the rows within [table][google.spanner.v1.Mutation.Delete.table] to delete. The + * primary keys must be specified in the order in which they appear in the + * `PRIMARY KEY()` clause of the table's equivalent DDL statement (the DDL + * statement used to create the table). + * Delete is idempotent. The transaction will succeed even if some or all + * rows do not exist. + * + * Generated from protobuf field .google.spanner.v1.KeySet key_set = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\V1\KeySet $var + * @return $this + */ + public function setKeySet($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\KeySet::class); + $this->key_set = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Delete::class, \Google\Cloud\Spanner\V1\Mutation_Delete::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation/Write.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation/Write.php new file mode 100644 index 000000000000..8e08ca69d213 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation/Write.php @@ -0,0 +1,179 @@ +google.spanner.v1.Mutation.Write + */ +class Write extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The table whose rows will be written. + * + * Generated from protobuf field string table = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $table = ''; + /** + * The names of the columns in [table][google.spanner.v1.Mutation.Write.table] to be written. + * The list of columns must contain enough columns to allow + * Cloud Spanner to derive values for all primary key columns in the + * row(s) to be modified. + * + * Generated from protobuf field repeated string columns = 2; + */ + private $columns; + /** + * The values to be written. `values` can contain more than one + * list of values. If it does, then multiple rows are written, one + * for each entry in `values`. Each list in `values` must have + * exactly as many entries as there are entries in [columns][google.spanner.v1.Mutation.Write.columns] + * above. Sending multiple lists is equivalent to sending multiple + * `Mutation`s, each containing one `values` entry and repeating + * [table][google.spanner.v1.Mutation.Write.table] and [columns][google.spanner.v1.Mutation.Write.columns]. Individual values in each list are + * encoded as described [here][google.spanner.v1.TypeCode]. + * + * Generated from protobuf field repeated .google.protobuf.ListValue values = 3; + */ + private $values; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $table + * Required. The table whose rows will be written. + * @type array|\Google\Protobuf\Internal\RepeatedField $columns + * The names of the columns in [table][google.spanner.v1.Mutation.Write.table] to be written. + * The list of columns must contain enough columns to allow + * Cloud Spanner to derive values for all primary key columns in the + * row(s) to be modified. + * @type array<\Google\Protobuf\ListValue>|\Google\Protobuf\Internal\RepeatedField $values + * The values to be written. `values` can contain more than one + * list of values. If it does, then multiple rows are written, one + * for each entry in `values`. Each list in `values` must have + * exactly as many entries as there are entries in [columns][google.spanner.v1.Mutation.Write.columns] + * above. Sending multiple lists is equivalent to sending multiple + * `Mutation`s, each containing one `values` entry and repeating + * [table][google.spanner.v1.Mutation.Write.table] and [columns][google.spanner.v1.Mutation.Write.columns]. Individual values in each list are + * encoded as described [here][google.spanner.v1.TypeCode]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Mutation::initOnce(); + parent::__construct($data); + } + + /** + * Required. The table whose rows will be written. + * + * Generated from protobuf field string table = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTable() + { + return $this->table; + } + + /** + * Required. The table whose rows will be written. + * + * Generated from protobuf field string table = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTable($var) + { + GPBUtil::checkString($var, True); + $this->table = $var; + + return $this; + } + + /** + * The names of the columns in [table][google.spanner.v1.Mutation.Write.table] to be written. + * The list of columns must contain enough columns to allow + * Cloud Spanner to derive values for all primary key columns in the + * row(s) to be modified. + * + * Generated from protobuf field repeated string columns = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getColumns() + { + return $this->columns; + } + + /** + * The names of the columns in [table][google.spanner.v1.Mutation.Write.table] to be written. + * The list of columns must contain enough columns to allow + * Cloud Spanner to derive values for all primary key columns in the + * row(s) to be modified. + * + * Generated from protobuf field repeated string columns = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setColumns($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->columns = $arr; + + return $this; + } + + /** + * The values to be written. `values` can contain more than one + * list of values. If it does, then multiple rows are written, one + * for each entry in `values`. Each list in `values` must have + * exactly as many entries as there are entries in [columns][google.spanner.v1.Mutation.Write.columns] + * above. Sending multiple lists is equivalent to sending multiple + * `Mutation`s, each containing one `values` entry and repeating + * [table][google.spanner.v1.Mutation.Write.table] and [columns][google.spanner.v1.Mutation.Write.columns]. Individual values in each list are + * encoded as described [here][google.spanner.v1.TypeCode]. + * + * Generated from protobuf field repeated .google.protobuf.ListValue values = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValues() + { + return $this->values; + } + + /** + * The values to be written. `values` can contain more than one + * list of values. If it does, then multiple rows are written, one + * for each entry in `values`. Each list in `values` must have + * exactly as many entries as there are entries in [columns][google.spanner.v1.Mutation.Write.columns] + * above. Sending multiple lists is equivalent to sending multiple + * `Mutation`s, each containing one `values` entry and repeating + * [table][google.spanner.v1.Mutation.Write.table] and [columns][google.spanner.v1.Mutation.Write.columns]. Individual values in each list are + * encoded as described [here][google.spanner.v1.TypeCode]. + * + * Generated from protobuf field repeated .google.protobuf.ListValue values = 3; + * @param array<\Google\Protobuf\ListValue>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\ListValue::class); + $this->values = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Write::class, \Google\Cloud\Spanner\V1\Mutation_Write::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartialResultSet.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartialResultSet.php new file mode 100644 index 000000000000..dd0f33180421 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartialResultSet.php @@ -0,0 +1,573 @@ +google.spanner.v1.PartialResultSet + */ +class PartialResultSet extends \Google\Protobuf\Internal\Message +{ + /** + * Metadata about the result set, such as row type information. + * Only present in the first response. + * + * Generated from protobuf field .google.spanner.v1.ResultSetMetadata metadata = 1; + */ + protected $metadata = null; + /** + * A streamed result set consists of a stream of values, which might + * be split into many `PartialResultSet` messages to accommodate + * large rows and/or large values. Every N complete values defines a + * row, where N is equal to the number of entries in + * [metadata.row_type.fields][google.spanner.v1.StructType.fields]. + * Most values are encoded based on type as described + * [here][google.spanner.v1.TypeCode]. + * It is possible that the last value in values is "chunked", + * meaning that the rest of the value is sent in subsequent + * `PartialResultSet`(s). This is denoted by the [chunked_value][google.spanner.v1.PartialResultSet.chunked_value] + * field. Two or more chunked values can be merged to form a + * complete value as follows: + * * `bool/number/null`: cannot be chunked + * * `string`: concatenate the strings + * * `list`: concatenate the lists. If the last element in a list is a + * `string`, `list`, or `object`, merge it with the first element in + * the next list by applying these rules recursively. + * * `object`: concatenate the (field name, field value) pairs. If a + * field name is duplicated, then apply these rules recursively + * to merge the field values. + * Some examples of merging: + * # Strings are concatenated. + * "foo", "bar" => "foobar" + * # Lists of non-strings are concatenated. + * [2, 3], [4] => [2, 3, 4] + * # Lists are concatenated, but the last and first elements are merged + * # because they are strings. + * ["a", "b"], ["c", "d"] => ["a", "bc", "d"] + * # Lists are concatenated, but the last and first elements are merged + * # because they are lists. Recursively, the last and first elements + * # of the inner lists are merged because they are strings. + * ["a", ["b", "c"]], [["d"], "e"] => ["a", ["b", "cd"], "e"] + * # Non-overlapping object fields are combined. + * {"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"} + * # Overlapping object fields are merged. + * {"a": "1"}, {"a": "2"} => {"a": "12"} + * # Examples of merging objects containing lists of strings. + * {"a": ["1"]}, {"a": ["2"]} => {"a": ["12"]} + * For a more complete example, suppose a streaming SQL query is + * yielding a result set whose rows contain a single string + * field. The following `PartialResultSet`s might be yielded: + * { + * "metadata": { ... } + * "values": ["Hello", "W"] + * "chunked_value": true + * "resume_token": "Af65..." + * } + * { + * "values": ["orl"] + * "chunked_value": true + * "resume_token": "Bqp2..." + * } + * { + * "values": ["d"] + * "resume_token": "Zx1B..." + * } + * This sequence of `PartialResultSet`s encodes two rows, one + * containing the field value `"Hello"`, and a second containing the + * field value `"World" = "W" + "orl" + "d"`. + * + * Generated from protobuf field repeated .google.protobuf.Value values = 2; + */ + private $values; + /** + * If true, then the final value in [values][google.spanner.v1.PartialResultSet.values] is chunked, and must + * be combined with more values from subsequent `PartialResultSet`s + * to obtain a complete field value. + * + * Generated from protobuf field bool chunked_value = 3; + */ + protected $chunked_value = false; + /** + * Streaming calls might be interrupted for a variety of reasons, such + * as TCP connection loss. If this occurs, the stream of results can + * be resumed by re-sending the original request and including + * `resume_token`. Note that executing any other transaction in the + * same session invalidates the token. + * + * Generated from protobuf field bytes resume_token = 4; + */ + protected $resume_token = ''; + /** + * Query plan and execution statistics for the statement that produced this + * streaming result set. These can be requested by setting + * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] and are sent + * only once with the last response in the stream. + * This field will also be present in the last response for DML + * statements. + * + * Generated from protobuf field .google.spanner.v1.ResultSetStats stats = 5; + */ + protected $stats = null; + /** + * Optional. A precommit token will be included if the read-write transaction + * is on a multiplexed session. + * The precommit token with the highest sequence number from this transaction + * attempt should be passed to the + * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $precommit_token = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\V1\ResultSetMetadata $metadata + * Metadata about the result set, such as row type information. + * Only present in the first response. + * @type array<\Google\Protobuf\Value>|\Google\Protobuf\Internal\RepeatedField $values + * A streamed result set consists of a stream of values, which might + * be split into many `PartialResultSet` messages to accommodate + * large rows and/or large values. Every N complete values defines a + * row, where N is equal to the number of entries in + * [metadata.row_type.fields][google.spanner.v1.StructType.fields]. + * Most values are encoded based on type as described + * [here][google.spanner.v1.TypeCode]. + * It is possible that the last value in values is "chunked", + * meaning that the rest of the value is sent in subsequent + * `PartialResultSet`(s). This is denoted by the [chunked_value][google.spanner.v1.PartialResultSet.chunked_value] + * field. Two or more chunked values can be merged to form a + * complete value as follows: + * * `bool/number/null`: cannot be chunked + * * `string`: concatenate the strings + * * `list`: concatenate the lists. If the last element in a list is a + * `string`, `list`, or `object`, merge it with the first element in + * the next list by applying these rules recursively. + * * `object`: concatenate the (field name, field value) pairs. If a + * field name is duplicated, then apply these rules recursively + * to merge the field values. + * Some examples of merging: + * # Strings are concatenated. + * "foo", "bar" => "foobar" + * # Lists of non-strings are concatenated. + * [2, 3], [4] => [2, 3, 4] + * # Lists are concatenated, but the last and first elements are merged + * # because they are strings. + * ["a", "b"], ["c", "d"] => ["a", "bc", "d"] + * # Lists are concatenated, but the last and first elements are merged + * # because they are lists. Recursively, the last and first elements + * # of the inner lists are merged because they are strings. + * ["a", ["b", "c"]], [["d"], "e"] => ["a", ["b", "cd"], "e"] + * # Non-overlapping object fields are combined. + * {"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"} + * # Overlapping object fields are merged. + * {"a": "1"}, {"a": "2"} => {"a": "12"} + * # Examples of merging objects containing lists of strings. + * {"a": ["1"]}, {"a": ["2"]} => {"a": ["12"]} + * For a more complete example, suppose a streaming SQL query is + * yielding a result set whose rows contain a single string + * field. The following `PartialResultSet`s might be yielded: + * { + * "metadata": { ... } + * "values": ["Hello", "W"] + * "chunked_value": true + * "resume_token": "Af65..." + * } + * { + * "values": ["orl"] + * "chunked_value": true + * "resume_token": "Bqp2..." + * } + * { + * "values": ["d"] + * "resume_token": "Zx1B..." + * } + * This sequence of `PartialResultSet`s encodes two rows, one + * containing the field value `"Hello"`, and a second containing the + * field value `"World" = "W" + "orl" + "d"`. + * @type bool $chunked_value + * If true, then the final value in [values][google.spanner.v1.PartialResultSet.values] is chunked, and must + * be combined with more values from subsequent `PartialResultSet`s + * to obtain a complete field value. + * @type string $resume_token + * Streaming calls might be interrupted for a variety of reasons, such + * as TCP connection loss. If this occurs, the stream of results can + * be resumed by re-sending the original request and including + * `resume_token`. Note that executing any other transaction in the + * same session invalidates the token. + * @type \Google\Cloud\Spanner\V1\ResultSetStats $stats + * Query plan and execution statistics for the statement that produced this + * streaming result set. These can be requested by setting + * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] and are sent + * only once with the last response in the stream. + * This field will also be present in the last response for DML + * statements. + * @type \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $precommit_token + * Optional. A precommit token will be included if the read-write transaction + * is on a multiplexed session. + * The precommit token with the highest sequence number from this transaction + * attempt should be passed to the + * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\ResultSet::initOnce(); + parent::__construct($data); + } + + /** + * Metadata about the result set, such as row type information. + * Only present in the first response. + * + * Generated from protobuf field .google.spanner.v1.ResultSetMetadata metadata = 1; + * @return \Google\Cloud\Spanner\V1\ResultSetMetadata|null + */ + public function getMetadata() + { + return $this->metadata; + } + + public function hasMetadata() + { + return isset($this->metadata); + } + + public function clearMetadata() + { + unset($this->metadata); + } + + /** + * Metadata about the result set, such as row type information. + * Only present in the first response. + * + * Generated from protobuf field .google.spanner.v1.ResultSetMetadata metadata = 1; + * @param \Google\Cloud\Spanner\V1\ResultSetMetadata $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\ResultSetMetadata::class); + $this->metadata = $var; + + return $this; + } + + /** + * A streamed result set consists of a stream of values, which might + * be split into many `PartialResultSet` messages to accommodate + * large rows and/or large values. Every N complete values defines a + * row, where N is equal to the number of entries in + * [metadata.row_type.fields][google.spanner.v1.StructType.fields]. + * Most values are encoded based on type as described + * [here][google.spanner.v1.TypeCode]. + * It is possible that the last value in values is "chunked", + * meaning that the rest of the value is sent in subsequent + * `PartialResultSet`(s). This is denoted by the [chunked_value][google.spanner.v1.PartialResultSet.chunked_value] + * field. Two or more chunked values can be merged to form a + * complete value as follows: + * * `bool/number/null`: cannot be chunked + * * `string`: concatenate the strings + * * `list`: concatenate the lists. If the last element in a list is a + * `string`, `list`, or `object`, merge it with the first element in + * the next list by applying these rules recursively. + * * `object`: concatenate the (field name, field value) pairs. If a + * field name is duplicated, then apply these rules recursively + * to merge the field values. + * Some examples of merging: + * # Strings are concatenated. + * "foo", "bar" => "foobar" + * # Lists of non-strings are concatenated. + * [2, 3], [4] => [2, 3, 4] + * # Lists are concatenated, but the last and first elements are merged + * # because they are strings. + * ["a", "b"], ["c", "d"] => ["a", "bc", "d"] + * # Lists are concatenated, but the last and first elements are merged + * # because they are lists. Recursively, the last and first elements + * # of the inner lists are merged because they are strings. + * ["a", ["b", "c"]], [["d"], "e"] => ["a", ["b", "cd"], "e"] + * # Non-overlapping object fields are combined. + * {"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"} + * # Overlapping object fields are merged. + * {"a": "1"}, {"a": "2"} => {"a": "12"} + * # Examples of merging objects containing lists of strings. + * {"a": ["1"]}, {"a": ["2"]} => {"a": ["12"]} + * For a more complete example, suppose a streaming SQL query is + * yielding a result set whose rows contain a single string + * field. The following `PartialResultSet`s might be yielded: + * { + * "metadata": { ... } + * "values": ["Hello", "W"] + * "chunked_value": true + * "resume_token": "Af65..." + * } + * { + * "values": ["orl"] + * "chunked_value": true + * "resume_token": "Bqp2..." + * } + * { + * "values": ["d"] + * "resume_token": "Zx1B..." + * } + * This sequence of `PartialResultSet`s encodes two rows, one + * containing the field value `"Hello"`, and a second containing the + * field value `"World" = "W" + "orl" + "d"`. + * + * Generated from protobuf field repeated .google.protobuf.Value values = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValues() + { + return $this->values; + } + + /** + * A streamed result set consists of a stream of values, which might + * be split into many `PartialResultSet` messages to accommodate + * large rows and/or large values. Every N complete values defines a + * row, where N is equal to the number of entries in + * [metadata.row_type.fields][google.spanner.v1.StructType.fields]. + * Most values are encoded based on type as described + * [here][google.spanner.v1.TypeCode]. + * It is possible that the last value in values is "chunked", + * meaning that the rest of the value is sent in subsequent + * `PartialResultSet`(s). This is denoted by the [chunked_value][google.spanner.v1.PartialResultSet.chunked_value] + * field. Two or more chunked values can be merged to form a + * complete value as follows: + * * `bool/number/null`: cannot be chunked + * * `string`: concatenate the strings + * * `list`: concatenate the lists. If the last element in a list is a + * `string`, `list`, or `object`, merge it with the first element in + * the next list by applying these rules recursively. + * * `object`: concatenate the (field name, field value) pairs. If a + * field name is duplicated, then apply these rules recursively + * to merge the field values. + * Some examples of merging: + * # Strings are concatenated. + * "foo", "bar" => "foobar" + * # Lists of non-strings are concatenated. + * [2, 3], [4] => [2, 3, 4] + * # Lists are concatenated, but the last and first elements are merged + * # because they are strings. + * ["a", "b"], ["c", "d"] => ["a", "bc", "d"] + * # Lists are concatenated, but the last and first elements are merged + * # because they are lists. Recursively, the last and first elements + * # of the inner lists are merged because they are strings. + * ["a", ["b", "c"]], [["d"], "e"] => ["a", ["b", "cd"], "e"] + * # Non-overlapping object fields are combined. + * {"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"} + * # Overlapping object fields are merged. + * {"a": "1"}, {"a": "2"} => {"a": "12"} + * # Examples of merging objects containing lists of strings. + * {"a": ["1"]}, {"a": ["2"]} => {"a": ["12"]} + * For a more complete example, suppose a streaming SQL query is + * yielding a result set whose rows contain a single string + * field. The following `PartialResultSet`s might be yielded: + * { + * "metadata": { ... } + * "values": ["Hello", "W"] + * "chunked_value": true + * "resume_token": "Af65..." + * } + * { + * "values": ["orl"] + * "chunked_value": true + * "resume_token": "Bqp2..." + * } + * { + * "values": ["d"] + * "resume_token": "Zx1B..." + * } + * This sequence of `PartialResultSet`s encodes two rows, one + * containing the field value `"Hello"`, and a second containing the + * field value `"World" = "W" + "orl" + "d"`. + * + * Generated from protobuf field repeated .google.protobuf.Value values = 2; + * @param array<\Google\Protobuf\Value>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Value::class); + $this->values = $arr; + + return $this; + } + + /** + * If true, then the final value in [values][google.spanner.v1.PartialResultSet.values] is chunked, and must + * be combined with more values from subsequent `PartialResultSet`s + * to obtain a complete field value. + * + * Generated from protobuf field bool chunked_value = 3; + * @return bool + */ + public function getChunkedValue() + { + return $this->chunked_value; + } + + /** + * If true, then the final value in [values][google.spanner.v1.PartialResultSet.values] is chunked, and must + * be combined with more values from subsequent `PartialResultSet`s + * to obtain a complete field value. + * + * Generated from protobuf field bool chunked_value = 3; + * @param bool $var + * @return $this + */ + public function setChunkedValue($var) + { + GPBUtil::checkBool($var); + $this->chunked_value = $var; + + return $this; + } + + /** + * Streaming calls might be interrupted for a variety of reasons, such + * as TCP connection loss. If this occurs, the stream of results can + * be resumed by re-sending the original request and including + * `resume_token`. Note that executing any other transaction in the + * same session invalidates the token. + * + * Generated from protobuf field bytes resume_token = 4; + * @return string + */ + public function getResumeToken() + { + return $this->resume_token; + } + + /** + * Streaming calls might be interrupted for a variety of reasons, such + * as TCP connection loss. If this occurs, the stream of results can + * be resumed by re-sending the original request and including + * `resume_token`. Note that executing any other transaction in the + * same session invalidates the token. + * + * Generated from protobuf field bytes resume_token = 4; + * @param string $var + * @return $this + */ + public function setResumeToken($var) + { + GPBUtil::checkString($var, False); + $this->resume_token = $var; + + return $this; + } + + /** + * Query plan and execution statistics for the statement that produced this + * streaming result set. These can be requested by setting + * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] and are sent + * only once with the last response in the stream. + * This field will also be present in the last response for DML + * statements. + * + * Generated from protobuf field .google.spanner.v1.ResultSetStats stats = 5; + * @return \Google\Cloud\Spanner\V1\ResultSetStats|null + */ + public function getStats() + { + return $this->stats; + } + + public function hasStats() + { + return isset($this->stats); + } + + public function clearStats() + { + unset($this->stats); + } + + /** + * Query plan and execution statistics for the statement that produced this + * streaming result set. These can be requested by setting + * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] and are sent + * only once with the last response in the stream. + * This field will also be present in the last response for DML + * statements. + * + * Generated from protobuf field .google.spanner.v1.ResultSetStats stats = 5; + * @param \Google\Cloud\Spanner\V1\ResultSetStats $var + * @return $this + */ + public function setStats($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\ResultSetStats::class); + $this->stats = $var; + + return $this; + } + + /** + * Optional. A precommit token will be included if the read-write transaction + * is on a multiplexed session. + * The precommit token with the highest sequence number from this transaction + * attempt should be passed to the + * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken|null + */ + public function getPrecommitToken() + { + return $this->precommit_token; + } + + public function hasPrecommitToken() + { + return isset($this->precommit_token); + } + + public function clearPrecommitToken() + { + unset($this->precommit_token); + } + + /** + * Optional. A precommit token will be included if the read-write transaction + * is on a multiplexed session. + * The precommit token with the highest sequence number from this transaction + * attempt should be passed to the + * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $var + * @return $this + */ + public function setPrecommitToken($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken::class); + $this->precommit_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Partition.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Partition.php new file mode 100644 index 000000000000..02b7e70d0762 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Partition.php @@ -0,0 +1,76 @@ +google.spanner.v1.Partition + */ +class Partition extends \Google\Protobuf\Internal\Message +{ + /** + * This token can be passed to Read, StreamingRead, ExecuteSql, or + * ExecuteStreamingSql requests to restrict the results to those identified by + * this partition token. + * + * Generated from protobuf field bytes partition_token = 1; + */ + protected $partition_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $partition_token + * This token can be passed to Read, StreamingRead, ExecuteSql, or + * ExecuteStreamingSql requests to restrict the results to those identified by + * this partition token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * This token can be passed to Read, StreamingRead, ExecuteSql, or + * ExecuteStreamingSql requests to restrict the results to those identified by + * this partition token. + * + * Generated from protobuf field bytes partition_token = 1; + * @return string + */ + public function getPartitionToken() + { + return $this->partition_token; + } + + /** + * This token can be passed to Read, StreamingRead, ExecuteSql, or + * ExecuteStreamingSql requests to restrict the results to those identified by + * this partition token. + * + * Generated from protobuf field bytes partition_token = 1; + * @param string $var + * @return $this + */ + public function setPartitionToken($var) + { + GPBUtil::checkString($var, False); + $this->partition_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionOptions.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionOptions.php new file mode 100644 index 000000000000..fa726b5f9161 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionOptions.php @@ -0,0 +1,142 @@ +google.spanner.v1.PartitionOptions + */ +class PartitionOptions extends \Google\Protobuf\Internal\Message +{ + /** + * **Note:** This hint is currently ignored by PartitionQuery and + * PartitionRead requests. + * The desired data size for each partition generated. The default for this + * option is currently 1 GiB. This is only a hint. The actual size of each + * partition may be smaller or larger than this size request. + * + * Generated from protobuf field int64 partition_size_bytes = 1; + */ + protected $partition_size_bytes = 0; + /** + * **Note:** This hint is currently ignored by PartitionQuery and + * PartitionRead requests. + * The desired maximum number of partitions to return. For example, this may + * be set to the number of workers available. The default for this option + * is currently 10,000. The maximum value is currently 200,000. This is only + * a hint. The actual number of partitions returned may be smaller or larger + * than this maximum count request. + * + * Generated from protobuf field int64 max_partitions = 2; + */ + protected $max_partitions = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $partition_size_bytes + * **Note:** This hint is currently ignored by PartitionQuery and + * PartitionRead requests. + * The desired data size for each partition generated. The default for this + * option is currently 1 GiB. This is only a hint. The actual size of each + * partition may be smaller or larger than this size request. + * @type int|string $max_partitions + * **Note:** This hint is currently ignored by PartitionQuery and + * PartitionRead requests. + * The desired maximum number of partitions to return. For example, this may + * be set to the number of workers available. The default for this option + * is currently 10,000. The maximum value is currently 200,000. This is only + * a hint. The actual number of partitions returned may be smaller or larger + * than this maximum count request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * **Note:** This hint is currently ignored by PartitionQuery and + * PartitionRead requests. + * The desired data size for each partition generated. The default for this + * option is currently 1 GiB. This is only a hint. The actual size of each + * partition may be smaller or larger than this size request. + * + * Generated from protobuf field int64 partition_size_bytes = 1; + * @return int|string + */ + public function getPartitionSizeBytes() + { + return $this->partition_size_bytes; + } + + /** + * **Note:** This hint is currently ignored by PartitionQuery and + * PartitionRead requests. + * The desired data size for each partition generated. The default for this + * option is currently 1 GiB. This is only a hint. The actual size of each + * partition may be smaller or larger than this size request. + * + * Generated from protobuf field int64 partition_size_bytes = 1; + * @param int|string $var + * @return $this + */ + public function setPartitionSizeBytes($var) + { + GPBUtil::checkInt64($var); + $this->partition_size_bytes = $var; + + return $this; + } + + /** + * **Note:** This hint is currently ignored by PartitionQuery and + * PartitionRead requests. + * The desired maximum number of partitions to return. For example, this may + * be set to the number of workers available. The default for this option + * is currently 10,000. The maximum value is currently 200,000. This is only + * a hint. The actual number of partitions returned may be smaller or larger + * than this maximum count request. + * + * Generated from protobuf field int64 max_partitions = 2; + * @return int|string + */ + public function getMaxPartitions() + { + return $this->max_partitions; + } + + /** + * **Note:** This hint is currently ignored by PartitionQuery and + * PartitionRead requests. + * The desired maximum number of partitions to return. For example, this may + * be set to the number of workers available. The default for this option + * is currently 10,000. The maximum value is currently 200,000. This is only + * a hint. The actual number of partitions returned may be smaller or larger + * than this maximum count request. + * + * Generated from protobuf field int64 max_partitions = 2; + * @param int|string $var + * @return $this + */ + public function setMaxPartitions($var) + { + GPBUtil::checkInt64($var); + $this->max_partitions = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionQueryRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionQueryRequest.php new file mode 100644 index 000000000000..98df014e6b07 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionQueryRequest.php @@ -0,0 +1,367 @@ +google.spanner.v1.PartitionQueryRequest + */ +class PartitionQueryRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The session used to create the partitions. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $session = ''; + /** + * Read only snapshot transactions are supported, read/write and single use + * transactions are not. + * + * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; + */ + protected $transaction = null; + /** + * Required. The query request to generate partitions for. The request will + * fail if the query is not root partitionable. For a query to be root + * partitionable, it needs to satisfy a few conditions. For example, if the + * query execution plan contains a distributed union operator, then it must be + * the first operator in the plan. For more information about other + * conditions, see [Read data in + * parallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel). + * The query request must not contain DML commands, such as INSERT, UPDATE, or + * DELETE. Use + * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] with a + * PartitionedDml transaction for large, partition-friendly DML operations. + * + * Generated from protobuf field string sql = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $sql = ''; + /** + * Parameter names and values that bind to placeholders in the SQL string. + * A parameter placeholder consists of the `@` character followed by the + * parameter name (for example, `@firstName`). Parameter names can contain + * letters, numbers, and underscores. + * Parameters can appear anywhere that a literal value is expected. The same + * parameter name can be used more than once, for example: + * `"WHERE id > @msg_id AND id < @msg_id + 100"` + * It is an error to execute a SQL statement with unbound parameters. + * + * Generated from protobuf field .google.protobuf.Struct params = 4; + */ + protected $params = null; + /** + * It is not always possible for Cloud Spanner to infer the right SQL type + * from a JSON value. For example, values of type `BYTES` and values + * of type `STRING` both appear in + * [params][google.spanner.v1.PartitionQueryRequest.params] as JSON strings. + * In these cases, `param_types` can be used to specify the exact + * SQL type for some or all of the SQL query parameters. See the + * definition of [Type][google.spanner.v1.Type] for more information + * about SQL types. + * + * Generated from protobuf field map param_types = 5; + */ + private $param_types; + /** + * Additional options that affect how many partitions are created. + * + * Generated from protobuf field .google.spanner.v1.PartitionOptions partition_options = 6; + */ + protected $partition_options = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $session + * Required. The session used to create the partitions. + * @type \Google\Cloud\Spanner\V1\TransactionSelector $transaction + * Read only snapshot transactions are supported, read/write and single use + * transactions are not. + * @type string $sql + * Required. The query request to generate partitions for. The request will + * fail if the query is not root partitionable. For a query to be root + * partitionable, it needs to satisfy a few conditions. For example, if the + * query execution plan contains a distributed union operator, then it must be + * the first operator in the plan. For more information about other + * conditions, see [Read data in + * parallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel). + * The query request must not contain DML commands, such as INSERT, UPDATE, or + * DELETE. Use + * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] with a + * PartitionedDml transaction for large, partition-friendly DML operations. + * @type \Google\Protobuf\Struct $params + * Parameter names and values that bind to placeholders in the SQL string. + * A parameter placeholder consists of the `@` character followed by the + * parameter name (for example, `@firstName`). Parameter names can contain + * letters, numbers, and underscores. + * Parameters can appear anywhere that a literal value is expected. The same + * parameter name can be used more than once, for example: + * `"WHERE id > @msg_id AND id < @msg_id + 100"` + * It is an error to execute a SQL statement with unbound parameters. + * @type array|\Google\Protobuf\Internal\MapField $param_types + * It is not always possible for Cloud Spanner to infer the right SQL type + * from a JSON value. For example, values of type `BYTES` and values + * of type `STRING` both appear in + * [params][google.spanner.v1.PartitionQueryRequest.params] as JSON strings. + * In these cases, `param_types` can be used to specify the exact + * SQL type for some or all of the SQL query parameters. See the + * definition of [Type][google.spanner.v1.Type] for more information + * about SQL types. + * @type \Google\Cloud\Spanner\V1\PartitionOptions $partition_options + * Additional options that affect how many partitions are created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The session used to create the partitions. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSession() + { + return $this->session; + } + + /** + * Required. The session used to create the partitions. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSession($var) + { + GPBUtil::checkString($var, True); + $this->session = $var; + + return $this; + } + + /** + * Read only snapshot transactions are supported, read/write and single use + * transactions are not. + * + * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; + * @return \Google\Cloud\Spanner\V1\TransactionSelector|null + */ + public function getTransaction() + { + return $this->transaction; + } + + public function hasTransaction() + { + return isset($this->transaction); + } + + public function clearTransaction() + { + unset($this->transaction); + } + + /** + * Read only snapshot transactions are supported, read/write and single use + * transactions are not. + * + * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; + * @param \Google\Cloud\Spanner\V1\TransactionSelector $var + * @return $this + */ + public function setTransaction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionSelector::class); + $this->transaction = $var; + + return $this; + } + + /** + * Required. The query request to generate partitions for. The request will + * fail if the query is not root partitionable. For a query to be root + * partitionable, it needs to satisfy a few conditions. For example, if the + * query execution plan contains a distributed union operator, then it must be + * the first operator in the plan. For more information about other + * conditions, see [Read data in + * parallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel). + * The query request must not contain DML commands, such as INSERT, UPDATE, or + * DELETE. Use + * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] with a + * PartitionedDml transaction for large, partition-friendly DML operations. + * + * Generated from protobuf field string sql = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getSql() + { + return $this->sql; + } + + /** + * Required. The query request to generate partitions for. The request will + * fail if the query is not root partitionable. For a query to be root + * partitionable, it needs to satisfy a few conditions. For example, if the + * query execution plan contains a distributed union operator, then it must be + * the first operator in the plan. For more information about other + * conditions, see [Read data in + * parallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel). + * The query request must not contain DML commands, such as INSERT, UPDATE, or + * DELETE. Use + * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] with a + * PartitionedDml transaction for large, partition-friendly DML operations. + * + * Generated from protobuf field string sql = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setSql($var) + { + GPBUtil::checkString($var, True); + $this->sql = $var; + + return $this; + } + + /** + * Parameter names and values that bind to placeholders in the SQL string. + * A parameter placeholder consists of the `@` character followed by the + * parameter name (for example, `@firstName`). Parameter names can contain + * letters, numbers, and underscores. + * Parameters can appear anywhere that a literal value is expected. The same + * parameter name can be used more than once, for example: + * `"WHERE id > @msg_id AND id < @msg_id + 100"` + * It is an error to execute a SQL statement with unbound parameters. + * + * Generated from protobuf field .google.protobuf.Struct params = 4; + * @return \Google\Protobuf\Struct|null + */ + public function getParams() + { + return $this->params; + } + + public function hasParams() + { + return isset($this->params); + } + + public function clearParams() + { + unset($this->params); + } + + /** + * Parameter names and values that bind to placeholders in the SQL string. + * A parameter placeholder consists of the `@` character followed by the + * parameter name (for example, `@firstName`). Parameter names can contain + * letters, numbers, and underscores. + * Parameters can appear anywhere that a literal value is expected. The same + * parameter name can be used more than once, for example: + * `"WHERE id > @msg_id AND id < @msg_id + 100"` + * It is an error to execute a SQL statement with unbound parameters. + * + * Generated from protobuf field .google.protobuf.Struct params = 4; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setParams($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->params = $var; + + return $this; + } + + /** + * It is not always possible for Cloud Spanner to infer the right SQL type + * from a JSON value. For example, values of type `BYTES` and values + * of type `STRING` both appear in + * [params][google.spanner.v1.PartitionQueryRequest.params] as JSON strings. + * In these cases, `param_types` can be used to specify the exact + * SQL type for some or all of the SQL query parameters. See the + * definition of [Type][google.spanner.v1.Type] for more information + * about SQL types. + * + * Generated from protobuf field map param_types = 5; + * @return \Google\Protobuf\Internal\MapField + */ + public function getParamTypes() + { + return $this->param_types; + } + + /** + * It is not always possible for Cloud Spanner to infer the right SQL type + * from a JSON value. For example, values of type `BYTES` and values + * of type `STRING` both appear in + * [params][google.spanner.v1.PartitionQueryRequest.params] as JSON strings. + * In these cases, `param_types` can be used to specify the exact + * SQL type for some or all of the SQL query parameters. See the + * definition of [Type][google.spanner.v1.Type] for more information + * about SQL types. + * + * Generated from protobuf field map param_types = 5; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setParamTypes($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Type::class); + $this->param_types = $arr; + + return $this; + } + + /** + * Additional options that affect how many partitions are created. + * + * Generated from protobuf field .google.spanner.v1.PartitionOptions partition_options = 6; + * @return \Google\Cloud\Spanner\V1\PartitionOptions|null + */ + public function getPartitionOptions() + { + return $this->partition_options; + } + + public function hasPartitionOptions() + { + return isset($this->partition_options); + } + + public function clearPartitionOptions() + { + unset($this->partition_options); + } + + /** + * Additional options that affect how many partitions are created. + * + * Generated from protobuf field .google.spanner.v1.PartitionOptions partition_options = 6; + * @param \Google\Cloud\Spanner\V1\PartitionOptions $var + * @return $this + */ + public function setPartitionOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\PartitionOptions::class); + $this->partition_options = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionReadRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionReadRequest.php new file mode 100644 index 000000000000..abf0b47074e2 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionReadRequest.php @@ -0,0 +1,361 @@ +google.spanner.v1.PartitionReadRequest + */ +class PartitionReadRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The session used to create the partitions. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $session = ''; + /** + * Read only snapshot transactions are supported, read/write and single use + * transactions are not. + * + * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; + */ + protected $transaction = null; + /** + * Required. The name of the table in the database to be read. + * + * Generated from protobuf field string table = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $table = ''; + /** + * If non-empty, the name of an index on + * [table][google.spanner.v1.PartitionReadRequest.table]. This index is used + * instead of the table primary key when interpreting + * [key_set][google.spanner.v1.PartitionReadRequest.key_set] and sorting + * result rows. See [key_set][google.spanner.v1.PartitionReadRequest.key_set] + * for further information. + * + * Generated from protobuf field string index = 4; + */ + protected $index = ''; + /** + * The columns of [table][google.spanner.v1.PartitionReadRequest.table] to be + * returned for each row matching this request. + * + * Generated from protobuf field repeated string columns = 5; + */ + private $columns; + /** + * Required. `key_set` identifies the rows to be yielded. `key_set` names the + * primary keys of the rows in + * [table][google.spanner.v1.PartitionReadRequest.table] to be yielded, unless + * [index][google.spanner.v1.PartitionReadRequest.index] is present. If + * [index][google.spanner.v1.PartitionReadRequest.index] is present, then + * [key_set][google.spanner.v1.PartitionReadRequest.key_set] instead names + * index keys in [index][google.spanner.v1.PartitionReadRequest.index]. + * It is not an error for the `key_set` to name rows that do not + * exist in the database. Read yields nothing for nonexistent rows. + * + * Generated from protobuf field .google.spanner.v1.KeySet key_set = 6 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $key_set = null; + /** + * Additional options that affect how many partitions are created. + * + * Generated from protobuf field .google.spanner.v1.PartitionOptions partition_options = 9; + */ + protected $partition_options = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $session + * Required. The session used to create the partitions. + * @type \Google\Cloud\Spanner\V1\TransactionSelector $transaction + * Read only snapshot transactions are supported, read/write and single use + * transactions are not. + * @type string $table + * Required. The name of the table in the database to be read. + * @type string $index + * If non-empty, the name of an index on + * [table][google.spanner.v1.PartitionReadRequest.table]. This index is used + * instead of the table primary key when interpreting + * [key_set][google.spanner.v1.PartitionReadRequest.key_set] and sorting + * result rows. See [key_set][google.spanner.v1.PartitionReadRequest.key_set] + * for further information. + * @type array|\Google\Protobuf\Internal\RepeatedField $columns + * The columns of [table][google.spanner.v1.PartitionReadRequest.table] to be + * returned for each row matching this request. + * @type \Google\Cloud\Spanner\V1\KeySet $key_set + * Required. `key_set` identifies the rows to be yielded. `key_set` names the + * primary keys of the rows in + * [table][google.spanner.v1.PartitionReadRequest.table] to be yielded, unless + * [index][google.spanner.v1.PartitionReadRequest.index] is present. If + * [index][google.spanner.v1.PartitionReadRequest.index] is present, then + * [key_set][google.spanner.v1.PartitionReadRequest.key_set] instead names + * index keys in [index][google.spanner.v1.PartitionReadRequest.index]. + * It is not an error for the `key_set` to name rows that do not + * exist in the database. Read yields nothing for nonexistent rows. + * @type \Google\Cloud\Spanner\V1\PartitionOptions $partition_options + * Additional options that affect how many partitions are created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The session used to create the partitions. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSession() + { + return $this->session; + } + + /** + * Required. The session used to create the partitions. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSession($var) + { + GPBUtil::checkString($var, True); + $this->session = $var; + + return $this; + } + + /** + * Read only snapshot transactions are supported, read/write and single use + * transactions are not. + * + * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; + * @return \Google\Cloud\Spanner\V1\TransactionSelector|null + */ + public function getTransaction() + { + return $this->transaction; + } + + public function hasTransaction() + { + return isset($this->transaction); + } + + public function clearTransaction() + { + unset($this->transaction); + } + + /** + * Read only snapshot transactions are supported, read/write and single use + * transactions are not. + * + * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; + * @param \Google\Cloud\Spanner\V1\TransactionSelector $var + * @return $this + */ + public function setTransaction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionSelector::class); + $this->transaction = $var; + + return $this; + } + + /** + * Required. The name of the table in the database to be read. + * + * Generated from protobuf field string table = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTable() + { + return $this->table; + } + + /** + * Required. The name of the table in the database to be read. + * + * Generated from protobuf field string table = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTable($var) + { + GPBUtil::checkString($var, True); + $this->table = $var; + + return $this; + } + + /** + * If non-empty, the name of an index on + * [table][google.spanner.v1.PartitionReadRequest.table]. This index is used + * instead of the table primary key when interpreting + * [key_set][google.spanner.v1.PartitionReadRequest.key_set] and sorting + * result rows. See [key_set][google.spanner.v1.PartitionReadRequest.key_set] + * for further information. + * + * Generated from protobuf field string index = 4; + * @return string + */ + public function getIndex() + { + return $this->index; + } + + /** + * If non-empty, the name of an index on + * [table][google.spanner.v1.PartitionReadRequest.table]. This index is used + * instead of the table primary key when interpreting + * [key_set][google.spanner.v1.PartitionReadRequest.key_set] and sorting + * result rows. See [key_set][google.spanner.v1.PartitionReadRequest.key_set] + * for further information. + * + * Generated from protobuf field string index = 4; + * @param string $var + * @return $this + */ + public function setIndex($var) + { + GPBUtil::checkString($var, True); + $this->index = $var; + + return $this; + } + + /** + * The columns of [table][google.spanner.v1.PartitionReadRequest.table] to be + * returned for each row matching this request. + * + * Generated from protobuf field repeated string columns = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getColumns() + { + return $this->columns; + } + + /** + * The columns of [table][google.spanner.v1.PartitionReadRequest.table] to be + * returned for each row matching this request. + * + * Generated from protobuf field repeated string columns = 5; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setColumns($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->columns = $arr; + + return $this; + } + + /** + * Required. `key_set` identifies the rows to be yielded. `key_set` names the + * primary keys of the rows in + * [table][google.spanner.v1.PartitionReadRequest.table] to be yielded, unless + * [index][google.spanner.v1.PartitionReadRequest.index] is present. If + * [index][google.spanner.v1.PartitionReadRequest.index] is present, then + * [key_set][google.spanner.v1.PartitionReadRequest.key_set] instead names + * index keys in [index][google.spanner.v1.PartitionReadRequest.index]. + * It is not an error for the `key_set` to name rows that do not + * exist in the database. Read yields nothing for nonexistent rows. + * + * Generated from protobuf field .google.spanner.v1.KeySet key_set = 6 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\V1\KeySet|null + */ + public function getKeySet() + { + return $this->key_set; + } + + public function hasKeySet() + { + return isset($this->key_set); + } + + public function clearKeySet() + { + unset($this->key_set); + } + + /** + * Required. `key_set` identifies the rows to be yielded. `key_set` names the + * primary keys of the rows in + * [table][google.spanner.v1.PartitionReadRequest.table] to be yielded, unless + * [index][google.spanner.v1.PartitionReadRequest.index] is present. If + * [index][google.spanner.v1.PartitionReadRequest.index] is present, then + * [key_set][google.spanner.v1.PartitionReadRequest.key_set] instead names + * index keys in [index][google.spanner.v1.PartitionReadRequest.index]. + * It is not an error for the `key_set` to name rows that do not + * exist in the database. Read yields nothing for nonexistent rows. + * + * Generated from protobuf field .google.spanner.v1.KeySet key_set = 6 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\V1\KeySet $var + * @return $this + */ + public function setKeySet($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\KeySet::class); + $this->key_set = $var; + + return $this; + } + + /** + * Additional options that affect how many partitions are created. + * + * Generated from protobuf field .google.spanner.v1.PartitionOptions partition_options = 9; + * @return \Google\Cloud\Spanner\V1\PartitionOptions|null + */ + public function getPartitionOptions() + { + return $this->partition_options; + } + + public function hasPartitionOptions() + { + return isset($this->partition_options); + } + + public function clearPartitionOptions() + { + unset($this->partition_options); + } + + /** + * Additional options that affect how many partitions are created. + * + * Generated from protobuf field .google.spanner.v1.PartitionOptions partition_options = 9; + * @param \Google\Cloud\Spanner\V1\PartitionOptions $var + * @return $this + */ + public function setPartitionOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\PartitionOptions::class); + $this->partition_options = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionResponse.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionResponse.php new file mode 100644 index 000000000000..f73e1179d2df --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionResponse.php @@ -0,0 +1,112 @@ +google.spanner.v1.PartitionResponse + */ +class PartitionResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Partitions created by this request. + * + * Generated from protobuf field repeated .google.spanner.v1.Partition partitions = 1; + */ + private $partitions; + /** + * Transaction created by this request. + * + * Generated from protobuf field .google.spanner.v1.Transaction transaction = 2; + */ + protected $transaction = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Spanner\V1\Partition>|\Google\Protobuf\Internal\RepeatedField $partitions + * Partitions created by this request. + * @type \Google\Cloud\Spanner\V1\Transaction $transaction + * Transaction created by this request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Partitions created by this request. + * + * Generated from protobuf field repeated .google.spanner.v1.Partition partitions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPartitions() + { + return $this->partitions; + } + + /** + * Partitions created by this request. + * + * Generated from protobuf field repeated .google.spanner.v1.Partition partitions = 1; + * @param array<\Google\Cloud\Spanner\V1\Partition>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPartitions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Partition::class); + $this->partitions = $arr; + + return $this; + } + + /** + * Transaction created by this request. + * + * Generated from protobuf field .google.spanner.v1.Transaction transaction = 2; + * @return \Google\Cloud\Spanner\V1\Transaction|null + */ + public function getTransaction() + { + return $this->transaction; + } + + public function hasTransaction() + { + return isset($this->transaction); + } + + public function clearTransaction() + { + unset($this->transaction); + } + + /** + * Transaction created by this request. + * + * Generated from protobuf field .google.spanner.v1.Transaction transaction = 2; + * @param \Google\Cloud\Spanner\V1\Transaction $var + * @return $this + */ + public function setTransaction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Transaction::class); + $this->transaction = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode.php new file mode 100644 index 000000000000..9137384574bb --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode.php @@ -0,0 +1,353 @@ +google.spanner.v1.PlanNode + */ +class PlanNode extends \Google\Protobuf\Internal\Message +{ + /** + * The `PlanNode`'s index in [node list][google.spanner.v1.QueryPlan.plan_nodes]. + * + * Generated from protobuf field int32 index = 1; + */ + protected $index = 0; + /** + * Used to determine the type of node. May be needed for visualizing + * different kinds of nodes differently. For example, If the node is a + * [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] node, it will have a condensed representation + * which can be used to directly embed a description of the node in its + * parent. + * + * Generated from protobuf field .google.spanner.v1.PlanNode.Kind kind = 2; + */ + protected $kind = 0; + /** + * The display name for the node. + * + * Generated from protobuf field string display_name = 3; + */ + protected $display_name = ''; + /** + * List of child node `index`es and their relationship to this parent. + * + * Generated from protobuf field repeated .google.spanner.v1.PlanNode.ChildLink child_links = 4; + */ + private $child_links; + /** + * Condensed representation for [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] nodes. + * + * Generated from protobuf field .google.spanner.v1.PlanNode.ShortRepresentation short_representation = 5; + */ + protected $short_representation = null; + /** + * Attributes relevant to the node contained in a group of key-value pairs. + * For example, a Parameter Reference node could have the following + * information in its metadata: + * { + * "parameter_reference": "param1", + * "parameter_type": "array" + * } + * + * Generated from protobuf field .google.protobuf.Struct metadata = 6; + */ + protected $metadata = null; + /** + * The execution statistics associated with the node, contained in a group of + * key-value pairs. Only present if the plan was returned as a result of a + * profile query. For example, number of executions, number of rows/time per + * execution etc. + * + * Generated from protobuf field .google.protobuf.Struct execution_stats = 7; + */ + protected $execution_stats = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $index + * The `PlanNode`'s index in [node list][google.spanner.v1.QueryPlan.plan_nodes]. + * @type int $kind + * Used to determine the type of node. May be needed for visualizing + * different kinds of nodes differently. For example, If the node is a + * [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] node, it will have a condensed representation + * which can be used to directly embed a description of the node in its + * parent. + * @type string $display_name + * The display name for the node. + * @type array<\Google\Cloud\Spanner\V1\PlanNode\ChildLink>|\Google\Protobuf\Internal\RepeatedField $child_links + * List of child node `index`es and their relationship to this parent. + * @type \Google\Cloud\Spanner\V1\PlanNode\ShortRepresentation $short_representation + * Condensed representation for [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] nodes. + * @type \Google\Protobuf\Struct $metadata + * Attributes relevant to the node contained in a group of key-value pairs. + * For example, a Parameter Reference node could have the following + * information in its metadata: + * { + * "parameter_reference": "param1", + * "parameter_type": "array" + * } + * @type \Google\Protobuf\Struct $execution_stats + * The execution statistics associated with the node, contained in a group of + * key-value pairs. Only present if the plan was returned as a result of a + * profile query. For example, number of executions, number of rows/time per + * execution etc. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\QueryPlan::initOnce(); + parent::__construct($data); + } + + /** + * The `PlanNode`'s index in [node list][google.spanner.v1.QueryPlan.plan_nodes]. + * + * Generated from protobuf field int32 index = 1; + * @return int + */ + public function getIndex() + { + return $this->index; + } + + /** + * The `PlanNode`'s index in [node list][google.spanner.v1.QueryPlan.plan_nodes]. + * + * Generated from protobuf field int32 index = 1; + * @param int $var + * @return $this + */ + public function setIndex($var) + { + GPBUtil::checkInt32($var); + $this->index = $var; + + return $this; + } + + /** + * Used to determine the type of node. May be needed for visualizing + * different kinds of nodes differently. For example, If the node is a + * [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] node, it will have a condensed representation + * which can be used to directly embed a description of the node in its + * parent. + * + * Generated from protobuf field .google.spanner.v1.PlanNode.Kind kind = 2; + * @return int + */ + public function getKind() + { + return $this->kind; + } + + /** + * Used to determine the type of node. May be needed for visualizing + * different kinds of nodes differently. For example, If the node is a + * [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] node, it will have a condensed representation + * which can be used to directly embed a description of the node in its + * parent. + * + * Generated from protobuf field .google.spanner.v1.PlanNode.Kind kind = 2; + * @param int $var + * @return $this + */ + public function setKind($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\V1\PlanNode\Kind::class); + $this->kind = $var; + + return $this; + } + + /** + * The display name for the node. + * + * Generated from protobuf field string display_name = 3; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The display name for the node. + * + * Generated from protobuf field string display_name = 3; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * List of child node `index`es and their relationship to this parent. + * + * Generated from protobuf field repeated .google.spanner.v1.PlanNode.ChildLink child_links = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getChildLinks() + { + return $this->child_links; + } + + /** + * List of child node `index`es and their relationship to this parent. + * + * Generated from protobuf field repeated .google.spanner.v1.PlanNode.ChildLink child_links = 4; + * @param array<\Google\Cloud\Spanner\V1\PlanNode\ChildLink>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setChildLinks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\PlanNode\ChildLink::class); + $this->child_links = $arr; + + return $this; + } + + /** + * Condensed representation for [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] nodes. + * + * Generated from protobuf field .google.spanner.v1.PlanNode.ShortRepresentation short_representation = 5; + * @return \Google\Cloud\Spanner\V1\PlanNode\ShortRepresentation|null + */ + public function getShortRepresentation() + { + return $this->short_representation; + } + + public function hasShortRepresentation() + { + return isset($this->short_representation); + } + + public function clearShortRepresentation() + { + unset($this->short_representation); + } + + /** + * Condensed representation for [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] nodes. + * + * Generated from protobuf field .google.spanner.v1.PlanNode.ShortRepresentation short_representation = 5; + * @param \Google\Cloud\Spanner\V1\PlanNode\ShortRepresentation $var + * @return $this + */ + public function setShortRepresentation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\PlanNode\ShortRepresentation::class); + $this->short_representation = $var; + + return $this; + } + + /** + * Attributes relevant to the node contained in a group of key-value pairs. + * For example, a Parameter Reference node could have the following + * information in its metadata: + * { + * "parameter_reference": "param1", + * "parameter_type": "array" + * } + * + * Generated from protobuf field .google.protobuf.Struct metadata = 6; + * @return \Google\Protobuf\Struct|null + */ + public function getMetadata() + { + return $this->metadata; + } + + public function hasMetadata() + { + return isset($this->metadata); + } + + public function clearMetadata() + { + unset($this->metadata); + } + + /** + * Attributes relevant to the node contained in a group of key-value pairs. + * For example, a Parameter Reference node could have the following + * information in its metadata: + * { + * "parameter_reference": "param1", + * "parameter_type": "array" + * } + * + * Generated from protobuf field .google.protobuf.Struct metadata = 6; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->metadata = $var; + + return $this; + } + + /** + * The execution statistics associated with the node, contained in a group of + * key-value pairs. Only present if the plan was returned as a result of a + * profile query. For example, number of executions, number of rows/time per + * execution etc. + * + * Generated from protobuf field .google.protobuf.Struct execution_stats = 7; + * @return \Google\Protobuf\Struct|null + */ + public function getExecutionStats() + { + return $this->execution_stats; + } + + public function hasExecutionStats() + { + return isset($this->execution_stats); + } + + public function clearExecutionStats() + { + unset($this->execution_stats); + } + + /** + * The execution statistics associated with the node, contained in a group of + * key-value pairs. Only present if the plan was returned as a result of a + * profile query. For example, number of executions, number of rows/time per + * execution etc. + * + * Generated from protobuf field .google.protobuf.Struct execution_stats = 7; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setExecutionStats($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->execution_stats = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/ChildLink.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/ChildLink.php new file mode 100644 index 000000000000..1afd40ab8fdb --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/ChildLink.php @@ -0,0 +1,179 @@ +google.spanner.v1.PlanNode.ChildLink + */ +class ChildLink extends \Google\Protobuf\Internal\Message +{ + /** + * The node to which the link points. + * + * Generated from protobuf field int32 child_index = 1; + */ + protected $child_index = 0; + /** + * The type of the link. For example, in Hash Joins this could be used to + * distinguish between the build child and the probe child, or in the case + * of the child being an output variable, to represent the tag associated + * with the output variable. + * + * Generated from protobuf field string type = 2; + */ + protected $type = ''; + /** + * Only present if the child node is [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] and corresponds + * to an output variable of the parent node. The field carries the name of + * the output variable. + * For example, a `TableScan` operator that reads rows from a table will + * have child links to the `SCALAR` nodes representing the output variables + * created for each column that is read by the operator. The corresponding + * `variable` fields will be set to the variable names assigned to the + * columns. + * + * Generated from protobuf field string variable = 3; + */ + protected $variable = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $child_index + * The node to which the link points. + * @type string $type + * The type of the link. For example, in Hash Joins this could be used to + * distinguish between the build child and the probe child, or in the case + * of the child being an output variable, to represent the tag associated + * with the output variable. + * @type string $variable + * Only present if the child node is [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] and corresponds + * to an output variable of the parent node. The field carries the name of + * the output variable. + * For example, a `TableScan` operator that reads rows from a table will + * have child links to the `SCALAR` nodes representing the output variables + * created for each column that is read by the operator. The corresponding + * `variable` fields will be set to the variable names assigned to the + * columns. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\QueryPlan::initOnce(); + parent::__construct($data); + } + + /** + * The node to which the link points. + * + * Generated from protobuf field int32 child_index = 1; + * @return int + */ + public function getChildIndex() + { + return $this->child_index; + } + + /** + * The node to which the link points. + * + * Generated from protobuf field int32 child_index = 1; + * @param int $var + * @return $this + */ + public function setChildIndex($var) + { + GPBUtil::checkInt32($var); + $this->child_index = $var; + + return $this; + } + + /** + * The type of the link. For example, in Hash Joins this could be used to + * distinguish between the build child and the probe child, or in the case + * of the child being an output variable, to represent the tag associated + * with the output variable. + * + * Generated from protobuf field string type = 2; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * The type of the link. For example, in Hash Joins this could be used to + * distinguish between the build child and the probe child, or in the case + * of the child being an output variable, to represent the tag associated + * with the output variable. + * + * Generated from protobuf field string type = 2; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * Only present if the child node is [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] and corresponds + * to an output variable of the parent node. The field carries the name of + * the output variable. + * For example, a `TableScan` operator that reads rows from a table will + * have child links to the `SCALAR` nodes representing the output variables + * created for each column that is read by the operator. The corresponding + * `variable` fields will be set to the variable names assigned to the + * columns. + * + * Generated from protobuf field string variable = 3; + * @return string + */ + public function getVariable() + { + return $this->variable; + } + + /** + * Only present if the child node is [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] and corresponds + * to an output variable of the parent node. The field carries the name of + * the output variable. + * For example, a `TableScan` operator that reads rows from a table will + * have child links to the `SCALAR` nodes representing the output variables + * created for each column that is read by the operator. The corresponding + * `variable` fields will be set to the variable names assigned to the + * columns. + * + * Generated from protobuf field string variable = 3; + * @param string $var + * @return $this + */ + public function setVariable($var) + { + GPBUtil::checkString($var, True); + $this->variable = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ChildLink::class, \Google\Cloud\Spanner\V1\PlanNode_ChildLink::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/Kind.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/Kind.php new file mode 100644 index 000000000000..78081c797e03 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/Kind.php @@ -0,0 +1,70 @@ +google.spanner.v1.PlanNode.Kind + */ +class Kind +{ + /** + * Not specified. + * + * Generated from protobuf enum KIND_UNSPECIFIED = 0; + */ + const KIND_UNSPECIFIED = 0; + /** + * Denotes a Relational operator node in the expression tree. Relational + * operators represent iterative processing of rows during query execution. + * For example, a `TableScan` operation that reads rows from a table. + * + * Generated from protobuf enum RELATIONAL = 1; + */ + const RELATIONAL = 1; + /** + * Denotes a Scalar node in the expression tree. Scalar nodes represent + * non-iterable entities in the query plan. For example, constants or + * arithmetic operators appearing inside predicate expressions or references + * to column names. + * + * Generated from protobuf enum SCALAR = 2; + */ + const SCALAR = 2; + + private static $valueToName = [ + self::KIND_UNSPECIFIED => 'KIND_UNSPECIFIED', + self::RELATIONAL => 'RELATIONAL', + self::SCALAR => 'SCALAR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Kind::class, \Google\Cloud\Spanner\V1\PlanNode_Kind::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/ShortRepresentation.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/ShortRepresentation.php new file mode 100644 index 000000000000..4de00c304229 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/ShortRepresentation.php @@ -0,0 +1,121 @@ +google.spanner.v1.PlanNode.ShortRepresentation + */ +class ShortRepresentation extends \Google\Protobuf\Internal\Message +{ + /** + * A string representation of the expression subtree rooted at this node. + * + * Generated from protobuf field string description = 1; + */ + protected $description = ''; + /** + * A mapping of (subquery variable name) -> (subquery node id) for cases + * where the `description` string of this node references a `SCALAR` + * subquery contained in the expression subtree rooted at this node. The + * referenced `SCALAR` subquery may not necessarily be a direct child of + * this node. + * + * Generated from protobuf field map subqueries = 2; + */ + private $subqueries; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $description + * A string representation of the expression subtree rooted at this node. + * @type array|\Google\Protobuf\Internal\MapField $subqueries + * A mapping of (subquery variable name) -> (subquery node id) for cases + * where the `description` string of this node references a `SCALAR` + * subquery contained in the expression subtree rooted at this node. The + * referenced `SCALAR` subquery may not necessarily be a direct child of + * this node. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\QueryPlan::initOnce(); + parent::__construct($data); + } + + /** + * A string representation of the expression subtree rooted at this node. + * + * Generated from protobuf field string description = 1; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * A string representation of the expression subtree rooted at this node. + * + * Generated from protobuf field string description = 1; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * A mapping of (subquery variable name) -> (subquery node id) for cases + * where the `description` string of this node references a `SCALAR` + * subquery contained in the expression subtree rooted at this node. The + * referenced `SCALAR` subquery may not necessarily be a direct child of + * this node. + * + * Generated from protobuf field map subqueries = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getSubqueries() + { + return $this->subqueries; + } + + /** + * A mapping of (subquery variable name) -> (subquery node id) for cases + * where the `description` string of this node references a `SCALAR` + * subquery contained in the expression subtree rooted at this node. The + * referenced `SCALAR` subquery may not necessarily be a direct child of + * this node. + * + * Generated from protobuf field map subqueries = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setSubqueries($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT32); + $this->subqueries = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ShortRepresentation::class, \Google\Cloud\Spanner\V1\PlanNode_ShortRepresentation::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/QueryPlan.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/QueryPlan.php new file mode 100644 index 000000000000..b09ddcab41ba --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/QueryPlan.php @@ -0,0 +1,75 @@ +google.spanner.v1.QueryPlan + */ +class QueryPlan extends \Google\Protobuf\Internal\Message +{ + /** + * The nodes in the query plan. Plan nodes are returned in pre-order starting + * with the plan root. Each [PlanNode][google.spanner.v1.PlanNode]'s `id` corresponds to its index in + * `plan_nodes`. + * + * Generated from protobuf field repeated .google.spanner.v1.PlanNode plan_nodes = 1; + */ + private $plan_nodes; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Spanner\V1\PlanNode>|\Google\Protobuf\Internal\RepeatedField $plan_nodes + * The nodes in the query plan. Plan nodes are returned in pre-order starting + * with the plan root. Each [PlanNode][google.spanner.v1.PlanNode]'s `id` corresponds to its index in + * `plan_nodes`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\QueryPlan::initOnce(); + parent::__construct($data); + } + + /** + * The nodes in the query plan. Plan nodes are returned in pre-order starting + * with the plan root. Each [PlanNode][google.spanner.v1.PlanNode]'s `id` corresponds to its index in + * `plan_nodes`. + * + * Generated from protobuf field repeated .google.spanner.v1.PlanNode plan_nodes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPlanNodes() + { + return $this->plan_nodes; + } + + /** + * The nodes in the query plan. Plan nodes are returned in pre-order starting + * with the plan root. Each [PlanNode][google.spanner.v1.PlanNode]'s `id` corresponds to its index in + * `plan_nodes`. + * + * Generated from protobuf field repeated .google.spanner.v1.PlanNode plan_nodes = 1; + * @param array<\Google\Cloud\Spanner\V1\PlanNode>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPlanNodes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\PlanNode::class); + $this->plan_nodes = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest.php new file mode 100644 index 000000000000..6f97b44a5e6f --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest.php @@ -0,0 +1,706 @@ +google.spanner.v1.ReadRequest + */ +class ReadRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The session in which the read should be performed. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $session = ''; + /** + * The transaction to use. If none is provided, the default is a + * temporary read-only transaction with strong concurrency. + * + * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; + */ + protected $transaction = null; + /** + * Required. The name of the table in the database to be read. + * + * Generated from protobuf field string table = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $table = ''; + /** + * If non-empty, the name of an index on + * [table][google.spanner.v1.ReadRequest.table]. This index is used instead of + * the table primary key when interpreting + * [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows. + * See [key_set][google.spanner.v1.ReadRequest.key_set] for further + * information. + * + * Generated from protobuf field string index = 4; + */ + protected $index = ''; + /** + * Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be + * returned for each row matching this request. + * + * Generated from protobuf field repeated string columns = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + private $columns; + /** + * Required. `key_set` identifies the rows to be yielded. `key_set` names the + * primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to + * be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present. + * If [index][google.spanner.v1.ReadRequest.index] is present, then + * [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys + * in [index][google.spanner.v1.ReadRequest.index]. + * If the [partition_token][google.spanner.v1.ReadRequest.partition_token] + * field is empty, rows are yielded in table primary key order (if + * [index][google.spanner.v1.ReadRequest.index] is empty) or index key order + * (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the + * [partition_token][google.spanner.v1.ReadRequest.partition_token] field is + * not empty, rows will be yielded in an unspecified order. + * It is not an error for the `key_set` to name rows that do not + * exist in the database. Read yields nothing for nonexistent rows. + * + * Generated from protobuf field .google.spanner.v1.KeySet key_set = 6 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $key_set = null; + /** + * If greater than zero, only the first `limit` rows are yielded. If `limit` + * is zero, the default is no limit. A limit cannot be specified if + * `partition_token` is set. + * + * Generated from protobuf field int64 limit = 8; + */ + protected $limit = 0; + /** + * If this request is resuming a previously interrupted read, + * `resume_token` should be copied from the last + * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the + * interruption. Doing this enables the new read to resume where the last read + * left off. The rest of the request parameters must exactly match the request + * that yielded this token. + * + * Generated from protobuf field bytes resume_token = 9; + */ + protected $resume_token = ''; + /** + * If present, results will be restricted to the specified partition + * previously created using PartitionRead(). There must be an exact + * match for the values of fields common to this message and the + * PartitionReadRequest message used to create this partition_token. + * + * Generated from protobuf field bytes partition_token = 10; + */ + protected $partition_token = ''; + /** + * Common options for this request. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 11; + */ + protected $request_options = null; + /** + * Directed read options for this request. + * + * Generated from protobuf field .google.spanner.v1.DirectedReadOptions directed_read_options = 14; + */ + protected $directed_read_options = null; + /** + * If this is for a partitioned read and this field is set to `true`, the + * request is executed with Spanner Data Boost independent compute resources. + * If the field is set to `true` but the request does not set + * `partition_token`, the API returns an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field bool data_boost_enabled = 15; + */ + protected $data_boost_enabled = false; + /** + * Optional. Order for the returned rows. + * By default, Spanner will return result rows in primary key order except for + * PartitionRead requests. For applications that do not require rows to be + * returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting + * `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval, + * resulting in lower latencies in certain cases (e.g. bulk point lookups). + * + * Generated from protobuf field .google.spanner.v1.ReadRequest.OrderBy order_by = 16 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = 0; + /** + * Optional. Lock Hint for the request, it can only be used with read-write + * transactions. + * + * Generated from protobuf field .google.spanner.v1.ReadRequest.LockHint lock_hint = 17 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $lock_hint = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $session + * Required. The session in which the read should be performed. + * @type \Google\Cloud\Spanner\V1\TransactionSelector $transaction + * The transaction to use. If none is provided, the default is a + * temporary read-only transaction with strong concurrency. + * @type string $table + * Required. The name of the table in the database to be read. + * @type string $index + * If non-empty, the name of an index on + * [table][google.spanner.v1.ReadRequest.table]. This index is used instead of + * the table primary key when interpreting + * [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows. + * See [key_set][google.spanner.v1.ReadRequest.key_set] for further + * information. + * @type array|\Google\Protobuf\Internal\RepeatedField $columns + * Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be + * returned for each row matching this request. + * @type \Google\Cloud\Spanner\V1\KeySet $key_set + * Required. `key_set` identifies the rows to be yielded. `key_set` names the + * primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to + * be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present. + * If [index][google.spanner.v1.ReadRequest.index] is present, then + * [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys + * in [index][google.spanner.v1.ReadRequest.index]. + * If the [partition_token][google.spanner.v1.ReadRequest.partition_token] + * field is empty, rows are yielded in table primary key order (if + * [index][google.spanner.v1.ReadRequest.index] is empty) or index key order + * (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the + * [partition_token][google.spanner.v1.ReadRequest.partition_token] field is + * not empty, rows will be yielded in an unspecified order. + * It is not an error for the `key_set` to name rows that do not + * exist in the database. Read yields nothing for nonexistent rows. + * @type int|string $limit + * If greater than zero, only the first `limit` rows are yielded. If `limit` + * is zero, the default is no limit. A limit cannot be specified if + * `partition_token` is set. + * @type string $resume_token + * If this request is resuming a previously interrupted read, + * `resume_token` should be copied from the last + * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the + * interruption. Doing this enables the new read to resume where the last read + * left off. The rest of the request parameters must exactly match the request + * that yielded this token. + * @type string $partition_token + * If present, results will be restricted to the specified partition + * previously created using PartitionRead(). There must be an exact + * match for the values of fields common to this message and the + * PartitionReadRequest message used to create this partition_token. + * @type \Google\Cloud\Spanner\V1\RequestOptions $request_options + * Common options for this request. + * @type \Google\Cloud\Spanner\V1\DirectedReadOptions $directed_read_options + * Directed read options for this request. + * @type bool $data_boost_enabled + * If this is for a partitioned read and this field is set to `true`, the + * request is executed with Spanner Data Boost independent compute resources. + * If the field is set to `true` but the request does not set + * `partition_token`, the API returns an `INVALID_ARGUMENT` error. + * @type int $order_by + * Optional. Order for the returned rows. + * By default, Spanner will return result rows in primary key order except for + * PartitionRead requests. For applications that do not require rows to be + * returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting + * `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval, + * resulting in lower latencies in certain cases (e.g. bulk point lookups). + * @type int $lock_hint + * Optional. Lock Hint for the request, it can only be used with read-write + * transactions. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The session in which the read should be performed. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSession() + { + return $this->session; + } + + /** + * Required. The session in which the read should be performed. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSession($var) + { + GPBUtil::checkString($var, True); + $this->session = $var; + + return $this; + } + + /** + * The transaction to use. If none is provided, the default is a + * temporary read-only transaction with strong concurrency. + * + * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; + * @return \Google\Cloud\Spanner\V1\TransactionSelector|null + */ + public function getTransaction() + { + return $this->transaction; + } + + public function hasTransaction() + { + return isset($this->transaction); + } + + public function clearTransaction() + { + unset($this->transaction); + } + + /** + * The transaction to use. If none is provided, the default is a + * temporary read-only transaction with strong concurrency. + * + * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; + * @param \Google\Cloud\Spanner\V1\TransactionSelector $var + * @return $this + */ + public function setTransaction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionSelector::class); + $this->transaction = $var; + + return $this; + } + + /** + * Required. The name of the table in the database to be read. + * + * Generated from protobuf field string table = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTable() + { + return $this->table; + } + + /** + * Required. The name of the table in the database to be read. + * + * Generated from protobuf field string table = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTable($var) + { + GPBUtil::checkString($var, True); + $this->table = $var; + + return $this; + } + + /** + * If non-empty, the name of an index on + * [table][google.spanner.v1.ReadRequest.table]. This index is used instead of + * the table primary key when interpreting + * [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows. + * See [key_set][google.spanner.v1.ReadRequest.key_set] for further + * information. + * + * Generated from protobuf field string index = 4; + * @return string + */ + public function getIndex() + { + return $this->index; + } + + /** + * If non-empty, the name of an index on + * [table][google.spanner.v1.ReadRequest.table]. This index is used instead of + * the table primary key when interpreting + * [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows. + * See [key_set][google.spanner.v1.ReadRequest.key_set] for further + * information. + * + * Generated from protobuf field string index = 4; + * @param string $var + * @return $this + */ + public function setIndex($var) + { + GPBUtil::checkString($var, True); + $this->index = $var; + + return $this; + } + + /** + * Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be + * returned for each row matching this request. + * + * Generated from protobuf field repeated string columns = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getColumns() + { + return $this->columns; + } + + /** + * Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be + * returned for each row matching this request. + * + * Generated from protobuf field repeated string columns = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setColumns($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->columns = $arr; + + return $this; + } + + /** + * Required. `key_set` identifies the rows to be yielded. `key_set` names the + * primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to + * be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present. + * If [index][google.spanner.v1.ReadRequest.index] is present, then + * [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys + * in [index][google.spanner.v1.ReadRequest.index]. + * If the [partition_token][google.spanner.v1.ReadRequest.partition_token] + * field is empty, rows are yielded in table primary key order (if + * [index][google.spanner.v1.ReadRequest.index] is empty) or index key order + * (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the + * [partition_token][google.spanner.v1.ReadRequest.partition_token] field is + * not empty, rows will be yielded in an unspecified order. + * It is not an error for the `key_set` to name rows that do not + * exist in the database. Read yields nothing for nonexistent rows. + * + * Generated from protobuf field .google.spanner.v1.KeySet key_set = 6 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Spanner\V1\KeySet|null + */ + public function getKeySet() + { + return $this->key_set; + } + + public function hasKeySet() + { + return isset($this->key_set); + } + + public function clearKeySet() + { + unset($this->key_set); + } + + /** + * Required. `key_set` identifies the rows to be yielded. `key_set` names the + * primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to + * be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present. + * If [index][google.spanner.v1.ReadRequest.index] is present, then + * [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys + * in [index][google.spanner.v1.ReadRequest.index]. + * If the [partition_token][google.spanner.v1.ReadRequest.partition_token] + * field is empty, rows are yielded in table primary key order (if + * [index][google.spanner.v1.ReadRequest.index] is empty) or index key order + * (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the + * [partition_token][google.spanner.v1.ReadRequest.partition_token] field is + * not empty, rows will be yielded in an unspecified order. + * It is not an error for the `key_set` to name rows that do not + * exist in the database. Read yields nothing for nonexistent rows. + * + * Generated from protobuf field .google.spanner.v1.KeySet key_set = 6 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Spanner\V1\KeySet $var + * @return $this + */ + public function setKeySet($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\KeySet::class); + $this->key_set = $var; + + return $this; + } + + /** + * If greater than zero, only the first `limit` rows are yielded. If `limit` + * is zero, the default is no limit. A limit cannot be specified if + * `partition_token` is set. + * + * Generated from protobuf field int64 limit = 8; + * @return int|string + */ + public function getLimit() + { + return $this->limit; + } + + /** + * If greater than zero, only the first `limit` rows are yielded. If `limit` + * is zero, the default is no limit. A limit cannot be specified if + * `partition_token` is set. + * + * Generated from protobuf field int64 limit = 8; + * @param int|string $var + * @return $this + */ + public function setLimit($var) + { + GPBUtil::checkInt64($var); + $this->limit = $var; + + return $this; + } + + /** + * If this request is resuming a previously interrupted read, + * `resume_token` should be copied from the last + * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the + * interruption. Doing this enables the new read to resume where the last read + * left off. The rest of the request parameters must exactly match the request + * that yielded this token. + * + * Generated from protobuf field bytes resume_token = 9; + * @return string + */ + public function getResumeToken() + { + return $this->resume_token; + } + + /** + * If this request is resuming a previously interrupted read, + * `resume_token` should be copied from the last + * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the + * interruption. Doing this enables the new read to resume where the last read + * left off. The rest of the request parameters must exactly match the request + * that yielded this token. + * + * Generated from protobuf field bytes resume_token = 9; + * @param string $var + * @return $this + */ + public function setResumeToken($var) + { + GPBUtil::checkString($var, False); + $this->resume_token = $var; + + return $this; + } + + /** + * If present, results will be restricted to the specified partition + * previously created using PartitionRead(). There must be an exact + * match for the values of fields common to this message and the + * PartitionReadRequest message used to create this partition_token. + * + * Generated from protobuf field bytes partition_token = 10; + * @return string + */ + public function getPartitionToken() + { + return $this->partition_token; + } + + /** + * If present, results will be restricted to the specified partition + * previously created using PartitionRead(). There must be an exact + * match for the values of fields common to this message and the + * PartitionReadRequest message used to create this partition_token. + * + * Generated from protobuf field bytes partition_token = 10; + * @param string $var + * @return $this + */ + public function setPartitionToken($var) + { + GPBUtil::checkString($var, False); + $this->partition_token = $var; + + return $this; + } + + /** + * Common options for this request. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 11; + * @return \Google\Cloud\Spanner\V1\RequestOptions|null + */ + public function getRequestOptions() + { + return $this->request_options; + } + + public function hasRequestOptions() + { + return isset($this->request_options); + } + + public function clearRequestOptions() + { + unset($this->request_options); + } + + /** + * Common options for this request. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 11; + * @param \Google\Cloud\Spanner\V1\RequestOptions $var + * @return $this + */ + public function setRequestOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\RequestOptions::class); + $this->request_options = $var; + + return $this; + } + + /** + * Directed read options for this request. + * + * Generated from protobuf field .google.spanner.v1.DirectedReadOptions directed_read_options = 14; + * @return \Google\Cloud\Spanner\V1\DirectedReadOptions|null + */ + public function getDirectedReadOptions() + { + return $this->directed_read_options; + } + + public function hasDirectedReadOptions() + { + return isset($this->directed_read_options); + } + + public function clearDirectedReadOptions() + { + unset($this->directed_read_options); + } + + /** + * Directed read options for this request. + * + * Generated from protobuf field .google.spanner.v1.DirectedReadOptions directed_read_options = 14; + * @param \Google\Cloud\Spanner\V1\DirectedReadOptions $var + * @return $this + */ + public function setDirectedReadOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\DirectedReadOptions::class); + $this->directed_read_options = $var; + + return $this; + } + + /** + * If this is for a partitioned read and this field is set to `true`, the + * request is executed with Spanner Data Boost independent compute resources. + * If the field is set to `true` but the request does not set + * `partition_token`, the API returns an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field bool data_boost_enabled = 15; + * @return bool + */ + public function getDataBoostEnabled() + { + return $this->data_boost_enabled; + } + + /** + * If this is for a partitioned read and this field is set to `true`, the + * request is executed with Spanner Data Boost independent compute resources. + * If the field is set to `true` but the request does not set + * `partition_token`, the API returns an `INVALID_ARGUMENT` error. + * + * Generated from protobuf field bool data_boost_enabled = 15; + * @param bool $var + * @return $this + */ + public function setDataBoostEnabled($var) + { + GPBUtil::checkBool($var); + $this->data_boost_enabled = $var; + + return $this; + } + + /** + * Optional. Order for the returned rows. + * By default, Spanner will return result rows in primary key order except for + * PartitionRead requests. For applications that do not require rows to be + * returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting + * `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval, + * resulting in lower latencies in certain cases (e.g. bulk point lookups). + * + * Generated from protobuf field .google.spanner.v1.ReadRequest.OrderBy order_by = 16 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Order for the returned rows. + * By default, Spanner will return result rows in primary key order except for + * PartitionRead requests. For applications that do not require rows to be + * returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting + * `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval, + * resulting in lower latencies in certain cases (e.g. bulk point lookups). + * + * Generated from protobuf field .google.spanner.v1.ReadRequest.OrderBy order_by = 16 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\V1\ReadRequest\OrderBy::class); + $this->order_by = $var; + + return $this; + } + + /** + * Optional. Lock Hint for the request, it can only be used with read-write + * transactions. + * + * Generated from protobuf field .google.spanner.v1.ReadRequest.LockHint lock_hint = 17 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getLockHint() + { + return $this->lock_hint; + } + + /** + * Optional. Lock Hint for the request, it can only be used with read-write + * transactions. + * + * Generated from protobuf field .google.spanner.v1.ReadRequest.LockHint lock_hint = 17 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setLockHint($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\V1\ReadRequest\LockHint::class); + $this->lock_hint = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest/LockHint.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest/LockHint.php new file mode 100644 index 000000000000..c0e38b196dbf --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest/LockHint.php @@ -0,0 +1,95 @@ +google.spanner.v1.ReadRequest.LockHint + */ +class LockHint +{ + /** + * Default value. + * LOCK_HINT_UNSPECIFIED is equivalent to LOCK_HINT_SHARED. + * + * Generated from protobuf enum LOCK_HINT_UNSPECIFIED = 0; + */ + const LOCK_HINT_UNSPECIFIED = 0; + /** + * Acquire shared locks. + * By default when you perform a read as part of a read-write transaction, + * Spanner acquires shared read locks, which allows other reads to still + * access the data until your transaction is ready to commit. When your + * transaction is committing and writes are being applied, the transaction + * attempts to upgrade to an exclusive lock for any data you are writing. + * For more information about locks, see [Lock + * modes](https://cloud.google.com/spanner/docs/introspection/lock-statistics#explain-lock-modes). + * + * Generated from protobuf enum LOCK_HINT_SHARED = 1; + */ + const LOCK_HINT_SHARED = 1; + /** + * Acquire exclusive locks. + * Requesting exclusive locks is beneficial if you observe high write + * contention, which means you notice that multiple transactions are + * concurrently trying to read and write to the same data, resulting in a + * large number of aborts. This problem occurs when two transactions + * initially acquire shared locks and then both try to upgrade to exclusive + * locks at the same time. In this situation both transactions are waiting + * for the other to give up their lock, resulting in a deadlocked situation. + * Spanner is able to detect this occurring and force one of the + * transactions to abort. However, this is a slow and expensive operation + * and results in lower performance. In this case it makes sense to acquire + * exclusive locks at the start of the transaction because then when + * multiple transactions try to act on the same data, they automatically get + * serialized. Each transaction waits its turn to acquire the lock and + * avoids getting into deadlock situations. + * Because the exclusive lock hint is just a hint, it should not be + * considered equivalent to a mutex. In other words, you should not use + * Spanner exclusive locks as a mutual exclusion mechanism for the execution + * of code outside of Spanner. + * **Note:** Request exclusive locks judiciously because they block others + * from reading that data for the entire transaction, rather than just when + * the writes are being performed. Unless you observe high write contention, + * you should use the default of shared read locks so you don't prematurely + * block other clients from reading the data that you're writing to. + * + * Generated from protobuf enum LOCK_HINT_EXCLUSIVE = 2; + */ + const LOCK_HINT_EXCLUSIVE = 2; + + private static $valueToName = [ + self::LOCK_HINT_UNSPECIFIED => 'LOCK_HINT_UNSPECIFIED', + self::LOCK_HINT_SHARED => 'LOCK_HINT_SHARED', + self::LOCK_HINT_EXCLUSIVE => 'LOCK_HINT_EXCLUSIVE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(LockHint::class, \Google\Cloud\Spanner\V1\ReadRequest_LockHint::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest/OrderBy.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest/OrderBy.php new file mode 100644 index 000000000000..4a229a9738f2 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest/OrderBy.php @@ -0,0 +1,67 @@ +google.spanner.v1.ReadRequest.OrderBy + */ +class OrderBy +{ + /** + * Default value. + * ORDER_BY_UNSPECIFIED is equivalent to ORDER_BY_PRIMARY_KEY. + * + * Generated from protobuf enum ORDER_BY_UNSPECIFIED = 0; + */ + const ORDER_BY_UNSPECIFIED = 0; + /** + * Read rows are returned in primary key order. + * In the event that this option is used in conjunction with the + * `partition_token` field, the API will return an `INVALID_ARGUMENT` error. + * + * Generated from protobuf enum ORDER_BY_PRIMARY_KEY = 1; + */ + const ORDER_BY_PRIMARY_KEY = 1; + /** + * Read rows are returned in any order. + * + * Generated from protobuf enum ORDER_BY_NO_ORDER = 2; + */ + const ORDER_BY_NO_ORDER = 2; + + private static $valueToName = [ + self::ORDER_BY_UNSPECIFIED => 'ORDER_BY_UNSPECIFIED', + self::ORDER_BY_PRIMARY_KEY => 'ORDER_BY_PRIMARY_KEY', + self::ORDER_BY_NO_ORDER => 'ORDER_BY_NO_ORDER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(OrderBy::class, \Google\Cloud\Spanner\V1\ReadRequest_OrderBy::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RequestOptions.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RequestOptions.php new file mode 100644 index 000000000000..1b2cd281d004 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RequestOptions.php @@ -0,0 +1,211 @@ +google.spanner.v1.RequestOptions + */ +class RequestOptions extends \Google\Protobuf\Internal\Message +{ + /** + * Priority for the request. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions.Priority priority = 1; + */ + protected $priority = 0; + /** + * A per-request tag which can be applied to queries or reads, used for + * statistics collection. + * Both request_tag and transaction_tag can be specified for a read or query + * that belongs to a transaction. + * This field is ignored for requests where it's not applicable (e.g. + * CommitRequest). + * Legal characters for `request_tag` values are all printable characters + * (ASCII 32 - 126) and the length of a request_tag is limited to 50 + * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. + * + * Generated from protobuf field string request_tag = 2; + */ + protected $request_tag = ''; + /** + * A tag used for statistics collection about this transaction. + * Both request_tag and transaction_tag can be specified for a read or query + * that belongs to a transaction. + * The value of transaction_tag should be the same for all requests belonging + * to the same transaction. + * If this request doesn't belong to any transaction, transaction_tag will be + * ignored. + * Legal characters for `transaction_tag` values are all printable characters + * (ASCII 32 - 126) and the length of a transaction_tag is limited to 50 + * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. + * + * Generated from protobuf field string transaction_tag = 3; + */ + protected $transaction_tag = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $priority + * Priority for the request. + * @type string $request_tag + * A per-request tag which can be applied to queries or reads, used for + * statistics collection. + * Both request_tag and transaction_tag can be specified for a read or query + * that belongs to a transaction. + * This field is ignored for requests where it's not applicable (e.g. + * CommitRequest). + * Legal characters for `request_tag` values are all printable characters + * (ASCII 32 - 126) and the length of a request_tag is limited to 50 + * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. + * @type string $transaction_tag + * A tag used for statistics collection about this transaction. + * Both request_tag and transaction_tag can be specified for a read or query + * that belongs to a transaction. + * The value of transaction_tag should be the same for all requests belonging + * to the same transaction. + * If this request doesn't belong to any transaction, transaction_tag will be + * ignored. + * Legal characters for `transaction_tag` values are all printable characters + * (ASCII 32 - 126) and the length of a transaction_tag is limited to 50 + * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Priority for the request. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions.Priority priority = 1; + * @return int + */ + public function getPriority() + { + return $this->priority; + } + + /** + * Priority for the request. + * + * Generated from protobuf field .google.spanner.v1.RequestOptions.Priority priority = 1; + * @param int $var + * @return $this + */ + public function setPriority($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\V1\RequestOptions\Priority::class); + $this->priority = $var; + + return $this; + } + + /** + * A per-request tag which can be applied to queries or reads, used for + * statistics collection. + * Both request_tag and transaction_tag can be specified for a read or query + * that belongs to a transaction. + * This field is ignored for requests where it's not applicable (e.g. + * CommitRequest). + * Legal characters for `request_tag` values are all printable characters + * (ASCII 32 - 126) and the length of a request_tag is limited to 50 + * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. + * + * Generated from protobuf field string request_tag = 2; + * @return string + */ + public function getRequestTag() + { + return $this->request_tag; + } + + /** + * A per-request tag which can be applied to queries or reads, used for + * statistics collection. + * Both request_tag and transaction_tag can be specified for a read or query + * that belongs to a transaction. + * This field is ignored for requests where it's not applicable (e.g. + * CommitRequest). + * Legal characters for `request_tag` values are all printable characters + * (ASCII 32 - 126) and the length of a request_tag is limited to 50 + * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. + * + * Generated from protobuf field string request_tag = 2; + * @param string $var + * @return $this + */ + public function setRequestTag($var) + { + GPBUtil::checkString($var, True); + $this->request_tag = $var; + + return $this; + } + + /** + * A tag used for statistics collection about this transaction. + * Both request_tag and transaction_tag can be specified for a read or query + * that belongs to a transaction. + * The value of transaction_tag should be the same for all requests belonging + * to the same transaction. + * If this request doesn't belong to any transaction, transaction_tag will be + * ignored. + * Legal characters for `transaction_tag` values are all printable characters + * (ASCII 32 - 126) and the length of a transaction_tag is limited to 50 + * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. + * + * Generated from protobuf field string transaction_tag = 3; + * @return string + */ + public function getTransactionTag() + { + return $this->transaction_tag; + } + + /** + * A tag used for statistics collection about this transaction. + * Both request_tag and transaction_tag can be specified for a read or query + * that belongs to a transaction. + * The value of transaction_tag should be the same for all requests belonging + * to the same transaction. + * If this request doesn't belong to any transaction, transaction_tag will be + * ignored. + * Legal characters for `transaction_tag` values are all printable characters + * (ASCII 32 - 126) and the length of a transaction_tag is limited to 50 + * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. + * + * Generated from protobuf field string transaction_tag = 3; + * @param string $var + * @return $this + */ + public function setTransactionTag($var) + { + GPBUtil::checkString($var, True); + $this->transaction_tag = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RequestOptions/Priority.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RequestOptions/Priority.php new file mode 100644 index 000000000000..b8d614f98da5 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RequestOptions/Priority.php @@ -0,0 +1,84 @@ +google.spanner.v1.RequestOptions.Priority + */ +class Priority +{ + /** + * `PRIORITY_UNSPECIFIED` is equivalent to `PRIORITY_HIGH`. + * + * Generated from protobuf enum PRIORITY_UNSPECIFIED = 0; + */ + const PRIORITY_UNSPECIFIED = 0; + /** + * This specifies that the request is low priority. + * + * Generated from protobuf enum PRIORITY_LOW = 1; + */ + const PRIORITY_LOW = 1; + /** + * This specifies that the request is medium priority. + * + * Generated from protobuf enum PRIORITY_MEDIUM = 2; + */ + const PRIORITY_MEDIUM = 2; + /** + * This specifies that the request is high priority. + * + * Generated from protobuf enum PRIORITY_HIGH = 3; + */ + const PRIORITY_HIGH = 3; + + private static $valueToName = [ + self::PRIORITY_UNSPECIFIED => 'PRIORITY_UNSPECIFIED', + self::PRIORITY_LOW => 'PRIORITY_LOW', + self::PRIORITY_MEDIUM => 'PRIORITY_MEDIUM', + self::PRIORITY_HIGH => 'PRIORITY_HIGH', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Priority::class, \Google\Cloud\Spanner\V1\RequestOptions_Priority::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSet.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSet.php new file mode 100644 index 000000000000..af4bbe1996f0 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSet.php @@ -0,0 +1,272 @@ +google.spanner.v1.ResultSet + */ +class ResultSet extends \Google\Protobuf\Internal\Message +{ + /** + * Metadata about the result set, such as row type information. + * + * Generated from protobuf field .google.spanner.v1.ResultSetMetadata metadata = 1; + */ + protected $metadata = null; + /** + * Each element in `rows` is a row whose format is defined by + * [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. The ith element + * in each row matches the ith field in + * [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. Elements are + * encoded based on type as described + * [here][google.spanner.v1.TypeCode]. + * + * Generated from protobuf field repeated .google.protobuf.ListValue rows = 2; + */ + private $rows; + /** + * Query plan and execution statistics for the SQL statement that + * produced this result set. These can be requested by setting + * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. + * DML statements always produce stats containing the number of rows + * modified, unless executed using the + * [ExecuteSqlRequest.QueryMode.PLAN][google.spanner.v1.ExecuteSqlRequest.QueryMode.PLAN] [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. + * Other fields may or may not be populated, based on the + * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. + * + * Generated from protobuf field .google.spanner.v1.ResultSetStats stats = 3; + */ + protected $stats = null; + /** + * Optional. A precommit token will be included if the read-write transaction + * is on a multiplexed session. + * The precommit token with the highest sequence number from this transaction + * attempt should be passed to the + * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $precommit_token = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\V1\ResultSetMetadata $metadata + * Metadata about the result set, such as row type information. + * @type array<\Google\Protobuf\ListValue>|\Google\Protobuf\Internal\RepeatedField $rows + * Each element in `rows` is a row whose format is defined by + * [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. The ith element + * in each row matches the ith field in + * [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. Elements are + * encoded based on type as described + * [here][google.spanner.v1.TypeCode]. + * @type \Google\Cloud\Spanner\V1\ResultSetStats $stats + * Query plan and execution statistics for the SQL statement that + * produced this result set. These can be requested by setting + * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. + * DML statements always produce stats containing the number of rows + * modified, unless executed using the + * [ExecuteSqlRequest.QueryMode.PLAN][google.spanner.v1.ExecuteSqlRequest.QueryMode.PLAN] [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. + * Other fields may or may not be populated, based on the + * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. + * @type \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $precommit_token + * Optional. A precommit token will be included if the read-write transaction + * is on a multiplexed session. + * The precommit token with the highest sequence number from this transaction + * attempt should be passed to the + * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\ResultSet::initOnce(); + parent::__construct($data); + } + + /** + * Metadata about the result set, such as row type information. + * + * Generated from protobuf field .google.spanner.v1.ResultSetMetadata metadata = 1; + * @return \Google\Cloud\Spanner\V1\ResultSetMetadata|null + */ + public function getMetadata() + { + return $this->metadata; + } + + public function hasMetadata() + { + return isset($this->metadata); + } + + public function clearMetadata() + { + unset($this->metadata); + } + + /** + * Metadata about the result set, such as row type information. + * + * Generated from protobuf field .google.spanner.v1.ResultSetMetadata metadata = 1; + * @param \Google\Cloud\Spanner\V1\ResultSetMetadata $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\ResultSetMetadata::class); + $this->metadata = $var; + + return $this; + } + + /** + * Each element in `rows` is a row whose format is defined by + * [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. The ith element + * in each row matches the ith field in + * [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. Elements are + * encoded based on type as described + * [here][google.spanner.v1.TypeCode]. + * + * Generated from protobuf field repeated .google.protobuf.ListValue rows = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRows() + { + return $this->rows; + } + + /** + * Each element in `rows` is a row whose format is defined by + * [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. The ith element + * in each row matches the ith field in + * [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. Elements are + * encoded based on type as described + * [here][google.spanner.v1.TypeCode]. + * + * Generated from protobuf field repeated .google.protobuf.ListValue rows = 2; + * @param array<\Google\Protobuf\ListValue>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\ListValue::class); + $this->rows = $arr; + + return $this; + } + + /** + * Query plan and execution statistics for the SQL statement that + * produced this result set. These can be requested by setting + * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. + * DML statements always produce stats containing the number of rows + * modified, unless executed using the + * [ExecuteSqlRequest.QueryMode.PLAN][google.spanner.v1.ExecuteSqlRequest.QueryMode.PLAN] [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. + * Other fields may or may not be populated, based on the + * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. + * + * Generated from protobuf field .google.spanner.v1.ResultSetStats stats = 3; + * @return \Google\Cloud\Spanner\V1\ResultSetStats|null + */ + public function getStats() + { + return $this->stats; + } + + public function hasStats() + { + return isset($this->stats); + } + + public function clearStats() + { + unset($this->stats); + } + + /** + * Query plan and execution statistics for the SQL statement that + * produced this result set. These can be requested by setting + * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. + * DML statements always produce stats containing the number of rows + * modified, unless executed using the + * [ExecuteSqlRequest.QueryMode.PLAN][google.spanner.v1.ExecuteSqlRequest.QueryMode.PLAN] [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. + * Other fields may or may not be populated, based on the + * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. + * + * Generated from protobuf field .google.spanner.v1.ResultSetStats stats = 3; + * @param \Google\Cloud\Spanner\V1\ResultSetStats $var + * @return $this + */ + public function setStats($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\ResultSetStats::class); + $this->stats = $var; + + return $this; + } + + /** + * Optional. A precommit token will be included if the read-write transaction + * is on a multiplexed session. + * The precommit token with the highest sequence number from this transaction + * attempt should be passed to the + * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken|null + */ + public function getPrecommitToken() + { + return $this->precommit_token; + } + + public function hasPrecommitToken() + { + return isset($this->precommit_token); + } + + public function clearPrecommitToken() + { + unset($this->precommit_token); + } + + /** + * Optional. A precommit token will be included if the read-write transaction + * is on a multiplexed session. + * The precommit token with the highest sequence number from this transaction + * attempt should be passed to the + * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $var + * @return $this + */ + public function setPrecommitToken($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken::class); + $this->precommit_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSetMetadata.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSetMetadata.php new file mode 100644 index 000000000000..fac10e18e680 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSetMetadata.php @@ -0,0 +1,225 @@ +google.spanner.v1.ResultSetMetadata + */ +class ResultSetMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Indicates the field names and types for the rows in the result + * set. For example, a SQL query like `"SELECT UserId, UserName FROM + * Users"` could return a `row_type` value like: + * "fields": [ + * { "name": "UserId", "type": { "code": "INT64" } }, + * { "name": "UserName", "type": { "code": "STRING" } }, + * ] + * + * Generated from protobuf field .google.spanner.v1.StructType row_type = 1; + */ + protected $row_type = null; + /** + * If the read or SQL query began a transaction as a side-effect, the + * information about the new transaction is yielded here. + * + * Generated from protobuf field .google.spanner.v1.Transaction transaction = 2; + */ + protected $transaction = null; + /** + * A SQL query can be parameterized. In PLAN mode, these parameters can be + * undeclared. This indicates the field names and types for those undeclared + * parameters in the SQL query. For example, a SQL query like `"SELECT * FROM + * Users where UserId = @userId and UserName = @userName "` could return a + * `undeclared_parameters` value like: + * "fields": [ + * { "name": "UserId", "type": { "code": "INT64" } }, + * { "name": "UserName", "type": { "code": "STRING" } }, + * ] + * + * Generated from protobuf field .google.spanner.v1.StructType undeclared_parameters = 3; + */ + protected $undeclared_parameters = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\V1\StructType $row_type + * Indicates the field names and types for the rows in the result + * set. For example, a SQL query like `"SELECT UserId, UserName FROM + * Users"` could return a `row_type` value like: + * "fields": [ + * { "name": "UserId", "type": { "code": "INT64" } }, + * { "name": "UserName", "type": { "code": "STRING" } }, + * ] + * @type \Google\Cloud\Spanner\V1\Transaction $transaction + * If the read or SQL query began a transaction as a side-effect, the + * information about the new transaction is yielded here. + * @type \Google\Cloud\Spanner\V1\StructType $undeclared_parameters + * A SQL query can be parameterized. In PLAN mode, these parameters can be + * undeclared. This indicates the field names and types for those undeclared + * parameters in the SQL query. For example, a SQL query like `"SELECT * FROM + * Users where UserId = @userId and UserName = @userName "` could return a + * `undeclared_parameters` value like: + * "fields": [ + * { "name": "UserId", "type": { "code": "INT64" } }, + * { "name": "UserName", "type": { "code": "STRING" } }, + * ] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\ResultSet::initOnce(); + parent::__construct($data); + } + + /** + * Indicates the field names and types for the rows in the result + * set. For example, a SQL query like `"SELECT UserId, UserName FROM + * Users"` could return a `row_type` value like: + * "fields": [ + * { "name": "UserId", "type": { "code": "INT64" } }, + * { "name": "UserName", "type": { "code": "STRING" } }, + * ] + * + * Generated from protobuf field .google.spanner.v1.StructType row_type = 1; + * @return \Google\Cloud\Spanner\V1\StructType|null + */ + public function getRowType() + { + return $this->row_type; + } + + public function hasRowType() + { + return isset($this->row_type); + } + + public function clearRowType() + { + unset($this->row_type); + } + + /** + * Indicates the field names and types for the rows in the result + * set. For example, a SQL query like `"SELECT UserId, UserName FROM + * Users"` could return a `row_type` value like: + * "fields": [ + * { "name": "UserId", "type": { "code": "INT64" } }, + * { "name": "UserName", "type": { "code": "STRING" } }, + * ] + * + * Generated from protobuf field .google.spanner.v1.StructType row_type = 1; + * @param \Google\Cloud\Spanner\V1\StructType $var + * @return $this + */ + public function setRowType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\StructType::class); + $this->row_type = $var; + + return $this; + } + + /** + * If the read or SQL query began a transaction as a side-effect, the + * information about the new transaction is yielded here. + * + * Generated from protobuf field .google.spanner.v1.Transaction transaction = 2; + * @return \Google\Cloud\Spanner\V1\Transaction|null + */ + public function getTransaction() + { + return $this->transaction; + } + + public function hasTransaction() + { + return isset($this->transaction); + } + + public function clearTransaction() + { + unset($this->transaction); + } + + /** + * If the read or SQL query began a transaction as a side-effect, the + * information about the new transaction is yielded here. + * + * Generated from protobuf field .google.spanner.v1.Transaction transaction = 2; + * @param \Google\Cloud\Spanner\V1\Transaction $var + * @return $this + */ + public function setTransaction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Transaction::class); + $this->transaction = $var; + + return $this; + } + + /** + * A SQL query can be parameterized. In PLAN mode, these parameters can be + * undeclared. This indicates the field names and types for those undeclared + * parameters in the SQL query. For example, a SQL query like `"SELECT * FROM + * Users where UserId = @userId and UserName = @userName "` could return a + * `undeclared_parameters` value like: + * "fields": [ + * { "name": "UserId", "type": { "code": "INT64" } }, + * { "name": "UserName", "type": { "code": "STRING" } }, + * ] + * + * Generated from protobuf field .google.spanner.v1.StructType undeclared_parameters = 3; + * @return \Google\Cloud\Spanner\V1\StructType|null + */ + public function getUndeclaredParameters() + { + return $this->undeclared_parameters; + } + + public function hasUndeclaredParameters() + { + return isset($this->undeclared_parameters); + } + + public function clearUndeclaredParameters() + { + unset($this->undeclared_parameters); + } + + /** + * A SQL query can be parameterized. In PLAN mode, these parameters can be + * undeclared. This indicates the field names and types for those undeclared + * parameters in the SQL query. For example, a SQL query like `"SELECT * FROM + * Users where UserId = @userId and UserName = @userName "` could return a + * `undeclared_parameters` value like: + * "fields": [ + * { "name": "UserId", "type": { "code": "INT64" } }, + * { "name": "UserName", "type": { "code": "STRING" } }, + * ] + * + * Generated from protobuf field .google.spanner.v1.StructType undeclared_parameters = 3; + * @param \Google\Cloud\Spanner\V1\StructType $var + * @return $this + */ + public function setUndeclaredParameters($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\StructType::class); + $this->undeclared_parameters = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSetStats.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSetStats.php new file mode 100644 index 000000000000..e39cc1952951 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSetStats.php @@ -0,0 +1,227 @@ +google.spanner.v1.ResultSetStats + */ +class ResultSetStats extends \Google\Protobuf\Internal\Message +{ + /** + * [QueryPlan][google.spanner.v1.QueryPlan] for the query associated with this result. + * + * Generated from protobuf field .google.spanner.v1.QueryPlan query_plan = 1; + */ + protected $query_plan = null; + /** + * Aggregated statistics from the execution of the query. Only present when + * the query is profiled. For example, a query could return the statistics as + * follows: + * { + * "rows_returned": "3", + * "elapsed_time": "1.22 secs", + * "cpu_time": "1.19 secs" + * } + * + * Generated from protobuf field .google.protobuf.Struct query_stats = 2; + */ + protected $query_stats = null; + protected $row_count; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\V1\QueryPlan $query_plan + * [QueryPlan][google.spanner.v1.QueryPlan] for the query associated with this result. + * @type \Google\Protobuf\Struct $query_stats + * Aggregated statistics from the execution of the query. Only present when + * the query is profiled. For example, a query could return the statistics as + * follows: + * { + * "rows_returned": "3", + * "elapsed_time": "1.22 secs", + * "cpu_time": "1.19 secs" + * } + * @type int|string $row_count_exact + * Standard DML returns an exact count of rows that were modified. + * @type int|string $row_count_lower_bound + * Partitioned DML does not offer exactly-once semantics, so it + * returns a lower bound of the rows modified. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\ResultSet::initOnce(); + parent::__construct($data); + } + + /** + * [QueryPlan][google.spanner.v1.QueryPlan] for the query associated with this result. + * + * Generated from protobuf field .google.spanner.v1.QueryPlan query_plan = 1; + * @return \Google\Cloud\Spanner\V1\QueryPlan|null + */ + public function getQueryPlan() + { + return $this->query_plan; + } + + public function hasQueryPlan() + { + return isset($this->query_plan); + } + + public function clearQueryPlan() + { + unset($this->query_plan); + } + + /** + * [QueryPlan][google.spanner.v1.QueryPlan] for the query associated with this result. + * + * Generated from protobuf field .google.spanner.v1.QueryPlan query_plan = 1; + * @param \Google\Cloud\Spanner\V1\QueryPlan $var + * @return $this + */ + public function setQueryPlan($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\QueryPlan::class); + $this->query_plan = $var; + + return $this; + } + + /** + * Aggregated statistics from the execution of the query. Only present when + * the query is profiled. For example, a query could return the statistics as + * follows: + * { + * "rows_returned": "3", + * "elapsed_time": "1.22 secs", + * "cpu_time": "1.19 secs" + * } + * + * Generated from protobuf field .google.protobuf.Struct query_stats = 2; + * @return \Google\Protobuf\Struct|null + */ + public function getQueryStats() + { + return $this->query_stats; + } + + public function hasQueryStats() + { + return isset($this->query_stats); + } + + public function clearQueryStats() + { + unset($this->query_stats); + } + + /** + * Aggregated statistics from the execution of the query. Only present when + * the query is profiled. For example, a query could return the statistics as + * follows: + * { + * "rows_returned": "3", + * "elapsed_time": "1.22 secs", + * "cpu_time": "1.19 secs" + * } + * + * Generated from protobuf field .google.protobuf.Struct query_stats = 2; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setQueryStats($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->query_stats = $var; + + return $this; + } + + /** + * Standard DML returns an exact count of rows that were modified. + * + * Generated from protobuf field int64 row_count_exact = 3; + * @return int|string + */ + public function getRowCountExact() + { + return $this->readOneof(3); + } + + public function hasRowCountExact() + { + return $this->hasOneof(3); + } + + /** + * Standard DML returns an exact count of rows that were modified. + * + * Generated from protobuf field int64 row_count_exact = 3; + * @param int|string $var + * @return $this + */ + public function setRowCountExact($var) + { + GPBUtil::checkInt64($var); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Partitioned DML does not offer exactly-once semantics, so it + * returns a lower bound of the rows modified. + * + * Generated from protobuf field int64 row_count_lower_bound = 4; + * @return int|string + */ + public function getRowCountLowerBound() + { + return $this->readOneof(4); + } + + public function hasRowCountLowerBound() + { + return $this->hasOneof(4); + } + + /** + * Partitioned DML does not offer exactly-once semantics, so it + * returns a lower bound of the rows modified. + * + * Generated from protobuf field int64 row_count_lower_bound = 4; + * @param int|string $var + * @return $this + */ + public function setRowCountLowerBound($var) + { + GPBUtil::checkInt64($var); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * @return string + */ + public function getRowCount() + { + return $this->whichOneof("row_count"); + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RollbackRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RollbackRequest.php new file mode 100644 index 000000000000..23129ad2e295 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RollbackRequest.php @@ -0,0 +1,117 @@ +google.spanner.v1.RollbackRequest + */ +class RollbackRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The session in which the transaction to roll back is running. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $session = ''; + /** + * Required. The transaction to roll back. + * + * Generated from protobuf field bytes transaction_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $transaction_id = ''; + + /** + * @param string $session Required. The session in which the transaction to roll back is running. Please see + * {@see SpannerClient::sessionName()} for help formatting this field. + * @param string $transactionId Required. The transaction to roll back. + * + * @return \Google\Cloud\Spanner\V1\RollbackRequest + * + * @experimental + */ + public static function build(string $session, string $transactionId): self + { + return (new self()) + ->setSession($session) + ->setTransactionId($transactionId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $session + * Required. The session in which the transaction to roll back is running. + * @type string $transaction_id + * Required. The transaction to roll back. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Required. The session in which the transaction to roll back is running. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSession() + { + return $this->session; + } + + /** + * Required. The session in which the transaction to roll back is running. + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSession($var) + { + GPBUtil::checkString($var, True); + $this->session = $var; + + return $this; + } + + /** + * Required. The transaction to roll back. + * + * Generated from protobuf field bytes transaction_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTransactionId() + { + return $this->transaction_id; + } + + /** + * Required. The transaction to roll back. + * + * Generated from protobuf field bytes transaction_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTransactionId($var) + { + GPBUtil::checkString($var, False); + $this->transaction_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Session.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Session.php new file mode 100644 index 000000000000..772272bb851a --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Session.php @@ -0,0 +1,309 @@ +google.spanner.v1.Session + */ +class Session extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the session. This is always system-assigned. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * The labels for the session. + * * Label keys must be between 1 and 63 characters long and must conform to + * the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. + * * Label values must be between 0 and 63 characters long and must conform + * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. + * * No more than 64 labels can be associated with a given session. + * See https://goo.gl/xmQnxf for more information on and examples of labels. + * + * Generated from protobuf field map labels = 2; + */ + private $labels; + /** + * Output only. The timestamp when the session is created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The approximate timestamp when the session is last used. It is + * typically earlier than the actual last use time. + * + * Generated from protobuf field .google.protobuf.Timestamp approximate_last_use_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $approximate_last_use_time = null; + /** + * The database role which created this session. + * + * Generated from protobuf field string creator_role = 5; + */ + protected $creator_role = ''; + /** + * Optional. If true, specifies a multiplexed session. A multiplexed session + * may be used for multiple, concurrent read-only operations but can not be + * used for read-write transactions, partitioned reads, or partitioned + * queries. Multiplexed sessions can be created via + * [CreateSession][google.spanner.v1.Spanner.CreateSession] but not via + * [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions]. + * Multiplexed sessions may not be deleted nor listed. + * + * Generated from protobuf field bool multiplexed = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $multiplexed = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The name of the session. This is always system-assigned. + * @type array|\Google\Protobuf\Internal\MapField $labels + * The labels for the session. + * * Label keys must be between 1 and 63 characters long and must conform to + * the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. + * * Label values must be between 0 and 63 characters long and must conform + * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. + * * No more than 64 labels can be associated with a given session. + * See https://goo.gl/xmQnxf for more information on and examples of labels. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp when the session is created. + * @type \Google\Protobuf\Timestamp $approximate_last_use_time + * Output only. The approximate timestamp when the session is last used. It is + * typically earlier than the actual last use time. + * @type string $creator_role + * The database role which created this session. + * @type bool $multiplexed + * Optional. If true, specifies a multiplexed session. A multiplexed session + * may be used for multiple, concurrent read-only operations but can not be + * used for read-write transactions, partitioned reads, or partitioned + * queries. Multiplexed sessions can be created via + * [CreateSession][google.spanner.v1.Spanner.CreateSession] but not via + * [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions]. + * Multiplexed sessions may not be deleted nor listed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the session. This is always system-assigned. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The name of the session. This is always system-assigned. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The labels for the session. + * * Label keys must be between 1 and 63 characters long and must conform to + * the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. + * * Label values must be between 0 and 63 characters long and must conform + * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. + * * No more than 64 labels can be associated with a given session. + * See https://goo.gl/xmQnxf for more information on and examples of labels. + * + * Generated from protobuf field map labels = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * The labels for the session. + * * Label keys must be between 1 and 63 characters long and must conform to + * the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. + * * Label values must be between 0 and 63 characters long and must conform + * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. + * * No more than 64 labels can be associated with a given session. + * See https://goo.gl/xmQnxf for more information on and examples of labels. + * + * Generated from protobuf field map labels = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Output only. The timestamp when the session is created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The timestamp when the session is created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The approximate timestamp when the session is last used. It is + * typically earlier than the actual last use time. + * + * Generated from protobuf field .google.protobuf.Timestamp approximate_last_use_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getApproximateLastUseTime() + { + return $this->approximate_last_use_time; + } + + public function hasApproximateLastUseTime() + { + return isset($this->approximate_last_use_time); + } + + public function clearApproximateLastUseTime() + { + unset($this->approximate_last_use_time); + } + + /** + * Output only. The approximate timestamp when the session is last used. It is + * typically earlier than the actual last use time. + * + * Generated from protobuf field .google.protobuf.Timestamp approximate_last_use_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setApproximateLastUseTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->approximate_last_use_time = $var; + + return $this; + } + + /** + * The database role which created this session. + * + * Generated from protobuf field string creator_role = 5; + * @return string + */ + public function getCreatorRole() + { + return $this->creator_role; + } + + /** + * The database role which created this session. + * + * Generated from protobuf field string creator_role = 5; + * @param string $var + * @return $this + */ + public function setCreatorRole($var) + { + GPBUtil::checkString($var, True); + $this->creator_role = $var; + + return $this; + } + + /** + * Optional. If true, specifies a multiplexed session. A multiplexed session + * may be used for multiple, concurrent read-only operations but can not be + * used for read-write transactions, partitioned reads, or partitioned + * queries. Multiplexed sessions can be created via + * [CreateSession][google.spanner.v1.Spanner.CreateSession] but not via + * [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions]. + * Multiplexed sessions may not be deleted nor listed. + * + * Generated from protobuf field bool multiplexed = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getMultiplexed() + { + return $this->multiplexed; + } + + /** + * Optional. If true, specifies a multiplexed session. A multiplexed session + * may be used for multiple, concurrent read-only operations but can not be + * used for read-write transactions, partitioned reads, or partitioned + * queries. Multiplexed sessions can be created via + * [CreateSession][google.spanner.v1.Spanner.CreateSession] but not via + * [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions]. + * Multiplexed sessions may not be deleted nor listed. + * + * Generated from protobuf field bool multiplexed = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setMultiplexed($var) + { + GPBUtil::checkBool($var); + $this->multiplexed = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/StructType.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/StructType.php new file mode 100644 index 000000000000..a67da0c0d598 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/StructType.php @@ -0,0 +1,88 @@ +google.spanner.v1.StructType + */ +class StructType extends \Google\Protobuf\Internal\Message +{ + /** + * The list of fields that make up this struct. Order is + * significant, because values of this struct type are represented as + * lists, where the order of field values matches the order of + * fields in the [StructType][google.spanner.v1.StructType]. In turn, the + * order of fields matches the order of columns in a read request, or the + * order of fields in the `SELECT` clause of a query. + * + * Generated from protobuf field repeated .google.spanner.v1.StructType.Field fields = 1; + */ + private $fields; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Spanner\V1\StructType\Field>|\Google\Protobuf\Internal\RepeatedField $fields + * The list of fields that make up this struct. Order is + * significant, because values of this struct type are represented as + * lists, where the order of field values matches the order of + * fields in the [StructType][google.spanner.v1.StructType]. In turn, the + * order of fields matches the order of columns in a read request, or the + * order of fields in the `SELECT` clause of a query. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Type::initOnce(); + parent::__construct($data); + } + + /** + * The list of fields that make up this struct. Order is + * significant, because values of this struct type are represented as + * lists, where the order of field values matches the order of + * fields in the [StructType][google.spanner.v1.StructType]. In turn, the + * order of fields matches the order of columns in a read request, or the + * order of fields in the `SELECT` clause of a query. + * + * Generated from protobuf field repeated .google.spanner.v1.StructType.Field fields = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFields() + { + return $this->fields; + } + + /** + * The list of fields that make up this struct. Order is + * significant, because values of this struct type are represented as + * lists, where the order of field values matches the order of + * fields in the [StructType][google.spanner.v1.StructType]. In turn, the + * order of fields matches the order of columns in a read request, or the + * order of fields in the `SELECT` clause of a query. + * + * Generated from protobuf field repeated .google.spanner.v1.StructType.Field fields = 1; + * @param array<\Google\Cloud\Spanner\V1\StructType\Field>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFields($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\StructType\Field::class); + $this->fields = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/StructType/Field.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/StructType/Field.php new file mode 100644 index 000000000000..d14de6cea1b3 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/StructType/Field.php @@ -0,0 +1,138 @@ +google.spanner.v1.StructType.Field + */ +class Field extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the field. For reads, this is the column name. For + * SQL queries, it is the column alias (e.g., `"Word"` in the + * query `"SELECT 'hello' AS Word"`), or the column name (e.g., + * `"ColName"` in the query `"SELECT ColName FROM Table"`). Some + * columns might have an empty name (e.g., `"SELECT + * UPPER(ColName)"`). Note that a query result can contain + * multiple fields with the same name. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The type of the field. + * + * Generated from protobuf field .google.spanner.v1.Type type = 2; + */ + protected $type = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the field. For reads, this is the column name. For + * SQL queries, it is the column alias (e.g., `"Word"` in the + * query `"SELECT 'hello' AS Word"`), or the column name (e.g., + * `"ColName"` in the query `"SELECT ColName FROM Table"`). Some + * columns might have an empty name (e.g., `"SELECT + * UPPER(ColName)"`). Note that a query result can contain + * multiple fields with the same name. + * @type \Google\Cloud\Spanner\V1\Type $type + * The type of the field. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Type::initOnce(); + parent::__construct($data); + } + + /** + * The name of the field. For reads, this is the column name. For + * SQL queries, it is the column alias (e.g., `"Word"` in the + * query `"SELECT 'hello' AS Word"`), or the column name (e.g., + * `"ColName"` in the query `"SELECT ColName FROM Table"`). Some + * columns might have an empty name (e.g., `"SELECT + * UPPER(ColName)"`). Note that a query result can contain + * multiple fields with the same name. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the field. For reads, this is the column name. For + * SQL queries, it is the column alias (e.g., `"Word"` in the + * query `"SELECT 'hello' AS Word"`), or the column name (e.g., + * `"ColName"` in the query `"SELECT ColName FROM Table"`). Some + * columns might have an empty name (e.g., `"SELECT + * UPPER(ColName)"`). Note that a query result can contain + * multiple fields with the same name. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The type of the field. + * + * Generated from protobuf field .google.spanner.v1.Type type = 2; + * @return \Google\Cloud\Spanner\V1\Type|null + */ + public function getType() + { + return $this->type; + } + + public function hasType() + { + return isset($this->type); + } + + public function clearType() + { + unset($this->type); + } + + /** + * The type of the field. + * + * Generated from protobuf field .google.spanner.v1.Type type = 2; + * @param \Google\Cloud\Spanner\V1\Type $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Type::class); + $this->type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Field::class, \Google\Cloud\Spanner\V1\StructType_Field::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Transaction.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Transaction.php new file mode 100644 index 000000000000..6bed7fe90d30 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Transaction.php @@ -0,0 +1,227 @@ +google.spanner.v1.Transaction + */ +class Transaction extends \Google\Protobuf\Internal\Message +{ + /** + * `id` may be used to identify the transaction in subsequent + * [Read][google.spanner.v1.Spanner.Read], + * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], + * [Commit][google.spanner.v1.Spanner.Commit], or + * [Rollback][google.spanner.v1.Spanner.Rollback] calls. + * Single-use read-only transactions do not have IDs, because + * single-use transactions do not support multiple requests. + * + * Generated from protobuf field bytes id = 1; + */ + protected $id = ''; + /** + * For snapshot read-only transactions, the read timestamp chosen + * for the transaction. Not returned by default: see + * [TransactionOptions.ReadOnly.return_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.return_read_timestamp]. + * A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. + * Example: `"2014-10-02T15:01:23.045123456Z"`. + * + * Generated from protobuf field .google.protobuf.Timestamp read_timestamp = 2; + */ + protected $read_timestamp = null; + /** + * A precommit token will be included in the response of a BeginTransaction + * request if the read-write transaction is on a multiplexed session and + * a mutation_key was specified in the + * [BeginTransaction][google.spanner.v1.BeginTransactionRequest]. + * The precommit token with the highest sequence number from this transaction + * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit] + * request for this transaction. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + */ + protected $precommit_token = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * `id` may be used to identify the transaction in subsequent + * [Read][google.spanner.v1.Spanner.Read], + * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], + * [Commit][google.spanner.v1.Spanner.Commit], or + * [Rollback][google.spanner.v1.Spanner.Rollback] calls. + * Single-use read-only transactions do not have IDs, because + * single-use transactions do not support multiple requests. + * @type \Google\Protobuf\Timestamp $read_timestamp + * For snapshot read-only transactions, the read timestamp chosen + * for the transaction. Not returned by default: see + * [TransactionOptions.ReadOnly.return_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.return_read_timestamp]. + * A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. + * Example: `"2014-10-02T15:01:23.045123456Z"`. + * @type \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $precommit_token + * A precommit token will be included in the response of a BeginTransaction + * request if the read-write transaction is on a multiplexed session and + * a mutation_key was specified in the + * [BeginTransaction][google.spanner.v1.BeginTransactionRequest]. + * The precommit token with the highest sequence number from this transaction + * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit] + * request for this transaction. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Transaction::initOnce(); + parent::__construct($data); + } + + /** + * `id` may be used to identify the transaction in subsequent + * [Read][google.spanner.v1.Spanner.Read], + * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], + * [Commit][google.spanner.v1.Spanner.Commit], or + * [Rollback][google.spanner.v1.Spanner.Rollback] calls. + * Single-use read-only transactions do not have IDs, because + * single-use transactions do not support multiple requests. + * + * Generated from protobuf field bytes id = 1; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * `id` may be used to identify the transaction in subsequent + * [Read][google.spanner.v1.Spanner.Read], + * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], + * [Commit][google.spanner.v1.Spanner.Commit], or + * [Rollback][google.spanner.v1.Spanner.Rollback] calls. + * Single-use read-only transactions do not have IDs, because + * single-use transactions do not support multiple requests. + * + * Generated from protobuf field bytes id = 1; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, False); + $this->id = $var; + + return $this; + } + + /** + * For snapshot read-only transactions, the read timestamp chosen + * for the transaction. Not returned by default: see + * [TransactionOptions.ReadOnly.return_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.return_read_timestamp]. + * A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. + * Example: `"2014-10-02T15:01:23.045123456Z"`. + * + * Generated from protobuf field .google.protobuf.Timestamp read_timestamp = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getReadTimestamp() + { + return $this->read_timestamp; + } + + public function hasReadTimestamp() + { + return isset($this->read_timestamp); + } + + public function clearReadTimestamp() + { + unset($this->read_timestamp); + } + + /** + * For snapshot read-only transactions, the read timestamp chosen + * for the transaction. Not returned by default: see + * [TransactionOptions.ReadOnly.return_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.return_read_timestamp]. + * A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. + * Example: `"2014-10-02T15:01:23.045123456Z"`. + * + * Generated from protobuf field .google.protobuf.Timestamp read_timestamp = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setReadTimestamp($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->read_timestamp = $var; + + return $this; + } + + /** + * A precommit token will be included in the response of a BeginTransaction + * request if the read-write transaction is on a multiplexed session and + * a mutation_key was specified in the + * [BeginTransaction][google.spanner.v1.BeginTransactionRequest]. + * The precommit token with the highest sequence number from this transaction + * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit] + * request for this transaction. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + * @return \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken|null + */ + public function getPrecommitToken() + { + return $this->precommit_token; + } + + public function hasPrecommitToken() + { + return isset($this->precommit_token); + } + + public function clearPrecommitToken() + { + unset($this->precommit_token); + } + + /** + * A precommit token will be included in the response of a BeginTransaction + * request if the read-write transaction is on a multiplexed session and + * a mutation_key was specified in the + * [BeginTransaction][google.spanner.v1.BeginTransactionRequest]. + * The precommit token with the highest sequence number from this transaction + * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit] + * request for this transaction. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + * @param \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $var + * @return $this + */ + public function setPrecommitToken($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken::class); + $this->precommit_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions.php new file mode 100644 index 000000000000..d72a12452c2e --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions.php @@ -0,0 +1,504 @@ +. + * All queries on change stream TVFs must be executed using the + * ExecuteStreamingSql API with a single-use read-only transaction with a + * strong read-only timestamp_bound. The change stream TVF allows users to + * specify the start_timestamp and end_timestamp for the time range of + * interest. All change records within the retention period is accessible + * using the strong read-only timestamp_bound. All other TransactionOptions + * are invalid for change stream queries. + * In addition, if TransactionOptions.read_only.return_read_timestamp is set + * to true, a special value of 2^63 - 2 will be returned in the + * [Transaction][google.spanner.v1.Transaction] message that describes the + * transaction, instead of a valid read timestamp. This special value should be + * discarded and not used for any subsequent queries. + * Please see https://cloud.google.com/spanner/docs/change-streams + * for more details on how to query the change stream TVFs. + * Partitioned DML transactions: + * Partitioned DML transactions are used to execute DML statements with a + * different execution strategy that provides different, and often better, + * scalability properties for large, table-wide operations than DML in a + * ReadWrite transaction. Smaller scoped statements, such as an OLTP workload, + * should prefer using ReadWrite transactions. + * Partitioned DML partitions the keyspace and runs the DML statement on each + * partition in separate, internal transactions. These transactions commit + * automatically when complete, and run independently from one another. + * To reduce lock contention, this execution strategy only acquires read locks + * on rows that match the WHERE clause of the statement. Additionally, the + * smaller per-partition transactions hold locks for less time. + * That said, Partitioned DML is not a drop-in replacement for standard DML used + * in ReadWrite transactions. + * - The DML statement must be fully-partitionable. Specifically, the statement + * must be expressible as the union of many statements which each access only + * a single row of the table. + * - The statement is not applied atomically to all rows of the table. Rather, + * the statement is applied atomically to partitions of the table, in + * independent transactions. Secondary index rows are updated atomically + * with the base table rows. + * - Partitioned DML does not guarantee exactly-once execution semantics + * against a partition. The statement will be applied at least once to each + * partition. It is strongly recommended that the DML statement should be + * idempotent to avoid unexpected results. For instance, it is potentially + * dangerous to run a statement such as + * `UPDATE table SET column = column + 1` as it could be run multiple times + * against some rows. + * - The partitions are committed automatically - there is no support for + * Commit or Rollback. If the call returns an error, or if the client issuing + * the ExecuteSql call dies, it is possible that some rows had the statement + * executed on them successfully. It is also possible that statement was + * never executed against other rows. + * - Partitioned DML transactions may only contain the execution of a single + * DML statement via ExecuteSql or ExecuteStreamingSql. + * - If any error is encountered during the execution of the partitioned DML + * operation (for instance, a UNIQUE INDEX violation, division by zero, or a + * value that cannot be stored due to schema constraints), then the + * operation is stopped at that point and an error is returned. It is + * possible that at this point, some partitions have been committed (or even + * committed multiple times), and other partitions have not been run at all. + * Given the above, Partitioned DML is good fit for large, database-wide, + * operations that are idempotent, such as deleting old rows from a very large + * table. + * + * Generated from protobuf message google.spanner.v1.TransactionOptions + */ +class TransactionOptions extends \Google\Protobuf\Internal\Message +{ + /** + * When `exclude_txn_from_change_streams` is set to `true`: + * * Mutations from this transaction will not be recorded in change streams + * with DDL option `allow_txn_exclusion=true` that are tracking columns + * modified by these transactions. + * * Mutations from this transaction will be recorded in change streams with + * DDL option `allow_txn_exclusion=false or not set` that are tracking + * columns modified by these transactions. + * When `exclude_txn_from_change_streams` is set to `false` or not set, + * mutations from this transaction will be recorded in all change streams that + * are tracking columns modified by these transactions. + * `exclude_txn_from_change_streams` may only be specified for read-write or + * partitioned-dml transactions, otherwise the API will return an + * `INVALID_ARGUMENT` error. + * + * Generated from protobuf field bool exclude_txn_from_change_streams = 5; + */ + protected $exclude_txn_from_change_streams = false; + protected $mode; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\V1\TransactionOptions\ReadWrite $read_write + * Transaction may write. + * Authorization to begin a read-write transaction requires + * `spanner.databases.beginOrRollbackReadWriteTransaction` permission + * on the `session` resource. + * @type \Google\Cloud\Spanner\V1\TransactionOptions\PartitionedDml $partitioned_dml + * Partitioned DML transaction. + * Authorization to begin a Partitioned DML transaction requires + * `spanner.databases.beginPartitionedDmlTransaction` permission + * on the `session` resource. + * @type \Google\Cloud\Spanner\V1\TransactionOptions\PBReadOnly $read_only + * Transaction will not write. + * Authorization to begin a read-only transaction requires + * `spanner.databases.beginReadOnlyTransaction` permission + * on the `session` resource. + * @type bool $exclude_txn_from_change_streams + * When `exclude_txn_from_change_streams` is set to `true`: + * * Mutations from this transaction will not be recorded in change streams + * with DDL option `allow_txn_exclusion=true` that are tracking columns + * modified by these transactions. + * * Mutations from this transaction will be recorded in change streams with + * DDL option `allow_txn_exclusion=false or not set` that are tracking + * columns modified by these transactions. + * When `exclude_txn_from_change_streams` is set to `false` or not set, + * mutations from this transaction will be recorded in all change streams that + * are tracking columns modified by these transactions. + * `exclude_txn_from_change_streams` may only be specified for read-write or + * partitioned-dml transactions, otherwise the API will return an + * `INVALID_ARGUMENT` error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Transaction::initOnce(); + parent::__construct($data); + } + + /** + * Transaction may write. + * Authorization to begin a read-write transaction requires + * `spanner.databases.beginOrRollbackReadWriteTransaction` permission + * on the `session` resource. + * + * Generated from protobuf field .google.spanner.v1.TransactionOptions.ReadWrite read_write = 1; + * @return \Google\Cloud\Spanner\V1\TransactionOptions\ReadWrite|null + */ + public function getReadWrite() + { + return $this->readOneof(1); + } + + public function hasReadWrite() + { + return $this->hasOneof(1); + } + + /** + * Transaction may write. + * Authorization to begin a read-write transaction requires + * `spanner.databases.beginOrRollbackReadWriteTransaction` permission + * on the `session` resource. + * + * Generated from protobuf field .google.spanner.v1.TransactionOptions.ReadWrite read_write = 1; + * @param \Google\Cloud\Spanner\V1\TransactionOptions\ReadWrite $var + * @return $this + */ + public function setReadWrite($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionOptions\ReadWrite::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Partitioned DML transaction. + * Authorization to begin a Partitioned DML transaction requires + * `spanner.databases.beginPartitionedDmlTransaction` permission + * on the `session` resource. + * + * Generated from protobuf field .google.spanner.v1.TransactionOptions.PartitionedDml partitioned_dml = 3; + * @return \Google\Cloud\Spanner\V1\TransactionOptions\PartitionedDml|null + */ + public function getPartitionedDml() + { + return $this->readOneof(3); + } + + public function hasPartitionedDml() + { + return $this->hasOneof(3); + } + + /** + * Partitioned DML transaction. + * Authorization to begin a Partitioned DML transaction requires + * `spanner.databases.beginPartitionedDmlTransaction` permission + * on the `session` resource. + * + * Generated from protobuf field .google.spanner.v1.TransactionOptions.PartitionedDml partitioned_dml = 3; + * @param \Google\Cloud\Spanner\V1\TransactionOptions\PartitionedDml $var + * @return $this + */ + public function setPartitionedDml($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionOptions\PartitionedDml::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Transaction will not write. + * Authorization to begin a read-only transaction requires + * `spanner.databases.beginReadOnlyTransaction` permission + * on the `session` resource. + * + * Generated from protobuf field .google.spanner.v1.TransactionOptions.ReadOnly read_only = 2; + * @return \Google\Cloud\Spanner\V1\TransactionOptions\PBReadOnly|null + */ + public function getReadOnly() + { + return $this->readOneof(2); + } + + public function hasReadOnly() + { + return $this->hasOneof(2); + } + + /** + * Transaction will not write. + * Authorization to begin a read-only transaction requires + * `spanner.databases.beginReadOnlyTransaction` permission + * on the `session` resource. + * + * Generated from protobuf field .google.spanner.v1.TransactionOptions.ReadOnly read_only = 2; + * @param \Google\Cloud\Spanner\V1\TransactionOptions\PBReadOnly $var + * @return $this + */ + public function setReadOnly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionOptions\PBReadOnly::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * When `exclude_txn_from_change_streams` is set to `true`: + * * Mutations from this transaction will not be recorded in change streams + * with DDL option `allow_txn_exclusion=true` that are tracking columns + * modified by these transactions. + * * Mutations from this transaction will be recorded in change streams with + * DDL option `allow_txn_exclusion=false or not set` that are tracking + * columns modified by these transactions. + * When `exclude_txn_from_change_streams` is set to `false` or not set, + * mutations from this transaction will be recorded in all change streams that + * are tracking columns modified by these transactions. + * `exclude_txn_from_change_streams` may only be specified for read-write or + * partitioned-dml transactions, otherwise the API will return an + * `INVALID_ARGUMENT` error. + * + * Generated from protobuf field bool exclude_txn_from_change_streams = 5; + * @return bool + */ + public function getExcludeTxnFromChangeStreams() + { + return $this->exclude_txn_from_change_streams; + } + + /** + * When `exclude_txn_from_change_streams` is set to `true`: + * * Mutations from this transaction will not be recorded in change streams + * with DDL option `allow_txn_exclusion=true` that are tracking columns + * modified by these transactions. + * * Mutations from this transaction will be recorded in change streams with + * DDL option `allow_txn_exclusion=false or not set` that are tracking + * columns modified by these transactions. + * When `exclude_txn_from_change_streams` is set to `false` or not set, + * mutations from this transaction will be recorded in all change streams that + * are tracking columns modified by these transactions. + * `exclude_txn_from_change_streams` may only be specified for read-write or + * partitioned-dml transactions, otherwise the API will return an + * `INVALID_ARGUMENT` error. + * + * Generated from protobuf field bool exclude_txn_from_change_streams = 5; + * @param bool $var + * @return $this + */ + public function setExcludeTxnFromChangeStreams($var) + { + GPBUtil::checkBool($var); + $this->exclude_txn_from_change_streams = $var; + + return $this; + } + + /** + * @return string + */ + public function getMode() + { + return $this->whichOneof("mode"); + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/PBReadOnly.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/PBReadOnly.php new file mode 100644 index 000000000000..114fed83d6e2 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/PBReadOnly.php @@ -0,0 +1,357 @@ +google.spanner.v1.TransactionOptions.ReadOnly + */ +class PBReadOnly extends \Google\Protobuf\Internal\Message +{ + /** + * If true, the Cloud Spanner-selected read timestamp is included in + * the [Transaction][google.spanner.v1.Transaction] message that describes + * the transaction. + * + * Generated from protobuf field bool return_read_timestamp = 6; + */ + protected $return_read_timestamp = false; + protected $timestamp_bound; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $strong + * Read at a timestamp where all previously committed transactions + * are visible. + * @type \Google\Protobuf\Timestamp $min_read_timestamp + * Executes all reads at a timestamp >= `min_read_timestamp`. + * This is useful for requesting fresher data than some previous + * read, or data that is fresh enough to observe the effects of some + * previously committed transaction whose timestamp is known. + * Note that this option can only be used in single-use transactions. + * A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. + * Example: `"2014-10-02T15:01:23.045123456Z"`. + * @type \Google\Protobuf\Duration $max_staleness + * Read data at a timestamp >= `NOW - max_staleness` + * seconds. Guarantees that all writes that have committed more + * than the specified number of seconds ago are visible. Because + * Cloud Spanner chooses the exact timestamp, this mode works even if + * the client's local clock is substantially skewed from Cloud Spanner + * commit timestamps. + * Useful for reading the freshest data available at a nearby + * replica, while bounding the possible staleness if the local + * replica has fallen behind. + * Note that this option can only be used in single-use + * transactions. + * @type \Google\Protobuf\Timestamp $read_timestamp + * Executes all reads at the given timestamp. Unlike other modes, + * reads at a specific timestamp are repeatable; the same read at + * the same timestamp always returns the same data. If the + * timestamp is in the future, the read will block until the + * specified timestamp, modulo the read's deadline. + * Useful for large scale consistent reads such as mapreduces, or + * for coordinating many reads against a consistent snapshot of the + * data. + * A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. + * Example: `"2014-10-02T15:01:23.045123456Z"`. + * @type \Google\Protobuf\Duration $exact_staleness + * Executes all reads at a timestamp that is `exact_staleness` + * old. The timestamp is chosen soon after the read is started. + * Guarantees that all writes that have committed more than the + * specified number of seconds ago are visible. Because Cloud Spanner + * chooses the exact timestamp, this mode works even if the client's + * local clock is substantially skewed from Cloud Spanner commit + * timestamps. + * Useful for reading at nearby replicas without the distributed + * timestamp negotiation overhead of `max_staleness`. + * @type bool $return_read_timestamp + * If true, the Cloud Spanner-selected read timestamp is included in + * the [Transaction][google.spanner.v1.Transaction] message that describes + * the transaction. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Transaction::initOnce(); + parent::__construct($data); + } + + /** + * Read at a timestamp where all previously committed transactions + * are visible. + * + * Generated from protobuf field bool strong = 1; + * @return bool + */ + public function getStrong() + { + return $this->readOneof(1); + } + + public function hasStrong() + { + return $this->hasOneof(1); + } + + /** + * Read at a timestamp where all previously committed transactions + * are visible. + * + * Generated from protobuf field bool strong = 1; + * @param bool $var + * @return $this + */ + public function setStrong($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Executes all reads at a timestamp >= `min_read_timestamp`. + * This is useful for requesting fresher data than some previous + * read, or data that is fresh enough to observe the effects of some + * previously committed transaction whose timestamp is known. + * Note that this option can only be used in single-use transactions. + * A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. + * Example: `"2014-10-02T15:01:23.045123456Z"`. + * + * Generated from protobuf field .google.protobuf.Timestamp min_read_timestamp = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getMinReadTimestamp() + { + return $this->readOneof(2); + } + + public function hasMinReadTimestamp() + { + return $this->hasOneof(2); + } + + /** + * Executes all reads at a timestamp >= `min_read_timestamp`. + * This is useful for requesting fresher data than some previous + * read, or data that is fresh enough to observe the effects of some + * previously committed transaction whose timestamp is known. + * Note that this option can only be used in single-use transactions. + * A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. + * Example: `"2014-10-02T15:01:23.045123456Z"`. + * + * Generated from protobuf field .google.protobuf.Timestamp min_read_timestamp = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setMinReadTimestamp($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Read data at a timestamp >= `NOW - max_staleness` + * seconds. Guarantees that all writes that have committed more + * than the specified number of seconds ago are visible. Because + * Cloud Spanner chooses the exact timestamp, this mode works even if + * the client's local clock is substantially skewed from Cloud Spanner + * commit timestamps. + * Useful for reading the freshest data available at a nearby + * replica, while bounding the possible staleness if the local + * replica has fallen behind. + * Note that this option can only be used in single-use + * transactions. + * + * Generated from protobuf field .google.protobuf.Duration max_staleness = 3; + * @return \Google\Protobuf\Duration|null + */ + public function getMaxStaleness() + { + return $this->readOneof(3); + } + + public function hasMaxStaleness() + { + return $this->hasOneof(3); + } + + /** + * Read data at a timestamp >= `NOW - max_staleness` + * seconds. Guarantees that all writes that have committed more + * than the specified number of seconds ago are visible. Because + * Cloud Spanner chooses the exact timestamp, this mode works even if + * the client's local clock is substantially skewed from Cloud Spanner + * commit timestamps. + * Useful for reading the freshest data available at a nearby + * replica, while bounding the possible staleness if the local + * replica has fallen behind. + * Note that this option can only be used in single-use + * transactions. + * + * Generated from protobuf field .google.protobuf.Duration max_staleness = 3; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMaxStaleness($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Executes all reads at the given timestamp. Unlike other modes, + * reads at a specific timestamp are repeatable; the same read at + * the same timestamp always returns the same data. If the + * timestamp is in the future, the read will block until the + * specified timestamp, modulo the read's deadline. + * Useful for large scale consistent reads such as mapreduces, or + * for coordinating many reads against a consistent snapshot of the + * data. + * A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. + * Example: `"2014-10-02T15:01:23.045123456Z"`. + * + * Generated from protobuf field .google.protobuf.Timestamp read_timestamp = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getReadTimestamp() + { + return $this->readOneof(4); + } + + public function hasReadTimestamp() + { + return $this->hasOneof(4); + } + + /** + * Executes all reads at the given timestamp. Unlike other modes, + * reads at a specific timestamp are repeatable; the same read at + * the same timestamp always returns the same data. If the + * timestamp is in the future, the read will block until the + * specified timestamp, modulo the read's deadline. + * Useful for large scale consistent reads such as mapreduces, or + * for coordinating many reads against a consistent snapshot of the + * data. + * A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. + * Example: `"2014-10-02T15:01:23.045123456Z"`. + * + * Generated from protobuf field .google.protobuf.Timestamp read_timestamp = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setReadTimestamp($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Executes all reads at a timestamp that is `exact_staleness` + * old. The timestamp is chosen soon after the read is started. + * Guarantees that all writes that have committed more than the + * specified number of seconds ago are visible. Because Cloud Spanner + * chooses the exact timestamp, this mode works even if the client's + * local clock is substantially skewed from Cloud Spanner commit + * timestamps. + * Useful for reading at nearby replicas without the distributed + * timestamp negotiation overhead of `max_staleness`. + * + * Generated from protobuf field .google.protobuf.Duration exact_staleness = 5; + * @return \Google\Protobuf\Duration|null + */ + public function getExactStaleness() + { + return $this->readOneof(5); + } + + public function hasExactStaleness() + { + return $this->hasOneof(5); + } + + /** + * Executes all reads at a timestamp that is `exact_staleness` + * old. The timestamp is chosen soon after the read is started. + * Guarantees that all writes that have committed more than the + * specified number of seconds ago are visible. Because Cloud Spanner + * chooses the exact timestamp, this mode works even if the client's + * local clock is substantially skewed from Cloud Spanner commit + * timestamps. + * Useful for reading at nearby replicas without the distributed + * timestamp negotiation overhead of `max_staleness`. + * + * Generated from protobuf field .google.protobuf.Duration exact_staleness = 5; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setExactStaleness($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * If true, the Cloud Spanner-selected read timestamp is included in + * the [Transaction][google.spanner.v1.Transaction] message that describes + * the transaction. + * + * Generated from protobuf field bool return_read_timestamp = 6; + * @return bool + */ + public function getReturnReadTimestamp() + { + return $this->return_read_timestamp; + } + + /** + * If true, the Cloud Spanner-selected read timestamp is included in + * the [Transaction][google.spanner.v1.Transaction] message that describes + * the transaction. + * + * Generated from protobuf field bool return_read_timestamp = 6; + * @param bool $var + * @return $this + */ + public function setReturnReadTimestamp($var) + { + GPBUtil::checkBool($var); + $this->return_read_timestamp = $var; + + return $this; + } + + /** + * @return string + */ + public function getTimestampBound() + { + return $this->whichOneof("timestamp_bound"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PBReadOnly::class, \Google\Cloud\Spanner\V1\TransactionOptions_ReadOnly::class); + +// Adding a class alias for backwards compatibility with the "readonly" keyword. +class_alias(PBReadOnly::class, __NAMESPACE__ . '\ReadOnly'); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/PartitionedDml.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/PartitionedDml.php new file mode 100644 index 000000000000..06d0e4b25c62 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/PartitionedDml.php @@ -0,0 +1,36 @@ +google.spanner.v1.TransactionOptions.PartitionedDml + */ +class PartitionedDml extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Transaction::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PartitionedDml::class, \Google\Cloud\Spanner\V1\TransactionOptions_PartitionedDml::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/ReadOnly.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/ReadOnly.php new file mode 100644 index 000000000000..d9f5f7d4789f --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/ReadOnly.php @@ -0,0 +1,9 @@ +google.spanner.v1.TransactionOptions.ReadWrite + */ +class ReadWrite extends \Google\Protobuf\Internal\Message +{ + /** + * Read lock mode for the transaction. + * + * Generated from protobuf field .google.spanner.v1.TransactionOptions.ReadWrite.ReadLockMode read_lock_mode = 1; + */ + protected $read_lock_mode = 0; + /** + * Optional. Clients should pass the transaction ID of the previous + * transaction attempt that was aborted if this transaction is being + * executed on a multiplexed session. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field bytes multiplexed_session_previous_transaction_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $multiplexed_session_previous_transaction_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $read_lock_mode + * Read lock mode for the transaction. + * @type string $multiplexed_session_previous_transaction_id + * Optional. Clients should pass the transaction ID of the previous + * transaction attempt that was aborted if this transaction is being + * executed on a multiplexed session. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Transaction::initOnce(); + parent::__construct($data); + } + + /** + * Read lock mode for the transaction. + * + * Generated from protobuf field .google.spanner.v1.TransactionOptions.ReadWrite.ReadLockMode read_lock_mode = 1; + * @return int + */ + public function getReadLockMode() + { + return $this->read_lock_mode; + } + + /** + * Read lock mode for the transaction. + * + * Generated from protobuf field .google.spanner.v1.TransactionOptions.ReadWrite.ReadLockMode read_lock_mode = 1; + * @param int $var + * @return $this + */ + public function setReadLockMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\V1\TransactionOptions\ReadWrite\ReadLockMode::class); + $this->read_lock_mode = $var; + + return $this; + } + + /** + * Optional. Clients should pass the transaction ID of the previous + * transaction attempt that was aborted if this transaction is being + * executed on a multiplexed session. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field bytes multiplexed_session_previous_transaction_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getMultiplexedSessionPreviousTransactionId() + { + return $this->multiplexed_session_previous_transaction_id; + } + + /** + * Optional. Clients should pass the transaction ID of the previous + * transaction attempt that was aborted if this transaction is being + * executed on a multiplexed session. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * Generated from protobuf field bytes multiplexed_session_previous_transaction_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setMultiplexedSessionPreviousTransactionId($var) + { + GPBUtil::checkString($var, False); + $this->multiplexed_session_previous_transaction_id = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ReadWrite::class, \Google\Cloud\Spanner\V1\TransactionOptions_ReadWrite::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/ReadWrite/ReadLockMode.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/ReadWrite/ReadLockMode.php new file mode 100644 index 000000000000..75b8922f96cb --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/ReadWrite/ReadLockMode.php @@ -0,0 +1,70 @@ +google.spanner.v1.TransactionOptions.ReadWrite.ReadLockMode + */ +class ReadLockMode +{ + /** + * Default value. + * If the value is not specified, the pessimistic read lock is used. + * + * Generated from protobuf enum READ_LOCK_MODE_UNSPECIFIED = 0; + */ + const READ_LOCK_MODE_UNSPECIFIED = 0; + /** + * Pessimistic lock mode. + * Read locks are acquired immediately on read. + * + * Generated from protobuf enum PESSIMISTIC = 1; + */ + const PESSIMISTIC = 1; + /** + * Optimistic lock mode. + * Locks for reads within the transaction are not acquired on read. + * Instead the locks are acquired on a commit to validate that + * read/queried data has not changed since the transaction started. + * + * Generated from protobuf enum OPTIMISTIC = 2; + */ + const OPTIMISTIC = 2; + + private static $valueToName = [ + self::READ_LOCK_MODE_UNSPECIFIED => 'READ_LOCK_MODE_UNSPECIFIED', + self::PESSIMISTIC => 'PESSIMISTIC', + self::OPTIMISTIC => 'OPTIMISTIC', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ReadLockMode::class, \Google\Cloud\Spanner\V1\TransactionOptions_ReadWrite_ReadLockMode::class); + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionSelector.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionSelector.php new file mode 100644 index 000000000000..f955f410ee81 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionSelector.php @@ -0,0 +1,160 @@ +google.spanner.v1.TransactionSelector + */ +class TransactionSelector extends \Google\Protobuf\Internal\Message +{ + protected $selector; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Spanner\V1\TransactionOptions $single_use + * Execute the read or SQL query in a temporary transaction. + * This is the most efficient way to execute a transaction that + * consists of a single SQL query. + * @type string $id + * Execute the read or SQL query in a previously-started transaction. + * @type \Google\Cloud\Spanner\V1\TransactionOptions $begin + * Begin a new transaction and execute this read or SQL query in + * it. The transaction ID of the new transaction is returned in + * [ResultSetMetadata.transaction][google.spanner.v1.ResultSetMetadata.transaction], + * which is a [Transaction][google.spanner.v1.Transaction]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Transaction::initOnce(); + parent::__construct($data); + } + + /** + * Execute the read or SQL query in a temporary transaction. + * This is the most efficient way to execute a transaction that + * consists of a single SQL query. + * + * Generated from protobuf field .google.spanner.v1.TransactionOptions single_use = 1; + * @return \Google\Cloud\Spanner\V1\TransactionOptions|null + */ + public function getSingleUse() + { + return $this->readOneof(1); + } + + public function hasSingleUse() + { + return $this->hasOneof(1); + } + + /** + * Execute the read or SQL query in a temporary transaction. + * This is the most efficient way to execute a transaction that + * consists of a single SQL query. + * + * Generated from protobuf field .google.spanner.v1.TransactionOptions single_use = 1; + * @param \Google\Cloud\Spanner\V1\TransactionOptions $var + * @return $this + */ + public function setSingleUse($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionOptions::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Execute the read or SQL query in a previously-started transaction. + * + * Generated from protobuf field bytes id = 2; + * @return string + */ + public function getId() + { + return $this->readOneof(2); + } + + public function hasId() + { + return $this->hasOneof(2); + } + + /** + * Execute the read or SQL query in a previously-started transaction. + * + * Generated from protobuf field bytes id = 2; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Begin a new transaction and execute this read or SQL query in + * it. The transaction ID of the new transaction is returned in + * [ResultSetMetadata.transaction][google.spanner.v1.ResultSetMetadata.transaction], + * which is a [Transaction][google.spanner.v1.Transaction]. + * + * Generated from protobuf field .google.spanner.v1.TransactionOptions begin = 3; + * @return \Google\Cloud\Spanner\V1\TransactionOptions|null + */ + public function getBegin() + { + return $this->readOneof(3); + } + + public function hasBegin() + { + return $this->hasOneof(3); + } + + /** + * Begin a new transaction and execute this read or SQL query in + * it. The transaction ID of the new transaction is returned in + * [ResultSetMetadata.transaction][google.spanner.v1.ResultSetMetadata.transaction], + * which is a [Transaction][google.spanner.v1.Transaction]. + * + * Generated from protobuf field .google.spanner.v1.TransactionOptions begin = 3; + * @param \Google\Cloud\Spanner\V1\TransactionOptions $var + * @return $this + */ + public function setBegin($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionOptions::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getSelector() + { + return $this->whichOneof("selector"); + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Type.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Type.php new file mode 100644 index 000000000000..6527eae3f162 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Type.php @@ -0,0 +1,284 @@ +google.spanner.v1.Type + */ +class Type extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The [TypeCode][google.spanner.v1.TypeCode] for this type. + * + * Generated from protobuf field .google.spanner.v1.TypeCode code = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $code = 0; + /** + * If [code][google.spanner.v1.Type.code] == + * [ARRAY][google.spanner.v1.TypeCode.ARRAY], then `array_element_type` is the + * type of the array elements. + * + * Generated from protobuf field .google.spanner.v1.Type array_element_type = 2; + */ + protected $array_element_type = null; + /** + * If [code][google.spanner.v1.Type.code] == + * [STRUCT][google.spanner.v1.TypeCode.STRUCT], then `struct_type` provides + * type information for the struct's fields. + * + * Generated from protobuf field .google.spanner.v1.StructType struct_type = 3; + */ + protected $struct_type = null; + /** + * The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that + * disambiguates SQL type that Spanner will use to represent values of this + * type during query processing. This is necessary for some type codes because + * a single [TypeCode][google.spanner.v1.TypeCode] can be mapped to different + * SQL types depending on the SQL dialect. + * [type_annotation][google.spanner.v1.Type.type_annotation] typically is not + * needed to process the content of a value (it doesn't affect serialization) + * and clients can ignore it on the read path. + * + * Generated from protobuf field .google.spanner.v1.TypeAnnotationCode type_annotation = 4; + */ + protected $type_annotation = 0; + /** + * If [code][google.spanner.v1.Type.code] == + * [PROTO][google.spanner.v1.TypeCode.PROTO] or + * [code][google.spanner.v1.Type.code] == + * [ENUM][google.spanner.v1.TypeCode.ENUM], then `proto_type_fqn` is the fully + * qualified name of the proto type representing the proto/enum definition. + * + * Generated from protobuf field string proto_type_fqn = 5; + */ + protected $proto_type_fqn = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $code + * Required. The [TypeCode][google.spanner.v1.TypeCode] for this type. + * @type \Google\Cloud\Spanner\V1\Type $array_element_type + * If [code][google.spanner.v1.Type.code] == + * [ARRAY][google.spanner.v1.TypeCode.ARRAY], then `array_element_type` is the + * type of the array elements. + * @type \Google\Cloud\Spanner\V1\StructType $struct_type + * If [code][google.spanner.v1.Type.code] == + * [STRUCT][google.spanner.v1.TypeCode.STRUCT], then `struct_type` provides + * type information for the struct's fields. + * @type int $type_annotation + * The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that + * disambiguates SQL type that Spanner will use to represent values of this + * type during query processing. This is necessary for some type codes because + * a single [TypeCode][google.spanner.v1.TypeCode] can be mapped to different + * SQL types depending on the SQL dialect. + * [type_annotation][google.spanner.v1.Type.type_annotation] typically is not + * needed to process the content of a value (it doesn't affect serialization) + * and clients can ignore it on the read path. + * @type string $proto_type_fqn + * If [code][google.spanner.v1.Type.code] == + * [PROTO][google.spanner.v1.TypeCode.PROTO] or + * [code][google.spanner.v1.Type.code] == + * [ENUM][google.spanner.v1.TypeCode.ENUM], then `proto_type_fqn` is the fully + * qualified name of the proto type representing the proto/enum definition. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Spanner\V1\Type::initOnce(); + parent::__construct($data); + } + + /** + * Required. The [TypeCode][google.spanner.v1.TypeCode] for this type. + * + * Generated from protobuf field .google.spanner.v1.TypeCode code = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getCode() + { + return $this->code; + } + + /** + * Required. The [TypeCode][google.spanner.v1.TypeCode] for this type. + * + * Generated from protobuf field .google.spanner.v1.TypeCode code = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\V1\TypeCode::class); + $this->code = $var; + + return $this; + } + + /** + * If [code][google.spanner.v1.Type.code] == + * [ARRAY][google.spanner.v1.TypeCode.ARRAY], then `array_element_type` is the + * type of the array elements. + * + * Generated from protobuf field .google.spanner.v1.Type array_element_type = 2; + * @return \Google\Cloud\Spanner\V1\Type|null + */ + public function getArrayElementType() + { + return $this->array_element_type; + } + + public function hasArrayElementType() + { + return isset($this->array_element_type); + } + + public function clearArrayElementType() + { + unset($this->array_element_type); + } + + /** + * If [code][google.spanner.v1.Type.code] == + * [ARRAY][google.spanner.v1.TypeCode.ARRAY], then `array_element_type` is the + * type of the array elements. + * + * Generated from protobuf field .google.spanner.v1.Type array_element_type = 2; + * @param \Google\Cloud\Spanner\V1\Type $var + * @return $this + */ + public function setArrayElementType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Type::class); + $this->array_element_type = $var; + + return $this; + } + + /** + * If [code][google.spanner.v1.Type.code] == + * [STRUCT][google.spanner.v1.TypeCode.STRUCT], then `struct_type` provides + * type information for the struct's fields. + * + * Generated from protobuf field .google.spanner.v1.StructType struct_type = 3; + * @return \Google\Cloud\Spanner\V1\StructType|null + */ + public function getStructType() + { + return $this->struct_type; + } + + public function hasStructType() + { + return isset($this->struct_type); + } + + public function clearStructType() + { + unset($this->struct_type); + } + + /** + * If [code][google.spanner.v1.Type.code] == + * [STRUCT][google.spanner.v1.TypeCode.STRUCT], then `struct_type` provides + * type information for the struct's fields. + * + * Generated from protobuf field .google.spanner.v1.StructType struct_type = 3; + * @param \Google\Cloud\Spanner\V1\StructType $var + * @return $this + */ + public function setStructType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\StructType::class); + $this->struct_type = $var; + + return $this; + } + + /** + * The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that + * disambiguates SQL type that Spanner will use to represent values of this + * type during query processing. This is necessary for some type codes because + * a single [TypeCode][google.spanner.v1.TypeCode] can be mapped to different + * SQL types depending on the SQL dialect. + * [type_annotation][google.spanner.v1.Type.type_annotation] typically is not + * needed to process the content of a value (it doesn't affect serialization) + * and clients can ignore it on the read path. + * + * Generated from protobuf field .google.spanner.v1.TypeAnnotationCode type_annotation = 4; + * @return int + */ + public function getTypeAnnotation() + { + return $this->type_annotation; + } + + /** + * The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that + * disambiguates SQL type that Spanner will use to represent values of this + * type during query processing. This is necessary for some type codes because + * a single [TypeCode][google.spanner.v1.TypeCode] can be mapped to different + * SQL types depending on the SQL dialect. + * [type_annotation][google.spanner.v1.Type.type_annotation] typically is not + * needed to process the content of a value (it doesn't affect serialization) + * and clients can ignore it on the read path. + * + * Generated from protobuf field .google.spanner.v1.TypeAnnotationCode type_annotation = 4; + * @param int $var + * @return $this + */ + public function setTypeAnnotation($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\V1\TypeAnnotationCode::class); + $this->type_annotation = $var; + + return $this; + } + + /** + * If [code][google.spanner.v1.Type.code] == + * [PROTO][google.spanner.v1.TypeCode.PROTO] or + * [code][google.spanner.v1.Type.code] == + * [ENUM][google.spanner.v1.TypeCode.ENUM], then `proto_type_fqn` is the fully + * qualified name of the proto type representing the proto/enum definition. + * + * Generated from protobuf field string proto_type_fqn = 5; + * @return string + */ + public function getProtoTypeFqn() + { + return $this->proto_type_fqn; + } + + /** + * If [code][google.spanner.v1.Type.code] == + * [PROTO][google.spanner.v1.TypeCode.PROTO] or + * [code][google.spanner.v1.Type.code] == + * [ENUM][google.spanner.v1.TypeCode.ENUM], then `proto_type_fqn` is the fully + * qualified name of the proto type representing the proto/enum definition. + * + * Generated from protobuf field string proto_type_fqn = 5; + * @param string $var + * @return $this + */ + public function setProtoTypeFqn($var) + { + GPBUtil::checkString($var, True); + $this->proto_type_fqn = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TypeAnnotationCode.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TypeAnnotationCode.php new file mode 100644 index 000000000000..5aa003011f3d --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TypeAnnotationCode.php @@ -0,0 +1,85 @@ +google.spanner.v1.TypeAnnotationCode + */ +class TypeAnnotationCode +{ + /** + * Not specified. + * + * Generated from protobuf enum TYPE_ANNOTATION_CODE_UNSPECIFIED = 0; + */ + const TYPE_ANNOTATION_CODE_UNSPECIFIED = 0; + /** + * PostgreSQL compatible NUMERIC type. This annotation needs to be applied to + * [Type][google.spanner.v1.Type] instances having + * [NUMERIC][google.spanner.v1.TypeCode.NUMERIC] type code to specify that + * values of this type should be treated as PostgreSQL NUMERIC values. + * Currently this annotation is always needed for + * [NUMERIC][google.spanner.v1.TypeCode.NUMERIC] when a client interacts with + * PostgreSQL-enabled Spanner databases. + * + * Generated from protobuf enum PG_NUMERIC = 2; + */ + const PG_NUMERIC = 2; + /** + * PostgreSQL compatible JSONB type. This annotation needs to be applied to + * [Type][google.spanner.v1.Type] instances having + * [JSON][google.spanner.v1.TypeCode.JSON] type code to specify that values of + * this type should be treated as PostgreSQL JSONB values. Currently this + * annotation is always needed for [JSON][google.spanner.v1.TypeCode.JSON] + * when a client interacts with PostgreSQL-enabled Spanner databases. + * + * Generated from protobuf enum PG_JSONB = 3; + */ + const PG_JSONB = 3; + /** + * PostgreSQL compatible OID type. This annotation can be used by a client + * interacting with PostgreSQL-enabled Spanner database to specify that a + * value should be treated using the semantics of the OID type. + * + * Generated from protobuf enum PG_OID = 4; + */ + const PG_OID = 4; + + private static $valueToName = [ + self::TYPE_ANNOTATION_CODE_UNSPECIFIED => 'TYPE_ANNOTATION_CODE_UNSPECIFIED', + self::PG_NUMERIC => 'PG_NUMERIC', + self::PG_JSONB => 'PG_JSONB', + self::PG_OID => 'PG_OID', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TypeCode.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TypeCode.php new file mode 100644 index 000000000000..19ca4f38e502 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TypeCode.php @@ -0,0 +1,199 @@ +google.spanner.v1.TypeCode + */ +class TypeCode +{ + /** + * Not specified. + * + * Generated from protobuf enum TYPE_CODE_UNSPECIFIED = 0; + */ + const TYPE_CODE_UNSPECIFIED = 0; + /** + * Encoded as JSON `true` or `false`. + * + * Generated from protobuf enum BOOL = 1; + */ + const BOOL = 1; + /** + * Encoded as `string`, in decimal format. + * + * Generated from protobuf enum INT64 = 2; + */ + const INT64 = 2; + /** + * Encoded as `number`, or the strings `"NaN"`, `"Infinity"`, or + * `"-Infinity"`. + * + * Generated from protobuf enum FLOAT64 = 3; + */ + const FLOAT64 = 3; + /** + * Encoded as `number`, or the strings `"NaN"`, `"Infinity"`, or + * `"-Infinity"`. + * + * Generated from protobuf enum FLOAT32 = 15; + */ + const FLOAT32 = 15; + /** + * Encoded as `string` in RFC 3339 timestamp format. The time zone + * must be present, and must be `"Z"`. + * If the schema has the column option + * `allow_commit_timestamp=true`, the placeholder string + * `"spanner.commit_timestamp()"` can be used to instruct the system + * to insert the commit timestamp associated with the transaction + * commit. + * + * Generated from protobuf enum TIMESTAMP = 4; + */ + const TIMESTAMP = 4; + /** + * Encoded as `string` in RFC 3339 date format. + * + * Generated from protobuf enum DATE = 5; + */ + const DATE = 5; + /** + * Encoded as `string`. + * + * Generated from protobuf enum STRING = 6; + */ + const STRING = 6; + /** + * Encoded as a base64-encoded `string`, as described in RFC 4648, + * section 4. + * + * Generated from protobuf enum BYTES = 7; + */ + const BYTES = 7; + /** + * Encoded as `list`, where the list elements are represented + * according to + * [array_element_type][google.spanner.v1.Type.array_element_type]. + * + * Generated from protobuf enum ARRAY = 8; + */ + const PBARRAY = 8; + /** + * Encoded as `list`, where list element `i` is represented according + * to [struct_type.fields[i]][google.spanner.v1.StructType.fields]. + * + * Generated from protobuf enum STRUCT = 9; + */ + const STRUCT = 9; + /** + * Encoded as `string`, in decimal format or scientific notation format. + * Decimal format: + * `[+-]Digits[.[Digits]]` or + * `[+-][Digits].Digits` + * Scientific notation: + * `[+-]Digits[.[Digits]][ExponentIndicator[+-]Digits]` or + * `[+-][Digits].Digits[ExponentIndicator[+-]Digits]` + * (ExponentIndicator is `"e"` or `"E"`) + * + * Generated from protobuf enum NUMERIC = 10; + */ + const NUMERIC = 10; + /** + * Encoded as a JSON-formatted `string` as described in RFC 7159. The + * following rules are applied when parsing JSON input: + * - Whitespace characters are not preserved. + * - If a JSON object has duplicate keys, only the first key is preserved. + * - Members of a JSON object are not guaranteed to have their order + * preserved. + * - JSON array elements will have their order preserved. + * + * Generated from protobuf enum JSON = 11; + */ + const JSON = 11; + /** + * Encoded as a base64-encoded `string`, as described in RFC 4648, + * section 4. + * + * Generated from protobuf enum PROTO = 13; + */ + const PROTO = 13; + /** + * Encoded as `string`, in decimal format. + * + * Generated from protobuf enum ENUM = 14; + */ + const ENUM = 14; + /** + * Encoded as `string`, in `ISO8601` duration format - + * `P[n]Y[n]M[n]DT[n]H[n]M[n[.fraction]]S` + * where `n` is an integer. + * For example, `P1Y2M3DT4H5M6.5S` represents time duration of 1 year, 2 + * months, 3 days, 4 hours, 5 minutes, and 6.5 seconds. + * + * Generated from protobuf enum INTERVAL = 16; + */ + const INTERVAL = 16; + /** + * Encoded as `string`, in lower-case hexa-decimal format, as described + * in RFC 9562, section 4. + * + * Generated from protobuf enum UUID = 17; + */ + const UUID = 17; + + private static $valueToName = [ + self::TYPE_CODE_UNSPECIFIED => 'TYPE_CODE_UNSPECIFIED', + self::BOOL => 'BOOL', + self::INT64 => 'INT64', + self::FLOAT64 => 'FLOAT64', + self::FLOAT32 => 'FLOAT32', + self::TIMESTAMP => 'TIMESTAMP', + self::DATE => 'DATE', + self::STRING => 'STRING', + self::BYTES => 'BYTES', + self::PBARRAY => 'ARRAY', + self::STRUCT => 'STRUCT', + self::NUMERIC => 'NUMERIC', + self::JSON => 'JSON', + self::PROTO => 'PROTO', + self::ENUM => 'ENUM', + self::INTERVAL => 'INTERVAL', + self::UUID => 'UUID', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + $pbconst = __CLASS__. '::PB' . strtoupper($name); + if (!defined($pbconst)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($pbconst); + } + return constant($const); + } +} + diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/batch_create_sessions.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/batch_create_sessions.php new file mode 100644 index 000000000000..40be97dbffc6 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/batch_create_sessions.php @@ -0,0 +1,82 @@ +setDatabase($formattedDatabase) + ->setSessionCount($sessionCount); + + // Call the API and handle any network failures. + try { + /** @var BatchCreateSessionsResponse $response */ + $response = $spannerClient->batchCreateSessions($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedDatabase = SpannerClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $sessionCount = 0; + + batch_create_sessions_sample($formattedDatabase, $sessionCount); +} +// [END spanner_v1_generated_Spanner_BatchCreateSessions_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/batch_write.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/batch_write.php new file mode 100644 index 000000000000..7d3aa26e340e --- /dev/null +++ b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/batch_write.php @@ -0,0 +1,102 @@ +setMutations($mutationGroupsMutations); + $mutationGroups = [$mutationGroup,]; + $request = (new BatchWriteRequest()) + ->setSession($formattedSession) + ->setMutationGroups($mutationGroups); + + // Call the API and handle any network failures. + try { + /** @var ServerStream $stream */ + $stream = $spannerClient->batchWrite($request); + + /** @var BatchWriteResponse $element */ + foreach ($stream->readAll() as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSession = SpannerClient::sessionName( + '[PROJECT]', + '[INSTANCE]', + '[DATABASE]', + '[SESSION]' + ); + + batch_write_sample($formattedSession); +} +// [END spanner_v1_generated_Spanner_BatchWrite_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/begin_transaction.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/begin_transaction.php new file mode 100644 index 000000000000..f1bd435dc644 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/begin_transaction.php @@ -0,0 +1,83 @@ +setSession($formattedSession) + ->setOptions($options); + + // Call the API and handle any network failures. + try { + /** @var Transaction $response */ + $response = $spannerClient->beginTransaction($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSession = SpannerClient::sessionName( + '[PROJECT]', + '[INSTANCE]', + '[DATABASE]', + '[SESSION]' + ); + + begin_transaction_sample($formattedSession); +} +// [END spanner_v1_generated_Spanner_BeginTransaction_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/commit.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/commit.php new file mode 100644 index 000000000000..abd85545fc62 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/commit.php @@ -0,0 +1,92 @@ +setSession($formattedSession) + ->setMutations($mutations); + + // Call the API and handle any network failures. + try { + /** @var CommitResponse $response */ + $response = $spannerClient->commit($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSession = SpannerClient::sessionName( + '[PROJECT]', + '[INSTANCE]', + '[DATABASE]', + '[SESSION]' + ); + + commit_sample($formattedSession); +} +// [END spanner_v1_generated_Spanner_Commit_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/create_session.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/create_session.php new file mode 100644 index 000000000000..e16f02cbd08e --- /dev/null +++ b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/create_session.php @@ -0,0 +1,89 @@ +setDatabase($formattedDatabase); + + // Call the API and handle any network failures. + try { + /** @var Session $response */ + $response = $spannerClient->createSession($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedDatabase = SpannerClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + + create_session_sample($formattedDatabase); +} +// [END spanner_v1_generated_Spanner_CreateSession_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/delete_session.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/delete_session.php new file mode 100644 index 000000000000..73c3e3c4da9f --- /dev/null +++ b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/delete_session.php @@ -0,0 +1,71 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $spannerClient->deleteSession($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = SpannerClient::sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + + delete_session_sample($formattedName); +} +// [END spanner_v1_generated_Spanner_DeleteSession_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_batch_dml.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_batch_dml.php new file mode 100644 index 000000000000..1c40318ba4d2 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_batch_dml.php @@ -0,0 +1,110 @@ +setSql($statementsSql); + $statements = [$statement,]; + $request = (new ExecuteBatchDmlRequest()) + ->setSession($formattedSession) + ->setTransaction($transaction) + ->setStatements($statements) + ->setSeqno($seqno); + + // Call the API and handle any network failures. + try { + /** @var ExecuteBatchDmlResponse $response */ + $response = $spannerClient->executeBatchDml($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSession = SpannerClient::sessionName( + '[PROJECT]', + '[INSTANCE]', + '[DATABASE]', + '[SESSION]' + ); + $statementsSql = '[SQL]'; + $seqno = 0; + + execute_batch_dml_sample($formattedSession, $statementsSql, $seqno); +} +// [END spanner_v1_generated_Spanner_ExecuteBatchDml_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_sql.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_sql.php new file mode 100644 index 000000000000..5e27212686bb --- /dev/null +++ b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_sql.php @@ -0,0 +1,91 @@ +setSession($formattedSession) + ->setSql($sql); + + // Call the API and handle any network failures. + try { + /** @var ResultSet $response */ + $response = $spannerClient->executeSql($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSession = SpannerClient::sessionName( + '[PROJECT]', + '[INSTANCE]', + '[DATABASE]', + '[SESSION]' + ); + $sql = '[SQL]'; + + execute_sql_sample($formattedSession, $sql); +} +// [END spanner_v1_generated_Spanner_ExecuteSql_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_streaming_sql.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_streaming_sql.php new file mode 100644 index 000000000000..330bd96b65ca --- /dev/null +++ b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_streaming_sql.php @@ -0,0 +1,88 @@ +setSession($formattedSession) + ->setSql($sql); + + // Call the API and handle any network failures. + try { + /** @var ServerStream $stream */ + $stream = $spannerClient->executeStreamingSql($request); + + /** @var PartialResultSet $element */ + foreach ($stream->readAll() as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSession = SpannerClient::sessionName( + '[PROJECT]', + '[INSTANCE]', + '[DATABASE]', + '[SESSION]' + ); + $sql = '[SQL]'; + + execute_streaming_sql_sample($formattedSession, $sql); +} +// [END spanner_v1_generated_Spanner_ExecuteStreamingSql_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/get_session.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/get_session.php new file mode 100644 index 000000000000..02478a3ef603 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/get_session.php @@ -0,0 +1,73 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Session $response */ + $response = $spannerClient->getSession($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = SpannerClient::sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + + get_session_sample($formattedName); +} +// [END spanner_v1_generated_Spanner_GetSession_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/list_sessions.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/list_sessions.php new file mode 100644 index 000000000000..1f91d9202b21 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/list_sessions.php @@ -0,0 +1,76 @@ +setDatabase($formattedDatabase); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $spannerClient->listSessions($request); + + /** @var Session $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedDatabase = SpannerClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + + list_sessions_sample($formattedDatabase); +} +// [END spanner_v1_generated_Spanner_ListSessions_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/partition_query.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/partition_query.php new file mode 100644 index 000000000000..9af6f93afe0b --- /dev/null +++ b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/partition_query.php @@ -0,0 +1,101 @@ +setSession($formattedSession) + ->setSql($sql); + + // Call the API and handle any network failures. + try { + /** @var PartitionResponse $response */ + $response = $spannerClient->partitionQuery($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSession = SpannerClient::sessionName( + '[PROJECT]', + '[INSTANCE]', + '[DATABASE]', + '[SESSION]' + ); + $sql = '[SQL]'; + + partition_query_sample($formattedSession, $sql); +} +// [END spanner_v1_generated_Spanner_PartitionQuery_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/partition_read.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/partition_read.php new file mode 100644 index 000000000000..4db50f8a4371 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/partition_read.php @@ -0,0 +1,95 @@ +setSession($formattedSession) + ->setTable($table) + ->setKeySet($keySet); + + // Call the API and handle any network failures. + try { + /** @var PartitionResponse $response */ + $response = $spannerClient->partitionRead($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSession = SpannerClient::sessionName( + '[PROJECT]', + '[INSTANCE]', + '[DATABASE]', + '[SESSION]' + ); + $table = '[TABLE]'; + + partition_read_sample($formattedSession, $table); +} +// [END spanner_v1_generated_Spanner_PartitionRead_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/read.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/read.php new file mode 100644 index 000000000000..0efe5830717f --- /dev/null +++ b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/read.php @@ -0,0 +1,100 @@ +setSession($formattedSession) + ->setTable($table) + ->setColumns($columns) + ->setKeySet($keySet); + + // Call the API and handle any network failures. + try { + /** @var ResultSet $response */ + $response = $spannerClient->read($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSession = SpannerClient::sessionName( + '[PROJECT]', + '[INSTANCE]', + '[DATABASE]', + '[SESSION]' + ); + $table = '[TABLE]'; + $columnsElement = '[COLUMNS]'; + + read_sample($formattedSession, $table, $columnsElement); +} +// [END spanner_v1_generated_Spanner_Read_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/rollback.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/rollback.php new file mode 100644 index 000000000000..1eb7e9a22772 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/rollback.php @@ -0,0 +1,85 @@ +setSession($formattedSession) + ->setTransactionId($transactionId); + + // Call the API and handle any network failures. + try { + $spannerClient->rollback($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSession = SpannerClient::sessionName( + '[PROJECT]', + '[INSTANCE]', + '[DATABASE]', + '[SESSION]' + ); + $transactionId = '...'; + + rollback_sample($formattedSession, $transactionId); +} +// [END spanner_v1_generated_Spanner_Rollback_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/streaming_read.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/streaming_read.php new file mode 100644 index 000000000000..48ee32a9a094 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/streaming_read.php @@ -0,0 +1,99 @@ +setSession($formattedSession) + ->setTable($table) + ->setColumns($columns) + ->setKeySet($keySet); + + // Call the API and handle any network failures. + try { + /** @var ServerStream $stream */ + $stream = $spannerClient->streamingRead($request); + + /** @var PartialResultSet $element */ + foreach ($stream->readAll() as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSession = SpannerClient::sessionName( + '[PROJECT]', + '[INSTANCE]', + '[DATABASE]', + '[SESSION]' + ); + $table = '[TABLE]'; + $columnsElement = '[COLUMNS]'; + + streaming_read_sample($formattedSession, $table, $columnsElement); +} +// [END spanner_v1_generated_Spanner_StreamingRead_sync] diff --git a/owl-bot-staging/Spanner/v1/src/V1/Client/SpannerClient.php b/owl-bot-staging/Spanner/v1/src/V1/Client/SpannerClient.php new file mode 100644 index 000000000000..e794a10d3d54 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/src/V1/Client/SpannerClient.php @@ -0,0 +1,836 @@ + batchCreateSessionsAsync(BatchCreateSessionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface beginTransactionAsync(BeginTransactionRequest $request, array $optionalArgs = []) + * @method PromiseInterface commitAsync(CommitRequest $request, array $optionalArgs = []) + * @method PromiseInterface createSessionAsync(CreateSessionRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteSessionAsync(DeleteSessionRequest $request, array $optionalArgs = []) + * @method PromiseInterface executeBatchDmlAsync(ExecuteBatchDmlRequest $request, array $optionalArgs = []) + * @method PromiseInterface executeSqlAsync(ExecuteSqlRequest $request, array $optionalArgs = []) + * @method PromiseInterface getSessionAsync(GetSessionRequest $request, array $optionalArgs = []) + * @method PromiseInterface listSessionsAsync(ListSessionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface partitionQueryAsync(PartitionQueryRequest $request, array $optionalArgs = []) + * @method PromiseInterface partitionReadAsync(PartitionReadRequest $request, array $optionalArgs = []) + * @method PromiseInterface readAsync(ReadRequest $request, array $optionalArgs = []) + * @method PromiseInterface rollbackAsync(RollbackRequest $request, array $optionalArgs = []) + */ +final class SpannerClient +{ + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.spanner.v1.Spanner'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + private const SERVICE_ADDRESS = 'spanner.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'spanner.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/spanner.data', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/spanner_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/spanner_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/spanner_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/spanner_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a database + * resource. + * + * @param string $project + * @param string $instance + * @param string $database + * + * @return string The formatted database resource. + */ + public static function databaseName(string $project, string $instance, string $database): string + { + return self::getPathTemplate('database')->render([ + 'project' => $project, + 'instance' => $instance, + 'database' => $database, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a session + * resource. + * + * @param string $project + * @param string $instance + * @param string $database + * @param string $session + * + * @return string The formatted session resource. + */ + public static function sessionName(string $project, string $instance, string $database, string $session): string + { + return self::getPathTemplate('session')->render([ + 'project' => $project, + 'instance' => $instance, + 'database' => $database, + 'session' => $session, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - database: projects/{project}/instances/{instance}/databases/{database} + * - session: projects/{project}/instances/{instance}/databases/{database}/sessions/{session} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, ?string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * Setting the "SPANNER_EMULATOR_HOST" environment variable will automatically set + * the API Endpoint to the value specified in the variable, as well as ensure that + * empty credentials are used in the transport layer. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'spanner.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * @type false|LoggerInterface $logger + * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the + * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $options = $this->setDefaultEmulatorConfig($options); + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates multiple new sessions. + * + * This API can be used to initialize a session cache on the clients. + * See https://goo.gl/TgSFN2 for best practices on session cache management. + * + * The async variant is {@see SpannerClient::batchCreateSessionsAsync()} . + * + * @example samples/V1/SpannerClient/batch_create_sessions.php + * + * @param BatchCreateSessionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return BatchCreateSessionsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function batchCreateSessions(BatchCreateSessionsRequest $request, array $callOptions = []): BatchCreateSessionsResponse + { + return $this->startApiCall('BatchCreateSessions', $request, $callOptions)->wait(); + } + + /** + * Batches the supplied mutation groups in a collection of efficient + * transactions. All mutations in a group are committed atomically. However, + * mutations across groups can be committed non-atomically in an unspecified + * order and thus, they must be independent of each other. Partial failure is + * possible, i.e., some groups may have been committed successfully, while + * some may have failed. The results of individual batches are streamed into + * the response as the batches are applied. + * + * BatchWrite requests are not replay protected, meaning that each mutation + * group may be applied more than once. Replays of non-idempotent mutations + * may have undesirable effects. For example, replays of an insert mutation + * may produce an already exists error or if you use generated or commit + * timestamp-based keys, it may result in additional rows being added to the + * mutation's table. We recommend structuring your mutation groups to be + * idempotent to avoid this issue. + * + * @example samples/V1/SpannerClient/batch_write.php + * + * @param BatchWriteRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type int $timeoutMillis + * Timeout to use for this call. + * } + * + * @return ServerStream + * + * @throws ApiException Thrown if the API call fails. + */ + public function batchWrite(BatchWriteRequest $request, array $callOptions = []): ServerStream + { + return $this->startApiCall('BatchWrite', $request, $callOptions); + } + + /** + * Begins a new transaction. This step can often be skipped: + * [Read][google.spanner.v1.Spanner.Read], + * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and + * [Commit][google.spanner.v1.Spanner.Commit] can begin a new transaction as a + * side-effect. + * + * The async variant is {@see SpannerClient::beginTransactionAsync()} . + * + * @example samples/V1/SpannerClient/begin_transaction.php + * + * @param BeginTransactionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Transaction + * + * @throws ApiException Thrown if the API call fails. + */ + public function beginTransaction(BeginTransactionRequest $request, array $callOptions = []): Transaction + { + return $this->startApiCall('BeginTransaction', $request, $callOptions)->wait(); + } + + /** + * Commits a transaction. The request includes the mutations to be + * applied to rows in the database. + * + * `Commit` might return an `ABORTED` error. This can occur at any time; + * commonly, the cause is conflicts with concurrent + * transactions. However, it can also happen for a variety of other + * reasons. If `Commit` returns `ABORTED`, the caller should re-attempt + * the transaction from the beginning, re-using the same session. + * + * On very rare occasions, `Commit` might return `UNKNOWN`. This can happen, + * for example, if the client job experiences a 1+ hour networking failure. + * At that point, Cloud Spanner has lost track of the transaction outcome and + * we recommend that you perform another read from the database to see the + * state of things as they are now. + * + * The async variant is {@see SpannerClient::commitAsync()} . + * + * @example samples/V1/SpannerClient/commit.php + * + * @param CommitRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return CommitResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function commit(CommitRequest $request, array $callOptions = []): CommitResponse + { + return $this->startApiCall('Commit', $request, $callOptions)->wait(); + } + + /** + * Creates a new session. A session can be used to perform + * transactions that read and/or modify data in a Cloud Spanner database. + * Sessions are meant to be reused for many consecutive + * transactions. + * + * Sessions can only execute one transaction at a time. To execute + * multiple concurrent read-write/write-only transactions, create + * multiple sessions. Note that standalone reads and queries use a + * transaction internally, and count toward the one transaction + * limit. + * + * Active sessions use additional server resources, so it is a good idea to + * delete idle and unneeded sessions. + * Aside from explicit deletes, Cloud Spanner may delete sessions for which no + * operations are sent for more than an hour. If a session is deleted, + * requests to it return `NOT_FOUND`. + * + * Idle sessions can be kept alive by sending a trivial SQL query + * periodically, e.g., `"SELECT 1"`. + * + * The async variant is {@see SpannerClient::createSessionAsync()} . + * + * @example samples/V1/SpannerClient/create_session.php + * + * @param CreateSessionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Session + * + * @throws ApiException Thrown if the API call fails. + */ + public function createSession(CreateSessionRequest $request, array $callOptions = []): Session + { + return $this->startApiCall('CreateSession', $request, $callOptions)->wait(); + } + + /** + * Ends a session, releasing server resources associated with it. This will + * asynchronously trigger cancellation of any operations that are running with + * this session. + * + * The async variant is {@see SpannerClient::deleteSessionAsync()} . + * + * @example samples/V1/SpannerClient/delete_session.php + * + * @param DeleteSessionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteSession(DeleteSessionRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteSession', $request, $callOptions)->wait(); + } + + /** + * Executes a batch of SQL DML statements. This method allows many statements + * to be run with lower latency than submitting them sequentially with + * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. + * + * Statements are executed in sequential order. A request can succeed even if + * a statement fails. The + * [ExecuteBatchDmlResponse.status][google.spanner.v1.ExecuteBatchDmlResponse.status] + * field in the response provides information about the statement that failed. + * Clients must inspect this field to determine whether an error occurred. + * + * Execution stops after the first failed statement; the remaining statements + * are not executed. + * + * The async variant is {@see SpannerClient::executeBatchDmlAsync()} . + * + * @example samples/V1/SpannerClient/execute_batch_dml.php + * + * @param ExecuteBatchDmlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ExecuteBatchDmlResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function executeBatchDml(ExecuteBatchDmlRequest $request, array $callOptions = []): ExecuteBatchDmlResponse + { + return $this->startApiCall('ExecuteBatchDml', $request, $callOptions)->wait(); + } + + /** + * Executes an SQL statement, returning all results in a single reply. This + * method cannot be used to return a result set larger than 10 MiB; + * if the query yields more data than that, the query fails with + * a `FAILED_PRECONDITION` error. + * + * Operations inside read-write transactions might return `ABORTED`. If + * this occurs, the application should restart the transaction from + * the beginning. See [Transaction][google.spanner.v1.Transaction] for more + * details. + * + * Larger result sets can be fetched in streaming fashion by calling + * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] + * instead. + * + * The async variant is {@see SpannerClient::executeSqlAsync()} . + * + * @example samples/V1/SpannerClient/execute_sql.php + * + * @param ExecuteSqlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ResultSet + * + * @throws ApiException Thrown if the API call fails. + */ + public function executeSql(ExecuteSqlRequest $request, array $callOptions = []): ResultSet + { + return $this->startApiCall('ExecuteSql', $request, $callOptions)->wait(); + } + + /** + * Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the + * result set as a stream. Unlike + * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there is no limit on + * the size of the returned result set. However, no individual row in the + * result set can exceed 100 MiB, and no column value can exceed 10 MiB. + * + * @example samples/V1/SpannerClient/execute_streaming_sql.php + * + * @param ExecuteSqlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type int $timeoutMillis + * Timeout to use for this call. + * } + * + * @return ServerStream + * + * @throws ApiException Thrown if the API call fails. + */ + public function executeStreamingSql(ExecuteSqlRequest $request, array $callOptions = []): ServerStream + { + return $this->startApiCall('ExecuteStreamingSql', $request, $callOptions); + } + + /** + * Gets a session. Returns `NOT_FOUND` if the session does not exist. + * This is mainly useful for determining whether a session is still + * alive. + * + * The async variant is {@see SpannerClient::getSessionAsync()} . + * + * @example samples/V1/SpannerClient/get_session.php + * + * @param GetSessionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Session + * + * @throws ApiException Thrown if the API call fails. + */ + public function getSession(GetSessionRequest $request, array $callOptions = []): Session + { + return $this->startApiCall('GetSession', $request, $callOptions)->wait(); + } + + /** + * Lists all sessions in a given database. + * + * The async variant is {@see SpannerClient::listSessionsAsync()} . + * + * @example samples/V1/SpannerClient/list_sessions.php + * + * @param ListSessionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listSessions(ListSessionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListSessions', $request, $callOptions); + } + + /** + * Creates a set of partition tokens that can be used to execute a query + * operation in parallel. Each of the returned partition tokens can be used + * by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to + * specify a subset of the query result to read. The same session and + * read-only transaction must be used by the PartitionQueryRequest used to + * create the partition tokens and the ExecuteSqlRequests that use the + * partition tokens. + * + * Partition tokens become invalid when the session used to create them + * is deleted, is idle for too long, begins a new transaction, or becomes too + * old. When any of these happen, it is not possible to resume the query, and + * the whole operation must be restarted from the beginning. + * + * The async variant is {@see SpannerClient::partitionQueryAsync()} . + * + * @example samples/V1/SpannerClient/partition_query.php + * + * @param PartitionQueryRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PartitionResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function partitionQuery(PartitionQueryRequest $request, array $callOptions = []): PartitionResponse + { + return $this->startApiCall('PartitionQuery', $request, $callOptions)->wait(); + } + + /** + * Creates a set of partition tokens that can be used to execute a read + * operation in parallel. Each of the returned partition tokens can be used + * by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a + * subset of the read result to read. The same session and read-only + * transaction must be used by the PartitionReadRequest used to create the + * partition tokens and the ReadRequests that use the partition tokens. There + * are no ordering guarantees on rows returned among the returned partition + * tokens, or even within each individual StreamingRead call issued with a + * partition_token. + * + * Partition tokens become invalid when the session used to create them + * is deleted, is idle for too long, begins a new transaction, or becomes too + * old. When any of these happen, it is not possible to resume the read, and + * the whole operation must be restarted from the beginning. + * + * The async variant is {@see SpannerClient::partitionReadAsync()} . + * + * @example samples/V1/SpannerClient/partition_read.php + * + * @param PartitionReadRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PartitionResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function partitionRead(PartitionReadRequest $request, array $callOptions = []): PartitionResponse + { + return $this->startApiCall('PartitionRead', $request, $callOptions)->wait(); + } + + /** + * Reads rows from the database using key lookups and scans, as a + * simple key/value style alternative to + * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be + * used to return a result set larger than 10 MiB; if the read matches more + * data than that, the read fails with a `FAILED_PRECONDITION` + * error. + * + * Reads inside read-write transactions might return `ABORTED`. If + * this occurs, the application should restart the transaction from + * the beginning. See [Transaction][google.spanner.v1.Transaction] for more + * details. + * + * Larger result sets can be yielded in streaming fashion by calling + * [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead. + * + * The async variant is {@see SpannerClient::readAsync()} . + * + * @example samples/V1/SpannerClient/read.php + * + * @param ReadRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ResultSet + * + * @throws ApiException Thrown if the API call fails. + */ + public function read(ReadRequest $request, array $callOptions = []): ResultSet + { + return $this->startApiCall('Read', $request, $callOptions)->wait(); + } + + /** + * Rolls back a transaction, releasing any locks it holds. It is a good + * idea to call this for any transaction that includes one or more + * [Read][google.spanner.v1.Spanner.Read] or + * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and ultimately + * decides not to commit. + * + * `Rollback` returns `OK` if it successfully aborts the transaction, the + * transaction was already aborted, or the transaction is not + * found. `Rollback` never returns `ABORTED`. + * + * The async variant is {@see SpannerClient::rollbackAsync()} . + * + * @example samples/V1/SpannerClient/rollback.php + * + * @param RollbackRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function rollback(RollbackRequest $request, array $callOptions = []): void + { + $this->startApiCall('Rollback', $request, $callOptions)->wait(); + } + + /** + * Like [Read][google.spanner.v1.Spanner.Read], except returns the result set + * as a stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no + * limit on the size of the returned result set. However, no individual row in + * the result set can exceed 100 MiB, and no column value can exceed + * 10 MiB. + * + * @example samples/V1/SpannerClient/streaming_read.php + * + * @param ReadRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type int $timeoutMillis + * Timeout to use for this call. + * } + * + * @return ServerStream + * + * @throws ApiException Thrown if the API call fails. + */ + public function streamingRead(ReadRequest $request, array $callOptions = []): ServerStream + { + return $this->startApiCall('StreamingRead', $request, $callOptions); + } + + /** Configure the gapic configuration to use a service emulator. */ + private function setDefaultEmulatorConfig(array $options): array + { + $emulatorHost = getenv('SPANNER_EMULATOR_HOST'); + if (empty($emulatorHost)) { + return $options; + } + + if ($scheme = parse_url($emulatorHost, PHP_URL_SCHEME)) { + $search = $scheme . '://'; + $emulatorHost = str_replace($search, '', $emulatorHost); + } + + $options['apiEndpoint'] ??= $emulatorHost; + $options['transportConfig']['grpc']['stubOpts']['credentials'] ??= ChannelCredentials::createInsecure(); + $options['credentials'] ??= new InsecureCredentialsWrapper(); + return $options; + } +} diff --git a/owl-bot-staging/Spanner/v1/src/V1/Gapic/SpannerGapicClient.php b/owl-bot-staging/Spanner/v1/src/V1/Gapic/SpannerGapicClient.php new file mode 100644 index 000000000000..836e5478470b --- /dev/null +++ b/owl-bot-staging/Spanner/v1/src/V1/Gapic/SpannerGapicClient.php @@ -0,0 +1,1919 @@ +databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + * $sessionCount = 0; + * $response = $spannerClient->batchCreateSessions($formattedDatabase, $sessionCount); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\Spanner\V1\Client\SpannerClient}. + */ +class SpannerGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.spanner.v1.Spanner'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'spanner.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'spanner.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/spanner.data', + ]; + + private static $databaseNameTemplate; + + private static $sessionNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/spanner_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/spanner_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/spanner_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/spanner_rest_client_config.php', + ], + ], + ]; + } + + private static function getDatabaseNameTemplate() + { + if (self::$databaseNameTemplate == null) { + self::$databaseNameTemplate = new PathTemplate('projects/{project}/instances/{instance}/databases/{database}'); + } + + return self::$databaseNameTemplate; + } + + private static function getSessionNameTemplate() + { + if (self::$sessionNameTemplate == null) { + self::$sessionNameTemplate = new PathTemplate('projects/{project}/instances/{instance}/databases/{database}/sessions/{session}'); + } + + return self::$sessionNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'database' => self::getDatabaseNameTemplate(), + 'session' => self::getSessionNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a database + * resource. + * + * @param string $project + * @param string $instance + * @param string $database + * + * @return string The formatted database resource. + */ + public static function databaseName($project, $instance, $database) + { + return self::getDatabaseNameTemplate()->render([ + 'project' => $project, + 'instance' => $instance, + 'database' => $database, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a session + * resource. + * + * @param string $project + * @param string $instance + * @param string $database + * @param string $session + * + * @return string The formatted session resource. + */ + public static function sessionName($project, $instance, $database, $session) + { + return self::getSessionNameTemplate()->render([ + 'project' => $project, + 'instance' => $instance, + 'database' => $database, + 'session' => $session, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - database: projects/{project}/instances/{instance}/databases/{database} + * - session: projects/{project}/instances/{instance}/databases/{database}/sessions/{session} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'spanner.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Creates multiple new sessions. + * + * This API can be used to initialize a session cache on the clients. + * See https://goo.gl/TgSFN2 for best practices on session cache management. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedDatabase = $spannerClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + * $sessionCount = 0; + * $response = $spannerClient->batchCreateSessions($formattedDatabase, $sessionCount); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $database Required. The database in which the new sessions are created. + * @param int $sessionCount Required. The number of sessions to be created in this batch call. + * The API may return fewer than the requested number of sessions. If a + * specific number of sessions are desired, the client can make additional + * calls to BatchCreateSessions (adjusting + * [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count] + * as necessary). + * @param array $optionalArgs { + * Optional. + * + * @type Session $sessionTemplate + * Parameters to be applied to each created session. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\V1\BatchCreateSessionsResponse + * + * @throws ApiException if the remote call fails + */ + public function batchCreateSessions($database, $sessionCount, array $optionalArgs = []) + { + $request = new BatchCreateSessionsRequest(); + $requestParamHeaders = []; + $request->setDatabase($database); + $request->setSessionCount($sessionCount); + $requestParamHeaders['database'] = $database; + if (isset($optionalArgs['sessionTemplate'])) { + $request->setSessionTemplate($optionalArgs['sessionTemplate']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('BatchCreateSessions', BatchCreateSessionsResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Batches the supplied mutation groups in a collection of efficient + * transactions. All mutations in a group are committed atomically. However, + * mutations across groups can be committed non-atomically in an unspecified + * order and thus, they must be independent of each other. Partial failure is + * possible, i.e., some groups may have been committed successfully, while + * some may have failed. The results of individual batches are streamed into + * the response as the batches are applied. + * + * BatchWrite requests are not replay protected, meaning that each mutation + * group may be applied more than once. Replays of non-idempotent mutations + * may have undesirable effects. For example, replays of an insert mutation + * may produce an already exists error or if you use generated or commit + * timestamp-based keys, it may result in additional rows being added to the + * mutation's table. We recommend structuring your mutation groups to be + * idempotent to avoid this issue. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $mutationGroups = []; + * // Read all responses until the stream is complete + * $stream = $spannerClient->batchWrite($formattedSession, $mutationGroups); + * foreach ($stream->readAll() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $session Required. The session in which the batch request is to be run. + * @param MutationGroup[] $mutationGroups Required. The groups of mutations to be applied. + * @param array $optionalArgs { + * Optional. + * + * @type RequestOptions $requestOptions + * Common options for this request. + * @type bool $excludeTxnFromChangeStreams + * Optional. When `exclude_txn_from_change_streams` is set to `true`: + * * Mutations from all transactions in this batch write operation will not + * be recorded in change streams with DDL option `allow_txn_exclusion=true` + * that are tracking columns modified by these transactions. + * * Mutations from all transactions in this batch write operation will be + * recorded in change streams with DDL option `allow_txn_exclusion=false or + * not set` that are tracking columns modified by these transactions. + * + * When `exclude_txn_from_change_streams` is set to `false` or not set, + * mutations from all transactions in this batch write operation will be + * recorded in all change streams that are tracking columns modified by these + * transactions. + * @type int $timeoutMillis + * Timeout to use for this call. + * } + * + * @return \Google\ApiCore\ServerStream + * + * @throws ApiException if the remote call fails + */ + public function batchWrite($session, $mutationGroups, array $optionalArgs = []) + { + $request = new BatchWriteRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setMutationGroups($mutationGroups); + $requestParamHeaders['session'] = $session; + if (isset($optionalArgs['requestOptions'])) { + $request->setRequestOptions($optionalArgs['requestOptions']); + } + + if (isset($optionalArgs['excludeTxnFromChangeStreams'])) { + $request->setExcludeTxnFromChangeStreams($optionalArgs['excludeTxnFromChangeStreams']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('BatchWrite', BatchWriteResponse::class, $optionalArgs, $request, Call::SERVER_STREAMING_CALL); + } + + /** + * Begins a new transaction. This step can often be skipped: + * [Read][google.spanner.v1.Spanner.Read], + * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and + * [Commit][google.spanner.v1.Spanner.Commit] can begin a new transaction as a + * side-effect. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $options = new TransactionOptions(); + * $response = $spannerClient->beginTransaction($formattedSession, $options); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $session Required. The session in which the transaction runs. + * @param TransactionOptions $options Required. Options for the new transaction. + * @param array $optionalArgs { + * Optional. + * + * @type RequestOptions $requestOptions + * Common options for this request. + * Priority is ignored for this request. Setting the priority in this + * request_options struct will not do anything. To set the priority for a + * transaction, set it on the reads and writes that are part of this + * transaction instead. + * @type Mutation $mutationKey + * Optional. Required for read-write transactions on a multiplexed session + * that commit mutations but do not perform any reads or queries. Clients + * should randomly select one of the mutations from the mutation set and send + * it as a part of this request. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\V1\Transaction + * + * @throws ApiException if the remote call fails + */ + public function beginTransaction($session, $options, array $optionalArgs = []) + { + $request = new BeginTransactionRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setOptions($options); + $requestParamHeaders['session'] = $session; + if (isset($optionalArgs['requestOptions'])) { + $request->setRequestOptions($optionalArgs['requestOptions']); + } + + if (isset($optionalArgs['mutationKey'])) { + $request->setMutationKey($optionalArgs['mutationKey']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('BeginTransaction', Transaction::class, $optionalArgs, $request)->wait(); + } + + /** + * Commits a transaction. The request includes the mutations to be + * applied to rows in the database. + * + * `Commit` might return an `ABORTED` error. This can occur at any time; + * commonly, the cause is conflicts with concurrent + * transactions. However, it can also happen for a variety of other + * reasons. If `Commit` returns `ABORTED`, the caller should re-attempt + * the transaction from the beginning, re-using the same session. + * + * On very rare occasions, `Commit` might return `UNKNOWN`. This can happen, + * for example, if the client job experiences a 1+ hour networking failure. + * At that point, Cloud Spanner has lost track of the transaction outcome and + * we recommend that you perform another read from the database to see the + * state of things as they are now. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $mutations = []; + * $response = $spannerClient->commit($formattedSession, $mutations); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $session Required. The session in which the transaction to be committed is running. + * @param Mutation[] $mutations The mutations to be executed when this transaction commits. All + * mutations are applied atomically, in the order they appear in + * this list. + * @param array $optionalArgs { + * Optional. + * + * @type string $transactionId + * Commit a previously-started transaction. + * @type TransactionOptions $singleUseTransaction + * Execute mutations in a temporary transaction. Note that unlike + * commit of a previously-started transaction, commit with a + * temporary transaction is non-idempotent. That is, if the + * `CommitRequest` is sent to Cloud Spanner more than once (for + * instance, due to retries in the application, or in the + * transport library), it is possible that the mutations are + * executed more than once. If this is undesirable, use + * [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction] and + * [Commit][google.spanner.v1.Spanner.Commit] instead. + * @type bool $returnCommitStats + * If `true`, then statistics related to the transaction will be included in + * the [CommitResponse][google.spanner.v1.CommitResponse.commit_stats]. + * Default value is `false`. + * @type Duration $maxCommitDelay + * Optional. The amount of latency this request is willing to incur in order + * to improve throughput. If this field is not set, Spanner assumes requests + * are relatively latency sensitive and automatically determines an + * appropriate delay time. You can specify a batching delay value between 0 + * and 500 ms. + * @type RequestOptions $requestOptions + * Common options for this request. + * @type MultiplexedSessionPrecommitToken $precommitToken + * Optional. If the read-write transaction was executed on a multiplexed + * session, the precommit token with the highest sequence number received in + * this transaction attempt, should be included here. Failing to do so will + * result in a FailedPrecondition error. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\V1\CommitResponse + * + * @throws ApiException if the remote call fails + */ + public function commit($session, $mutations, array $optionalArgs = []) + { + $request = new CommitRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setMutations($mutations); + $requestParamHeaders['session'] = $session; + if (isset($optionalArgs['transactionId'])) { + $request->setTransactionId($optionalArgs['transactionId']); + } + + if (isset($optionalArgs['singleUseTransaction'])) { + $request->setSingleUseTransaction($optionalArgs['singleUseTransaction']); + } + + if (isset($optionalArgs['returnCommitStats'])) { + $request->setReturnCommitStats($optionalArgs['returnCommitStats']); + } + + if (isset($optionalArgs['maxCommitDelay'])) { + $request->setMaxCommitDelay($optionalArgs['maxCommitDelay']); + } + + if (isset($optionalArgs['requestOptions'])) { + $request->setRequestOptions($optionalArgs['requestOptions']); + } + + if (isset($optionalArgs['precommitToken'])) { + $request->setPrecommitToken($optionalArgs['precommitToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('Commit', CommitResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a new session. A session can be used to perform + * transactions that read and/or modify data in a Cloud Spanner database. + * Sessions are meant to be reused for many consecutive + * transactions. + * + * Sessions can only execute one transaction at a time. To execute + * multiple concurrent read-write/write-only transactions, create + * multiple sessions. Note that standalone reads and queries use a + * transaction internally, and count toward the one transaction + * limit. + * + * Active sessions use additional server resources, so it is a good idea to + * delete idle and unneeded sessions. + * Aside from explicit deletes, Cloud Spanner may delete sessions for which no + * operations are sent for more than an hour. If a session is deleted, + * requests to it return `NOT_FOUND`. + * + * Idle sessions can be kept alive by sending a trivial SQL query + * periodically, e.g., `"SELECT 1"`. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedDatabase = $spannerClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + * $response = $spannerClient->createSession($formattedDatabase); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $database Required. The database in which the new session is created. + * @param array $optionalArgs { + * Optional. + * + * @type Session $session + * Required. The session to create. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\V1\Session + * + * @throws ApiException if the remote call fails + */ + public function createSession($database, array $optionalArgs = []) + { + $request = new CreateSessionRequest(); + $requestParamHeaders = []; + $request->setDatabase($database); + $requestParamHeaders['database'] = $database; + if (isset($optionalArgs['session'])) { + $request->setSession($optionalArgs['session']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateSession', Session::class, $optionalArgs, $request)->wait(); + } + + /** + * Ends a session, releasing server resources associated with it. This will + * asynchronously trigger cancellation of any operations that are running with + * this session. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedName = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $spannerClient->deleteSession($formattedName); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the session to delete. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteSession($name, array $optionalArgs = []) + { + $request = new DeleteSessionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteSession', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Executes a batch of SQL DML statements. This method allows many statements + * to be run with lower latency than submitting them sequentially with + * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. + * + * Statements are executed in sequential order. A request can succeed even if + * a statement fails. The + * [ExecuteBatchDmlResponse.status][google.spanner.v1.ExecuteBatchDmlResponse.status] + * field in the response provides information about the statement that failed. + * Clients must inspect this field to determine whether an error occurred. + * + * Execution stops after the first failed statement; the remaining statements + * are not executed. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $transaction = new TransactionSelector(); + * $statements = []; + * $seqno = 0; + * $response = $spannerClient->executeBatchDml($formattedSession, $transaction, $statements, $seqno); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $session Required. The session in which the DML statements should be performed. + * @param TransactionSelector $transaction Required. The transaction to use. Must be a read-write transaction. + * + * To protect against replays, single-use transactions are not supported. The + * caller must either supply an existing transaction ID or begin a new + * transaction. + * @param Statement[] $statements Required. The list of statements to execute in this batch. Statements are + * executed serially, such that the effects of statement `i` are visible to + * statement `i+1`. Each statement must be a DML statement. Execution stops at + * the first failed statement; the remaining statements are not executed. + * + * Callers must provide at least one statement. + * @param int $seqno Required. A per-transaction sequence number used to identify this request. + * This field makes each request idempotent such that if the request is + * received multiple times, at most one will succeed. + * + * The sequence number must be monotonically increasing within the + * transaction. If a request arrives for the first time with an out-of-order + * sequence number, the transaction may be aborted. Replays of previously + * handled requests will yield the same response as the first execution. + * @param array $optionalArgs { + * Optional. + * + * @type RequestOptions $requestOptions + * Common options for this request. + * @type bool $lastStatements + * Optional. If set to true, this request marks the end of the transaction. + * The transaction should be committed or aborted after these statements + * execute, and attempts to execute any other requests against this + * transaction (including reads and queries) will be rejected. + * + * Setting this option may cause some error reporting to be deferred until + * commit time (e.g. validation of unique constraints). Given this, successful + * execution of statements should not be assumed until a subsequent Commit + * call completes successfully. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\V1\ExecuteBatchDmlResponse + * + * @throws ApiException if the remote call fails + */ + public function executeBatchDml($session, $transaction, $statements, $seqno, array $optionalArgs = []) + { + $request = new ExecuteBatchDmlRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setTransaction($transaction); + $request->setStatements($statements); + $request->setSeqno($seqno); + $requestParamHeaders['session'] = $session; + if (isset($optionalArgs['requestOptions'])) { + $request->setRequestOptions($optionalArgs['requestOptions']); + } + + if (isset($optionalArgs['lastStatements'])) { + $request->setLastStatements($optionalArgs['lastStatements']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ExecuteBatchDml', ExecuteBatchDmlResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Executes an SQL statement, returning all results in a single reply. This + * method cannot be used to return a result set larger than 10 MiB; + * if the query yields more data than that, the query fails with + * a `FAILED_PRECONDITION` error. + * + * Operations inside read-write transactions might return `ABORTED`. If + * this occurs, the application should restart the transaction from + * the beginning. See [Transaction][google.spanner.v1.Transaction] for more + * details. + * + * Larger result sets can be fetched in streaming fashion by calling + * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] + * instead. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $sql = 'sql'; + * $response = $spannerClient->executeSql($formattedSession, $sql); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $session Required. The session in which the SQL query should be performed. + * @param string $sql Required. The SQL string. + * @param array $optionalArgs { + * Optional. + * + * @type TransactionSelector $transaction + * The transaction to use. + * + * For queries, if none is provided, the default is a temporary read-only + * transaction with strong concurrency. + * + * Standard DML statements require a read-write transaction. To protect + * against replays, single-use transactions are not supported. The caller + * must either supply an existing transaction ID or begin a new transaction. + * + * Partitioned DML requires an existing Partitioned DML transaction ID. + * @type Struct $params + * Parameter names and values that bind to placeholders in the SQL string. + * + * A parameter placeholder consists of the `@` character followed by the + * parameter name (for example, `@firstName`). Parameter names must conform + * to the naming requirements of identifiers as specified at + * https://cloud.google.com/spanner/docs/lexical#identifiers. + * + * Parameters can appear anywhere that a literal value is expected. The same + * parameter name can be used more than once, for example: + * + * `"WHERE id > @msg_id AND id < @msg_id + 100"` + * + * It is an error to execute a SQL statement with unbound parameters. + * @type array $paramTypes + * It is not always possible for Cloud Spanner to infer the right SQL type + * from a JSON value. For example, values of type `BYTES` and values + * of type `STRING` both appear in + * [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings. + * + * In these cases, `param_types` can be used to specify the exact + * SQL type for some or all of the SQL statement parameters. See the + * definition of [Type][google.spanner.v1.Type] for more information + * about SQL types. + * @type string $resumeToken + * If this request is resuming a previously interrupted SQL statement + * execution, `resume_token` should be copied from the last + * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the + * interruption. Doing this enables the new SQL statement execution to resume + * where the last one left off. The rest of the request parameters must + * exactly match the request that yielded this token. + * @type int $queryMode + * Used to control the amount of debugging information returned in + * [ResultSetStats][google.spanner.v1.ResultSetStats]. If + * [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is + * set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only + * be set to + * [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL]. + * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryMode} + * @type string $partitionToken + * If present, results will be restricted to the specified partition + * previously created using PartitionQuery(). There must be an exact + * match for the values of fields common to this message and the + * PartitionQueryRequest message used to create this partition_token. + * @type int $seqno + * A per-transaction sequence number used to identify this request. This field + * makes each request idempotent such that if the request is received multiple + * times, at most one will succeed. + * + * The sequence number must be monotonically increasing within the + * transaction. If a request arrives for the first time with an out-of-order + * sequence number, the transaction may be aborted. Replays of previously + * handled requests will yield the same response as the first execution. + * + * Required for DML statements. Ignored for queries. + * @type QueryOptions $queryOptions + * Query optimizer configuration to use for the given query. + * @type RequestOptions $requestOptions + * Common options for this request. + * @type DirectedReadOptions $directedReadOptions + * Directed read options for this request. + * @type bool $dataBoostEnabled + * If this is for a partitioned query and this field is set to `true`, the + * request is executed with Spanner Data Boost independent compute resources. + * + * If the field is set to `true` but the request does not set + * `partition_token`, the API returns an `INVALID_ARGUMENT` error. + * @type bool $lastStatement + * Optional. If set to true, this statement marks the end of the transaction. + * The transaction should be committed or aborted after this statement + * executes, and attempts to execute any other requests against this + * transaction (including reads and queries) will be rejected. + * + * For DML statements, setting this option may cause some error reporting to + * be deferred until commit time (e.g. validation of unique constraints). + * Given this, successful execution of a DML statement should not be assumed + * until a subsequent Commit call completes successfully. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\V1\ResultSet + * + * @throws ApiException if the remote call fails + */ + public function executeSql($session, $sql, array $optionalArgs = []) + { + $request = new ExecuteSqlRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setSql($sql); + $requestParamHeaders['session'] = $session; + if (isset($optionalArgs['transaction'])) { + $request->setTransaction($optionalArgs['transaction']); + } + + if (isset($optionalArgs['params'])) { + $request->setParams($optionalArgs['params']); + } + + if (isset($optionalArgs['paramTypes'])) { + $request->setParamTypes($optionalArgs['paramTypes']); + } + + if (isset($optionalArgs['resumeToken'])) { + $request->setResumeToken($optionalArgs['resumeToken']); + } + + if (isset($optionalArgs['queryMode'])) { + $request->setQueryMode($optionalArgs['queryMode']); + } + + if (isset($optionalArgs['partitionToken'])) { + $request->setPartitionToken($optionalArgs['partitionToken']); + } + + if (isset($optionalArgs['seqno'])) { + $request->setSeqno($optionalArgs['seqno']); + } + + if (isset($optionalArgs['queryOptions'])) { + $request->setQueryOptions($optionalArgs['queryOptions']); + } + + if (isset($optionalArgs['requestOptions'])) { + $request->setRequestOptions($optionalArgs['requestOptions']); + } + + if (isset($optionalArgs['directedReadOptions'])) { + $request->setDirectedReadOptions($optionalArgs['directedReadOptions']); + } + + if (isset($optionalArgs['dataBoostEnabled'])) { + $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']); + } + + if (isset($optionalArgs['lastStatement'])) { + $request->setLastStatement($optionalArgs['lastStatement']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ExecuteSql', ResultSet::class, $optionalArgs, $request)->wait(); + } + + /** + * Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the + * result set as a stream. Unlike + * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there is no limit on + * the size of the returned result set. However, no individual row in the + * result set can exceed 100 MiB, and no column value can exceed 10 MiB. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $sql = 'sql'; + * // Read all responses until the stream is complete + * $stream = $spannerClient->executeStreamingSql($formattedSession, $sql); + * foreach ($stream->readAll() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $session Required. The session in which the SQL query should be performed. + * @param string $sql Required. The SQL string. + * @param array $optionalArgs { + * Optional. + * + * @type TransactionSelector $transaction + * The transaction to use. + * + * For queries, if none is provided, the default is a temporary read-only + * transaction with strong concurrency. + * + * Standard DML statements require a read-write transaction. To protect + * against replays, single-use transactions are not supported. The caller + * must either supply an existing transaction ID or begin a new transaction. + * + * Partitioned DML requires an existing Partitioned DML transaction ID. + * @type Struct $params + * Parameter names and values that bind to placeholders in the SQL string. + * + * A parameter placeholder consists of the `@` character followed by the + * parameter name (for example, `@firstName`). Parameter names must conform + * to the naming requirements of identifiers as specified at + * https://cloud.google.com/spanner/docs/lexical#identifiers. + * + * Parameters can appear anywhere that a literal value is expected. The same + * parameter name can be used more than once, for example: + * + * `"WHERE id > @msg_id AND id < @msg_id + 100"` + * + * It is an error to execute a SQL statement with unbound parameters. + * @type array $paramTypes + * It is not always possible for Cloud Spanner to infer the right SQL type + * from a JSON value. For example, values of type `BYTES` and values + * of type `STRING` both appear in + * [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings. + * + * In these cases, `param_types` can be used to specify the exact + * SQL type for some or all of the SQL statement parameters. See the + * definition of [Type][google.spanner.v1.Type] for more information + * about SQL types. + * @type string $resumeToken + * If this request is resuming a previously interrupted SQL statement + * execution, `resume_token` should be copied from the last + * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the + * interruption. Doing this enables the new SQL statement execution to resume + * where the last one left off. The rest of the request parameters must + * exactly match the request that yielded this token. + * @type int $queryMode + * Used to control the amount of debugging information returned in + * [ResultSetStats][google.spanner.v1.ResultSetStats]. If + * [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is + * set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only + * be set to + * [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL]. + * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryMode} + * @type string $partitionToken + * If present, results will be restricted to the specified partition + * previously created using PartitionQuery(). There must be an exact + * match for the values of fields common to this message and the + * PartitionQueryRequest message used to create this partition_token. + * @type int $seqno + * A per-transaction sequence number used to identify this request. This field + * makes each request idempotent such that if the request is received multiple + * times, at most one will succeed. + * + * The sequence number must be monotonically increasing within the + * transaction. If a request arrives for the first time with an out-of-order + * sequence number, the transaction may be aborted. Replays of previously + * handled requests will yield the same response as the first execution. + * + * Required for DML statements. Ignored for queries. + * @type QueryOptions $queryOptions + * Query optimizer configuration to use for the given query. + * @type RequestOptions $requestOptions + * Common options for this request. + * @type DirectedReadOptions $directedReadOptions + * Directed read options for this request. + * @type bool $dataBoostEnabled + * If this is for a partitioned query and this field is set to `true`, the + * request is executed with Spanner Data Boost independent compute resources. + * + * If the field is set to `true` but the request does not set + * `partition_token`, the API returns an `INVALID_ARGUMENT` error. + * @type bool $lastStatement + * Optional. If set to true, this statement marks the end of the transaction. + * The transaction should be committed or aborted after this statement + * executes, and attempts to execute any other requests against this + * transaction (including reads and queries) will be rejected. + * + * For DML statements, setting this option may cause some error reporting to + * be deferred until commit time (e.g. validation of unique constraints). + * Given this, successful execution of a DML statement should not be assumed + * until a subsequent Commit call completes successfully. + * @type int $timeoutMillis + * Timeout to use for this call. + * } + * + * @return \Google\ApiCore\ServerStream + * + * @throws ApiException if the remote call fails + */ + public function executeStreamingSql($session, $sql, array $optionalArgs = []) + { + $request = new ExecuteSqlRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setSql($sql); + $requestParamHeaders['session'] = $session; + if (isset($optionalArgs['transaction'])) { + $request->setTransaction($optionalArgs['transaction']); + } + + if (isset($optionalArgs['params'])) { + $request->setParams($optionalArgs['params']); + } + + if (isset($optionalArgs['paramTypes'])) { + $request->setParamTypes($optionalArgs['paramTypes']); + } + + if (isset($optionalArgs['resumeToken'])) { + $request->setResumeToken($optionalArgs['resumeToken']); + } + + if (isset($optionalArgs['queryMode'])) { + $request->setQueryMode($optionalArgs['queryMode']); + } + + if (isset($optionalArgs['partitionToken'])) { + $request->setPartitionToken($optionalArgs['partitionToken']); + } + + if (isset($optionalArgs['seqno'])) { + $request->setSeqno($optionalArgs['seqno']); + } + + if (isset($optionalArgs['queryOptions'])) { + $request->setQueryOptions($optionalArgs['queryOptions']); + } + + if (isset($optionalArgs['requestOptions'])) { + $request->setRequestOptions($optionalArgs['requestOptions']); + } + + if (isset($optionalArgs['directedReadOptions'])) { + $request->setDirectedReadOptions($optionalArgs['directedReadOptions']); + } + + if (isset($optionalArgs['dataBoostEnabled'])) { + $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']); + } + + if (isset($optionalArgs['lastStatement'])) { + $request->setLastStatement($optionalArgs['lastStatement']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ExecuteStreamingSql', PartialResultSet::class, $optionalArgs, $request, Call::SERVER_STREAMING_CALL); + } + + /** + * Gets a session. Returns `NOT_FOUND` if the session does not exist. + * This is mainly useful for determining whether a session is still + * alive. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedName = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $response = $spannerClient->getSession($formattedName); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the session to retrieve. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\V1\Session + * + * @throws ApiException if the remote call fails + */ + public function getSession($name, array $optionalArgs = []) + { + $request = new GetSessionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetSession', Session::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists all sessions in a given database. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedDatabase = $spannerClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + * // Iterate over pages of elements + * $pagedResponse = $spannerClient->listSessions($formattedDatabase); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $spannerClient->listSessions($formattedDatabase); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $database Required. The database in which to list sessions. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * + * * `labels.key` where key is the name of a label + * + * Some examples of using filters are: + * + * * `labels.env:*` --> The session has the label "env". + * * `labels.env:dev` --> The session has the label "env" and the value of + * the label contains the string "dev". + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listSessions($database, array $optionalArgs = []) + { + $request = new ListSessionsRequest(); + $requestParamHeaders = []; + $request->setDatabase($database); + $requestParamHeaders['database'] = $database; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListSessions', $optionalArgs, ListSessionsResponse::class, $request); + } + + /** + * Creates a set of partition tokens that can be used to execute a query + * operation in parallel. Each of the returned partition tokens can be used + * by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to + * specify a subset of the query result to read. The same session and + * read-only transaction must be used by the PartitionQueryRequest used to + * create the partition tokens and the ExecuteSqlRequests that use the + * partition tokens. + * + * Partition tokens become invalid when the session used to create them + * is deleted, is idle for too long, begins a new transaction, or becomes too + * old. When any of these happen, it is not possible to resume the query, and + * the whole operation must be restarted from the beginning. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $sql = 'sql'; + * $response = $spannerClient->partitionQuery($formattedSession, $sql); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $session Required. The session used to create the partitions. + * @param string $sql Required. The query request to generate partitions for. The request will + * fail if the query is not root partitionable. For a query to be root + * partitionable, it needs to satisfy a few conditions. For example, if the + * query execution plan contains a distributed union operator, then it must be + * the first operator in the plan. For more information about other + * conditions, see [Read data in + * parallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel). + * + * The query request must not contain DML commands, such as INSERT, UPDATE, or + * DELETE. Use + * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] with a + * PartitionedDml transaction for large, partition-friendly DML operations. + * @param array $optionalArgs { + * Optional. + * + * @type TransactionSelector $transaction + * Read only snapshot transactions are supported, read/write and single use + * transactions are not. + * @type Struct $params + * Parameter names and values that bind to placeholders in the SQL string. + * + * A parameter placeholder consists of the `@` character followed by the + * parameter name (for example, `@firstName`). Parameter names can contain + * letters, numbers, and underscores. + * + * Parameters can appear anywhere that a literal value is expected. The same + * parameter name can be used more than once, for example: + * + * `"WHERE id > @msg_id AND id < @msg_id + 100"` + * + * It is an error to execute a SQL statement with unbound parameters. + * @type array $paramTypes + * It is not always possible for Cloud Spanner to infer the right SQL type + * from a JSON value. For example, values of type `BYTES` and values + * of type `STRING` both appear in + * [params][google.spanner.v1.PartitionQueryRequest.params] as JSON strings. + * + * In these cases, `param_types` can be used to specify the exact + * SQL type for some or all of the SQL query parameters. See the + * definition of [Type][google.spanner.v1.Type] for more information + * about SQL types. + * @type PartitionOptions $partitionOptions + * Additional options that affect how many partitions are created. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\V1\PartitionResponse + * + * @throws ApiException if the remote call fails + */ + public function partitionQuery($session, $sql, array $optionalArgs = []) + { + $request = new PartitionQueryRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setSql($sql); + $requestParamHeaders['session'] = $session; + if (isset($optionalArgs['transaction'])) { + $request->setTransaction($optionalArgs['transaction']); + } + + if (isset($optionalArgs['params'])) { + $request->setParams($optionalArgs['params']); + } + + if (isset($optionalArgs['paramTypes'])) { + $request->setParamTypes($optionalArgs['paramTypes']); + } + + if (isset($optionalArgs['partitionOptions'])) { + $request->setPartitionOptions($optionalArgs['partitionOptions']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('PartitionQuery', PartitionResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a set of partition tokens that can be used to execute a read + * operation in parallel. Each of the returned partition tokens can be used + * by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a + * subset of the read result to read. The same session and read-only + * transaction must be used by the PartitionReadRequest used to create the + * partition tokens and the ReadRequests that use the partition tokens. There + * are no ordering guarantees on rows returned among the returned partition + * tokens, or even within each individual StreamingRead call issued with a + * partition_token. + * + * Partition tokens become invalid when the session used to create them + * is deleted, is idle for too long, begins a new transaction, or becomes too + * old. When any of these happen, it is not possible to resume the read, and + * the whole operation must be restarted from the beginning. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $table = 'table'; + * $keySet = new KeySet(); + * $response = $spannerClient->partitionRead($formattedSession, $table, $keySet); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $session Required. The session used to create the partitions. + * @param string $table Required. The name of the table in the database to be read. + * @param KeySet $keySet Required. `key_set` identifies the rows to be yielded. `key_set` names the + * primary keys of the rows in + * [table][google.spanner.v1.PartitionReadRequest.table] to be yielded, unless + * [index][google.spanner.v1.PartitionReadRequest.index] is present. If + * [index][google.spanner.v1.PartitionReadRequest.index] is present, then + * [key_set][google.spanner.v1.PartitionReadRequest.key_set] instead names + * index keys in [index][google.spanner.v1.PartitionReadRequest.index]. + * + * It is not an error for the `key_set` to name rows that do not + * exist in the database. Read yields nothing for nonexistent rows. + * @param array $optionalArgs { + * Optional. + * + * @type TransactionSelector $transaction + * Read only snapshot transactions are supported, read/write and single use + * transactions are not. + * @type string $index + * If non-empty, the name of an index on + * [table][google.spanner.v1.PartitionReadRequest.table]. This index is used + * instead of the table primary key when interpreting + * [key_set][google.spanner.v1.PartitionReadRequest.key_set] and sorting + * result rows. See [key_set][google.spanner.v1.PartitionReadRequest.key_set] + * for further information. + * @type string[] $columns + * The columns of [table][google.spanner.v1.PartitionReadRequest.table] to be + * returned for each row matching this request. + * @type PartitionOptions $partitionOptions + * Additional options that affect how many partitions are created. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\V1\PartitionResponse + * + * @throws ApiException if the remote call fails + */ + public function partitionRead($session, $table, $keySet, array $optionalArgs = []) + { + $request = new PartitionReadRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setTable($table); + $request->setKeySet($keySet); + $requestParamHeaders['session'] = $session; + if (isset($optionalArgs['transaction'])) { + $request->setTransaction($optionalArgs['transaction']); + } + + if (isset($optionalArgs['index'])) { + $request->setIndex($optionalArgs['index']); + } + + if (isset($optionalArgs['columns'])) { + $request->setColumns($optionalArgs['columns']); + } + + if (isset($optionalArgs['partitionOptions'])) { + $request->setPartitionOptions($optionalArgs['partitionOptions']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('PartitionRead', PartitionResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Reads rows from the database using key lookups and scans, as a + * simple key/value style alternative to + * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be + * used to return a result set larger than 10 MiB; if the read matches more + * data than that, the read fails with a `FAILED_PRECONDITION` + * error. + * + * Reads inside read-write transactions might return `ABORTED`. If + * this occurs, the application should restart the transaction from + * the beginning. See [Transaction][google.spanner.v1.Transaction] for more + * details. + * + * Larger result sets can be yielded in streaming fashion by calling + * [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $table = 'table'; + * $columns = []; + * $keySet = new KeySet(); + * $response = $spannerClient->read($formattedSession, $table, $columns, $keySet); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $session Required. The session in which the read should be performed. + * @param string $table Required. The name of the table in the database to be read. + * @param string[] $columns Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be + * returned for each row matching this request. + * @param KeySet $keySet Required. `key_set` identifies the rows to be yielded. `key_set` names the + * primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to + * be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present. + * If [index][google.spanner.v1.ReadRequest.index] is present, then + * [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys + * in [index][google.spanner.v1.ReadRequest.index]. + * + * If the [partition_token][google.spanner.v1.ReadRequest.partition_token] + * field is empty, rows are yielded in table primary key order (if + * [index][google.spanner.v1.ReadRequest.index] is empty) or index key order + * (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the + * [partition_token][google.spanner.v1.ReadRequest.partition_token] field is + * not empty, rows will be yielded in an unspecified order. + * + * It is not an error for the `key_set` to name rows that do not + * exist in the database. Read yields nothing for nonexistent rows. + * @param array $optionalArgs { + * Optional. + * + * @type TransactionSelector $transaction + * The transaction to use. If none is provided, the default is a + * temporary read-only transaction with strong concurrency. + * @type string $index + * If non-empty, the name of an index on + * [table][google.spanner.v1.ReadRequest.table]. This index is used instead of + * the table primary key when interpreting + * [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows. + * See [key_set][google.spanner.v1.ReadRequest.key_set] for further + * information. + * @type int $limit + * If greater than zero, only the first `limit` rows are yielded. If `limit` + * is zero, the default is no limit. A limit cannot be specified if + * `partition_token` is set. + * @type string $resumeToken + * If this request is resuming a previously interrupted read, + * `resume_token` should be copied from the last + * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the + * interruption. Doing this enables the new read to resume where the last read + * left off. The rest of the request parameters must exactly match the request + * that yielded this token. + * @type string $partitionToken + * If present, results will be restricted to the specified partition + * previously created using PartitionRead(). There must be an exact + * match for the values of fields common to this message and the + * PartitionReadRequest message used to create this partition_token. + * @type RequestOptions $requestOptions + * Common options for this request. + * @type DirectedReadOptions $directedReadOptions + * Directed read options for this request. + * @type bool $dataBoostEnabled + * If this is for a partitioned read and this field is set to `true`, the + * request is executed with Spanner Data Boost independent compute resources. + * + * If the field is set to `true` but the request does not set + * `partition_token`, the API returns an `INVALID_ARGUMENT` error. + * @type int $orderBy + * Optional. Order for the returned rows. + * + * By default, Spanner will return result rows in primary key order except for + * PartitionRead requests. For applications that do not require rows to be + * returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting + * `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval, + * resulting in lower latencies in certain cases (e.g. bulk point lookups). + * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\OrderBy} + * @type int $lockHint + * Optional. Lock Hint for the request, it can only be used with read-write + * transactions. + * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\LockHint} + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\V1\ResultSet + * + * @throws ApiException if the remote call fails + */ + public function read($session, $table, $columns, $keySet, array $optionalArgs = []) + { + $request = new ReadRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setTable($table); + $request->setColumns($columns); + $request->setKeySet($keySet); + $requestParamHeaders['session'] = $session; + if (isset($optionalArgs['transaction'])) { + $request->setTransaction($optionalArgs['transaction']); + } + + if (isset($optionalArgs['index'])) { + $request->setIndex($optionalArgs['index']); + } + + if (isset($optionalArgs['limit'])) { + $request->setLimit($optionalArgs['limit']); + } + + if (isset($optionalArgs['resumeToken'])) { + $request->setResumeToken($optionalArgs['resumeToken']); + } + + if (isset($optionalArgs['partitionToken'])) { + $request->setPartitionToken($optionalArgs['partitionToken']); + } + + if (isset($optionalArgs['requestOptions'])) { + $request->setRequestOptions($optionalArgs['requestOptions']); + } + + if (isset($optionalArgs['directedReadOptions'])) { + $request->setDirectedReadOptions($optionalArgs['directedReadOptions']); + } + + if (isset($optionalArgs['dataBoostEnabled'])) { + $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + if (isset($optionalArgs['lockHint'])) { + $request->setLockHint($optionalArgs['lockHint']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('Read', ResultSet::class, $optionalArgs, $request)->wait(); + } + + /** + * Rolls back a transaction, releasing any locks it holds. It is a good + * idea to call this for any transaction that includes one or more + * [Read][google.spanner.v1.Spanner.Read] or + * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and ultimately + * decides not to commit. + * + * `Rollback` returns `OK` if it successfully aborts the transaction, the + * transaction was already aborted, or the transaction is not + * found. `Rollback` never returns `ABORTED`. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $transactionId = '...'; + * $spannerClient->rollback($formattedSession, $transactionId); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $session Required. The session in which the transaction to roll back is running. + * @param string $transactionId Required. The transaction to roll back. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function rollback($session, $transactionId, array $optionalArgs = []) + { + $request = new RollbackRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setTransactionId($transactionId); + $requestParamHeaders['session'] = $session; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('Rollback', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Like [Read][google.spanner.v1.Spanner.Read], except returns the result set + * as a stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no + * limit on the size of the returned result set. However, no individual row in + * the result set can exceed 100 MiB, and no column value can exceed + * 10 MiB. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $table = 'table'; + * $columns = []; + * $keySet = new KeySet(); + * // Read all responses until the stream is complete + * $stream = $spannerClient->streamingRead($formattedSession, $table, $columns, $keySet); + * foreach ($stream->readAll() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $session Required. The session in which the read should be performed. + * @param string $table Required. The name of the table in the database to be read. + * @param string[] $columns Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be + * returned for each row matching this request. + * @param KeySet $keySet Required. `key_set` identifies the rows to be yielded. `key_set` names the + * primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to + * be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present. + * If [index][google.spanner.v1.ReadRequest.index] is present, then + * [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys + * in [index][google.spanner.v1.ReadRequest.index]. + * + * If the [partition_token][google.spanner.v1.ReadRequest.partition_token] + * field is empty, rows are yielded in table primary key order (if + * [index][google.spanner.v1.ReadRequest.index] is empty) or index key order + * (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the + * [partition_token][google.spanner.v1.ReadRequest.partition_token] field is + * not empty, rows will be yielded in an unspecified order. + * + * It is not an error for the `key_set` to name rows that do not + * exist in the database. Read yields nothing for nonexistent rows. + * @param array $optionalArgs { + * Optional. + * + * @type TransactionSelector $transaction + * The transaction to use. If none is provided, the default is a + * temporary read-only transaction with strong concurrency. + * @type string $index + * If non-empty, the name of an index on + * [table][google.spanner.v1.ReadRequest.table]. This index is used instead of + * the table primary key when interpreting + * [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows. + * See [key_set][google.spanner.v1.ReadRequest.key_set] for further + * information. + * @type int $limit + * If greater than zero, only the first `limit` rows are yielded. If `limit` + * is zero, the default is no limit. A limit cannot be specified if + * `partition_token` is set. + * @type string $resumeToken + * If this request is resuming a previously interrupted read, + * `resume_token` should be copied from the last + * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the + * interruption. Doing this enables the new read to resume where the last read + * left off. The rest of the request parameters must exactly match the request + * that yielded this token. + * @type string $partitionToken + * If present, results will be restricted to the specified partition + * previously created using PartitionRead(). There must be an exact + * match for the values of fields common to this message and the + * PartitionReadRequest message used to create this partition_token. + * @type RequestOptions $requestOptions + * Common options for this request. + * @type DirectedReadOptions $directedReadOptions + * Directed read options for this request. + * @type bool $dataBoostEnabled + * If this is for a partitioned read and this field is set to `true`, the + * request is executed with Spanner Data Boost independent compute resources. + * + * If the field is set to `true` but the request does not set + * `partition_token`, the API returns an `INVALID_ARGUMENT` error. + * @type int $orderBy + * Optional. Order for the returned rows. + * + * By default, Spanner will return result rows in primary key order except for + * PartitionRead requests. For applications that do not require rows to be + * returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting + * `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval, + * resulting in lower latencies in certain cases (e.g. bulk point lookups). + * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\OrderBy} + * @type int $lockHint + * Optional. Lock Hint for the request, it can only be used with read-write + * transactions. + * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\LockHint} + * @type int $timeoutMillis + * Timeout to use for this call. + * } + * + * @return \Google\ApiCore\ServerStream + * + * @throws ApiException if the remote call fails + */ + public function streamingRead($session, $table, $columns, $keySet, array $optionalArgs = []) + { + $request = new ReadRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setTable($table); + $request->setColumns($columns); + $request->setKeySet($keySet); + $requestParamHeaders['session'] = $session; + if (isset($optionalArgs['transaction'])) { + $request->setTransaction($optionalArgs['transaction']); + } + + if (isset($optionalArgs['index'])) { + $request->setIndex($optionalArgs['index']); + } + + if (isset($optionalArgs['limit'])) { + $request->setLimit($optionalArgs['limit']); + } + + if (isset($optionalArgs['resumeToken'])) { + $request->setResumeToken($optionalArgs['resumeToken']); + } + + if (isset($optionalArgs['partitionToken'])) { + $request->setPartitionToken($optionalArgs['partitionToken']); + } + + if (isset($optionalArgs['requestOptions'])) { + $request->setRequestOptions($optionalArgs['requestOptions']); + } + + if (isset($optionalArgs['directedReadOptions'])) { + $request->setDirectedReadOptions($optionalArgs['directedReadOptions']); + } + + if (isset($optionalArgs['dataBoostEnabled'])) { + $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + if (isset($optionalArgs['lockHint'])) { + $request->setLockHint($optionalArgs['lockHint']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('StreamingRead', PartialResultSet::class, $optionalArgs, $request, Call::SERVER_STREAMING_CALL); + } +} diff --git a/owl-bot-staging/Spanner/v1/src/V1/SpannerClient.php b/owl-bot-staging/Spanner/v1/src/V1/SpannerClient.php new file mode 100644 index 000000000000..d4d3a0e783b3 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/src/V1/SpannerClient.php @@ -0,0 +1,34 @@ + [ + 'google.spanner.v1.Spanner' => [ + 'BatchCreateSessions' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Spanner\V1\BatchCreateSessionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'database', + 'fieldAccessors' => [ + 'getDatabase', + ], + ], + ], + ], + 'BatchWrite' => [ + 'grpcStreaming' => [ + 'grpcStreamingType' => 'ServerStreaming', + ], + 'callType' => \Google\ApiCore\Call::SERVER_STREAMING_CALL, + 'responseType' => 'Google\Cloud\Spanner\V1\BatchWriteResponse', + 'headerParams' => [ + [ + 'keyName' => 'session', + 'fieldAccessors' => [ + 'getSession', + ], + ], + ], + ], + 'BeginTransaction' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Spanner\V1\Transaction', + 'headerParams' => [ + [ + 'keyName' => 'session', + 'fieldAccessors' => [ + 'getSession', + ], + ], + ], + ], + 'Commit' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Spanner\V1\CommitResponse', + 'headerParams' => [ + [ + 'keyName' => 'session', + 'fieldAccessors' => [ + 'getSession', + ], + ], + ], + ], + 'CreateSession' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Spanner\V1\Session', + 'headerParams' => [ + [ + 'keyName' => 'database', + 'fieldAccessors' => [ + 'getDatabase', + ], + ], + ], + ], + 'DeleteSession' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ExecuteBatchDml' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Spanner\V1\ExecuteBatchDmlResponse', + 'headerParams' => [ + [ + 'keyName' => 'session', + 'fieldAccessors' => [ + 'getSession', + ], + ], + ], + ], + 'ExecuteSql' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Spanner\V1\ResultSet', + 'headerParams' => [ + [ + 'keyName' => 'session', + 'fieldAccessors' => [ + 'getSession', + ], + ], + ], + ], + 'ExecuteStreamingSql' => [ + 'grpcStreaming' => [ + 'grpcStreamingType' => 'ServerStreaming', + ], + 'callType' => \Google\ApiCore\Call::SERVER_STREAMING_CALL, + 'responseType' => 'Google\Cloud\Spanner\V1\PartialResultSet', + 'headerParams' => [ + [ + 'keyName' => 'session', + 'fieldAccessors' => [ + 'getSession', + ], + ], + ], + ], + 'GetSession' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Spanner\V1\Session', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListSessions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getSessions', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Spanner\V1\ListSessionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'database', + 'fieldAccessors' => [ + 'getDatabase', + ], + ], + ], + ], + 'PartitionQuery' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Spanner\V1\PartitionResponse', + 'headerParams' => [ + [ + 'keyName' => 'session', + 'fieldAccessors' => [ + 'getSession', + ], + ], + ], + ], + 'PartitionRead' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Spanner\V1\PartitionResponse', + 'headerParams' => [ + [ + 'keyName' => 'session', + 'fieldAccessors' => [ + 'getSession', + ], + ], + ], + ], + 'Read' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Spanner\V1\ResultSet', + 'headerParams' => [ + [ + 'keyName' => 'session', + 'fieldAccessors' => [ + 'getSession', + ], + ], + ], + ], + 'Rollback' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'session', + 'fieldAccessors' => [ + 'getSession', + ], + ], + ], + ], + 'StreamingRead' => [ + 'grpcStreaming' => [ + 'grpcStreamingType' => 'ServerStreaming', + ], + 'callType' => \Google\ApiCore\Call::SERVER_STREAMING_CALL, + 'responseType' => 'Google\Cloud\Spanner\V1\PartialResultSet', + 'headerParams' => [ + [ + 'keyName' => 'session', + 'fieldAccessors' => [ + 'getSession', + ], + ], + ], + ], + 'templateMap' => [ + 'database' => 'projects/{project}/instances/{instance}/databases/{database}', + 'session' => 'projects/{project}/instances/{instance}/databases/{database}/sessions/{session}', + ], + ], + ], +]; diff --git a/owl-bot-staging/Spanner/v1/src/V1/resources/spanner_rest_client_config.php b/owl-bot-staging/Spanner/v1/src/V1/resources/spanner_rest_client_config.php new file mode 100644 index 000000000000..e661da669861 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/src/V1/resources/spanner_rest_client_config.php @@ -0,0 +1,320 @@ + [ + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations/*}:cancel', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations/*}:cancel', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/backups/*/operations/*}:cancel', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/instanceConfigs/*/operations/*}:cancel', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations/*}', + ], + [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/backups/*/operations/*}', + ], + [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/instanceConfigs/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/backups/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instanceConfigs/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/backups/*/operations}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instanceConfigs/*/operations}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.spanner.v1.Spanner' => [ + 'BatchCreateSessions' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{database=projects/*/instances/*/databases/*}/sessions:batchCreate', + 'body' => '*', + 'placeholders' => [ + 'database' => [ + 'getters' => [ + 'getDatabase', + ], + ], + ], + ], + 'BatchWrite' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:batchWrite', + 'body' => '*', + 'placeholders' => [ + 'session' => [ + 'getters' => [ + 'getSession', + ], + ], + ], + ], + 'BeginTransaction' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:beginTransaction', + 'body' => '*', + 'placeholders' => [ + 'session' => [ + 'getters' => [ + 'getSession', + ], + ], + ], + ], + 'Commit' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:commit', + 'body' => '*', + 'placeholders' => [ + 'session' => [ + 'getters' => [ + 'getSession', + ], + ], + ], + ], + 'CreateSession' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{database=projects/*/instances/*/databases/*}/sessions', + 'body' => '*', + 'placeholders' => [ + 'database' => [ + 'getters' => [ + 'getDatabase', + ], + ], + ], + ], + 'DeleteSession' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/sessions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ExecuteBatchDml' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeBatchDml', + 'body' => '*', + 'placeholders' => [ + 'session' => [ + 'getters' => [ + 'getSession', + ], + ], + ], + ], + 'ExecuteSql' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeSql', + 'body' => '*', + 'placeholders' => [ + 'session' => [ + 'getters' => [ + 'getSession', + ], + ], + ], + ], + 'ExecuteStreamingSql' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeStreamingSql', + 'body' => '*', + 'placeholders' => [ + 'session' => [ + 'getters' => [ + 'getSession', + ], + ], + ], + ], + 'GetSession' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/sessions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListSessions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{database=projects/*/instances/*/databases/*}/sessions', + 'placeholders' => [ + 'database' => [ + 'getters' => [ + 'getDatabase', + ], + ], + ], + ], + 'PartitionQuery' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:partitionQuery', + 'body' => '*', + 'placeholders' => [ + 'session' => [ + 'getters' => [ + 'getSession', + ], + ], + ], + ], + 'PartitionRead' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:partitionRead', + 'body' => '*', + 'placeholders' => [ + 'session' => [ + 'getters' => [ + 'getSession', + ], + ], + ], + ], + 'Read' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:read', + 'body' => '*', + 'placeholders' => [ + 'session' => [ + 'getters' => [ + 'getSession', + ], + ], + ], + ], + 'Rollback' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:rollback', + 'body' => '*', + 'placeholders' => [ + 'session' => [ + 'getters' => [ + 'getSession', + ], + ], + ], + ], + 'StreamingRead' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:streamingRead', + 'body' => '*', + 'placeholders' => [ + 'session' => [ + 'getters' => [ + 'getSession', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/Spanner/v1/tests/Unit/V1/Client/SpannerClientTest.php b/owl-bot-staging/Spanner/v1/tests/Unit/V1/Client/SpannerClientTest.php new file mode 100644 index 000000000000..1a1021bad381 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/tests/Unit/V1/Client/SpannerClientTest.php @@ -0,0 +1,1308 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return SpannerClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new SpannerClient($options); + } + + /** @test */ + public function batchCreateSessionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new BatchCreateSessionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $sessionCount = 185691686; + $request = (new BatchCreateSessionsRequest()) + ->setDatabase($formattedDatabase) + ->setSessionCount($sessionCount); + $response = $gapicClient->batchCreateSessions($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/BatchCreateSessions', $actualFuncCall); + $actualValue = $actualRequestObject->getDatabase(); + $this->assertProtobufEquals($formattedDatabase, $actualValue); + $actualValue = $actualRequestObject->getSessionCount(); + $this->assertProtobufEquals($sessionCount, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function batchCreateSessionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $sessionCount = 185691686; + $request = (new BatchCreateSessionsRequest()) + ->setDatabase($formattedDatabase) + ->setSessionCount($sessionCount); + try { + $gapicClient->batchCreateSessions($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function batchWriteTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new BatchWriteResponse(); + $transport->addResponse($expectedResponse); + $expectedResponse2 = new BatchWriteResponse(); + $transport->addResponse($expectedResponse2); + $expectedResponse3 = new BatchWriteResponse(); + $transport->addResponse($expectedResponse3); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $mutationGroups = []; + $request = (new BatchWriteRequest()) + ->setSession($formattedSession) + ->setMutationGroups($mutationGroups); + $serverStream = $gapicClient->batchWrite($request); + $this->assertInstanceOf(ServerStream::class, $serverStream); + $responses = iterator_to_array($serverStream->readAll()); + $expectedResponses = []; + $expectedResponses[] = $expectedResponse; + $expectedResponses[] = $expectedResponse2; + $expectedResponses[] = $expectedResponse3; + $this->assertEquals($expectedResponses, $responses); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/BatchWrite', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getMutationGroups(); + $this->assertProtobufEquals($mutationGroups, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function batchWriteExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->setStreamingStatus($status); + $this->assertTrue($transport->isExhausted()); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $mutationGroups = []; + $request = (new BatchWriteRequest()) + ->setSession($formattedSession) + ->setMutationGroups($mutationGroups); + $serverStream = $gapicClient->batchWrite($request); + $results = $serverStream->readAll(); + try { + iterator_to_array($results); + // If the close stream method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function beginTransactionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $id = '27'; + $expectedResponse = new Transaction(); + $expectedResponse->setId($id); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $options = new TransactionOptions(); + $request = (new BeginTransactionRequest()) + ->setSession($formattedSession) + ->setOptions($options); + $response = $gapicClient->beginTransaction($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/BeginTransaction', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getOptions(); + $this->assertProtobufEquals($options, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function beginTransactionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $options = new TransactionOptions(); + $request = (new BeginTransactionRequest()) + ->setSession($formattedSession) + ->setOptions($options); + try { + $gapicClient->beginTransaction($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function commitTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new CommitResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $mutations = []; + $request = (new CommitRequest()) + ->setSession($formattedSession) + ->setMutations($mutations); + $response = $gapicClient->commit($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/Commit', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getMutations(); + $this->assertProtobufEquals($mutations, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function commitExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $mutations = []; + $request = (new CommitRequest()) + ->setSession($formattedSession) + ->setMutations($mutations); + try { + $gapicClient->commit($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSessionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $creatorRole = 'creatorRole-1605962583'; + $multiplexed = false; + $expectedResponse = new Session(); + $expectedResponse->setName($name); + $expectedResponse->setCreatorRole($creatorRole); + $expectedResponse->setMultiplexed($multiplexed); + $transport->addResponse($expectedResponse); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $request = (new CreateSessionRequest()) + ->setDatabase($formattedDatabase); + $response = $gapicClient->createSession($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/CreateSession', $actualFuncCall); + $actualValue = $actualRequestObject->getDatabase(); + $this->assertProtobufEquals($formattedDatabase, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSessionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $request = (new CreateSessionRequest()) + ->setDatabase($formattedDatabase); + try { + $gapicClient->createSession($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSessionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $request = (new DeleteSessionRequest()) + ->setName($formattedName); + $gapicClient->deleteSession($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/DeleteSession', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSessionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $request = (new DeleteSessionRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteSession($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function executeBatchDmlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ExecuteBatchDmlResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $transaction = new TransactionSelector(); + $statements = []; + $seqno = 109325920; + $request = (new ExecuteBatchDmlRequest()) + ->setSession($formattedSession) + ->setTransaction($transaction) + ->setStatements($statements) + ->setSeqno($seqno); + $response = $gapicClient->executeBatchDml($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/ExecuteBatchDml', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getTransaction(); + $this->assertProtobufEquals($transaction, $actualValue); + $actualValue = $actualRequestObject->getStatements(); + $this->assertProtobufEquals($statements, $actualValue); + $actualValue = $actualRequestObject->getSeqno(); + $this->assertProtobufEquals($seqno, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function executeBatchDmlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $transaction = new TransactionSelector(); + $statements = []; + $seqno = 109325920; + $request = (new ExecuteBatchDmlRequest()) + ->setSession($formattedSession) + ->setTransaction($transaction) + ->setStatements($statements) + ->setSeqno($seqno); + try { + $gapicClient->executeBatchDml($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function executeSqlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ResultSet(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $sql = 'sql114126'; + $request = (new ExecuteSqlRequest()) + ->setSession($formattedSession) + ->setSql($sql); + $response = $gapicClient->executeSql($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/ExecuteSql', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getSql(); + $this->assertProtobufEquals($sql, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function executeSqlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $sql = 'sql114126'; + $request = (new ExecuteSqlRequest()) + ->setSession($formattedSession) + ->setSql($sql); + try { + $gapicClient->executeSql($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function executeStreamingSqlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $chunkedValue = true; + $resumeToken2 = '90'; + $expectedResponse = new PartialResultSet(); + $expectedResponse->setChunkedValue($chunkedValue); + $expectedResponse->setResumeToken($resumeToken2); + $transport->addResponse($expectedResponse); + $chunkedValue2 = false; + $resumeToken3 = '91'; + $expectedResponse2 = new PartialResultSet(); + $expectedResponse2->setChunkedValue($chunkedValue2); + $expectedResponse2->setResumeToken($resumeToken3); + $transport->addResponse($expectedResponse2); + $chunkedValue3 = true; + $resumeToken4 = '92'; + $expectedResponse3 = new PartialResultSet(); + $expectedResponse3->setChunkedValue($chunkedValue3); + $expectedResponse3->setResumeToken($resumeToken4); + $transport->addResponse($expectedResponse3); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $sql = 'sql114126'; + $request = (new ExecuteSqlRequest()) + ->setSession($formattedSession) + ->setSql($sql); + $serverStream = $gapicClient->executeStreamingSql($request); + $this->assertInstanceOf(ServerStream::class, $serverStream); + $responses = iterator_to_array($serverStream->readAll()); + $expectedResponses = []; + $expectedResponses[] = $expectedResponse; + $expectedResponses[] = $expectedResponse2; + $expectedResponses[] = $expectedResponse3; + $this->assertEquals($expectedResponses, $responses); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/ExecuteStreamingSql', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getSql(); + $this->assertProtobufEquals($sql, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function executeStreamingSqlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->setStreamingStatus($status); + $this->assertTrue($transport->isExhausted()); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $sql = 'sql114126'; + $request = (new ExecuteSqlRequest()) + ->setSession($formattedSession) + ->setSql($sql); + $serverStream = $gapicClient->executeStreamingSql($request); + $results = $serverStream->readAll(); + try { + iterator_to_array($results); + // If the close stream method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSessionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $creatorRole = 'creatorRole-1605962583'; + $multiplexed = false; + $expectedResponse = new Session(); + $expectedResponse->setName($name2); + $expectedResponse->setCreatorRole($creatorRole); + $expectedResponse->setMultiplexed($multiplexed); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $request = (new GetSessionRequest()) + ->setName($formattedName); + $response = $gapicClient->getSession($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/GetSession', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSessionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $request = (new GetSessionRequest()) + ->setName($formattedName); + try { + $gapicClient->getSession($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSessionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $sessionsElement = new Session(); + $sessions = [ + $sessionsElement, + ]; + $expectedResponse = new ListSessionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSessions($sessions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $request = (new ListSessionsRequest()) + ->setDatabase($formattedDatabase); + $response = $gapicClient->listSessions($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSessions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/ListSessions', $actualFuncCall); + $actualValue = $actualRequestObject->getDatabase(); + $this->assertProtobufEquals($formattedDatabase, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSessionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $request = (new ListSessionsRequest()) + ->setDatabase($formattedDatabase); + try { + $gapicClient->listSessions($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function partitionQueryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new PartitionResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $sql = 'sql114126'; + $request = (new PartitionQueryRequest()) + ->setSession($formattedSession) + ->setSql($sql); + $response = $gapicClient->partitionQuery($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/PartitionQuery', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getSql(); + $this->assertProtobufEquals($sql, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function partitionQueryExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $sql = 'sql114126'; + $request = (new PartitionQueryRequest()) + ->setSession($formattedSession) + ->setSql($sql); + try { + $gapicClient->partitionQuery($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function partitionReadTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new PartitionResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $table = 'table110115790'; + $keySet = new KeySet(); + $request = (new PartitionReadRequest()) + ->setSession($formattedSession) + ->setTable($table) + ->setKeySet($keySet); + $response = $gapicClient->partitionRead($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/PartitionRead', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getTable(); + $this->assertProtobufEquals($table, $actualValue); + $actualValue = $actualRequestObject->getKeySet(); + $this->assertProtobufEquals($keySet, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function partitionReadExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $table = 'table110115790'; + $keySet = new KeySet(); + $request = (new PartitionReadRequest()) + ->setSession($formattedSession) + ->setTable($table) + ->setKeySet($keySet); + try { + $gapicClient->partitionRead($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function readTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ResultSet(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $table = 'table110115790'; + $columns = []; + $keySet = new KeySet(); + $request = (new ReadRequest()) + ->setSession($formattedSession) + ->setTable($table) + ->setColumns($columns) + ->setKeySet($keySet); + $response = $gapicClient->read($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/Read', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getTable(); + $this->assertProtobufEquals($table, $actualValue); + $actualValue = $actualRequestObject->getColumns(); + $this->assertProtobufEquals($columns, $actualValue); + $actualValue = $actualRequestObject->getKeySet(); + $this->assertProtobufEquals($keySet, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function readExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $table = 'table110115790'; + $columns = []; + $keySet = new KeySet(); + $request = (new ReadRequest()) + ->setSession($formattedSession) + ->setTable($table) + ->setColumns($columns) + ->setKeySet($keySet); + try { + $gapicClient->read($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function rollbackTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $transactionId = '28'; + $request = (new RollbackRequest()) + ->setSession($formattedSession) + ->setTransactionId($transactionId); + $gapicClient->rollback($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/Rollback', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getTransactionId(); + $this->assertProtobufEquals($transactionId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function rollbackExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $transactionId = '28'; + $request = (new RollbackRequest()) + ->setSession($formattedSession) + ->setTransactionId($transactionId); + try { + $gapicClient->rollback($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function streamingReadTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $chunkedValue = true; + $resumeToken2 = '90'; + $expectedResponse = new PartialResultSet(); + $expectedResponse->setChunkedValue($chunkedValue); + $expectedResponse->setResumeToken($resumeToken2); + $transport->addResponse($expectedResponse); + $chunkedValue2 = false; + $resumeToken3 = '91'; + $expectedResponse2 = new PartialResultSet(); + $expectedResponse2->setChunkedValue($chunkedValue2); + $expectedResponse2->setResumeToken($resumeToken3); + $transport->addResponse($expectedResponse2); + $chunkedValue3 = true; + $resumeToken4 = '92'; + $expectedResponse3 = new PartialResultSet(); + $expectedResponse3->setChunkedValue($chunkedValue3); + $expectedResponse3->setResumeToken($resumeToken4); + $transport->addResponse($expectedResponse3); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $table = 'table110115790'; + $columns = []; + $keySet = new KeySet(); + $request = (new ReadRequest()) + ->setSession($formattedSession) + ->setTable($table) + ->setColumns($columns) + ->setKeySet($keySet); + $serverStream = $gapicClient->streamingRead($request); + $this->assertInstanceOf(ServerStream::class, $serverStream); + $responses = iterator_to_array($serverStream->readAll()); + $expectedResponses = []; + $expectedResponses[] = $expectedResponse; + $expectedResponses[] = $expectedResponse2; + $expectedResponses[] = $expectedResponse3; + $this->assertEquals($expectedResponses, $responses); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/StreamingRead', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getTable(); + $this->assertProtobufEquals($table, $actualValue); + $actualValue = $actualRequestObject->getColumns(); + $this->assertProtobufEquals($columns, $actualValue); + $actualValue = $actualRequestObject->getKeySet(); + $this->assertProtobufEquals($keySet, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function streamingReadExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->setStreamingStatus($status); + $this->assertTrue($transport->isExhausted()); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $table = 'table110115790'; + $columns = []; + $keySet = new KeySet(); + $request = (new ReadRequest()) + ->setSession($formattedSession) + ->setTable($table) + ->setColumns($columns) + ->setKeySet($keySet); + $serverStream = $gapicClient->streamingRead($request); + $results = $serverStream->readAll(); + try { + iterator_to_array($results); + // If the close stream method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function batchCreateSessionsAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new BatchCreateSessionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $sessionCount = 185691686; + $request = (new BatchCreateSessionsRequest()) + ->setDatabase($formattedDatabase) + ->setSessionCount($sessionCount); + $response = $gapicClient->batchCreateSessionsAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/BatchCreateSessions', $actualFuncCall); + $actualValue = $actualRequestObject->getDatabase(); + $this->assertProtobufEquals($formattedDatabase, $actualValue); + $actualValue = $actualRequestObject->getSessionCount(); + $this->assertProtobufEquals($sessionCount, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/owl-bot-staging/Spanner/v1/tests/Unit/V1/SpannerClientTest.php b/owl-bot-staging/Spanner/v1/tests/Unit/V1/SpannerClientTest.php new file mode 100644 index 000000000000..adf20f12570b --- /dev/null +++ b/owl-bot-staging/Spanner/v1/tests/Unit/V1/SpannerClientTest.php @@ -0,0 +1,1161 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return SpannerClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new SpannerClient($options); + } + + /** @test */ + public function batchCreateSessionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new BatchCreateSessionsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $sessionCount = 185691686; + $response = $gapicClient->batchCreateSessions($formattedDatabase, $sessionCount); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/BatchCreateSessions', $actualFuncCall); + $actualValue = $actualRequestObject->getDatabase(); + $this->assertProtobufEquals($formattedDatabase, $actualValue); + $actualValue = $actualRequestObject->getSessionCount(); + $this->assertProtobufEquals($sessionCount, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function batchCreateSessionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $sessionCount = 185691686; + try { + $gapicClient->batchCreateSessions($formattedDatabase, $sessionCount); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function batchWriteTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new BatchWriteResponse(); + $transport->addResponse($expectedResponse); + $expectedResponse2 = new BatchWriteResponse(); + $transport->addResponse($expectedResponse2); + $expectedResponse3 = new BatchWriteResponse(); + $transport->addResponse($expectedResponse3); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $mutationGroups = []; + $serverStream = $gapicClient->batchWrite($formattedSession, $mutationGroups); + $this->assertInstanceOf(ServerStream::class, $serverStream); + $responses = iterator_to_array($serverStream->readAll()); + $expectedResponses = []; + $expectedResponses[] = $expectedResponse; + $expectedResponses[] = $expectedResponse2; + $expectedResponses[] = $expectedResponse3; + $this->assertEquals($expectedResponses, $responses); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/BatchWrite', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getMutationGroups(); + $this->assertProtobufEquals($mutationGroups, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function batchWriteExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->setStreamingStatus($status); + $this->assertTrue($transport->isExhausted()); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $mutationGroups = []; + $serverStream = $gapicClient->batchWrite($formattedSession, $mutationGroups); + $results = $serverStream->readAll(); + try { + iterator_to_array($results); + // If the close stream method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function beginTransactionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $id = '27'; + $expectedResponse = new Transaction(); + $expectedResponse->setId($id); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $options = new TransactionOptions(); + $response = $gapicClient->beginTransaction($formattedSession, $options); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/BeginTransaction', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getOptions(); + $this->assertProtobufEquals($options, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function beginTransactionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $options = new TransactionOptions(); + try { + $gapicClient->beginTransaction($formattedSession, $options); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function commitTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new CommitResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $mutations = []; + $response = $gapicClient->commit($formattedSession, $mutations); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/Commit', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getMutations(); + $this->assertProtobufEquals($mutations, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function commitExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $mutations = []; + try { + $gapicClient->commit($formattedSession, $mutations); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSessionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $creatorRole = 'creatorRole-1605962583'; + $multiplexed = false; + $expectedResponse = new Session(); + $expectedResponse->setName($name); + $expectedResponse->setCreatorRole($creatorRole); + $expectedResponse->setMultiplexed($multiplexed); + $transport->addResponse($expectedResponse); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $response = $gapicClient->createSession($formattedDatabase); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/CreateSession', $actualFuncCall); + $actualValue = $actualRequestObject->getDatabase(); + $this->assertProtobufEquals($formattedDatabase, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSessionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + try { + $gapicClient->createSession($formattedDatabase); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSessionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $gapicClient->deleteSession($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/DeleteSession', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSessionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + try { + $gapicClient->deleteSession($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function executeBatchDmlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ExecuteBatchDmlResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $transaction = new TransactionSelector(); + $statements = []; + $seqno = 109325920; + $response = $gapicClient->executeBatchDml($formattedSession, $transaction, $statements, $seqno); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/ExecuteBatchDml', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getTransaction(); + $this->assertProtobufEquals($transaction, $actualValue); + $actualValue = $actualRequestObject->getStatements(); + $this->assertProtobufEquals($statements, $actualValue); + $actualValue = $actualRequestObject->getSeqno(); + $this->assertProtobufEquals($seqno, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function executeBatchDmlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $transaction = new TransactionSelector(); + $statements = []; + $seqno = 109325920; + try { + $gapicClient->executeBatchDml($formattedSession, $transaction, $statements, $seqno); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function executeSqlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ResultSet(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $sql = 'sql114126'; + $response = $gapicClient->executeSql($formattedSession, $sql); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/ExecuteSql', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getSql(); + $this->assertProtobufEquals($sql, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function executeSqlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $sql = 'sql114126'; + try { + $gapicClient->executeSql($formattedSession, $sql); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function executeStreamingSqlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $chunkedValue = true; + $resumeToken2 = '90'; + $expectedResponse = new PartialResultSet(); + $expectedResponse->setChunkedValue($chunkedValue); + $expectedResponse->setResumeToken($resumeToken2); + $transport->addResponse($expectedResponse); + $chunkedValue2 = false; + $resumeToken3 = '91'; + $expectedResponse2 = new PartialResultSet(); + $expectedResponse2->setChunkedValue($chunkedValue2); + $expectedResponse2->setResumeToken($resumeToken3); + $transport->addResponse($expectedResponse2); + $chunkedValue3 = true; + $resumeToken4 = '92'; + $expectedResponse3 = new PartialResultSet(); + $expectedResponse3->setChunkedValue($chunkedValue3); + $expectedResponse3->setResumeToken($resumeToken4); + $transport->addResponse($expectedResponse3); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $sql = 'sql114126'; + $serverStream = $gapicClient->executeStreamingSql($formattedSession, $sql); + $this->assertInstanceOf(ServerStream::class, $serverStream); + $responses = iterator_to_array($serverStream->readAll()); + $expectedResponses = []; + $expectedResponses[] = $expectedResponse; + $expectedResponses[] = $expectedResponse2; + $expectedResponses[] = $expectedResponse3; + $this->assertEquals($expectedResponses, $responses); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/ExecuteStreamingSql', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getSql(); + $this->assertProtobufEquals($sql, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function executeStreamingSqlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->setStreamingStatus($status); + $this->assertTrue($transport->isExhausted()); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $sql = 'sql114126'; + $serverStream = $gapicClient->executeStreamingSql($formattedSession, $sql); + $results = $serverStream->readAll(); + try { + iterator_to_array($results); + // If the close stream method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSessionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $creatorRole = 'creatorRole-1605962583'; + $multiplexed = false; + $expectedResponse = new Session(); + $expectedResponse->setName($name2); + $expectedResponse->setCreatorRole($creatorRole); + $expectedResponse->setMultiplexed($multiplexed); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $response = $gapicClient->getSession($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/GetSession', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSessionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + try { + $gapicClient->getSession($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSessionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $sessionsElement = new Session(); + $sessions = [ + $sessionsElement, + ]; + $expectedResponse = new ListSessionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSessions($sessions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + $response = $gapicClient->listSessions($formattedDatabase); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSessions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/ListSessions', $actualFuncCall); + $actualValue = $actualRequestObject->getDatabase(); + $this->assertProtobufEquals($formattedDatabase, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSessionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + try { + $gapicClient->listSessions($formattedDatabase); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function partitionQueryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new PartitionResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $sql = 'sql114126'; + $response = $gapicClient->partitionQuery($formattedSession, $sql); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/PartitionQuery', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getSql(); + $this->assertProtobufEquals($sql, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function partitionQueryExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $sql = 'sql114126'; + try { + $gapicClient->partitionQuery($formattedSession, $sql); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function partitionReadTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new PartitionResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $table = 'table110115790'; + $keySet = new KeySet(); + $response = $gapicClient->partitionRead($formattedSession, $table, $keySet); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/PartitionRead', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getTable(); + $this->assertProtobufEquals($table, $actualValue); + $actualValue = $actualRequestObject->getKeySet(); + $this->assertProtobufEquals($keySet, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function partitionReadExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $table = 'table110115790'; + $keySet = new KeySet(); + try { + $gapicClient->partitionRead($formattedSession, $table, $keySet); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function readTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ResultSet(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $table = 'table110115790'; + $columns = []; + $keySet = new KeySet(); + $response = $gapicClient->read($formattedSession, $table, $columns, $keySet); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/Read', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getTable(); + $this->assertProtobufEquals($table, $actualValue); + $actualValue = $actualRequestObject->getColumns(); + $this->assertProtobufEquals($columns, $actualValue); + $actualValue = $actualRequestObject->getKeySet(); + $this->assertProtobufEquals($keySet, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function readExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $table = 'table110115790'; + $columns = []; + $keySet = new KeySet(); + try { + $gapicClient->read($formattedSession, $table, $columns, $keySet); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function rollbackTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $transactionId = '28'; + $gapicClient->rollback($formattedSession, $transactionId); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/Rollback', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getTransactionId(); + $this->assertProtobufEquals($transactionId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function rollbackExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $transactionId = '28'; + try { + $gapicClient->rollback($formattedSession, $transactionId); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function streamingReadTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $chunkedValue = true; + $resumeToken2 = '90'; + $expectedResponse = new PartialResultSet(); + $expectedResponse->setChunkedValue($chunkedValue); + $expectedResponse->setResumeToken($resumeToken2); + $transport->addResponse($expectedResponse); + $chunkedValue2 = false; + $resumeToken3 = '91'; + $expectedResponse2 = new PartialResultSet(); + $expectedResponse2->setChunkedValue($chunkedValue2); + $expectedResponse2->setResumeToken($resumeToken3); + $transport->addResponse($expectedResponse2); + $chunkedValue3 = true; + $resumeToken4 = '92'; + $expectedResponse3 = new PartialResultSet(); + $expectedResponse3->setChunkedValue($chunkedValue3); + $expectedResponse3->setResumeToken($resumeToken4); + $transport->addResponse($expectedResponse3); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $table = 'table110115790'; + $columns = []; + $keySet = new KeySet(); + $serverStream = $gapicClient->streamingRead($formattedSession, $table, $columns, $keySet); + $this->assertInstanceOf(ServerStream::class, $serverStream); + $responses = iterator_to_array($serverStream->readAll()); + $expectedResponses = []; + $expectedResponses[] = $expectedResponse; + $expectedResponses[] = $expectedResponse2; + $expectedResponses[] = $expectedResponse3; + $this->assertEquals($expectedResponses, $responses); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.spanner.v1.Spanner/StreamingRead', $actualFuncCall); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($formattedSession, $actualValue); + $actualValue = $actualRequestObject->getTable(); + $this->assertProtobufEquals($table, $actualValue); + $actualValue = $actualRequestObject->getColumns(); + $this->assertProtobufEquals($columns, $actualValue); + $actualValue = $actualRequestObject->getKeySet(); + $this->assertProtobufEquals($keySet, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function streamingReadExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->setStreamingStatus($status); + $this->assertTrue($transport->isExhausted()); + // Mock request + $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + $table = 'table110115790'; + $columns = []; + $keySet = new KeySet(); + $serverStream = $gapicClient->streamingRead($formattedSession, $table, $columns, $keySet); + $results = $serverStream->readAll(); + try { + iterator_to_array($results); + // If the close stream method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} From cfbc13413d53ea77852cf1bff239c195a9c60adf Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 17 Dec 2024 08:04:41 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- Spanner/metadata/Admin/Instance/V1/Common.php | Bin 1366 -> 1447 bytes .../Instance/V1/SpannerInstanceAdmin.php | Bin 16601 -> 17768 bytes .../AutoscalingConfig/AutoscalingTargets.php | 8 +- .../V1/Client/InstanceAdminClient.php | 72 +- .../V1/CreateInstanceConfigRequest.php | 32 +- .../V1/DeleteInstanceConfigRequest.php | 2 +- .../Instance/V1/FreeInstanceMetadata.php | 6 +- .../FreeInstanceMetadata/ExpireBehavior.php | 0 .../V1/Gapic/InstanceAdminGapicClient.php | 91 +- Spanner/src/Admin/Instance/V1/Instance.php | 158 +- .../V1/Instance/DefaultBackupScheduleType.php | 19 +- .../Instance/V1/Instance/InstanceType.php | 0 .../src/Admin/Instance/V1/InstanceConfig.php | 154 +- .../FreeInstanceAvailability.php | 0 .../Instance/V1/InstanceConfig/QuorumType.php | 0 .../Admin/Instance/V1/InstanceConfig/Type.php | 4 +- .../Admin/Instance/V1/InstancePartition.php | 51 +- .../ListInstanceConfigOperationsRequest.php | 12 +- .../ListInstanceConfigOperationsResponse.php | 24 +- ...ListInstancePartitionOperationsRequest.php | 24 +- ...istInstancePartitionOperationsResponse.php | 24 +- .../V1/ListInstancePartitionsRequest.php | 20 +- .../V1/ListInstancePartitionsResponse.php | 24 +- Spanner/src/Admin/Instance/V1/ReplicaInfo.php | 8 +- .../V1/UpdateInstanceConfigRequest.php | 2 +- .../V1/Client/InstanceAdminClientTest.php | 6 + .../Instance/V1/InstanceAdminClientTest.php | 6 + .../Spanner/Admin/Database/V1/Backup.php | Bin 5621 -> 0 bytes .../Admin/Database/V1/BackupSchedule.php | Bin 3205 -> 0 bytes .../Spanner/Admin/Database/V1/Common.php | Bin 2220 -> 0 bytes .../Database/V1/SpannerDatabaseAdmin.php | Bin 13533 -> 0 bytes .../Spanner/Admin/Database/V1/Backup.php | 1013 ------- .../Admin/Database/V1/Backup/State.php | 65 - .../Spanner/Admin/Database/V1/BackupInfo.php | 213 -- .../Admin/Database/V1/BackupSchedule.php | 380 --- .../Admin/Database/V1/BackupScheduleSpec.php | 75 - .../V1/CopyBackupEncryptionConfig.php | 207 -- .../EncryptionType.php | 78 - .../Admin/Database/V1/CopyBackupMetadata.php | 258 -- .../Admin/Database/V1/CopyBackupRequest.php | 321 --- .../V1/CreateBackupEncryptionConfig.php | 203 -- .../EncryptionType.php | 77 - .../Database/V1/CreateBackupMetadata.php | 242 -- .../Admin/Database/V1/CreateBackupRequest.php | 259 -- .../V1/CreateBackupScheduleRequest.php | 174 -- .../Database/V1/CreateDatabaseMetadata.php | 68 - .../Database/V1/CreateDatabaseRequest.php | 365 --- .../Spanner/Admin/Database/V1/CrontabSpec.php | 214 -- .../Spanner/Admin/Database/V1/Database.php | 605 ----- .../Admin/Database/V1/Database/State.php | 78 - .../Admin/Database/V1/DatabaseDialect.php | 62 - .../Admin/Database/V1/DatabaseRole.php | 75 - .../Database/V1/DdlStatementActionInfo.php | 165 -- .../Admin/Database/V1/DeleteBackupRequest.php | 92 - .../V1/DeleteBackupScheduleRequest.php | 92 - .../Admin/Database/V1/DropDatabaseRequest.php | 82 - .../Admin/Database/V1/EncryptionConfig.php | 161 -- .../Admin/Database/V1/EncryptionInfo.php | 157 -- .../Admin/Database/V1/EncryptionInfo/Type.php | 68 - .../Admin/Database/V1/FullBackupSpec.php | 35 - .../Admin/Database/V1/GetBackupRequest.php | 92 - .../Database/V1/GetBackupScheduleRequest.php | 92 - .../Database/V1/GetDatabaseDdlRequest.php | 92 - .../Database/V1/GetDatabaseDdlResponse.php | 122 - .../Admin/Database/V1/GetDatabaseRequest.php | 87 - .../Database/V1/IncrementalBackupSpec.php | 38 - .../V1/ListBackupOperationsRequest.php | 461 ---- .../V1/ListBackupOperationsResponse.php | 142 - .../V1/ListBackupSchedulesRequest.php | 180 -- .../V1/ListBackupSchedulesResponse.php | 110 - .../Admin/Database/V1/ListBackupsRequest.php | 341 --- .../Admin/Database/V1/ListBackupsResponse.php | 114 - .../V1/ListDatabaseOperationsRequest.php | 361 --- .../V1/ListDatabaseOperationsResponse.php | 126 - .../Database/V1/ListDatabaseRolesRequest.php | 176 -- .../Database/V1/ListDatabaseRolesResponse.php | 110 - .../Database/V1/ListDatabasesRequest.php | 171 -- .../Database/V1/ListDatabasesResponse.php | 110 - .../Admin/Database/V1/OperationProgress.php | 164 -- .../V1/OptimizeRestoredDatabaseMetadata.php | 114 - .../V1/RestoreDatabaseEncryptionConfig.php | 203 -- .../EncryptionType.php | 74 - .../Database/V1/RestoreDatabaseMetadata.php | 358 --- .../Database/V1/RestoreDatabaseRequest.php | 265 -- .../Spanner/Admin/Database/V1/RestoreInfo.php | 112 - .../Admin/Database/V1/RestoreSourceType.php | 54 - .../Admin/Database/V1/UpdateBackupRequest.php | 172 -- .../V1/UpdateBackupScheduleRequest.php | 167 -- .../Database/V1/UpdateDatabaseDdlMetadata.php | 286 -- .../Database/V1/UpdateDatabaseDdlRequest.php | 323 --- .../Database/V1/UpdateDatabaseMetadata.php | 182 -- .../Database/V1/UpdateDatabaseRequest.php | 152 -- .../V1/DatabaseAdminClient/copy_backup.php | 116 - .../V1/DatabaseAdminClient/create_backup.php | 106 - .../create_backup_schedule.php | 78 - .../DatabaseAdminClient/create_database.php | 98 - .../V1/DatabaseAdminClient/delete_backup.php | 72 - .../delete_backup_schedule.php | 76 - .../V1/DatabaseAdminClient/drop_database.php | 73 - .../V1/DatabaseAdminClient/get_backup.php | 74 - .../get_backup_schedule.php | 78 - .../V1/DatabaseAdminClient/get_database.php | 72 - .../DatabaseAdminClient/get_database_ddl.php | 75 - .../V1/DatabaseAdminClient/get_iam_policy.php | 78 - .../list_backup_operations.php | 86 - .../list_backup_schedules.php | 78 - .../V1/DatabaseAdminClient/list_backups.php | 79 - .../list_database_operations.php | 84 - .../list_database_roles.php | 78 - .../V1/DatabaseAdminClient/list_databases.php | 77 - .../DatabaseAdminClient/restore_database.php | 109 - .../V1/DatabaseAdminClient/set_iam_policy.php | 79 - .../test_iam_permissions.php | 87 - .../V1/DatabaseAdminClient/update_backup.php | 63 - .../update_backup_schedule.php | 62 - .../DatabaseAdminClient/update_database.php | 126 - .../update_database_ddl.php | 91 - .../v1/src/V1/Client/DatabaseAdminClient.php | 1232 --------- .../v1/src/V1/DatabaseAdminClient.php | 34 - .../src/V1/Gapic/DatabaseAdminGapicClient.php | 2401 ----------------- .../Database/v1/src/V1/gapic_metadata.json | 143 - .../database_admin_client_config.json | 193 -- .../database_admin_descriptor_config.php | 429 --- .../database_admin_rest_client_config.php | 477 ---- .../V1/Client/DatabaseAdminClientTest.php | 2352 ---------------- .../tests/Unit/V1/DatabaseAdminClientTest.php | 2109 --------------- .../Spanner/Admin/Instance/V1/Common.php | Bin 1447 -> 0 bytes .../Instance/V1/SpannerInstanceAdmin.php | Bin 17768 -> 0 bytes .../Admin/Instance/V1/AutoscalingConfig.php | 183 -- .../AsymmetricAutoscalingOption.php | 133 - .../AutoscalingConfigOverrides.php | 129 - .../AutoscalingConfig/AutoscalingLimits.php | 205 -- .../AutoscalingConfig/AutoscalingTargets.php | 128 - .../V1/CreateInstanceConfigMetadata.php | 174 -- .../V1/CreateInstanceConfigRequest.php | 242 -- .../Instance/V1/CreateInstanceMetadata.php | 260 -- .../V1/CreateInstancePartitionMetadata.php | 226 -- .../V1/CreateInstancePartitionRequest.php | 194 -- .../Instance/V1/CreateInstanceRequest.php | 184 -- .../V1/DeleteInstanceConfigRequest.php | 188 -- .../V1/DeleteInstancePartitionRequest.php | 138 - .../Instance/V1/DeleteInstanceRequest.php | 87 - .../Admin/Instance/V1/FulfillmentPeriod.php | 63 - .../Instance/V1/GetInstanceConfigRequest.php | 87 - .../V1/GetInstancePartitionRequest.php | 92 - .../Admin/Instance/V1/GetInstanceRequest.php | 143 - .../Spanner/Admin/Instance/V1/Instance.php | 861 ------ .../V1/Instance/DefaultBackupScheduleType.php | 71 - .../Admin/Instance/V1/Instance/Edition.php | 72 - .../Admin/Instance/V1/Instance/State.php | 67 - .../Admin/Instance/V1/InstanceConfig.php | 690 ----- .../Instance/V1/InstanceConfig/State.php | 65 - .../Admin/Instance/V1/InstanceConfig/Type.php | 64 - .../Admin/Instance/V1/InstancePartition.php | 568 ---- .../Instance/V1/InstancePartition/State.php | 67 - .../ListInstanceConfigOperationsRequest.php | 349 --- .../ListInstanceConfigOperationsResponse.php | 126 - .../V1/ListInstanceConfigsRequest.php | 176 -- .../V1/ListInstanceConfigsResponse.php | 110 - ...ListInstancePartitionOperationsRequest.php | 413 --- ...istInstancePartitionOperationsResponse.php | 172 -- .../V1/ListInstancePartitionsRequest.php | 245 -- .../V1/ListInstancePartitionsResponse.php | 156 -- .../Instance/V1/ListInstancesRequest.php | 329 --- .../Instance/V1/ListInstancesResponse.php | 156 -- .../Instance/V1/MoveInstanceMetadata.php | 176 -- .../Admin/Instance/V1/MoveInstanceRequest.php | 110 - .../Instance/V1/MoveInstanceResponse.php | 34 - .../Admin/Instance/V1/OperationProgress.php | 164 -- .../Instance/V1/ReplicaComputeCapacity.php | 169 -- .../Spanner/Admin/Instance/V1/ReplicaInfo.php | 145 - .../Instance/V1/ReplicaInfo/ReplicaType.php | 87 - .../Admin/Instance/V1/ReplicaSelection.php | 67 - .../V1/UpdateInstanceConfigMetadata.php | 174 -- .../V1/UpdateInstanceConfigRequest.php | 230 -- .../Instance/V1/UpdateInstanceMetadata.php | 260 -- .../V1/UpdateInstancePartitionMetadata.php | 226 -- .../V1/UpdateInstancePartitionRequest.php | 177 -- .../Instance/V1/UpdateInstanceRequest.php | 172 -- .../InstanceAdminClient/create_instance.php | 155 -- .../create_instance_config.php | 132 - .../create_instance_partition.php | 161 -- .../InstanceAdminClient/delete_instance.php | 80 - .../delete_instance_config.php | 78 - .../delete_instance_partition.php | 81 - .../V1/InstanceAdminClient/get_iam_policy.php | 75 - .../V1/InstanceAdminClient/get_instance.php | 72 - .../get_instance_config.php | 72 - .../get_instance_partition.php | 77 - .../list_instance_config_operations.php | 87 - .../list_instance_configs.php | 81 - .../list_instance_partition_operations.php | 90 - .../list_instance_partitions.php | 79 - .../V1/InstanceAdminClient/list_instances.php | 77 - .../V1/InstanceAdminClient/move_instance.php | 149 - .../V1/InstanceAdminClient/set_iam_policy.php | 77 - .../test_iam_permissions.php | 83 - .../InstanceAdminClient/update_instance.php | 145 - .../update_instance_config.php | 117 - .../update_instance_partition.php | 155 -- .../v1/src/V1/Client/InstanceAdminClient.php | 1302 --------- .../src/V1/Gapic/InstanceAdminGapicClient.php | 2277 ---------------- .../v1/src/V1/InstanceAdminClient.php | 34 - .../Instance/v1/src/V1/gapic_metadata.json | 123 - .../instance_admin_client_config.json | 173 -- .../instance_admin_descriptor_config.php | 378 --- .../instance_admin_rest_client_config.php | 343 --- .../V1/Client/InstanceAdminClientTest.php | 2172 --------------- .../tests/Unit/V1/InstanceAdminClientTest.php | 1955 -------------- .../Google/Spanner/V1/CommitResponse.php | Bin 1251 -> 0 bytes .../GPBMetadata/Google/Spanner/V1/Keys.php | Bin 1173 -> 0 bytes .../Google/Spanner/V1/Mutation.php | Bin 1480 -> 0 bytes .../Google/Spanner/V1/QueryPlan.php | Bin 1535 -> 0 bytes .../Google/Spanner/V1/ResultSet.php | Bin 2130 -> 0 bytes .../GPBMetadata/Google/Spanner/V1/Spanner.php | Bin 12024 -> 0 bytes .../Google/Spanner/V1/Transaction.php | Bin 2283 -> 0 bytes .../GPBMetadata/Google/Spanner/V1/Type.php | Bin 1525 -> 0 bytes .../Spanner/V1/BatchCreateSessionsRequest.php | 187 -- .../V1/BatchCreateSessionsResponse.php | 68 - .../Cloud/Spanner/V1/BatchWriteRequest.php | 235 -- .../V1/BatchWriteRequest/MutationGroup.php | 72 - .../Cloud/Spanner/V1/BatchWriteResponse.php | 163 -- .../Spanner/V1/BeginTransactionRequest.php | 252 -- .../Google/Cloud/Spanner/V1/CommitRequest.php | 466 ---- .../Cloud/Spanner/V1/CommitResponse.php | 174 -- .../Spanner/V1/CommitResponse/CommitStats.php | 94 - .../Cloud/Spanner/V1/CreateSessionRequest.php | 125 - .../Cloud/Spanner/V1/DeleteSessionRequest.php | 81 - .../Cloud/Spanner/V1/DirectedReadOptions.php | 129 - .../DirectedReadOptions/ExcludeReplicas.php | 71 - .../DirectedReadOptions/IncludeReplicas.php | 113 - .../DirectedReadOptions/ReplicaSelection.php | 118 - .../ReplicaSelection/Type.php | 64 - .../Spanner/V1/ExecuteBatchDmlRequest.php | 337 --- .../V1/ExecuteBatchDmlRequest/Statement.php | 208 -- .../Spanner/V1/ExecuteBatchDmlResponse.php | 235 -- .../Cloud/Spanner/V1/ExecuteSqlRequest.php | 764 ------ .../V1/ExecuteSqlRequest/QueryMode.php | 84 - .../V1/ExecuteSqlRequest/QueryOptions.php | 232 -- .../Cloud/Spanner/V1/GetSessionRequest.php | 81 - .../src/Google/Cloud/Spanner/V1/KeyRange.php | 255 -- .../src/Google/Cloud/Spanner/V1/KeySet.php | 164 -- .../Cloud/Spanner/V1/ListSessionsRequest.php | 223 -- .../Cloud/Spanner/V1/ListSessionsResponse.php | 109 - .../V1/MultiplexedSessionPrecommitToken.php | 112 - .../src/Google/Cloud/Spanner/V1/Mutation.php | 254 -- .../Cloud/Spanner/V1/Mutation/Delete.php | 134 - .../Cloud/Spanner/V1/Mutation/Write.php | 179 -- .../Cloud/Spanner/V1/PartialResultSet.php | 573 ---- .../src/Google/Cloud/Spanner/V1/Partition.php | 76 - .../Cloud/Spanner/V1/PartitionOptions.php | 142 - .../Spanner/V1/PartitionQueryRequest.php | 367 --- .../Cloud/Spanner/V1/PartitionReadRequest.php | 361 --- .../Cloud/Spanner/V1/PartitionResponse.php | 112 - .../src/Google/Cloud/Spanner/V1/PlanNode.php | 353 --- .../Cloud/Spanner/V1/PlanNode/ChildLink.php | 179 -- .../Google/Cloud/Spanner/V1/PlanNode/Kind.php | 70 - .../V1/PlanNode/ShortRepresentation.php | 121 - .../src/Google/Cloud/Spanner/V1/QueryPlan.php | 75 - .../Google/Cloud/Spanner/V1/ReadRequest.php | 706 ----- .../Cloud/Spanner/V1/ReadRequest/LockHint.php | 95 - .../Cloud/Spanner/V1/ReadRequest/OrderBy.php | 67 - .../Cloud/Spanner/V1/RequestOptions.php | 211 -- .../Spanner/V1/RequestOptions/Priority.php | 84 - .../src/Google/Cloud/Spanner/V1/ResultSet.php | 272 -- .../Cloud/Spanner/V1/ResultSetMetadata.php | 225 -- .../Cloud/Spanner/V1/ResultSetStats.php | 227 -- .../Cloud/Spanner/V1/RollbackRequest.php | 117 - .../src/Google/Cloud/Spanner/V1/Session.php | 309 --- .../Google/Cloud/Spanner/V1/StructType.php | 88 - .../Cloud/Spanner/V1/StructType/Field.php | 138 - .../Google/Cloud/Spanner/V1/Transaction.php | 227 -- .../Cloud/Spanner/V1/TransactionOptions.php | 504 ---- .../V1/TransactionOptions/PBReadOnly.php | 357 --- .../V1/TransactionOptions/PartitionedDml.php | 36 - .../V1/TransactionOptions/ReadOnly.php | 9 - .../V1/TransactionOptions/ReadWrite.php | 121 - .../ReadWrite/ReadLockMode.php | 70 - .../Cloud/Spanner/V1/TransactionSelector.php | 160 -- .../src/Google/Cloud/Spanner/V1/Type.php | 284 -- .../Cloud/Spanner/V1/TypeAnnotationCode.php | 85 - .../src/Google/Cloud/Spanner/V1/TypeCode.php | 199 -- .../SpannerClient/batch_create_sessions.php | 82 - .../samples/V1/SpannerClient/batch_write.php | 102 - .../V1/SpannerClient/begin_transaction.php | 83 - .../v1/samples/V1/SpannerClient/commit.php | 92 - .../V1/SpannerClient/create_session.php | 89 - .../V1/SpannerClient/delete_session.php | 71 - .../V1/SpannerClient/execute_batch_dml.php | 110 - .../samples/V1/SpannerClient/execute_sql.php | 91 - .../SpannerClient/execute_streaming_sql.php | 88 - .../samples/V1/SpannerClient/get_session.php | 73 - .../V1/SpannerClient/list_sessions.php | 76 - .../V1/SpannerClient/partition_query.php | 101 - .../V1/SpannerClient/partition_read.php | 95 - .../v1/samples/V1/SpannerClient/read.php | 100 - .../v1/samples/V1/SpannerClient/rollback.php | 85 - .../V1/SpannerClient/streaming_read.php | 99 - .../v1/src/V1/Client/SpannerClient.php | 836 ------ .../v1/src/V1/Gapic/SpannerGapicClient.php | 1919 ------------- .../Spanner/v1/src/V1/SpannerClient.php | 34 - .../Spanner/v1/src/V1/gapic_metadata.json | 98 - .../V1/resources/spanner_client_config.json | 145 - .../resources/spanner_descriptor_config.php | 241 -- .../resources/spanner_rest_client_config.php | 320 --- .../Unit/V1/Client/SpannerClientTest.php | 1308 --------- .../v1/tests/Unit/V1/SpannerClientTest.php | 1161 -------- 307 files changed, 476 insertions(+), 64157 deletions(-) rename {owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner => Spanner/src}/Admin/Instance/V1/FreeInstanceMetadata.php (98%) rename {owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner => Spanner/src}/Admin/Instance/V1/FreeInstanceMetadata/ExpireBehavior.php (100%) rename {owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner => Spanner/src}/Admin/Instance/V1/Instance/InstanceType.php (100%) rename {owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner => Spanner/src}/Admin/Instance/V1/InstanceConfig/FreeInstanceAvailability.php (100%) rename {owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner => Spanner/src}/Admin/Instance/V1/InstanceConfig/QuorumType.php (100%) delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Database/V1/Backup.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Database/V1/BackupSchedule.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Database/V1/Common.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Database/V1/SpannerDatabaseAdmin.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Backup.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Backup/State.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupInfo.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupSchedule.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupScheduleSpec.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupEncryptionConfig.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupEncryptionConfig/EncryptionType.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupMetadata.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupEncryptionConfig.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupEncryptionConfig/EncryptionType.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupMetadata.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupScheduleRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateDatabaseMetadata.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateDatabaseRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CrontabSpec.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Database.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Database/State.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DatabaseDialect.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DatabaseRole.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DdlStatementActionInfo.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DeleteBackupRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DeleteBackupScheduleRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DropDatabaseRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionConfig.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionInfo.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionInfo/Type.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/FullBackupSpec.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetBackupRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetBackupScheduleRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseDdlRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseDdlResponse.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/IncrementalBackupSpec.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupOperationsRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupOperationsResponse.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupSchedulesRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupSchedulesResponse.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupsRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupsResponse.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseOperationsRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseOperationsResponse.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseRolesRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseRolesResponse.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabasesRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabasesResponse.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/OperationProgress.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/OptimizeRestoredDatabaseMetadata.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseEncryptionConfig.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseEncryptionConfig/EncryptionType.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseMetadata.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreInfo.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreSourceType.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateBackupRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateBackupScheduleRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseDdlMetadata.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseDdlRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseMetadata.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/copy_backup.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_backup.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_backup_schedule.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_database.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/delete_backup.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/delete_backup_schedule.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/drop_database.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_backup.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_backup_schedule.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_database.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_database_ddl.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_iam_policy.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backup_operations.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backup_schedules.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backups.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_database_operations.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_database_roles.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_databases.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/restore_database.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/set_iam_policy.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/test_iam_permissions.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_backup.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_backup_schedule.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_database.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_database_ddl.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/Client/DatabaseAdminClient.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/DatabaseAdminClient.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/Gapic/DatabaseAdminGapicClient.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/gapic_metadata.json delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_client_config.json delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_descriptor_config.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_rest_client_config.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/tests/Unit/V1/Client/DatabaseAdminClientTest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Database/v1/tests/Unit/V1/DatabaseAdminClientTest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Instance/V1/Common.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Instance/V1/SpannerInstanceAdmin.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AsymmetricAutoscalingOption.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AsymmetricAutoscalingOption/AutoscalingConfigOverrides.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AutoscalingLimits.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AutoscalingTargets.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceConfigMetadata.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceConfigRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceMetadata.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstancePartitionMetadata.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstancePartitionRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstanceConfigRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstancePartitionRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstanceRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FulfillmentPeriod.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstanceConfigRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstancePartitionRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstanceRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/DefaultBackupScheduleType.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/Edition.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/State.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/State.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/Type.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstancePartition.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstancePartition/State.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigOperationsRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigOperationsResponse.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigsRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigsResponse.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionOperationsRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionOperationsResponse.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionsRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionsResponse.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancesRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancesResponse.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceMetadata.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceResponse.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/OperationProgress.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaComputeCapacity.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaInfo.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaInfo/ReplicaType.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaSelection.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceConfigMetadata.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceConfigRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceMetadata.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstancePartitionMetadata.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstancePartitionRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance_config.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance_partition.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance_config.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance_partition.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_iam_policy.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance_config.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance_partition.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_config_operations.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_configs.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_partition_operations.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_partitions.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instances.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/move_instance.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/set_iam_policy.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/test_iam_permissions.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance_config.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance_partition.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/Client/InstanceAdminClient.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/Gapic/InstanceAdminGapicClient.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/InstanceAdminClient.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/gapic_metadata.json delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/resources/instance_admin_client_config.json delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/resources/instance_admin_descriptor_config.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/resources/instance_admin_rest_client_config.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/tests/Unit/V1/Client/InstanceAdminClientTest.php delete mode 100644 owl-bot-staging/Spanner/v1/Admin/Instance/v1/tests/Unit/V1/InstanceAdminClientTest.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/CommitResponse.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Keys.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Mutation.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/QueryPlan.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/ResultSet.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Spanner.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Transaction.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Type.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchCreateSessionsRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchCreateSessionsResponse.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteRequest/MutationGroup.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteResponse.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BeginTransactionRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitResponse.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitResponse/CommitStats.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CreateSessionRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DeleteSessionRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ExcludeReplicas.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/IncludeReplicas.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ReplicaSelection.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ReplicaSelection/Type.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlRequest/Statement.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlResponse.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest/QueryMode.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest/QueryOptions.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/GetSessionRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/KeyRange.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/KeySet.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ListSessionsRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ListSessionsResponse.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/MultiplexedSessionPrecommitToken.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation/Delete.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation/Write.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartialResultSet.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Partition.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionOptions.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionQueryRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionReadRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionResponse.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/ChildLink.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/Kind.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/ShortRepresentation.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/QueryPlan.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest/LockHint.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest/OrderBy.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RequestOptions.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RequestOptions/Priority.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSet.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSetMetadata.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSetStats.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RollbackRequest.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Session.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/StructType.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/StructType/Field.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Transaction.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/PBReadOnly.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/PartitionedDml.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/ReadOnly.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/ReadWrite.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/ReadWrite/ReadLockMode.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionSelector.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Type.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TypeAnnotationCode.php delete mode 100644 owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TypeCode.php delete mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/batch_create_sessions.php delete mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/batch_write.php delete mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/begin_transaction.php delete mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/commit.php delete mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/create_session.php delete mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/delete_session.php delete mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_batch_dml.php delete mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_sql.php delete mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_streaming_sql.php delete mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/get_session.php delete mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/list_sessions.php delete mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/partition_query.php delete mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/partition_read.php delete mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/read.php delete mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/rollback.php delete mode 100644 owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/streaming_read.php delete mode 100644 owl-bot-staging/Spanner/v1/src/V1/Client/SpannerClient.php delete mode 100644 owl-bot-staging/Spanner/v1/src/V1/Gapic/SpannerGapicClient.php delete mode 100644 owl-bot-staging/Spanner/v1/src/V1/SpannerClient.php delete mode 100644 owl-bot-staging/Spanner/v1/src/V1/gapic_metadata.json delete mode 100644 owl-bot-staging/Spanner/v1/src/V1/resources/spanner_client_config.json delete mode 100644 owl-bot-staging/Spanner/v1/src/V1/resources/spanner_descriptor_config.php delete mode 100644 owl-bot-staging/Spanner/v1/src/V1/resources/spanner_rest_client_config.php delete mode 100644 owl-bot-staging/Spanner/v1/tests/Unit/V1/Client/SpannerClientTest.php delete mode 100644 owl-bot-staging/Spanner/v1/tests/Unit/V1/SpannerClientTest.php diff --git a/Spanner/metadata/Admin/Instance/V1/Common.php b/Spanner/metadata/Admin/Instance/V1/Common.php index 75e8043d35ca28feb87a1098616dd9f7961d5dba..ce280a9688c2e93af7b4ae16afde68b380f0c3af 100644 GIT binary patch delta 62 zcmcb{wVZncI}?v%L1s))YH@yPQF7|!yNr#D$0x@#1xrb$=jW&Ar0ORYWa<||rS%Gm N@=NkJZ)94^1OUip7d8L@ delta 28 kcmZ3^eT{1aJJV!arf`-utX#Siy>%xaWm4YE%)EpN0DYebMgRZ+ diff --git a/Spanner/metadata/Admin/Instance/V1/SpannerInstanceAdmin.php b/Spanner/metadata/Admin/Instance/V1/SpannerInstanceAdmin.php index 8b5e9db042db74928e64a578df25e8e81c54bec9..3bca763a961b13aecf62ffb380c5bb00eef2dfc6 100644 GIT binary patch delta 1069 zcmZ`%&rcIU7b z#DjVx<6oeO2Tz(kaUpv2qQ;w^^duoBgoAg7(kex~?Y{TEnfcy(U$(jZr`+ouN87K5 z9NeI;_P|bY!20aKHrrdU`Yv9zjUxlDtQwj|^itJSOUoKj*Hyi!F6l+x-0-_bxL{XA zr1MiDdN|ZR9ZoQ<*pLdRlu`RP!H#m^yk9FDwKZaHR5U-TPtP`|XT$S#QeoVQJ`91X zSvJ&yMvD5HZjy>-kcv@W)~Z##R3NpIZu))f6g$P8Z?^cy9QgnD0u+Mrgp4r}(^*AG z$1oA{f|wMdVp3EVNiLn0a7;{yINp5$xuLVcCUG~1Jm6$}PLeXR!gw2UK}TH73ehC{ zvm*pu^SO*t6bN33VH{_mgI@snyAJAyUM7)qDWWV&_{?np?J}MdGwGA7;yEEn8h{OT zgDaIwDq<6{U*F~qgiX5b3DQxR4um|-Xkz8ks$Qr@x>^Bi0gfEDS5E7;=O@>j26vM_ z2?6RM(05a#^ixlVJKRj~I0ZW6eH6&U<<SG4C?IuHmw4Dxi(H+d=4*<7g_ z>1cjhKYTA>@`DY|eHyw3PVGTOH#B1EYnq><-v>wNrneoY!Bwji40T1L>gdEV^T|!*4%!jox&QZJoDx7}t-EHq^WhU9AWjhJL&ti83Zpd`rlS8Tm{ndcjxU zTFH=BJD7bkPG$0}zX=7)9x^8jtjrRY#SE*a^ZV>URU_ViFzX`^L%#tbkx6v` delta 140 zcmV;70CWH7iUHYy0kDw-1m|}OJ(CRvA(3nxv(p4c0s_7Uvl<660+U7xtOYt?>OozT zJ})Pe1PnH_TMY380-6c4P7&+@lZq3Avt<+`0h8Mmy97<@K}wT;Eh3Y=7Adp(7NZKY u?jpzm0gkh`B$NRGAd^fc903E9YbHwue(FJc3Mi9+EgzHJCR(#zCkh^kwlN0) diff --git a/Spanner/src/Admin/Instance/V1/AutoscalingConfig/AutoscalingTargets.php b/Spanner/src/Admin/Instance/V1/AutoscalingConfig/AutoscalingTargets.php index 45f359fee624..cf5df0923f5b 100644 --- a/Spanner/src/Admin/Instance/V1/AutoscalingConfig/AutoscalingTargets.php +++ b/Spanner/src/Admin/Instance/V1/AutoscalingConfig/AutoscalingTargets.php @@ -28,7 +28,7 @@ class AutoscalingTargets extends \Google\Protobuf\Internal\Message * Required. The target storage utilization percentage that the autoscaler * should be trying to achieve for the instance. This number is on a scale * from 0 (no utilization) to 100 (full utilization). The valid range is - * [10, 100] inclusive. + * [10, 99] inclusive. * * Generated from protobuf field int32 storage_utilization_percent = 2 [(.google.api.field_behavior) = REQUIRED]; */ @@ -49,7 +49,7 @@ class AutoscalingTargets extends \Google\Protobuf\Internal\Message * Required. The target storage utilization percentage that the autoscaler * should be trying to achieve for the instance. This number is on a scale * from 0 (no utilization) to 100 (full utilization). The valid range is - * [10, 100] inclusive. + * [10, 99] inclusive. * } */ public function __construct($data = NULL) { @@ -93,7 +93,7 @@ public function setHighPriorityCpuUtilizationPercent($var) * Required. The target storage utilization percentage that the autoscaler * should be trying to achieve for the instance. This number is on a scale * from 0 (no utilization) to 100 (full utilization). The valid range is - * [10, 100] inclusive. + * [10, 99] inclusive. * * Generated from protobuf field int32 storage_utilization_percent = 2 [(.google.api.field_behavior) = REQUIRED]; * @return int @@ -107,7 +107,7 @@ public function getStorageUtilizationPercent() * Required. The target storage utilization percentage that the autoscaler * should be trying to achieve for the instance. This number is on a scale * from 0 (no utilization) to 100 (full utilization). The valid range is - * [10, 100] inclusive. + * [10, 99] inclusive. * * Generated from protobuf field int32 storage_utilization_percent = 2 [(.google.api.field_behavior) = REQUIRED]; * @param int $var diff --git a/Spanner/src/Admin/Instance/V1/Client/InstanceAdminClient.php b/Spanner/src/Admin/Instance/V1/Client/InstanceAdminClient.php index f076d4f7f633..a8c85e0d7c77 100644 --- a/Spanner/src/Admin/Instance/V1/Client/InstanceAdminClient.php +++ b/Spanner/src/Admin/Instance/V1/Client/InstanceAdminClient.php @@ -384,7 +384,7 @@ public function __call($method, $args) /** * Creates an instance and begins preparing it to begin serving. The - * returned [long-running operation][google.longrunning.Operation] + * returned long-running operation * can be used to track the progress of preparing the new * instance. The instance name is assigned by the caller. If the * named instance already exists, `CreateInstance` returns @@ -410,12 +410,12 @@ public function __call($method, $args) * * The instance's allocated resource levels are readable via the API. * * The instance's state becomes `READY`. * - * The returned [long-running operation][google.longrunning.Operation] will + * The returned long-running operation will * have a name of the format `/operations/` and * can be used to track creation of the instance. The - * [metadata][google.longrunning.Operation.metadata] field type is + * metadata field type is * [CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata]. - * The [response][google.longrunning.Operation.response] field type is + * The response field type is * [Instance][google.spanner.admin.instance.v1.Instance], if successful. * * The async variant is {@see InstanceAdminClient::createInstanceAsync()} . @@ -443,7 +443,7 @@ public function createInstance(CreateInstanceRequest $request, array $callOption /** * Creates an instance configuration and begins preparing it to be used. The - * returned [long-running operation][google.longrunning.Operation] + * returned long-running operation * can be used to track the progress of preparing the new * instance configuration. The instance configuration name is assigned by the * caller. If the named instance configuration already exists, @@ -470,13 +470,13 @@ public function createInstance(CreateInstanceRequest $request, array $callOption * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] * field becomes false. Its state becomes `READY`. * - * The returned [long-running operation][google.longrunning.Operation] will + * The returned long-running operation will * have a name of the format * `/operations/` and can be used to track * creation of the instance configuration. The - * [metadata][google.longrunning.Operation.metadata] field type is + * metadata field type is * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. - * The [response][google.longrunning.Operation.response] field type is + * The response field type is * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if * successful. * @@ -509,7 +509,7 @@ public function createInstanceConfig(CreateInstanceConfigRequest $request, array /** * Creates an instance partition and begins preparing it to be used. The - * returned [long-running operation][google.longrunning.Operation] + * returned long-running operation * can be used to track the progress of preparing the new instance partition. * The instance partition name is assigned by the caller. If the named * instance partition already exists, `CreateInstancePartition` returns @@ -536,13 +536,13 @@ public function createInstanceConfig(CreateInstanceConfigRequest $request, array * API. * * The instance partition's state becomes `READY`. * - * The returned [long-running operation][google.longrunning.Operation] will + * The returned long-running operation will * have a name of the format * `/operations/` and can be used to * track creation of the instance partition. The - * [metadata][google.longrunning.Operation.metadata] field type is + * metadata field type is * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. - * The [response][google.longrunning.Operation.response] field type is + * The response field type is * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if * successful. * @@ -775,12 +775,12 @@ public function getInstancePartition(GetInstancePartitionRequest $request, array } /** - * Lists the user-managed instance configuration [long-running - * operations][google.longrunning.Operation] in the given project. An instance + * Lists the user-managed instance configuration long-running + * operations in the given project. An instance * configuration operation has a name of the form * `projects//instanceConfigs//operations/`. * The long-running operation - * [metadata][google.longrunning.Operation.metadata] field type + * metadata field type * `metadata.type_url` describes the type of the metadata. Operations returned * include those that have completed/failed/canceled within the last 7 days, * and pending operations. Operations returned are ordered by @@ -814,6 +814,9 @@ public function listInstanceConfigOperations(ListInstanceConfigOperationsRequest /** * Lists the supported instance configurations for a given project. * + * Returns both Google-managed configurations and user-managed + * configurations. + * * The async variant is {@see InstanceAdminClient::listInstanceConfigsAsync()} . * * @example samples/V1/InstanceAdminClient/list_instance_configs.php @@ -838,12 +841,11 @@ public function listInstanceConfigs(ListInstanceConfigsRequest $request, array $ } /** - * Lists instance partition [long-running - * operations][google.longrunning.Operation] in the given instance. + * Lists instance partition long-running operations in the given instance. * An instance partition operation has a name of the form * `projects//instances//instancePartitions//operations/`. * The long-running operation - * [metadata][google.longrunning.Operation.metadata] field type + * metadata field type * `metadata.type_url` describes the type of the metadata. Operations returned * include those that have completed/failed/canceled within the last 7 days, * and pending operations. Operations returned are ordered by @@ -932,7 +934,7 @@ public function listInstances(ListInstancesRequest $request, array $callOptions /** * Moves an instance to the target instance configuration. You can use the - * returned [long-running operation][google.longrunning.Operation] to track + * returned long-running operation to track * the progress of moving the instance. * * `MoveInstance` returns `FAILED_PRECONDITION` if the instance meets any of @@ -963,13 +965,13 @@ public function listInstances(ListInstancesRequest $request, array $callOptions * transaction abort rate. However, moving an instance doesn't cause any * downtime. * - * The returned [long-running operation][google.longrunning.Operation] has + * The returned long-running operation has * a name of the format * `/operations/` and can be used to track * the move instance operation. The - * [metadata][google.longrunning.Operation.metadata] field type is + * metadata field type is * [MoveInstanceMetadata][google.spanner.admin.instance.v1.MoveInstanceMetadata]. - * The [response][google.longrunning.Operation.response] field type is + * The response field type is * [Instance][google.spanner.admin.instance.v1.Instance], * if successful. * Cancelling the operation sets its metadata's @@ -1079,8 +1081,7 @@ public function testIamPermissions(TestIamPermissionsRequest $request, array $ca /** * Updates an instance, and begins allocating or releasing resources - * as requested. The returned [long-running - * operation][google.longrunning.Operation] can be used to track the + * as requested. The returned long-running operation can be used to track the * progress of updating the instance. If the named instance does not * exist, returns `NOT_FOUND`. * @@ -1108,12 +1109,12 @@ public function testIamPermissions(TestIamPermissionsRequest $request, array $ca * tables. * * The instance's new resource levels are readable via the API. * - * The returned [long-running operation][google.longrunning.Operation] will + * The returned long-running operation will * have a name of the format `/operations/` and * can be used to track the instance modification. The - * [metadata][google.longrunning.Operation.metadata] field type is + * metadata field type is * [UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. - * The [response][google.longrunning.Operation.response] field type is + * The response field type is * [Instance][google.spanner.admin.instance.v1.Instance], if successful. * * Authorization requires `spanner.instances.update` permission on @@ -1144,7 +1145,7 @@ public function updateInstance(UpdateInstanceRequest $request, array $callOption /** * Updates an instance configuration. The returned - * [long-running operation][google.longrunning.Operation] can be used to track + * long-running operation can be used to track * the progress of updating the instance. If the named instance configuration * does not exist, returns `NOT_FOUND`. * @@ -1175,13 +1176,13 @@ public function updateInstance(UpdateInstanceRequest $request, array $callOption * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] * field becomes false. * - * The returned [long-running operation][google.longrunning.Operation] will + * The returned long-running operation will * have a name of the format * `/operations/` and can be used to track * the instance configuration modification. The - * [metadata][google.longrunning.Operation.metadata] field type is + * metadata field type is * [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]. - * The [response][google.longrunning.Operation.response] field type is + * The response field type is * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if * successful. * @@ -1213,8 +1214,7 @@ public function updateInstanceConfig(UpdateInstanceConfigRequest $request, array /** * Updates an instance partition, and begins allocating or releasing resources - * as requested. The returned [long-running - * operation][google.longrunning.Operation] can be used to track the + * as requested. The returned long-running operation can be used to track the * progress of updating the instance partition. If the named instance * partition does not exist, returns `NOT_FOUND`. * @@ -1243,13 +1243,13 @@ public function updateInstanceConfig(UpdateInstanceConfigRequest $request, array * partition's tables. * * The instance partition's new resource levels are readable via the API. * - * The returned [long-running operation][google.longrunning.Operation] will + * The returned long-running operation will * have a name of the format * `/operations/` and can be used to * track the instance partition modification. The - * [metadata][google.longrunning.Operation.metadata] field type is + * metadata field type is * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. - * The [response][google.longrunning.Operation.response] field type is + * The response field type is * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if * successful. * diff --git a/Spanner/src/Admin/Instance/V1/CreateInstanceConfigRequest.php b/Spanner/src/Admin/Instance/V1/CreateInstanceConfigRequest.php index 72182a6d1a46..d629275fc079 100644 --- a/Spanner/src/Admin/Instance/V1/CreateInstanceConfigRequest.php +++ b/Spanner/src/Admin/Instance/V1/CreateInstanceConfigRequest.php @@ -10,7 +10,7 @@ /** * The request for - * [CreateInstanceConfigRequest][InstanceAdmin.CreateInstanceConfigRequest]. + * [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig]. * * Generated from protobuf message google.spanner.admin.instance.v1.CreateInstanceConfigRequest */ @@ -33,10 +33,10 @@ class CreateInstanceConfigRequest extends \Google\Protobuf\Internal\Message */ private $instance_config_id = ''; /** - * Required. The InstanceConfig proto of the configuration to create. - * instance_config.name must be + * Required. The `InstanceConfig` proto of the configuration to create. + * `instance_config.name` must be * `/instanceConfigs/`. - * instance_config.base_config must be a Google managed configuration name, + * `instance_config.base_config` must be a Google-managed configuration name, * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3. * * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 3 [(.google.api.field_behavior) = REQUIRED]; @@ -54,10 +54,10 @@ class CreateInstanceConfigRequest extends \Google\Protobuf\Internal\Message * @param string $parent Required. The name of the project in which to create the instance * configuration. Values are of the form `projects/`. Please see * {@see InstanceAdminClient::projectName()} for help formatting this field. - * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $instanceConfig Required. The InstanceConfig proto of the configuration to create. - * instance_config.name must be + * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $instanceConfig Required. The `InstanceConfig` proto of the configuration to create. + * `instance_config.name` must be * `/instanceConfigs/`. - * instance_config.base_config must be a Google managed configuration name, + * `instance_config.base_config` must be a Google-managed configuration name, * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3. * @param string $instanceConfigId Required. The ID of the instance configuration to create. Valid identifiers * are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 @@ -91,10 +91,10 @@ public static function build(string $parent, \Google\Cloud\Spanner\Admin\Instanc * characters in length. The `custom-` prefix is required to avoid name * conflicts with Google-managed configurations. * @type \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $instance_config - * Required. The InstanceConfig proto of the configuration to create. - * instance_config.name must be + * Required. The `InstanceConfig` proto of the configuration to create. + * `instance_config.name` must be * `/instanceConfigs/`. - * instance_config.base_config must be a Google managed configuration name, + * `instance_config.base_config` must be a Google-managed configuration name, * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3. * @type bool $validate_only * An option to validate, but not actually execute, a request, @@ -167,10 +167,10 @@ public function setInstanceConfigId($var) } /** - * Required. The InstanceConfig proto of the configuration to create. - * instance_config.name must be + * Required. The `InstanceConfig` proto of the configuration to create. + * `instance_config.name` must be * `/instanceConfigs/`. - * instance_config.base_config must be a Google managed configuration name, + * `instance_config.base_config` must be a Google-managed configuration name, * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3. * * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 3 [(.google.api.field_behavior) = REQUIRED]; @@ -192,10 +192,10 @@ public function clearInstanceConfig() } /** - * Required. The InstanceConfig proto of the configuration to create. - * instance_config.name must be + * Required. The `InstanceConfig` proto of the configuration to create. + * `instance_config.name` must be * `/instanceConfigs/`. - * instance_config.base_config must be a Google managed configuration name, + * `instance_config.base_config` must be a Google-managed configuration name, * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3. * * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 3 [(.google.api.field_behavior) = REQUIRED]; diff --git a/Spanner/src/Admin/Instance/V1/DeleteInstanceConfigRequest.php b/Spanner/src/Admin/Instance/V1/DeleteInstanceConfigRequest.php index 6cc41a917dcc..e8c7334f4693 100644 --- a/Spanner/src/Admin/Instance/V1/DeleteInstanceConfigRequest.php +++ b/Spanner/src/Admin/Instance/V1/DeleteInstanceConfigRequest.php @@ -10,7 +10,7 @@ /** * The request for - * [DeleteInstanceConfigRequest][InstanceAdmin.DeleteInstanceConfigRequest]. + * [DeleteInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.DeleteInstanceConfig]. * * Generated from protobuf message google.spanner.admin.instance.v1.DeleteInstanceConfigRequest */ diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FreeInstanceMetadata.php b/Spanner/src/Admin/Instance/V1/FreeInstanceMetadata.php similarity index 98% rename from owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FreeInstanceMetadata.php rename to Spanner/src/Admin/Instance/V1/FreeInstanceMetadata.php index 49b3e7084a27..26702b73547b 100644 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FreeInstanceMetadata.php +++ b/Spanner/src/Admin/Instance/V1/FreeInstanceMetadata.php @@ -24,14 +24,14 @@ class FreeInstanceMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.protobuf.Timestamp expire_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - protected $expire_time = null; + private $expire_time = null; /** * Output only. If present, the timestamp at which the free instance was * upgraded to a provisioned instance. * * Generated from protobuf field .google.protobuf.Timestamp upgrade_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ - protected $upgrade_time = null; + private $upgrade_time = null; /** * Specifies the expiration behavior of a free instance. The default of * ExpireBehavior is `REMOVE_AFTER_GRACE_PERIOD`. This can be modified during @@ -39,7 +39,7 @@ class FreeInstanceMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.spanner.admin.instance.v1.FreeInstanceMetadata.ExpireBehavior expire_behavior = 3; */ - protected $expire_behavior = 0; + private $expire_behavior = 0; /** * Constructor. diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FreeInstanceMetadata/ExpireBehavior.php b/Spanner/src/Admin/Instance/V1/FreeInstanceMetadata/ExpireBehavior.php similarity index 100% rename from owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FreeInstanceMetadata/ExpireBehavior.php rename to Spanner/src/Admin/Instance/V1/FreeInstanceMetadata/ExpireBehavior.php diff --git a/Spanner/src/Admin/Instance/V1/Gapic/InstanceAdminGapicClient.php b/Spanner/src/Admin/Instance/V1/Gapic/InstanceAdminGapicClient.php index 4e93f047478a..369c8441c203 100644 --- a/Spanner/src/Admin/Instance/V1/Gapic/InstanceAdminGapicClient.php +++ b/Spanner/src/Admin/Instance/V1/Gapic/InstanceAdminGapicClient.php @@ -488,7 +488,7 @@ public function __construct(array $options = []) /** * Creates an instance and begins preparing it to begin serving. The - * returned [long-running operation][google.longrunning.Operation] + * returned long-running operation * can be used to track the progress of preparing the new * instance. The instance name is assigned by the caller. If the * named instance already exists, `CreateInstance` returns @@ -514,12 +514,12 @@ public function __construct(array $options = []) * * The instance's allocated resource levels are readable via the API. * * The instance's state becomes `READY`. * - * The returned [long-running operation][google.longrunning.Operation] will + * The returned long-running operation will * have a name of the format `/operations/` and * can be used to track creation of the instance. The - * [metadata][google.longrunning.Operation.metadata] field type is + * metadata field type is * [CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata]. - * The [response][google.longrunning.Operation.response] field type is + * The response field type is * [Instance][google.spanner.admin.instance.v1.Instance], if successful. * * Sample code: @@ -608,7 +608,7 @@ public function createInstance( /** * Creates an instance configuration and begins preparing it to be used. The - * returned [long-running operation][google.longrunning.Operation] + * returned long-running operation * can be used to track the progress of preparing the new * instance configuration. The instance configuration name is assigned by the * caller. If the named instance configuration already exists, @@ -635,13 +635,13 @@ public function createInstance( * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] * field becomes false. Its state becomes `READY`. * - * The returned [long-running operation][google.longrunning.Operation] will + * The returned long-running operation will * have a name of the format * `/operations/` and can be used to track * creation of the instance configuration. The - * [metadata][google.longrunning.Operation.metadata] field type is + * metadata field type is * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. - * The [response][google.longrunning.Operation.response] field type is + * The response field type is * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if * successful. * @@ -693,10 +693,10 @@ public function createInstance( * are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 * characters in length. The `custom-` prefix is required to avoid name * conflicts with Google-managed configurations. - * @param InstanceConfig $instanceConfig Required. The InstanceConfig proto of the configuration to create. - * instance_config.name must be + * @param InstanceConfig $instanceConfig Required. The `InstanceConfig` proto of the configuration to create. + * `instance_config.name` must be * `/instanceConfigs/`. - * instance_config.base_config must be a Google managed configuration name, + * `instance_config.base_config` must be a Google-managed configuration name, * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3. * @param array $optionalArgs { * Optional. @@ -746,7 +746,7 @@ public function createInstanceConfig( /** * Creates an instance partition and begins preparing it to be used. The - * returned [long-running operation][google.longrunning.Operation] + * returned long-running operation * can be used to track the progress of preparing the new instance partition. * The instance partition name is assigned by the caller. If the named * instance partition already exists, `CreateInstancePartition` returns @@ -773,13 +773,13 @@ public function createInstanceConfig( * API. * * The instance partition's state becomes `READY`. * - * The returned [long-running operation][google.longrunning.Operation] will + * The returned long-running operation will * have a name of the format * `/operations/` and can be used to * track creation of the instance partition. The - * [metadata][google.longrunning.Operation.metadata] field type is + * metadata field type is * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. - * The [response][google.longrunning.Operation.response] field type is + * The response field type is * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if * successful. * @@ -1281,12 +1281,12 @@ public function getInstancePartition($name, array $optionalArgs = []) } /** - * Lists the user-managed instance configuration [long-running - * operations][google.longrunning.Operation] in the given project. An instance + * Lists the user-managed instance configuration long-running + * operations in the given project. An instance * configuration operation has a name of the form * `projects//instanceConfigs//operations/`. * The long-running operation - * [metadata][google.longrunning.Operation.metadata] field type + * metadata field type * `metadata.type_url` describes the type of the metadata. Operations returned * include those that have completed/failed/canceled within the last 7 days, * and pending operations. Operations returned are ordered by @@ -1330,8 +1330,7 @@ public function getInstancePartition($name, array $optionalArgs = []) * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. * Colon `:` is the contains operator. Filter rules are not case sensitive. * - * The following fields in the [Operation][google.longrunning.Operation] - * are eligible for filtering: + * The following fields in the Operation are eligible for filtering: * * * `name` - The name of the long-running operation * * `done` - False if the operation is in progress, else true. @@ -1421,6 +1420,9 @@ public function listInstanceConfigOperations( /** * Lists the supported instance configurations for a given project. * + * Returns both Google-managed configurations and user-managed + * configurations. + * * Sample code: * ``` * $instanceAdminClient = new InstanceAdminClient(); @@ -1498,12 +1500,11 @@ public function listInstanceConfigs($parent, array $optionalArgs = []) } /** - * Lists instance partition [long-running - * operations][google.longrunning.Operation] in the given instance. + * Lists instance partition long-running operations in the given instance. * An instance partition operation has a name of the form * `projects//instances//instancePartitions//operations/`. * The long-running operation - * [metadata][google.longrunning.Operation.metadata] field type + * metadata field type * `metadata.type_url` describes the type of the metadata. Operations returned * include those that have completed/failed/canceled within the last 7 days, * and pending operations. Operations returned are ordered by @@ -1551,8 +1552,7 @@ public function listInstanceConfigs($parent, array $optionalArgs = []) * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. * Colon `:` is the contains operator. Filter rules are not case sensitive. * - * The following fields in the [Operation][google.longrunning.Operation] - * are eligible for filtering: + * The following fields in the Operation are eligible for filtering: * * * `name` - The name of the long-running operation * * `done` - False if the operation is in progress, else true. @@ -1599,7 +1599,8 @@ public function listInstanceConfigs($parent, array $optionalArgs = []) * Optional. Deadline used while retrieving metadata for instance partition * operations. Instance partitions whose operation metadata cannot be * retrieved within this deadline will be added to - * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in + * [unreachable_instance_partitions][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions] + * in * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]. * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an @@ -1678,7 +1679,9 @@ public function listInstancePartitionOperations( * ``` * * @param string $parent Required. The instance whose instance partitions should be listed. Values - * are of the form `projects//instances/`. + * are of the form `projects//instances/`. Use `{instance} + * = '-'` to list instance partitions for all Instances in a project, e.g., + * `projects/myproject/instances/-`. * @param array $optionalArgs { * Optional. * @@ -1857,7 +1860,7 @@ public function listInstances($parent, array $optionalArgs = []) /** * Moves an instance to the target instance configuration. You can use the - * returned [long-running operation][google.longrunning.Operation] to track + * returned long-running operation to track * the progress of moving the instance. * * `MoveInstance` returns `FAILED_PRECONDITION` if the instance meets any of @@ -1888,13 +1891,13 @@ public function listInstances($parent, array $optionalArgs = []) * transaction abort rate. However, moving an instance doesn't cause any * downtime. * - * The returned [long-running operation][google.longrunning.Operation] has + * The returned long-running operation has * a name of the format * `/operations/` and can be used to track * the move instance operation. The - * [metadata][google.longrunning.Operation.metadata] field type is + * metadata field type is * [MoveInstanceMetadata][google.spanner.admin.instance.v1.MoveInstanceMetadata]. - * The [response][google.longrunning.Operation.response] field type is + * The response field type is * [Instance][google.spanner.admin.instance.v1.Instance], * if successful. * Cancelling the operation sets its metadata's @@ -2127,8 +2130,7 @@ public function testIamPermissions( /** * Updates an instance, and begins allocating or releasing resources - * as requested. The returned [long-running - * operation][google.longrunning.Operation] can be used to track the + * as requested. The returned long-running operation can be used to track the * progress of updating the instance. If the named instance does not * exist, returns `NOT_FOUND`. * @@ -2156,12 +2158,12 @@ public function testIamPermissions( * tables. * * The instance's new resource levels are readable via the API. * - * The returned [long-running operation][google.longrunning.Operation] will + * The returned long-running operation will * have a name of the format `/operations/` and * can be used to track the instance modification. The - * [metadata][google.longrunning.Operation.metadata] field type is + * metadata field type is * [UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. - * The [response][google.longrunning.Operation.response] field type is + * The response field type is * [Instance][google.spanner.admin.instance.v1.Instance], if successful. * * Authorization requires `spanner.instances.update` permission on @@ -2252,7 +2254,7 @@ public function updateInstance( /** * Updates an instance configuration. The returned - * [long-running operation][google.longrunning.Operation] can be used to track + * long-running operation can be used to track * the progress of updating the instance. If the named instance configuration * does not exist, returns `NOT_FOUND`. * @@ -2283,13 +2285,13 @@ public function updateInstance( * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] * field becomes false. * - * The returned [long-running operation][google.longrunning.Operation] will + * The returned long-running operation will * have a name of the format * `/operations/` and can be used to track * the instance configuration modification. The - * [metadata][google.longrunning.Operation.metadata] field type is + * metadata field type is * [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]. - * The [response][google.longrunning.Operation.response] field type is + * The response field type is * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if * successful. * @@ -2394,8 +2396,7 @@ public function updateInstanceConfig( /** * Updates an instance partition, and begins allocating or releasing resources - * as requested. The returned [long-running - * operation][google.longrunning.Operation] can be used to track the + * as requested. The returned long-running operation can be used to track the * progress of updating the instance partition. If the named instance * partition does not exist, returns `NOT_FOUND`. * @@ -2424,13 +2425,13 @@ public function updateInstanceConfig( * partition's tables. * * The instance partition's new resource levels are readable via the API. * - * The returned [long-running operation][google.longrunning.Operation] will + * The returned long-running operation will * have a name of the format * `/operations/` and can be used to * track the instance partition modification. The - * [metadata][google.longrunning.Operation.metadata] field type is + * metadata field type is * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. - * The [response][google.longrunning.Operation.response] field type is + * The response field type is * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if * successful. * diff --git a/Spanner/src/Admin/Instance/V1/Instance.php b/Spanner/src/Admin/Instance/V1/Instance.php index 27cafab2cc74..a056a931e61c 100644 --- a/Spanner/src/Admin/Instance/V1/Instance.php +++ b/Spanner/src/Admin/Instance/V1/Instance.php @@ -49,9 +49,6 @@ class Instance extends \Google\Protobuf\Internal\Message * field and reflects the current number of nodes allocated to the instance. * This might be zero in API responses for instances that are not yet in the * `READY` state. - * If the instance has varying node count across replicas (achieved by - * setting asymmetric_autoscaling_options in autoscaling config), the - * node_count here is the maximum node count across all replicas. * For more information, see * [Compute capacity, nodes, and processing * units](https://cloud.google.com/spanner/docs/compute-capacity). @@ -69,10 +66,6 @@ class Instance extends \Google\Protobuf\Internal\Message * allocated to the instance. * This might be zero in API responses for instances that are not yet in the * `READY` state. - * If the instance has varying processing units per replica - * (achieved by setting asymmetric_autoscaling_options in autoscaling config), - * the processing_units here is the maximum processing units across all - * replicas. * For more information, see * [Compute capacity, nodes and processing * units](https://cloud.google.com/spanner/docs/compute-capacity). @@ -130,6 +123,12 @@ class Instance extends \Google\Protobuf\Internal\Message * Generated from protobuf field map labels = 7; */ private $labels; + /** + * The `InstanceType` of the current instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.InstanceType instance_type = 10; + */ + private $instance_type = 0; /** * Deprecated. This field is not populated. * @@ -148,6 +147,12 @@ class Instance extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ private $update_time = null; + /** + * Free instance metadata. Only populated for free instances. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.FreeInstanceMetadata free_instance_metadata = 13; + */ + private $free_instance_metadata = null; /** * Optional. The `Edition` of the current instance. * @@ -155,13 +160,14 @@ class Instance extends \Google\Protobuf\Internal\Message */ private $edition = 0; /** - * Optional. Controls the default backup behavior for new databases within the - * instance. - * Note that `AUTOMATIC` is not permitted for free instances, as backups and - * backup schedules are not allowed for free instances. + * Optional. Controls the default backup schedule behavior for new databases + * within the instance. By default, a backup schedule is created automatically + * when a new database is created in a new instance. + * Note that the `AUTOMATIC` value isn't permitted for free instances, + * as backups and backup schedules aren't supported for free instances. * In the `GetInstance` or `ListInstances` response, if the value of - * default_backup_schedule_type is unset or NONE, no default backup - * schedule will be created for new databases within the instance. + * `default_backup_schedule_type` isn't set, or set to `NONE`, Spanner doesn't + * create a default backup schedule for new databases in the instance. * * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.DefaultBackupScheduleType default_backup_schedule_type = 23 [(.google.api.field_behavior) = OPTIONAL]; */ @@ -195,9 +201,6 @@ class Instance extends \Google\Protobuf\Internal\Message * field and reflects the current number of nodes allocated to the instance. * This might be zero in API responses for instances that are not yet in the * `READY` state. - * If the instance has varying node count across replicas (achieved by - * setting asymmetric_autoscaling_options in autoscaling config), the - * node_count here is the maximum node count across all replicas. * For more information, see * [Compute capacity, nodes, and processing * units](https://cloud.google.com/spanner/docs/compute-capacity). @@ -211,10 +214,6 @@ class Instance extends \Google\Protobuf\Internal\Message * allocated to the instance. * This might be zero in API responses for instances that are not yet in the * `READY` state. - * If the instance has varying processing units per replica - * (achieved by setting asymmetric_autoscaling_options in autoscaling config), - * the processing_units here is the maximum processing units across all - * replicas. * For more information, see * [Compute capacity, nodes and processing * units](https://cloud.google.com/spanner/docs/compute-capacity). @@ -252,22 +251,27 @@ class Instance extends \Google\Protobuf\Internal\Message * specific characters being disallowed. For example, representing labels * as the string: name + "_" + value would prove problematic if we were to * allow "_" in a future release. + * @type int $instance_type + * The `InstanceType` of the current instance. * @type array|\Google\Protobuf\Internal\RepeatedField $endpoint_uris * Deprecated. This field is not populated. * @type \Google\Protobuf\Timestamp $create_time * Output only. The time at which the instance was created. * @type \Google\Protobuf\Timestamp $update_time * Output only. The time at which the instance was most recently updated. + * @type \Google\Cloud\Spanner\Admin\Instance\V1\FreeInstanceMetadata $free_instance_metadata + * Free instance metadata. Only populated for free instances. * @type int $edition * Optional. The `Edition` of the current instance. * @type int $default_backup_schedule_type - * Optional. Controls the default backup behavior for new databases within the - * instance. - * Note that `AUTOMATIC` is not permitted for free instances, as backups and - * backup schedules are not allowed for free instances. + * Optional. Controls the default backup schedule behavior for new databases + * within the instance. By default, a backup schedule is created automatically + * when a new database is created in a new instance. + * Note that the `AUTOMATIC` value isn't permitted for free instances, + * as backups and backup schedules aren't supported for free instances. * In the `GetInstance` or `ListInstances` response, if the value of - * default_backup_schedule_type is unset or NONE, no default backup - * schedule will be created for new databases within the instance. + * `default_backup_schedule_type` isn't set, or set to `NONE`, Spanner doesn't + * create a default backup schedule for new databases in the instance. * } */ public function __construct($data = NULL) { @@ -376,9 +380,6 @@ public function setDisplayName($var) * field and reflects the current number of nodes allocated to the instance. * This might be zero in API responses for instances that are not yet in the * `READY` state. - * If the instance has varying node count across replicas (achieved by - * setting asymmetric_autoscaling_options in autoscaling config), the - * node_count here is the maximum node count across all replicas. * For more information, see * [Compute capacity, nodes, and processing * units](https://cloud.google.com/spanner/docs/compute-capacity). @@ -400,9 +401,6 @@ public function getNodeCount() * field and reflects the current number of nodes allocated to the instance. * This might be zero in API responses for instances that are not yet in the * `READY` state. - * If the instance has varying node count across replicas (achieved by - * setting asymmetric_autoscaling_options in autoscaling config), the - * node_count here is the maximum node count across all replicas. * For more information, see * [Compute capacity, nodes, and processing * units](https://cloud.google.com/spanner/docs/compute-capacity). @@ -429,10 +427,6 @@ public function setNodeCount($var) * allocated to the instance. * This might be zero in API responses for instances that are not yet in the * `READY` state. - * If the instance has varying processing units per replica - * (achieved by setting asymmetric_autoscaling_options in autoscaling config), - * the processing_units here is the maximum processing units across all - * replicas. * For more information, see * [Compute capacity, nodes and processing * units](https://cloud.google.com/spanner/docs/compute-capacity). @@ -455,10 +449,6 @@ public function getProcessingUnits() * allocated to the instance. * This might be zero in API responses for instances that are not yet in the * `READY` state. - * If the instance has varying processing units per replica - * (achieved by setting asymmetric_autoscaling_options in autoscaling config), - * the processing_units here is the maximum processing units across all - * replicas. * For more information, see * [Compute capacity, nodes and processing * units](https://cloud.google.com/spanner/docs/compute-capacity). @@ -641,6 +631,32 @@ public function setLabels($var) return $this; } + /** + * The `InstanceType` of the current instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.InstanceType instance_type = 10; + * @return int + */ + public function getInstanceType() + { + return $this->instance_type; + } + + /** + * The `InstanceType` of the current instance. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.InstanceType instance_type = 10; + * @param int $var + * @return $this + */ + public function setInstanceType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\Instance\InstanceType::class); + $this->instance_type = $var; + + return $this; + } + /** * Deprecated. This field is not populated. * @@ -739,6 +755,42 @@ public function setUpdateTime($var) return $this; } + /** + * Free instance metadata. Only populated for free instances. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.FreeInstanceMetadata free_instance_metadata = 13; + * @return \Google\Cloud\Spanner\Admin\Instance\V1\FreeInstanceMetadata|null + */ + public function getFreeInstanceMetadata() + { + return $this->free_instance_metadata; + } + + public function hasFreeInstanceMetadata() + { + return isset($this->free_instance_metadata); + } + + public function clearFreeInstanceMetadata() + { + unset($this->free_instance_metadata); + } + + /** + * Free instance metadata. Only populated for free instances. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.FreeInstanceMetadata free_instance_metadata = 13; + * @param \Google\Cloud\Spanner\Admin\Instance\V1\FreeInstanceMetadata $var + * @return $this + */ + public function setFreeInstanceMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\FreeInstanceMetadata::class); + $this->free_instance_metadata = $var; + + return $this; + } + /** * Optional. The `Edition` of the current instance. * @@ -766,13 +818,14 @@ public function setEdition($var) } /** - * Optional. Controls the default backup behavior for new databases within the - * instance. - * Note that `AUTOMATIC` is not permitted for free instances, as backups and - * backup schedules are not allowed for free instances. + * Optional. Controls the default backup schedule behavior for new databases + * within the instance. By default, a backup schedule is created automatically + * when a new database is created in a new instance. + * Note that the `AUTOMATIC` value isn't permitted for free instances, + * as backups and backup schedules aren't supported for free instances. * In the `GetInstance` or `ListInstances` response, if the value of - * default_backup_schedule_type is unset or NONE, no default backup - * schedule will be created for new databases within the instance. + * `default_backup_schedule_type` isn't set, or set to `NONE`, Spanner doesn't + * create a default backup schedule for new databases in the instance. * * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.DefaultBackupScheduleType default_backup_schedule_type = 23 [(.google.api.field_behavior) = OPTIONAL]; * @return int @@ -783,13 +836,14 @@ public function getDefaultBackupScheduleType() } /** - * Optional. Controls the default backup behavior for new databases within the - * instance. - * Note that `AUTOMATIC` is not permitted for free instances, as backups and - * backup schedules are not allowed for free instances. + * Optional. Controls the default backup schedule behavior for new databases + * within the instance. By default, a backup schedule is created automatically + * when a new database is created in a new instance. + * Note that the `AUTOMATIC` value isn't permitted for free instances, + * as backups and backup schedules aren't supported for free instances. * In the `GetInstance` or `ListInstances` response, if the value of - * default_backup_schedule_type is unset or NONE, no default backup - * schedule will be created for new databases within the instance. + * `default_backup_schedule_type` isn't set, or set to `NONE`, Spanner doesn't + * create a default backup schedule for new databases in the instance. * * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.DefaultBackupScheduleType default_backup_schedule_type = 23 [(.google.api.field_behavior) = OPTIONAL]; * @param int $var diff --git a/Spanner/src/Admin/Instance/V1/Instance/DefaultBackupScheduleType.php b/Spanner/src/Admin/Instance/V1/Instance/DefaultBackupScheduleType.php index ee1c54f26a01..ca0a5ec8fd95 100644 --- a/Spanner/src/Admin/Instance/V1/Instance/DefaultBackupScheduleType.php +++ b/Spanner/src/Admin/Instance/V1/Instance/DefaultBackupScheduleType.php @@ -7,8 +7,10 @@ use UnexpectedValueException; /** - * Indicates the default backup behavior for new databases within the - * instance. + * Indicates the + * [default backup + * schedule](https://cloud.google.com/spanner/docs/backup#default-backup-schedules) + * behavior for new databases within the instance. * * Protobuf type google.spanner.admin.instance.v1.Instance.DefaultBackupScheduleType */ @@ -21,18 +23,17 @@ class DefaultBackupScheduleType */ const DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIED = 0; /** - * No default backup schedule will be created automatically on creation of a - * database within the instance. + * A default backup schedule isn't created automatically when a new database + * is created in the instance. * * Generated from protobuf enum NONE = 1; */ const NONE = 1; /** - * A default backup schedule will be created automatically on creation of a - * database within the instance. The default backup schedule creates a full - * backup every 24 hours and retains the backup for a period of 7 days. Once - * created, the default backup schedule can be edited/deleted similar to any - * other backup schedule. + * A default backup schedule is created automatically when a new database + * is created in the instance. The default backup schedule creates a full + * backup every 24 hours. These full backups are retained for 7 days. + * You can edit or delete the default backup schedule once it's created. * * Generated from protobuf enum AUTOMATIC = 2; */ diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/InstanceType.php b/Spanner/src/Admin/Instance/V1/Instance/InstanceType.php similarity index 100% rename from owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/InstanceType.php rename to Spanner/src/Admin/Instance/V1/Instance/InstanceType.php diff --git a/Spanner/src/Admin/Instance/V1/InstanceConfig.php b/Spanner/src/Admin/Instance/V1/InstanceConfig.php index 73b4e0350fee..1f08fb03d2aa 100644 --- a/Spanner/src/Admin/Instance/V1/InstanceConfig.php +++ b/Spanner/src/Admin/Instance/V1/InstanceConfig.php @@ -41,22 +41,26 @@ class InstanceConfig extends \Google\Protobuf\Internal\Message /** * The geographic placement of nodes in this instance configuration and their * replication properties. + * To create user-managed configurations, input + * `replicas` must include all replicas in `replicas` of the `base_config` + * and include one or more replicas in the `optional_replicas` of the + * `base_config`. * * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaInfo replicas = 3; */ private $replicas; /** - * Output only. The available optional replicas to choose from for user - * managed configurations. Populated for Google managed configurations. + * Output only. The available optional replicas to choose from for + * user-managed configurations. Populated for Google-managed configurations. * * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaInfo optional_replicas = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ private $optional_replicas; /** * Base configuration name, e.g. projects//instanceConfigs/nam3, - * based on which this configuration is created. Only set for user managed + * based on which this configuration is created. Only set for user-managed * configurations. `base_config` must refer to a configuration of type - * GOOGLE_MANAGED in the same project as this configuration. + * `GOOGLE_MANAGED` in the same project as this configuration. * * Generated from protobuf field string base_config = 7 [(.google.api.resource_reference) = { */ @@ -122,6 +126,25 @@ class InstanceConfig extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.State state = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ private $state = 0; + /** + * Output only. Describes whether free instances are available to be created + * in this instance configuration. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.FreeInstanceAvailability free_instance_availability = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $free_instance_availability = 0; + /** + * Output only. The `QuorumType` of the instance configuration. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.QuorumType quorum_type = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $quorum_type = 0; + /** + * Output only. The storage limit in bytes per processing unit. + * + * Generated from protobuf field int64 storage_limit_per_processing_unit = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $storage_limit_per_processing_unit = 0; /** * Constructor. @@ -142,14 +165,18 @@ class InstanceConfig extends \Google\Protobuf\Internal\Message * @type array<\Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo>|\Google\Protobuf\Internal\RepeatedField $replicas * The geographic placement of nodes in this instance configuration and their * replication properties. + * To create user-managed configurations, input + * `replicas` must include all replicas in `replicas` of the `base_config` + * and include one or more replicas in the `optional_replicas` of the + * `base_config`. * @type array<\Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo>|\Google\Protobuf\Internal\RepeatedField $optional_replicas - * Output only. The available optional replicas to choose from for user - * managed configurations. Populated for Google managed configurations. + * Output only. The available optional replicas to choose from for + * user-managed configurations. Populated for Google-managed configurations. * @type string $base_config * Base configuration name, e.g. projects//instanceConfigs/nam3, - * based on which this configuration is created. Only set for user managed + * based on which this configuration is created. Only set for user-managed * configurations. `base_config` must refer to a configuration of type - * GOOGLE_MANAGED in the same project as this configuration. + * `GOOGLE_MANAGED` in the same project as this configuration. * @type array|\Google\Protobuf\Internal\MapField $labels * Cloud Labels are a flexible and lightweight mechanism for organizing cloud * resources into groups that reflect a customer's organizational needs and @@ -191,6 +218,13 @@ class InstanceConfig extends \Google\Protobuf\Internal\Message * @type int $state * Output only. The current instance configuration state. Applicable only for * `USER_MANAGED` configurations. + * @type int $free_instance_availability + * Output only. Describes whether free instances are available to be created + * in this instance configuration. + * @type int $quorum_type + * Output only. The `QuorumType` of the instance configuration. + * @type int|string $storage_limit_per_processing_unit + * Output only. The storage limit in bytes per processing unit. * } */ public function __construct($data = NULL) { @@ -287,6 +321,10 @@ public function setConfigType($var) /** * The geographic placement of nodes in this instance configuration and their * replication properties. + * To create user-managed configurations, input + * `replicas` must include all replicas in `replicas` of the `base_config` + * and include one or more replicas in the `optional_replicas` of the + * `base_config`. * * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaInfo replicas = 3; * @return \Google\Protobuf\Internal\RepeatedField @@ -299,6 +337,10 @@ public function getReplicas() /** * The geographic placement of nodes in this instance configuration and their * replication properties. + * To create user-managed configurations, input + * `replicas` must include all replicas in `replicas` of the `base_config` + * and include one or more replicas in the `optional_replicas` of the + * `base_config`. * * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaInfo replicas = 3; * @param array<\Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo>|\Google\Protobuf\Internal\RepeatedField $var @@ -313,8 +355,8 @@ public function setReplicas($var) } /** - * Output only. The available optional replicas to choose from for user - * managed configurations. Populated for Google managed configurations. + * Output only. The available optional replicas to choose from for + * user-managed configurations. Populated for Google-managed configurations. * * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaInfo optional_replicas = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; * @return \Google\Protobuf\Internal\RepeatedField @@ -325,8 +367,8 @@ public function getOptionalReplicas() } /** - * Output only. The available optional replicas to choose from for user - * managed configurations. Populated for Google managed configurations. + * Output only. The available optional replicas to choose from for + * user-managed configurations. Populated for Google-managed configurations. * * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaInfo optional_replicas = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; * @param array<\Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo>|\Google\Protobuf\Internal\RepeatedField $var @@ -342,9 +384,9 @@ public function setOptionalReplicas($var) /** * Base configuration name, e.g. projects//instanceConfigs/nam3, - * based on which this configuration is created. Only set for user managed + * based on which this configuration is created. Only set for user-managed * configurations. `base_config` must refer to a configuration of type - * GOOGLE_MANAGED in the same project as this configuration. + * `GOOGLE_MANAGED` in the same project as this configuration. * * Generated from protobuf field string base_config = 7 [(.google.api.resource_reference) = { * @return string @@ -356,9 +398,9 @@ public function getBaseConfig() /** * Base configuration name, e.g. projects//instanceConfigs/nam3, - * based on which this configuration is created. Only set for user managed + * based on which this configuration is created. Only set for user-managed * configurations. `base_config` must refer to a configuration of type - * GOOGLE_MANAGED in the same project as this configuration. + * `GOOGLE_MANAGED` in the same project as this configuration. * * Generated from protobuf field string base_config = 7 [(.google.api.resource_reference) = { * @param string $var @@ -564,5 +606,85 @@ public function setState($var) return $this; } + /** + * Output only. Describes whether free instances are available to be created + * in this instance configuration. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.FreeInstanceAvailability free_instance_availability = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getFreeInstanceAvailability() + { + return $this->free_instance_availability; + } + + /** + * Output only. Describes whether free instances are available to be created + * in this instance configuration. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.FreeInstanceAvailability free_instance_availability = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setFreeInstanceAvailability($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig\FreeInstanceAvailability::class); + $this->free_instance_availability = $var; + + return $this; + } + + /** + * Output only. The `QuorumType` of the instance configuration. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.QuorumType quorum_type = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getQuorumType() + { + return $this->quorum_type; + } + + /** + * Output only. The `QuorumType` of the instance configuration. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.QuorumType quorum_type = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setQuorumType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig\QuorumType::class); + $this->quorum_type = $var; + + return $this; + } + + /** + * Output only. The storage limit in bytes per processing unit. + * + * Generated from protobuf field int64 storage_limit_per_processing_unit = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getStorageLimitPerProcessingUnit() + { + return $this->storage_limit_per_processing_unit; + } + + /** + * Output only. The storage limit in bytes per processing unit. + * + * Generated from protobuf field int64 storage_limit_per_processing_unit = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setStorageLimitPerProcessingUnit($var) + { + GPBUtil::checkInt64($var); + $this->storage_limit_per_processing_unit = $var; + + return $this; + } + } diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/FreeInstanceAvailability.php b/Spanner/src/Admin/Instance/V1/InstanceConfig/FreeInstanceAvailability.php similarity index 100% rename from owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/FreeInstanceAvailability.php rename to Spanner/src/Admin/Instance/V1/InstanceConfig/FreeInstanceAvailability.php diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/QuorumType.php b/Spanner/src/Admin/Instance/V1/InstanceConfig/QuorumType.php similarity index 100% rename from owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/QuorumType.php rename to Spanner/src/Admin/Instance/V1/InstanceConfig/QuorumType.php diff --git a/Spanner/src/Admin/Instance/V1/InstanceConfig/Type.php b/Spanner/src/Admin/Instance/V1/InstanceConfig/Type.php index c51f5593a52e..08f5079da568 100644 --- a/Spanner/src/Admin/Instance/V1/InstanceConfig/Type.php +++ b/Spanner/src/Admin/Instance/V1/InstanceConfig/Type.php @@ -20,13 +20,13 @@ class Type */ const TYPE_UNSPECIFIED = 0; /** - * Google managed configuration. + * Google-managed configuration. * * Generated from protobuf enum GOOGLE_MANAGED = 1; */ const GOOGLE_MANAGED = 1; /** - * User managed configuration. + * User-managed configuration. * * Generated from protobuf enum USER_MANAGED = 2; */ diff --git a/Spanner/src/Admin/Instance/V1/InstancePartition.php b/Spanner/src/Admin/Instance/V1/InstancePartition.php index 7ce35ef9a0ca..6616bb2d174c 100644 --- a/Spanner/src/Admin/Instance/V1/InstancePartition.php +++ b/Spanner/src/Admin/Instance/V1/InstancePartition.php @@ -72,12 +72,14 @@ class InstancePartition extends \Google\Protobuf\Internal\Message */ private $referencing_databases; /** + * Output only. Deprecated: This field is not populated. * Output only. The names of the backups that reference this instance * partition. Referencing backups should share the parent instance. The * existence of any referencing backup prevents the instance partition from * being deleted. * - * Generated from protobuf field repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * Generated from protobuf field repeated string referencing_backups = 11 [deprecated = true, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @deprecated */ private $referencing_backups; /** @@ -120,16 +122,16 @@ class InstancePartition extends \Google\Protobuf\Internal\Message * UIs. Must be unique per project and between 4 and 30 characters in length. * @type int $node_count * The number of nodes allocated to this instance partition. - * Users can set the node_count field to specify the target number of nodes - * allocated to the instance partition. + * Users can set the `node_count` field to specify the target number of + * nodes allocated to the instance partition. * This may be zero in API responses for instance partitions that are not * yet in state `READY`. * @type int $processing_units * The number of processing units allocated to this instance partition. - * Users can set the processing_units field to specify the target number of - * processing units allocated to the instance partition. - * This may be zero in API responses for instance partitions that are not - * yet in state `READY`. + * Users can set the `processing_units` field to specify the target number + * of processing units allocated to the instance partition. + * This might be zero in API responses for instance partitions that are not + * yet in the `READY` state. * @type int $state * Output only. The current instance partition state. * @type \Google\Protobuf\Timestamp $create_time @@ -143,6 +145,7 @@ class InstancePartition extends \Google\Protobuf\Internal\Message * The existence of any referencing database prevents the instance partition * from being deleted. * @type array|\Google\Protobuf\Internal\RepeatedField $referencing_backups + * Output only. Deprecated: This field is not populated. * Output only. The names of the backups that reference this instance * partition. Referencing backups should share the parent instance. The * existence of any referencing backup prevents the instance partition from @@ -263,8 +266,8 @@ public function setDisplayName($var) /** * The number of nodes allocated to this instance partition. - * Users can set the node_count field to specify the target number of nodes - * allocated to the instance partition. + * Users can set the `node_count` field to specify the target number of + * nodes allocated to the instance partition. * This may be zero in API responses for instance partitions that are not * yet in state `READY`. * @@ -283,8 +286,8 @@ public function hasNodeCount() /** * The number of nodes allocated to this instance partition. - * Users can set the node_count field to specify the target number of nodes - * allocated to the instance partition. + * Users can set the `node_count` field to specify the target number of + * nodes allocated to the instance partition. * This may be zero in API responses for instance partitions that are not * yet in state `READY`. * @@ -302,10 +305,10 @@ public function setNodeCount($var) /** * The number of processing units allocated to this instance partition. - * Users can set the processing_units field to specify the target number of - * processing units allocated to the instance partition. - * This may be zero in API responses for instance partitions that are not - * yet in state `READY`. + * Users can set the `processing_units` field to specify the target number + * of processing units allocated to the instance partition. + * This might be zero in API responses for instance partitions that are not + * yet in the `READY` state. * * Generated from protobuf field int32 processing_units = 6; * @return int @@ -322,10 +325,10 @@ public function hasProcessingUnits() /** * The number of processing units allocated to this instance partition. - * Users can set the processing_units field to specify the target number of - * processing units allocated to the instance partition. - * This may be zero in API responses for instance partitions that are not - * yet in state `READY`. + * Users can set the `processing_units` field to specify the target number + * of processing units allocated to the instance partition. + * This might be zero in API responses for instance partitions that are not + * yet in the `READY` state. * * Generated from protobuf field int32 processing_units = 6; * @param int $var @@ -472,31 +475,37 @@ public function setReferencingDatabases($var) } /** + * Output only. Deprecated: This field is not populated. * Output only. The names of the backups that reference this instance * partition. Referencing backups should share the parent instance. The * existence of any referencing backup prevents the instance partition from * being deleted. * - * Generated from protobuf field repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * Generated from protobuf field repeated string referencing_backups = 11 [deprecated = true, (.google.api.field_behavior) = OUTPUT_ONLY]; * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated */ public function getReferencingBackups() { + @trigger_error('referencing_backups is deprecated.', E_USER_DEPRECATED); return $this->referencing_backups; } /** + * Output only. Deprecated: This field is not populated. * Output only. The names of the backups that reference this instance * partition. Referencing backups should share the parent instance. The * existence of any referencing backup prevents the instance partition from * being deleted. * - * Generated from protobuf field repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * Generated from protobuf field repeated string referencing_backups = 11 [deprecated = true, (.google.api.field_behavior) = OUTPUT_ONLY]; * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this + * @deprecated */ public function setReferencingBackups($var) { + @trigger_error('referencing_backups is deprecated.', E_USER_DEPRECATED); $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); $this->referencing_backups = $arr; diff --git a/Spanner/src/Admin/Instance/V1/ListInstanceConfigOperationsRequest.php b/Spanner/src/Admin/Instance/V1/ListInstanceConfigOperationsRequest.php index 17dfdb2ca079..bc7db4ec11ee 100644 --- a/Spanner/src/Admin/Instance/V1/ListInstanceConfigOperationsRequest.php +++ b/Spanner/src/Admin/Instance/V1/ListInstanceConfigOperationsRequest.php @@ -30,8 +30,7 @@ class ListInstanceConfigOperationsRequest extends \Google\Protobuf\Internal\Mess * The value must be a string, a number, or a boolean. The comparison operator * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the [Operation][google.longrunning.Operation] - * are eligible for filtering: + * The following fields in the Operation are eligible for filtering: * * `name` - The name of the long-running operation * * `done` - False if the operation is in progress, else true. * * `metadata.@type` - the type of metadata. For example, the type string @@ -114,8 +113,7 @@ public static function build(string $parent): self * The value must be a string, a number, or a boolean. The comparison operator * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the [Operation][google.longrunning.Operation] - * are eligible for filtering: + * The following fields in the Operation are eligible for filtering: * * `name` - The name of the long-running operation * * `done` - False if the operation is in progress, else true. * * `metadata.@type` - the type of metadata. For example, the type string @@ -196,8 +194,7 @@ public function setParent($var) * The value must be a string, a number, or a boolean. The comparison operator * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the [Operation][google.longrunning.Operation] - * are eligible for filtering: + * The following fields in the Operation are eligible for filtering: * * `name` - The name of the long-running operation * * `done` - False if the operation is in progress, else true. * * `metadata.@type` - the type of metadata. For example, the type string @@ -243,8 +240,7 @@ public function getFilter() * The value must be a string, a number, or a boolean. The comparison operator * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the [Operation][google.longrunning.Operation] - * are eligible for filtering: + * The following fields in the Operation are eligible for filtering: * * `name` - The name of the long-running operation * * `done` - False if the operation is in progress, else true. * * `metadata.@type` - the type of metadata. For example, the type string diff --git a/Spanner/src/Admin/Instance/V1/ListInstanceConfigOperationsResponse.php b/Spanner/src/Admin/Instance/V1/ListInstanceConfigOperationsResponse.php index 10d805eb3e32..5554a74f4ab7 100644 --- a/Spanner/src/Admin/Instance/V1/ListInstanceConfigOperationsResponse.php +++ b/Spanner/src/Admin/Instance/V1/ListInstanceConfigOperationsResponse.php @@ -17,10 +17,10 @@ class ListInstanceConfigOperationsResponse extends \Google\Protobuf\Internal\Message { /** - * The list of matching instance configuration [long-running - * operations][google.longrunning.Operation]. Each operation's name will be + * The list of matching instance configuration long-running operations. Each + * operation's name will be * prefixed by the name of the instance configuration. The operation's - * [metadata][google.longrunning.Operation.metadata] field type + * metadata field type * `metadata.type_url` describes the type of the metadata. * * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; @@ -42,10 +42,10 @@ class ListInstanceConfigOperationsResponse extends \Google\Protobuf\Internal\Mes * Optional. Data for populating the Message object. * * @type array<\Google\LongRunning\Operation>|\Google\Protobuf\Internal\RepeatedField $operations - * The list of matching instance configuration [long-running - * operations][google.longrunning.Operation]. Each operation's name will be + * The list of matching instance configuration long-running operations. Each + * operation's name will be * prefixed by the name of the instance configuration. The operation's - * [metadata][google.longrunning.Operation.metadata] field type + * metadata field type * `metadata.type_url` describes the type of the metadata. * @type string $next_page_token * `next_page_token` can be sent in a subsequent @@ -59,10 +59,10 @@ public function __construct($data = NULL) { } /** - * The list of matching instance configuration [long-running - * operations][google.longrunning.Operation]. Each operation's name will be + * The list of matching instance configuration long-running operations. Each + * operation's name will be * prefixed by the name of the instance configuration. The operation's - * [metadata][google.longrunning.Operation.metadata] field type + * metadata field type * `metadata.type_url` describes the type of the metadata. * * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; @@ -74,10 +74,10 @@ public function getOperations() } /** - * The list of matching instance configuration [long-running - * operations][google.longrunning.Operation]. Each operation's name will be + * The list of matching instance configuration long-running operations. Each + * operation's name will be * prefixed by the name of the instance configuration. The operation's - * [metadata][google.longrunning.Operation.metadata] field type + * metadata field type * `metadata.type_url` describes the type of the metadata. * * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; diff --git a/Spanner/src/Admin/Instance/V1/ListInstancePartitionOperationsRequest.php b/Spanner/src/Admin/Instance/V1/ListInstancePartitionOperationsRequest.php index 3f66a1028928..b3a881c4b384 100644 --- a/Spanner/src/Admin/Instance/V1/ListInstancePartitionOperationsRequest.php +++ b/Spanner/src/Admin/Instance/V1/ListInstancePartitionOperationsRequest.php @@ -30,8 +30,7 @@ class ListInstancePartitionOperationsRequest extends \Google\Protobuf\Internal\M * The value must be a string, a number, or a boolean. The comparison operator * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the [Operation][google.longrunning.Operation] - * are eligible for filtering: + * The following fields in the Operation are eligible for filtering: * * `name` - The name of the long-running operation * * `done` - False if the operation is in progress, else true. * * `metadata.@type` - the type of metadata. For example, the type string @@ -86,7 +85,8 @@ class ListInstancePartitionOperationsRequest extends \Google\Protobuf\Internal\M * Optional. Deadline used while retrieving metadata for instance partition * operations. Instance partitions whose operation metadata cannot be * retrieved within this deadline will be added to - * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in + * [unreachable_instance_partitions][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions] + * in * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]. * * Generated from protobuf field .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; @@ -124,8 +124,7 @@ public static function build(string $parent): self * The value must be a string, a number, or a boolean. The comparison operator * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the [Operation][google.longrunning.Operation] - * are eligible for filtering: + * The following fields in the Operation are eligible for filtering: * * `name` - The name of the long-running operation * * `done` - False if the operation is in progress, else true. * * `metadata.@type` - the type of metadata. For example, the type string @@ -168,7 +167,8 @@ public static function build(string $parent): self * Optional. Deadline used while retrieving metadata for instance partition * operations. Instance partitions whose operation metadata cannot be * retrieved within this deadline will be added to - * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in + * [unreachable_instance_partitions][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions] + * in * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]. * } */ @@ -212,8 +212,7 @@ public function setParent($var) * The value must be a string, a number, or a boolean. The comparison operator * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the [Operation][google.longrunning.Operation] - * are eligible for filtering: + * The following fields in the Operation are eligible for filtering: * * `name` - The name of the long-running operation * * `done` - False if the operation is in progress, else true. * * `metadata.@type` - the type of metadata. For example, the type string @@ -259,8 +258,7 @@ public function getFilter() * The value must be a string, a number, or a boolean. The comparison operator * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the [Operation][google.longrunning.Operation] - * are eligible for filtering: + * The following fields in the Operation are eligible for filtering: * * `name` - The name of the long-running operation * * `done` - False if the operation is in progress, else true. * * `metadata.@type` - the type of metadata. For example, the type string @@ -369,7 +367,8 @@ public function setPageToken($var) * Optional. Deadline used while retrieving metadata for instance partition * operations. Instance partitions whose operation metadata cannot be * retrieved within this deadline will be added to - * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in + * [unreachable_instance_partitions][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions] + * in * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]. * * Generated from protobuf field .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; @@ -394,7 +393,8 @@ public function clearInstancePartitionDeadline() * Optional. Deadline used while retrieving metadata for instance partition * operations. Instance partitions whose operation metadata cannot be * retrieved within this deadline will be added to - * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in + * [unreachable_instance_partitions][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions] + * in * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]. * * Generated from protobuf field .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; diff --git a/Spanner/src/Admin/Instance/V1/ListInstancePartitionOperationsResponse.php b/Spanner/src/Admin/Instance/V1/ListInstancePartitionOperationsResponse.php index 8ed281a554bf..886c45864495 100644 --- a/Spanner/src/Admin/Instance/V1/ListInstancePartitionOperationsResponse.php +++ b/Spanner/src/Admin/Instance/V1/ListInstancePartitionOperationsResponse.php @@ -17,10 +17,10 @@ class ListInstancePartitionOperationsResponse extends \Google\Protobuf\Internal\Message { /** - * The list of matching instance partition [long-running - * operations][google.longrunning.Operation]. Each operation's name will be + * The list of matching instance partition long-running operations. Each + * operation's name will be * prefixed by the instance partition's name. The operation's - * [metadata][google.longrunning.Operation.metadata] field type + * metadata field type * `metadata.type_url` describes the type of the metadata. * * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; @@ -51,10 +51,10 @@ class ListInstancePartitionOperationsResponse extends \Google\Protobuf\Internal\ * Optional. Data for populating the Message object. * * @type array<\Google\LongRunning\Operation>|\Google\Protobuf\Internal\RepeatedField $operations - * The list of matching instance partition [long-running - * operations][google.longrunning.Operation]. Each operation's name will be + * The list of matching instance partition long-running operations. Each + * operation's name will be * prefixed by the instance partition's name. The operation's - * [metadata][google.longrunning.Operation.metadata] field type + * metadata field type * `metadata.type_url` describes the type of the metadata. * @type string $next_page_token * `next_page_token` can be sent in a subsequent @@ -73,10 +73,10 @@ public function __construct($data = NULL) { } /** - * The list of matching instance partition [long-running - * operations][google.longrunning.Operation]. Each operation's name will be + * The list of matching instance partition long-running operations. Each + * operation's name will be * prefixed by the instance partition's name. The operation's - * [metadata][google.longrunning.Operation.metadata] field type + * metadata field type * `metadata.type_url` describes the type of the metadata. * * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; @@ -88,10 +88,10 @@ public function getOperations() } /** - * The list of matching instance partition [long-running - * operations][google.longrunning.Operation]. Each operation's name will be + * The list of matching instance partition long-running operations. Each + * operation's name will be * prefixed by the instance partition's name. The operation's - * [metadata][google.longrunning.Operation.metadata] field type + * metadata field type * `metadata.type_url` describes the type of the metadata. * * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; diff --git a/Spanner/src/Admin/Instance/V1/ListInstancePartitionsRequest.php b/Spanner/src/Admin/Instance/V1/ListInstancePartitionsRequest.php index 877be2da98d1..370831027f22 100644 --- a/Spanner/src/Admin/Instance/V1/ListInstancePartitionsRequest.php +++ b/Spanner/src/Admin/Instance/V1/ListInstancePartitionsRequest.php @@ -18,7 +18,9 @@ class ListInstancePartitionsRequest extends \Google\Protobuf\Internal\Message { /** * Required. The instance whose instance partitions should be listed. Values - * are of the form `projects//instances/`. + * are of the form `projects//instances/`. Use `{instance} + * = '-'` to list instance partitions for all Instances in a project, e.g., + * `projects/myproject/instances/-`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -53,7 +55,9 @@ class ListInstancePartitionsRequest extends \Google\Protobuf\Internal\Message /** * @param string $parent Required. The instance whose instance partitions should be listed. Values - * are of the form `projects//instances/`. Please see + * are of the form `projects//instances/`. Use `{instance} + * = '-'` to list instance partitions for all Instances in a project, e.g., + * `projects/myproject/instances/-`. Please see * {@see InstanceAdminClient::instanceName()} for help formatting this field. * * @return \Google\Cloud\Spanner\Admin\Instance\V1\ListInstancePartitionsRequest @@ -74,7 +78,9 @@ public static function build(string $parent): self * * @type string $parent * Required. The instance whose instance partitions should be listed. Values - * are of the form `projects//instances/`. + * are of the form `projects//instances/`. Use `{instance} + * = '-'` to list instance partitions for all Instances in a project, e.g., + * `projects/myproject/instances/-`. * @type int $page_size * Number of instance partitions to be returned in the response. If 0 or less, * defaults to the server's maximum allowed page size. @@ -99,7 +105,9 @@ public function __construct($data = NULL) { /** * Required. The instance whose instance partitions should be listed. Values - * are of the form `projects//instances/`. + * are of the form `projects//instances/`. Use `{instance} + * = '-'` to list instance partitions for all Instances in a project, e.g., + * `projects/myproject/instances/-`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -111,7 +119,9 @@ public function getParent() /** * Required. The instance whose instance partitions should be listed. Values - * are of the form `projects//instances/`. + * are of the form `projects//instances/`. Use `{instance} + * = '-'` to list instance partitions for all Instances in a project, e.g., + * `projects/myproject/instances/-`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var diff --git a/Spanner/src/Admin/Instance/V1/ListInstancePartitionsResponse.php b/Spanner/src/Admin/Instance/V1/ListInstancePartitionsResponse.php index 916ce4a772ff..306569fa24d5 100644 --- a/Spanner/src/Admin/Instance/V1/ListInstancePartitionsResponse.php +++ b/Spanner/src/Admin/Instance/V1/ListInstancePartitionsResponse.php @@ -31,9 +31,9 @@ class ListInstancePartitionsResponse extends \Google\Protobuf\Internal\Message */ private $next_page_token = ''; /** - * The list of unreachable instance partitions. - * It includes the names of instance partitions whose metadata could - * not be retrieved within + * The list of unreachable instances or instance partitions. + * It includes the names of instances or instance partitions whose metadata + * could not be retrieved within * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline]. * * Generated from protobuf field repeated string unreachable = 3; @@ -53,9 +53,9 @@ class ListInstancePartitionsResponse extends \Google\Protobuf\Internal\Message * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions] * call to fetch more of the matching instance partitions. * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable - * The list of unreachable instance partitions. - * It includes the names of instance partitions whose metadata could - * not be retrieved within + * The list of unreachable instances or instance partitions. + * It includes the names of instances or instance partitions whose metadata + * could not be retrieved within * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline]. * } */ @@ -121,9 +121,9 @@ public function setNextPageToken($var) } /** - * The list of unreachable instance partitions. - * It includes the names of instance partitions whose metadata could - * not be retrieved within + * The list of unreachable instances or instance partitions. + * It includes the names of instances or instance partitions whose metadata + * could not be retrieved within * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline]. * * Generated from protobuf field repeated string unreachable = 3; @@ -135,9 +135,9 @@ public function getUnreachable() } /** - * The list of unreachable instance partitions. - * It includes the names of instance partitions whose metadata could - * not be retrieved within + * The list of unreachable instances or instance partitions. + * It includes the names of instances or instance partitions whose metadata + * could not be retrieved within * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline]. * * Generated from protobuf field repeated string unreachable = 3; diff --git a/Spanner/src/Admin/Instance/V1/ReplicaInfo.php b/Spanner/src/Admin/Instance/V1/ReplicaInfo.php index 858d005c5bc3..0da8919cc59c 100644 --- a/Spanner/src/Admin/Instance/V1/ReplicaInfo.php +++ b/Spanner/src/Admin/Instance/V1/ReplicaInfo.php @@ -14,7 +14,7 @@ class ReplicaInfo extends \Google\Protobuf\Internal\Message { /** - * The location of the serving resources, e.g. "us-central1". + * The location of the serving resources, e.g., "us-central1". * * Generated from protobuf field string location = 1; */ @@ -42,7 +42,7 @@ class ReplicaInfo extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $location - * The location of the serving resources, e.g. "us-central1". + * The location of the serving resources, e.g., "us-central1". * @type int $type * The type of replica. * @type bool $default_leader_location @@ -58,7 +58,7 @@ public function __construct($data = NULL) { } /** - * The location of the serving resources, e.g. "us-central1". + * The location of the serving resources, e.g., "us-central1". * * Generated from protobuf field string location = 1; * @return string @@ -69,7 +69,7 @@ public function getLocation() } /** - * The location of the serving resources, e.g. "us-central1". + * The location of the serving resources, e.g., "us-central1". * * Generated from protobuf field string location = 1; * @param string $var diff --git a/Spanner/src/Admin/Instance/V1/UpdateInstanceConfigRequest.php b/Spanner/src/Admin/Instance/V1/UpdateInstanceConfigRequest.php index 29962464c2b5..5cd410d7208e 100644 --- a/Spanner/src/Admin/Instance/V1/UpdateInstanceConfigRequest.php +++ b/Spanner/src/Admin/Instance/V1/UpdateInstanceConfigRequest.php @@ -10,7 +10,7 @@ /** * The request for - * [UpdateInstanceConfigRequest][InstanceAdmin.UpdateInstanceConfigRequest]. + * [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig]. * * Generated from protobuf message google.spanner.admin.instance.v1.UpdateInstanceConfigRequest */ diff --git a/Spanner/tests/Unit/Admin/Instance/V1/Client/InstanceAdminClientTest.php b/Spanner/tests/Unit/Admin/Instance/V1/Client/InstanceAdminClientTest.php index 1d694ac1b6d9..bd01402c01ee 100644 --- a/Spanner/tests/Unit/Admin/Instance/V1/Client/InstanceAdminClientTest.php +++ b/Spanner/tests/Unit/Admin/Instance/V1/Client/InstanceAdminClientTest.php @@ -277,12 +277,14 @@ public function createInstanceConfigTest() $baseConfig = 'baseConfig1990483056'; $etag = 'etag3123477'; $reconciling = false; + $storageLimitPerProcessingUnit = 1769187130; $expectedResponse = new InstanceConfig(); $expectedResponse->setName($name); $expectedResponse->setDisplayName($displayName); $expectedResponse->setBaseConfig($baseConfig); $expectedResponse->setEtag($etag); $expectedResponse->setReconciling($reconciling); + $expectedResponse->setStorageLimitPerProcessingUnit($storageLimitPerProcessingUnit); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); @@ -884,12 +886,14 @@ public function getInstanceConfigTest() $baseConfig = 'baseConfig1990483056'; $etag = 'etag3123477'; $reconciling = false; + $storageLimitPerProcessingUnit = 1769187130; $expectedResponse = new InstanceConfig(); $expectedResponse->setName($name2); $expectedResponse->setDisplayName($displayName); $expectedResponse->setBaseConfig($baseConfig); $expectedResponse->setEtag($etag); $expectedResponse->setReconciling($reconciling); + $expectedResponse->setStorageLimitPerProcessingUnit($storageLimitPerProcessingUnit); $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); @@ -1816,12 +1820,14 @@ public function updateInstanceConfigTest() $baseConfig = 'baseConfig1990483056'; $etag = 'etag3123477'; $reconciling = false; + $storageLimitPerProcessingUnit = 1769187130; $expectedResponse = new InstanceConfig(); $expectedResponse->setName($name); $expectedResponse->setDisplayName($displayName); $expectedResponse->setBaseConfig($baseConfig); $expectedResponse->setEtag($etag); $expectedResponse->setReconciling($reconciling); + $expectedResponse->setStorageLimitPerProcessingUnit($storageLimitPerProcessingUnit); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); diff --git a/Spanner/tests/Unit/Admin/Instance/V1/InstanceAdminClientTest.php b/Spanner/tests/Unit/Admin/Instance/V1/InstanceAdminClientTest.php index 1cd269d78353..dcd7cec82b34 100644 --- a/Spanner/tests/Unit/Admin/Instance/V1/InstanceAdminClientTest.php +++ b/Spanner/tests/Unit/Admin/Instance/V1/InstanceAdminClientTest.php @@ -248,12 +248,14 @@ public function createInstanceConfigTest() $baseConfig = 'baseConfig1990483056'; $etag = 'etag3123477'; $reconciling = false; + $storageLimitPerProcessingUnit = 1769187130; $expectedResponse = new InstanceConfig(); $expectedResponse->setName($name); $expectedResponse->setDisplayName($displayName); $expectedResponse->setBaseConfig($baseConfig); $expectedResponse->setEtag($etag); $expectedResponse->setReconciling($reconciling); + $expectedResponse->setStorageLimitPerProcessingUnit($storageLimitPerProcessingUnit); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); @@ -819,12 +821,14 @@ public function getInstanceConfigTest() $baseConfig = 'baseConfig1990483056'; $etag = 'etag3123477'; $reconciling = false; + $storageLimitPerProcessingUnit = 1769187130; $expectedResponse = new InstanceConfig(); $expectedResponse->setName($name2); $expectedResponse->setDisplayName($displayName); $expectedResponse->setBaseConfig($baseConfig); $expectedResponse->setEtag($etag); $expectedResponse->setReconciling($reconciling); + $expectedResponse->setStorageLimitPerProcessingUnit($storageLimitPerProcessingUnit); $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); @@ -1699,12 +1703,14 @@ public function updateInstanceConfigTest() $baseConfig = 'baseConfig1990483056'; $etag = 'etag3123477'; $reconciling = false; + $storageLimitPerProcessingUnit = 1769187130; $expectedResponse = new InstanceConfig(); $expectedResponse->setName($name); $expectedResponse->setDisplayName($displayName); $expectedResponse->setBaseConfig($baseConfig); $expectedResponse->setEtag($etag); $expectedResponse->setReconciling($reconciling); + $expectedResponse->setStorageLimitPerProcessingUnit($storageLimitPerProcessingUnit); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Database/V1/Backup.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Database/V1/Backup.php deleted file mode 100644 index 57f9f920210920820883b8e47ba916ed0fa103d4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5621 zcmd5=-EZ4e6elSy%W2mSm$9%h&C3ey1aoMI`0!T1`DhfjHc^vK8nUn)=O#6EY-2ms z3hEoYAc6P`;2qxi6L{dSKs@d*fJsQ4d#}IRwM*!Ppf7dobIv`VzjN-n^MSkT!gaAm zY~tww>582LG1w)d>p6jAIF{HM_Ikt<4QJq*7V#uetTe=}Mq8{_>g{XD>N`WvAhOtZ zoW4bhzN_0PtEhJerd{mnf!@)5QrurHc64KJ=t@j7fUOS*(i%jpHA|Z$&?%`}V?xvx z7osXuh*}ASsP|WI0~nU>`(lX+gD*hDKX=%%OhfboJ-~lUrmvZ{8JN0devTHci#^@) z39>#(+Z)rLI?I|Faq z#5@Z0fjd6$soABLox#AdPnN`z;pY2h7<#4KjU&B*m9Y}XhDK@`ep!N>|EMH{u!5wp zf+SW!QdB|G{_3TdLxH+$7QHZByq+#y4?kH+Oo~n%laMH?QC5PO$Hg8^7j1x^4=JvO zVq%IQa&Jg5+9pH_^dToNe3yeMUaG>|a4xbXpA|DJxzf^O zBP8<)NeLz?a*+HKzMEZ>BI_gPJ&`LC_qx=gTwIY2xZn}Qa$*};v04-iKmUR_fzeQx z(TuSovITP}!#i+ky(852ocuXdYkKX?(P~v=#yawG#dhGOWAeNK!;<`Y)a=Y+n=l{Q zsCBU!5F^L~bKmM{J)`uia7M0Z2^P~H?64l>=ck$fUS;mP3Rj|-982i14Bmygf&NfS zC+G}w-cvG~pI(D`exl|ZyQDj`FwbV$(Kp%A>N33g)U#V5o3H|xO^gE>5IfKL!M>n_obEa{SCYu;^G_1X%4z4GLpvTzCg2S^fzZV4>Ak+Es05tJSQQ>l^iIW&Sx~ z2F{hYt4h1RRh!QUIhe#Bl?U@#Sydk?4@Pp}@HpWm$c0`+|8aCfRLBbJ zFvZ{JISQ?e&OELXb$?d)1Qt@2VK{cr?B_Wky+2w~+Qg*p%1jECpDFy2ffv(M(Hw@L zn?l4=;juC@ug?naRXB&y>tj3fLm%B5ZCN~RG(%R3`34QVH6~~me$K)|*>Mm4?F_gB z=lNU}mKifLS3_us$7^@d$1ywyMZ)i`NUb{2eyNO#)&YC|nAS5);kTdTc z_YJR{ankL-N}I1Uu(;!5Um-^mCn@}C`BXJM*mT6p2&z$z?2&ei*TQexFK zDF^`URp9Iqn*n65V8Y@NHGCH@Cq#G;Ug(5+$Lbx& zNBog6$KXCSqth^)R4>V$U>)W{7>;Jb5QxXRgcN?5fLGFu@;ERGdq-yC;J_tphL~O3 zjNBTHW>1dlPZKO9C$&*19}7N!nZ1Fp?U4hG-CHUqa#A49p%?O}Gk|t6Sym2hDc9v8A;iG>?yam*L`0tEyF$ zwo+2?A)&_U?+UzJYcy*2@OyPb*}2zFf6h|j<(*c$v02^LHkB=L6mHJB7Y;+IkXe z1UHlsG`OAH$>WdN*J^AlDV1qmNiDvcl-O=ks)V~q>Hg}k5uvIwN;O_%hI`Cpk%^nk zN7>i8SXpM&vK$JQWhPmcBhj*af3-7(LvrBUT8_6&Z}5F#YQ0Do1g3GqYLQX$1>hkZ G0{jhnw=9JK diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Database/V1/BackupSchedule.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Database/V1/BackupSchedule.php deleted file mode 100644 index cb0825c4e2d4ffb66fd087a0bf6963e1151be444..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3205 zcmcImQBNC35Uy=P!=i?8m5M{8vTTkxG5(U&wQQLZ3Rjw|m9`3kRvZaNgbdX7-zJX6Nf~qQeM%gj z*yY5>?Gwxo36A2Bhh7-qcG~HX7<*waq5+9bjGNo|@%A3R-`v`}1*S=u#vZY7Hw?Q0 zsU?xi0ITNuJ<4jn%iXq{klOJ|t?hb8Y2+l{A@S3In9>D8%ofd3KYFW82+NP9Z(M^+~x3ZktPmhlv6jLFW`#n zxZ?&10f@6_J1O%x4H*^&+sq@?+c?7%XBVRoC|SokydA+3Fl28rPGaT;c9SGtOd}q~ zJ8;ypx`gN4ik0eZ~b{S9wwUx@PnJj!=u!1NPO4g*OqnrdSav*ukG{CM0VdF01j2)N8Z+oU-B~0~<@YP-+ORKU7EOq5 zBV9~2O0ViyjTV}aUMHp3I~RK$h7`^PP{FW}0o6&EkiDaME|(~NkoW8u!#r;aw zABETTUkm7C%~2*DD2T*_cdMp6s3*dB3NSwqk0-U4>Z@O)4EhFidsx$-{rvHQMO|=x z^@{2D2DY^7`k&5Z{N{VB*M=7w2D+ZDIQ%3cnM|Ld=~F@$66NGaK9Fe9_yA1_GMpD7 zBjqA6BBfh0?xGpUg6y--bISbi`B-u*RsJfVo2Nyi1AaoDrO-bCcrtQh$gYaQUV2q8 z{#(C=7Df=P-(_O~8R~+X6^HtRn2W|^q)5ug02T8XLTn7Z^dj@c%2QNs5k9=5udy~% z?aT5G_R^RtsT`o2O%gyw{~zGL6wv%bn!FKsq9eb20zfN~+XZRCpd)#|l68PNgycF8 zj|h{kMT)3U`3baeZX`(*vV<7l=91MJO+XbT=+JMSF=GzRFwnMhDiSH@%5M47!YX>LgFot7p4RK8i@I#?M8x2<=2SBV7w;UgXC6!?)NGL*h>1 zVABi2)Ys;sF?GXH<1+Lvn3#3fiP~#}&p(TwwB&GXZb-b{Y(zHYh-~UoH1}8j)(34{ zp0x96T8-0#c^U@l*Tv5=Sj&>9ElUAgmPEEJ4Q*NbEA2_yi@#jTC!No;arM-6J94s> MC$sspkNODx2ja&x8vpP;i5D!vL$;wB(|}X%#_iLMwZvkQd!bS z>kMwkzkmZbegFp!{0xr#3eNorJ@Iz6vQwH&%>iG$+I{bPZ@>4weNVnk&J%POw@E}& zpOFzB&M`YDI7wp`2XTmpv+%k(j8NoH3D^b%xBHC~!hCM(wgrf5=OC`ZL0nUU zxM%x^2nC^^Wwm9D%N#v6 zPY7U^>RSh27d%{BL-lni)dA;5yRM5icrwZ-sOmiJTi$8c?pw`Ht7Dnfca+c3t#+^1KDIp5 zY8j`;j%Rh7gQtC`)9Y4C%5C&%^VD{FC)U6_F}gEzSkCWLTz$6s&ZPWVp^!hz16e* zzY0Uw6_)ODu*k`>8Z9teUY5VeVRc$(Kib%Ctw1+=b%weizB?O;P+{|NMF+6%c_ zXki?P_J_S^b8CSX2>k<i4mxsn^#dUg`~C3fs&lBk$skC z{H9Zo6x|7-no%_Yw`3;g3$yo4*C1fUc}ldn!iW|%LbRCUM2oLa-$bZXF&rn!A;b~| zL{Cr>{_4&3id9NFuHnMRdCSqQn&nzX#d;g$ok?yO6~_cZ?XVloTFJHST9P0v)k@~Y zOG!qPz@D$$pr4tfV6s3|2I?v<)LgSsGb+WL>698)-L)G909DmZ)0K)Qzg)b;w+}?2JEVELcHMfjMmfh$Lb=l-j6`9EeqYB#;AIIz!?VerRY&2^% ztF~EOs*~91O{>ybz*PBa-R*&6iAptm-*6sAmsaAgS`cooQLRVE?HYu|S)=r@`3xzo zl(x)rvtm9A-m-SJYS%hbq7i)gw#DOBE0<+>&Ox%fC!UNFY0mPTi@FmNrl0*z2 zdYy&|Uq9(z_pP1dYn7J6r)}x*oWLm#ROcx$Z4#H}i=r~fMaF&=9G61~*(8K3ypsc5 z=JdJVIuw_6>Vh2ndPH#D;f@x08z_U|O$=Q5Weg2Ms)F=xF4Q(`d>0L}yrsL_b#pwH zj9omExsqbcbhmkm(^#Q}bQMr>77a3ipj2(x<8h!gn3)Qv!~&5pbN9K~!;&3BM0whe z21I$pBj|Zja4C<8*}ng1ahyYkNcl18ZbvdNhwmn+rB(Xau0^%_&6G- zU-hNJ>cahnHwZwVy8fA_qqD+iSoA?Uby5(#X~8`Ryjy3Ex2db)x|$<&jmq0HO7T_F`9l7WkGBk%_vo zY3dGir8H~~VT=&{$+aJvwQ&*?3B^XEfsLIyv~wn&K?%X01Dg}~oQ!Tsd;%SZ&6nvz{ZUeTFNQ|f>cEI8ei9V50DnC>8nZA|i6*73lP-YQxArO_8(fN| z?8eZTpCzfYyXb`m3qh)~!OV?t-}jRe(&fJcbhP7F0C1VwPzpW~B>zz2y*1y8H5$1@r<_ z9Z3-+b-xnszMZWAdF5CR>TfV;58y${G8*+HmS^LZ$~+ni66KZ5Z#GiO5_qChHYFZ4 zr2HU;PJ2tDjKybAl)z&uI|AJrJBvt#Dv=QmxI%G{;Kb9W?Z? z>gW&6ZJkbDOrw{e75G9shh8jI>}DAN_~x=-&5}{Ze$Cv*ucE_V0-_~~PC@xe3?1>a zhR>o?`Niz=1L&WZ7WLH!g<$Xf5-MI;TgmI$rNz00c|Dh()7I{->PyS|td@Okt)REi zp*KH`Cgzux=I`Ytpl3NwcFV4yX`G@%<8$1JN2JgpE za*1PdyOc!`9>_4>x=E}u80DNq=0eeB5sw}c{4CoQv%|TD`s6e1F*+x5OP6twB7Y4U zzkQE{a!w?qU{-9v$Byzg8uwNLx+a>so|ChX)L({(`hv3}anFSE9W>Elb6$bw;B-JF zc*3iwLaFfdC-@-JbS+Dh&}ng(@f>Wy#NHvvAk@#Y$#5+5qiJ+lY(Q^u@E>C6uvZQT zUk~Tehrl&{GQv<0z+=i%ZtrS*uK(`eKmB1mjW3gP)F*7zpOJ1e={Z4|^qd^v58~*E zf7-(lc=2NhA@*()l;6glYGrgO^w3f07~cp5_46U(epfreFN=+}hRXL8#BHq&{~ss*G|cJ-LHFhl1)KTcViNk0H1Y zG3z^ER>gCG+hq{m)sBm(o@%xxY%1Pt<~sFS0g#F+rz+1Q@cVHz;^!a60j!4GsSPQj z+#iD6D`=GaC`1~)VolL2GpvTXZripk?>#2;FeM$=p?Xp?*L-@4;tJ_?P}5(l-Vnj(>*hb{{nvN2^?a=2Ci|2wAK zrm7Z;QT#%6JZyo3yrC(#A`xLD7RfSgB-WHdBoe~Efk>K>6Zfi}$l~9D62Vg4mFQgz zQR3&I!~vnF188s4!_Pjo7bNkFv=<b2C`pibva>(_LgD(c0tQ|yX@=^py z9ytGvLz)-boq~%au^rX))3}oB)jxJrw~cqA?|Ef55-E?jb|&-<<@HE}LVUI}@dwIk z&&0(>v?C``){!*+DFg*;f7nSzlzi@m7uF4_?jJ#w`zB1?IVwK|!XL&F%G&j9&RT?twgnwgJ%0xEyxD_#u7s;cGTc(m zByVS>R;KuEKKo(Hd|bESf|^{xa(%tri@r**C20|U9zzL8rCePRZmcA*(3VUpVyJCD zFk{pe)!W`)#>~EZwS7!f+T4B&tqg0QII9s_883YA+4Aizi~6HM?-Ac_QJ zNS-Tc;HwJjQ$y4wupJd@HBl0Y{!if!(|g7s&$JwTM|1$)!@4u3(BP~4C&2w--tP~u zU^X#E6x1WjzhdkG3Fg(Fg_&qP2JwW5xA%+A1A1In5OV{LV7*RwLdXcuOEJTX z4V8CbkhsL7ah*QmC!g69-HUjJPqZ=1%AH=NXOzXJj(Rk(75*#OTb5w~7scLfNc&d> z7`b&+rC}!IUbS52pN{h%eh-Z7t=Cel2uALNw|~jL2Sz>>PrJP0D> zvBXVVydD#Lwi%d*s|Ml8_4S*rufK?Yd7i!>lgbjAQhdu4-76(_PQ5<;Q~(x>6tXB^ zsNrwav|g!!wgoogle.spanner.admin.database.v1.Backup - */ -class Backup extends \Google\Protobuf\Internal\Message -{ - /** - * Required for the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * operation. Name of the database from which this backup was created. This - * needs to be in the same instance as the backup. Values are of the form - * `projects//instances//databases/`. - * - * Generated from protobuf field string database = 2 [(.google.api.resource_reference) = { - */ - protected $database = ''; - /** - * The backup will contain an externally consistent copy of the database at - * the timestamp specified by `version_time`. If `version_time` is not - * specified, the system will set `version_time` to the `create_time` of the - * backup. - * - * Generated from protobuf field .google.protobuf.Timestamp version_time = 9; - */ - protected $version_time = null; - /** - * Required for the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * operation. The expiration time of the backup, with microseconds - * granularity that must be at least 6 hours and at most 366 days - * from the time the CreateBackup request is processed. Once the `expire_time` - * has passed, the backup is eligible to be automatically deleted by Cloud - * Spanner to free the resources used by the backup. - * - * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3; - */ - protected $expire_time = null; - /** - * Output only for the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * operation. Required for the - * [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup] - * operation. - * A globally unique identifier for the backup which cannot be - * changed. Values are of the form - * `projects//instances//backups/[a-z][a-z0-9_\-]*[a-z0-9]` - * The final segment of the name must be between 2 and 60 characters - * in length. - * The backup is stored in the location(s) specified in the instance - * configuration of the instance containing the backup, identified - * by the prefix of the backup name of the form - * `projects//instances/`. - * - * Generated from protobuf field string name = 1; - */ - protected $name = ''; - /** - * Output only. The time the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * request is received. If the request does not specify `version_time`, the - * `version_time` of the backup will be equivalent to the `create_time`. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $create_time = null; - /** - * Output only. Size of the backup in bytes. - * - * Generated from protobuf field int64 size_bytes = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $size_bytes = 0; - /** - * Output only. The number of bytes that will be freed by deleting this - * backup. This value will be zero if, for example, this backup is part of an - * incremental backup chain and younger backups in the chain require that we - * keep its data. For backups not in an incremental backup chain, this is - * always the size of the backup. This value may change if backups on the same - * chain get created, deleted or expired. - * - * Generated from protobuf field int64 freeable_size_bytes = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $freeable_size_bytes = 0; - /** - * Output only. For a backup in an incremental backup chain, this is the - * storage space needed to keep the data that has changed since the previous - * backup. For all other backups, this is always the size of the backup. This - * value may change if backups on the same chain get deleted or expired. - * This field can be used to calculate the total storage space used by a set - * of backups. For example, the total space used by all backups of a database - * can be computed by summing up this field. - * - * Generated from protobuf field int64 exclusive_size_bytes = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $exclusive_size_bytes = 0; - /** - * Output only. The current state of the backup. - * - * Generated from protobuf field .google.spanner.admin.database.v1.Backup.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $state = 0; - /** - * Output only. The names of the restored databases that reference the backup. - * The database names are of - * the form `projects//instances//databases/`. - * Referencing databases may exist in different instances. The existence of - * any referencing database prevents the backup from being deleted. When a - * restored database from the backup enters the `READY` state, the reference - * to the backup is removed. - * - * Generated from protobuf field repeated string referencing_databases = 7 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - */ - private $referencing_databases; - /** - * Output only. The encryption information for the backup. - * - * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionInfo encryption_info = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $encryption_info = null; - /** - * Output only. The encryption information for the backup, whether it is - * protected by one or more KMS keys. The information includes all Cloud - * KMS key versions used to encrypt the backup. The `encryption_status' field - * inside of each `EncryptionInfo` is not populated. At least one of the key - * versions must be available for the backup to be restored. If a key version - * is revoked in the middle of a restore, the restore behavior is undefined. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.EncryptionInfo encryption_information = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $encryption_information; - /** - * Output only. The database dialect information for the backup. - * - * Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $database_dialect = 0; - /** - * Output only. The names of the destination backups being created by copying - * this source backup. The backup names are of the form - * `projects//instances//backups/`. - * Referencing backups may exist in different instances. The existence of - * any referencing backup prevents the backup from being deleted. When the - * copy operation is done (either successfully completed or cancelled or the - * destination backup is deleted), the reference to the backup is removed. - * - * Generated from protobuf field repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - */ - private $referencing_backups; - /** - * Output only. The max allowed expiration time of the backup, with - * microseconds granularity. A backup's expiration time can be configured in - * multiple APIs: CreateBackup, UpdateBackup, CopyBackup. When updating or - * copying an existing backup, the expiration time specified must be - * less than `Backup.max_expire_time`. - * - * Generated from protobuf field .google.protobuf.Timestamp max_expire_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $max_expire_time = null; - /** - * Output only. List of backup schedule URIs that are associated with - * creating this backup. This is only applicable for scheduled backups, and - * is empty for on-demand backups. - * To optimize for storage, whenever possible, multiple schedules are - * collapsed together to create one backup. In such cases, this field captures - * the list of all backup schedule URIs that are associated with creating - * this backup. If collapsing is not done, then this field captures the - * single backup schedule URI associated with creating this backup. - * - * Generated from protobuf field repeated string backup_schedules = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - */ - private $backup_schedules; - /** - * Output only. Populated only for backups in an incremental backup chain. - * Backups share the same chain id if and only if they belong to the same - * incremental backup chain. Use this field to determine which backups are - * part of the same incremental backup chain. The ordering of backups in the - * chain can be determined by ordering the backup `version_time`. - * - * Generated from protobuf field string incremental_backup_chain_id = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $incremental_backup_chain_id = ''; - /** - * Output only. Data deleted at a time older than this is guaranteed not to be - * retained in order to support this backup. For a backup in an incremental - * backup chain, this is the version time of the oldest backup that exists or - * ever existed in the chain. For all other backups, this is the version time - * of the backup. This field can be used to understand what data is being - * retained by the backup system. - * - * Generated from protobuf field .google.protobuf.Timestamp oldest_version_time = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $oldest_version_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $database - * Required for the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * operation. Name of the database from which this backup was created. This - * needs to be in the same instance as the backup. Values are of the form - * `projects//instances//databases/`. - * @type \Google\Protobuf\Timestamp $version_time - * The backup will contain an externally consistent copy of the database at - * the timestamp specified by `version_time`. If `version_time` is not - * specified, the system will set `version_time` to the `create_time` of the - * backup. - * @type \Google\Protobuf\Timestamp $expire_time - * Required for the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * operation. The expiration time of the backup, with microseconds - * granularity that must be at least 6 hours and at most 366 days - * from the time the CreateBackup request is processed. Once the `expire_time` - * has passed, the backup is eligible to be automatically deleted by Cloud - * Spanner to free the resources used by the backup. - * @type string $name - * Output only for the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * operation. Required for the - * [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup] - * operation. - * A globally unique identifier for the backup which cannot be - * changed. Values are of the form - * `projects//instances//backups/[a-z][a-z0-9_\-]*[a-z0-9]` - * The final segment of the name must be between 2 and 60 characters - * in length. - * The backup is stored in the location(s) specified in the instance - * configuration of the instance containing the backup, identified - * by the prefix of the backup name of the form - * `projects//instances/`. - * @type \Google\Protobuf\Timestamp $create_time - * Output only. The time the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * request is received. If the request does not specify `version_time`, the - * `version_time` of the backup will be equivalent to the `create_time`. - * @type int|string $size_bytes - * Output only. Size of the backup in bytes. - * @type int|string $freeable_size_bytes - * Output only. The number of bytes that will be freed by deleting this - * backup. This value will be zero if, for example, this backup is part of an - * incremental backup chain and younger backups in the chain require that we - * keep its data. For backups not in an incremental backup chain, this is - * always the size of the backup. This value may change if backups on the same - * chain get created, deleted or expired. - * @type int|string $exclusive_size_bytes - * Output only. For a backup in an incremental backup chain, this is the - * storage space needed to keep the data that has changed since the previous - * backup. For all other backups, this is always the size of the backup. This - * value may change if backups on the same chain get deleted or expired. - * This field can be used to calculate the total storage space used by a set - * of backups. For example, the total space used by all backups of a database - * can be computed by summing up this field. - * @type int $state - * Output only. The current state of the backup. - * @type array|\Google\Protobuf\Internal\RepeatedField $referencing_databases - * Output only. The names of the restored databases that reference the backup. - * The database names are of - * the form `projects//instances//databases/`. - * Referencing databases may exist in different instances. The existence of - * any referencing database prevents the backup from being deleted. When a - * restored database from the backup enters the `READY` state, the reference - * to the backup is removed. - * @type \Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo $encryption_info - * Output only. The encryption information for the backup. - * @type array<\Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo>|\Google\Protobuf\Internal\RepeatedField $encryption_information - * Output only. The encryption information for the backup, whether it is - * protected by one or more KMS keys. The information includes all Cloud - * KMS key versions used to encrypt the backup. The `encryption_status' field - * inside of each `EncryptionInfo` is not populated. At least one of the key - * versions must be available for the backup to be restored. If a key version - * is revoked in the middle of a restore, the restore behavior is undefined. - * @type int $database_dialect - * Output only. The database dialect information for the backup. - * @type array|\Google\Protobuf\Internal\RepeatedField $referencing_backups - * Output only. The names of the destination backups being created by copying - * this source backup. The backup names are of the form - * `projects//instances//backups/`. - * Referencing backups may exist in different instances. The existence of - * any referencing backup prevents the backup from being deleted. When the - * copy operation is done (either successfully completed or cancelled or the - * destination backup is deleted), the reference to the backup is removed. - * @type \Google\Protobuf\Timestamp $max_expire_time - * Output only. The max allowed expiration time of the backup, with - * microseconds granularity. A backup's expiration time can be configured in - * multiple APIs: CreateBackup, UpdateBackup, CopyBackup. When updating or - * copying an existing backup, the expiration time specified must be - * less than `Backup.max_expire_time`. - * @type array|\Google\Protobuf\Internal\RepeatedField $backup_schedules - * Output only. List of backup schedule URIs that are associated with - * creating this backup. This is only applicable for scheduled backups, and - * is empty for on-demand backups. - * To optimize for storage, whenever possible, multiple schedules are - * collapsed together to create one backup. In such cases, this field captures - * the list of all backup schedule URIs that are associated with creating - * this backup. If collapsing is not done, then this field captures the - * single backup schedule URI associated with creating this backup. - * @type string $incremental_backup_chain_id - * Output only. Populated only for backups in an incremental backup chain. - * Backups share the same chain id if and only if they belong to the same - * incremental backup chain. Use this field to determine which backups are - * part of the same incremental backup chain. The ordering of backups in the - * chain can be determined by ordering the backup `version_time`. - * @type \Google\Protobuf\Timestamp $oldest_version_time - * Output only. Data deleted at a time older than this is guaranteed not to be - * retained in order to support this backup. For a backup in an incremental - * backup chain, this is the version time of the oldest backup that exists or - * ever existed in the chain. For all other backups, this is the version time - * of the backup. This field can be used to understand what data is being - * retained by the backup system. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); - parent::__construct($data); - } - - /** - * Required for the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * operation. Name of the database from which this backup was created. This - * needs to be in the same instance as the backup. Values are of the form - * `projects//instances//databases/`. - * - * Generated from protobuf field string database = 2 [(.google.api.resource_reference) = { - * @return string - */ - public function getDatabase() - { - return $this->database; - } - - /** - * Required for the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * operation. Name of the database from which this backup was created. This - * needs to be in the same instance as the backup. Values are of the form - * `projects//instances//databases/`. - * - * Generated from protobuf field string database = 2 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setDatabase($var) - { - GPBUtil::checkString($var, True); - $this->database = $var; - - return $this; - } - - /** - * The backup will contain an externally consistent copy of the database at - * the timestamp specified by `version_time`. If `version_time` is not - * specified, the system will set `version_time` to the `create_time` of the - * backup. - * - * Generated from protobuf field .google.protobuf.Timestamp version_time = 9; - * @return \Google\Protobuf\Timestamp|null - */ - public function getVersionTime() - { - return $this->version_time; - } - - public function hasVersionTime() - { - return isset($this->version_time); - } - - public function clearVersionTime() - { - unset($this->version_time); - } - - /** - * The backup will contain an externally consistent copy of the database at - * the timestamp specified by `version_time`. If `version_time` is not - * specified, the system will set `version_time` to the `create_time` of the - * backup. - * - * Generated from protobuf field .google.protobuf.Timestamp version_time = 9; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setVersionTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->version_time = $var; - - return $this; - } - - /** - * Required for the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * operation. The expiration time of the backup, with microseconds - * granularity that must be at least 6 hours and at most 366 days - * from the time the CreateBackup request is processed. Once the `expire_time` - * has passed, the backup is eligible to be automatically deleted by Cloud - * Spanner to free the resources used by the backup. - * - * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3; - * @return \Google\Protobuf\Timestamp|null - */ - public function getExpireTime() - { - return $this->expire_time; - } - - public function hasExpireTime() - { - return isset($this->expire_time); - } - - public function clearExpireTime() - { - unset($this->expire_time); - } - - /** - * Required for the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * operation. The expiration time of the backup, with microseconds - * granularity that must be at least 6 hours and at most 366 days - * from the time the CreateBackup request is processed. Once the `expire_time` - * has passed, the backup is eligible to be automatically deleted by Cloud - * Spanner to free the resources used by the backup. - * - * Generated from protobuf field .google.protobuf.Timestamp expire_time = 3; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setExpireTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->expire_time = $var; - - return $this; - } - - /** - * Output only for the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * operation. Required for the - * [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup] - * operation. - * A globally unique identifier for the backup which cannot be - * changed. Values are of the form - * `projects//instances//backups/[a-z][a-z0-9_\-]*[a-z0-9]` - * The final segment of the name must be between 2 and 60 characters - * in length. - * The backup is stored in the location(s) specified in the instance - * configuration of the instance containing the backup, identified - * by the prefix of the backup name of the form - * `projects//instances/`. - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Output only for the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * operation. Required for the - * [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup] - * operation. - * A globally unique identifier for the backup which cannot be - * changed. Values are of the form - * `projects//instances//backups/[a-z][a-z0-9_\-]*[a-z0-9]` - * The final segment of the name must be between 2 and 60 characters - * in length. - * The backup is stored in the location(s) specified in the instance - * configuration of the instance containing the backup, identified - * by the prefix of the backup name of the form - * `projects//instances/`. - * - * Generated from protobuf field string name = 1; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Output only. The time the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * request is received. If the request does not specify `version_time`, the - * `version_time` of the backup will be equivalent to the `create_time`. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCreateTime() - { - return $this->create_time; - } - - public function hasCreateTime() - { - return isset($this->create_time); - } - - public function clearCreateTime() - { - unset($this->create_time); - } - - /** - * Output only. The time the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * request is received. If the request does not specify `version_time`, the - * `version_time` of the backup will be equivalent to the `create_time`. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCreateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->create_time = $var; - - return $this; - } - - /** - * Output only. Size of the backup in bytes. - * - * Generated from protobuf field int64 size_bytes = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int|string - */ - public function getSizeBytes() - { - return $this->size_bytes; - } - - /** - * Output only. Size of the backup in bytes. - * - * Generated from protobuf field int64 size_bytes = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int|string $var - * @return $this - */ - public function setSizeBytes($var) - { - GPBUtil::checkInt64($var); - $this->size_bytes = $var; - - return $this; - } - - /** - * Output only. The number of bytes that will be freed by deleting this - * backup. This value will be zero if, for example, this backup is part of an - * incremental backup chain and younger backups in the chain require that we - * keep its data. For backups not in an incremental backup chain, this is - * always the size of the backup. This value may change if backups on the same - * chain get created, deleted or expired. - * - * Generated from protobuf field int64 freeable_size_bytes = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int|string - */ - public function getFreeableSizeBytes() - { - return $this->freeable_size_bytes; - } - - /** - * Output only. The number of bytes that will be freed by deleting this - * backup. This value will be zero if, for example, this backup is part of an - * incremental backup chain and younger backups in the chain require that we - * keep its data. For backups not in an incremental backup chain, this is - * always the size of the backup. This value may change if backups on the same - * chain get created, deleted or expired. - * - * Generated from protobuf field int64 freeable_size_bytes = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int|string $var - * @return $this - */ - public function setFreeableSizeBytes($var) - { - GPBUtil::checkInt64($var); - $this->freeable_size_bytes = $var; - - return $this; - } - - /** - * Output only. For a backup in an incremental backup chain, this is the - * storage space needed to keep the data that has changed since the previous - * backup. For all other backups, this is always the size of the backup. This - * value may change if backups on the same chain get deleted or expired. - * This field can be used to calculate the total storage space used by a set - * of backups. For example, the total space used by all backups of a database - * can be computed by summing up this field. - * - * Generated from protobuf field int64 exclusive_size_bytes = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int|string - */ - public function getExclusiveSizeBytes() - { - return $this->exclusive_size_bytes; - } - - /** - * Output only. For a backup in an incremental backup chain, this is the - * storage space needed to keep the data that has changed since the previous - * backup. For all other backups, this is always the size of the backup. This - * value may change if backups on the same chain get deleted or expired. - * This field can be used to calculate the total storage space used by a set - * of backups. For example, the total space used by all backups of a database - * can be computed by summing up this field. - * - * Generated from protobuf field int64 exclusive_size_bytes = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int|string $var - * @return $this - */ - public function setExclusiveSizeBytes($var) - { - GPBUtil::checkInt64($var); - $this->exclusive_size_bytes = $var; - - return $this; - } - - /** - * Output only. The current state of the backup. - * - * Generated from protobuf field .google.spanner.admin.database.v1.Backup.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * Output only. The current state of the backup. - * - * Generated from protobuf field .google.spanner.admin.database.v1.Backup.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\Backup\State::class); - $this->state = $var; - - return $this; - } - - /** - * Output only. The names of the restored databases that reference the backup. - * The database names are of - * the form `projects//instances//databases/`. - * Referencing databases may exist in different instances. The existence of - * any referencing database prevents the backup from being deleted. When a - * restored database from the backup enters the `READY` state, the reference - * to the backup is removed. - * - * Generated from protobuf field repeated string referencing_databases = 7 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getReferencingDatabases() - { - return $this->referencing_databases; - } - - /** - * Output only. The names of the restored databases that reference the backup. - * The database names are of - * the form `projects//instances//databases/`. - * Referencing databases may exist in different instances. The existence of - * any referencing database prevents the backup from being deleted. When a - * restored database from the backup enters the `READY` state, the reference - * to the backup is removed. - * - * Generated from protobuf field repeated string referencing_databases = 7 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setReferencingDatabases($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->referencing_databases = $arr; - - return $this; - } - - /** - * Output only. The encryption information for the backup. - * - * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionInfo encryption_info = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo|null - */ - public function getEncryptionInfo() - { - return $this->encryption_info; - } - - public function hasEncryptionInfo() - { - return isset($this->encryption_info); - } - - public function clearEncryptionInfo() - { - unset($this->encryption_info); - } - - /** - * Output only. The encryption information for the backup. - * - * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionInfo encryption_info = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo $var - * @return $this - */ - public function setEncryptionInfo($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo::class); - $this->encryption_info = $var; - - return $this; - } - - /** - * Output only. The encryption information for the backup, whether it is - * protected by one or more KMS keys. The information includes all Cloud - * KMS key versions used to encrypt the backup. The `encryption_status' field - * inside of each `EncryptionInfo` is not populated. At least one of the key - * versions must be available for the backup to be restored. If a key version - * is revoked in the middle of a restore, the restore behavior is undefined. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.EncryptionInfo encryption_information = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getEncryptionInformation() - { - return $this->encryption_information; - } - - /** - * Output only. The encryption information for the backup, whether it is - * protected by one or more KMS keys. The information includes all Cloud - * KMS key versions used to encrypt the backup. The `encryption_status' field - * inside of each `EncryptionInfo` is not populated. At least one of the key - * versions must be available for the backup to be restored. If a key version - * is revoked in the middle of a restore, the restore behavior is undefined. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.EncryptionInfo encryption_information = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param array<\Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setEncryptionInformation($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo::class); - $this->encryption_information = $arr; - - return $this; - } - - /** - * Output only. The database dialect information for the backup. - * - * Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getDatabaseDialect() - { - return $this->database_dialect; - } - - /** - * Output only. The database dialect information for the backup. - * - * Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setDatabaseDialect($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\DatabaseDialect::class); - $this->database_dialect = $var; - - return $this; - } - - /** - * Output only. The names of the destination backups being created by copying - * this source backup. The backup names are of the form - * `projects//instances//backups/`. - * Referencing backups may exist in different instances. The existence of - * any referencing backup prevents the backup from being deleted. When the - * copy operation is done (either successfully completed or cancelled or the - * destination backup is deleted), the reference to the backup is removed. - * - * Generated from protobuf field repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getReferencingBackups() - { - return $this->referencing_backups; - } - - /** - * Output only. The names of the destination backups being created by copying - * this source backup. The backup names are of the form - * `projects//instances//backups/`. - * Referencing backups may exist in different instances. The existence of - * any referencing backup prevents the backup from being deleted. When the - * copy operation is done (either successfully completed or cancelled or the - * destination backup is deleted), the reference to the backup is removed. - * - * Generated from protobuf field repeated string referencing_backups = 11 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setReferencingBackups($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->referencing_backups = $arr; - - return $this; - } - - /** - * Output only. The max allowed expiration time of the backup, with - * microseconds granularity. A backup's expiration time can be configured in - * multiple APIs: CreateBackup, UpdateBackup, CopyBackup. When updating or - * copying an existing backup, the expiration time specified must be - * less than `Backup.max_expire_time`. - * - * Generated from protobuf field .google.protobuf.Timestamp max_expire_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getMaxExpireTime() - { - return $this->max_expire_time; - } - - public function hasMaxExpireTime() - { - return isset($this->max_expire_time); - } - - public function clearMaxExpireTime() - { - unset($this->max_expire_time); - } - - /** - * Output only. The max allowed expiration time of the backup, with - * microseconds granularity. A backup's expiration time can be configured in - * multiple APIs: CreateBackup, UpdateBackup, CopyBackup. When updating or - * copying an existing backup, the expiration time specified must be - * less than `Backup.max_expire_time`. - * - * Generated from protobuf field .google.protobuf.Timestamp max_expire_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setMaxExpireTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->max_expire_time = $var; - - return $this; - } - - /** - * Output only. List of backup schedule URIs that are associated with - * creating this backup. This is only applicable for scheduled backups, and - * is empty for on-demand backups. - * To optimize for storage, whenever possible, multiple schedules are - * collapsed together to create one backup. In such cases, this field captures - * the list of all backup schedule URIs that are associated with creating - * this backup. If collapsing is not done, then this field captures the - * single backup schedule URI associated with creating this backup. - * - * Generated from protobuf field repeated string backup_schedules = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getBackupSchedules() - { - return $this->backup_schedules; - } - - /** - * Output only. List of backup schedule URIs that are associated with - * creating this backup. This is only applicable for scheduled backups, and - * is empty for on-demand backups. - * To optimize for storage, whenever possible, multiple schedules are - * collapsed together to create one backup. In such cases, this field captures - * the list of all backup schedule URIs that are associated with creating - * this backup. If collapsing is not done, then this field captures the - * single backup schedule URI associated with creating this backup. - * - * Generated from protobuf field repeated string backup_schedules = 14 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setBackupSchedules($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->backup_schedules = $arr; - - return $this; - } - - /** - * Output only. Populated only for backups in an incremental backup chain. - * Backups share the same chain id if and only if they belong to the same - * incremental backup chain. Use this field to determine which backups are - * part of the same incremental backup chain. The ordering of backups in the - * chain can be determined by ordering the backup `version_time`. - * - * Generated from protobuf field string incremental_backup_chain_id = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getIncrementalBackupChainId() - { - return $this->incremental_backup_chain_id; - } - - /** - * Output only. Populated only for backups in an incremental backup chain. - * Backups share the same chain id if and only if they belong to the same - * incremental backup chain. Use this field to determine which backups are - * part of the same incremental backup chain. The ordering of backups in the - * chain can be determined by ordering the backup `version_time`. - * - * Generated from protobuf field string incremental_backup_chain_id = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setIncrementalBackupChainId($var) - { - GPBUtil::checkString($var, True); - $this->incremental_backup_chain_id = $var; - - return $this; - } - - /** - * Output only. Data deleted at a time older than this is guaranteed not to be - * retained in order to support this backup. For a backup in an incremental - * backup chain, this is the version time of the oldest backup that exists or - * ever existed in the chain. For all other backups, this is the version time - * of the backup. This field can be used to understand what data is being - * retained by the backup system. - * - * Generated from protobuf field .google.protobuf.Timestamp oldest_version_time = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getOldestVersionTime() - { - return $this->oldest_version_time; - } - - public function hasOldestVersionTime() - { - return isset($this->oldest_version_time); - } - - public function clearOldestVersionTime() - { - unset($this->oldest_version_time); - } - - /** - * Output only. Data deleted at a time older than this is guaranteed not to be - * retained in order to support this backup. For a backup in an incremental - * backup chain, this is the version time of the oldest backup that exists or - * ever existed in the chain. For all other backups, this is the version time - * of the backup. This field can be used to understand what data is being - * retained by the backup system. - * - * Generated from protobuf field .google.protobuf.Timestamp oldest_version_time = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setOldestVersionTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->oldest_version_time = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Backup/State.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Backup/State.php deleted file mode 100644 index 18d79b35ac2d..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Backup/State.php +++ /dev/null @@ -1,65 +0,0 @@ -google.spanner.admin.database.v1.Backup.State - */ -class State -{ - /** - * Not specified. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * The pending backup is still being created. Operations on the - * backup may fail with `FAILED_PRECONDITION` in this state. - * - * Generated from protobuf enum CREATING = 1; - */ - const CREATING = 1; - /** - * The backup is complete and ready for use. - * - * Generated from protobuf enum READY = 2; - */ - const READY = 2; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::CREATING => 'CREATING', - self::READY => 'READY', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(State::class, \Google\Cloud\Spanner\Admin\Database\V1\Backup_State::class); - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupInfo.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupInfo.php deleted file mode 100644 index 301cdec6653a..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupInfo.php +++ /dev/null @@ -1,213 +0,0 @@ -google.spanner.admin.database.v1.BackupInfo - */ -class BackupInfo extends \Google\Protobuf\Internal\Message -{ - /** - * Name of the backup. - * - * Generated from protobuf field string backup = 1 [(.google.api.resource_reference) = { - */ - protected $backup = ''; - /** - * The backup contains an externally consistent copy of `source_database` at - * the timestamp specified by `version_time`. If the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * request did not specify `version_time`, the `version_time` of the backup is - * equivalent to the `create_time`. - * - * Generated from protobuf field .google.protobuf.Timestamp version_time = 4; - */ - protected $version_time = null; - /** - * The time the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 2; - */ - protected $create_time = null; - /** - * Name of the database the backup was created from. - * - * Generated from protobuf field string source_database = 3 [(.google.api.resource_reference) = { - */ - protected $source_database = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $backup - * Name of the backup. - * @type \Google\Protobuf\Timestamp $version_time - * The backup contains an externally consistent copy of `source_database` at - * the timestamp specified by `version_time`. If the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * request did not specify `version_time`, the `version_time` of the backup is - * equivalent to the `create_time`. - * @type \Google\Protobuf\Timestamp $create_time - * The time the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * request was received. - * @type string $source_database - * Name of the database the backup was created from. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); - parent::__construct($data); - } - - /** - * Name of the backup. - * - * Generated from protobuf field string backup = 1 [(.google.api.resource_reference) = { - * @return string - */ - public function getBackup() - { - return $this->backup; - } - - /** - * Name of the backup. - * - * Generated from protobuf field string backup = 1 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setBackup($var) - { - GPBUtil::checkString($var, True); - $this->backup = $var; - - return $this; - } - - /** - * The backup contains an externally consistent copy of `source_database` at - * the timestamp specified by `version_time`. If the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * request did not specify `version_time`, the `version_time` of the backup is - * equivalent to the `create_time`. - * - * Generated from protobuf field .google.protobuf.Timestamp version_time = 4; - * @return \Google\Protobuf\Timestamp|null - */ - public function getVersionTime() - { - return $this->version_time; - } - - public function hasVersionTime() - { - return isset($this->version_time); - } - - public function clearVersionTime() - { - unset($this->version_time); - } - - /** - * The backup contains an externally consistent copy of `source_database` at - * the timestamp specified by `version_time`. If the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * request did not specify `version_time`, the `version_time` of the backup is - * equivalent to the `create_time`. - * - * Generated from protobuf field .google.protobuf.Timestamp version_time = 4; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setVersionTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->version_time = $var; - - return $this; - } - - /** - * The time the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 2; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCreateTime() - { - return $this->create_time; - } - - public function hasCreateTime() - { - return isset($this->create_time); - } - - public function clearCreateTime() - { - unset($this->create_time); - } - - /** - * The time the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 2; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCreateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->create_time = $var; - - return $this; - } - - /** - * Name of the database the backup was created from. - * - * Generated from protobuf field string source_database = 3 [(.google.api.resource_reference) = { - * @return string - */ - public function getSourceDatabase() - { - return $this->source_database; - } - - /** - * Name of the database the backup was created from. - * - * Generated from protobuf field string source_database = 3 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSourceDatabase($var) - { - GPBUtil::checkString($var, True); - $this->source_database = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupSchedule.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupSchedule.php deleted file mode 100644 index 4e438c2b75a1..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupSchedule.php +++ /dev/null @@ -1,380 +0,0 @@ -google.spanner.admin.database.v1.BackupSchedule - */ -class BackupSchedule extends \Google\Protobuf\Internal\Message -{ - /** - * Identifier. Output only for the - * [CreateBackupSchedule][DatabaseAdmin.CreateBackupSchededule] operation. - * Required for the - * [UpdateBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule] - * operation. A globally unique identifier for the backup schedule which - * cannot be changed. Values are of the form - * `projects//instances//databases//backupSchedules/[a-z][a-z0-9_\-]*[a-z0-9]` - * The final segment of the name must be between 2 and 60 characters in - * length. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; - */ - protected $name = ''; - /** - * Optional. The schedule specification based on which the backup creations - * are triggered. - * - * Generated from protobuf field .google.spanner.admin.database.v1.BackupScheduleSpec spec = 6 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $spec = null; - /** - * Optional. The retention duration of a backup that must be at least 6 hours - * and at most 366 days. The backup is eligible to be automatically deleted - * once the retention period has elapsed. - * - * Generated from protobuf field .google.protobuf.Duration retention_duration = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $retention_duration = null; - /** - * Optional. The encryption configuration that will be used to encrypt the - * backup. If this field is not specified, the backup will use the same - * encryption configuration as the database. - * - * Generated from protobuf field .google.spanner.admin.database.v1.CreateBackupEncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $encryption_config = null; - /** - * Output only. The timestamp at which the schedule was last updated. - * If the schedule has never been updated, this field contains the timestamp - * when the schedule was first created. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $update_time = null; - protected $backup_type_spec; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Identifier. Output only for the - * [CreateBackupSchedule][DatabaseAdmin.CreateBackupSchededule] operation. - * Required for the - * [UpdateBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule] - * operation. A globally unique identifier for the backup schedule which - * cannot be changed. Values are of the form - * `projects//instances//databases//backupSchedules/[a-z][a-z0-9_\-]*[a-z0-9]` - * The final segment of the name must be between 2 and 60 characters in - * length. - * @type \Google\Cloud\Spanner\Admin\Database\V1\BackupScheduleSpec $spec - * Optional. The schedule specification based on which the backup creations - * are triggered. - * @type \Google\Protobuf\Duration $retention_duration - * Optional. The retention duration of a backup that must be at least 6 hours - * and at most 366 days. The backup is eligible to be automatically deleted - * once the retention period has elapsed. - * @type \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig $encryption_config - * Optional. The encryption configuration that will be used to encrypt the - * backup. If this field is not specified, the backup will use the same - * encryption configuration as the database. - * @type \Google\Cloud\Spanner\Admin\Database\V1\FullBackupSpec $full_backup_spec - * The schedule creates only full backups. - * @type \Google\Cloud\Spanner\Admin\Database\V1\IncrementalBackupSpec $incremental_backup_spec - * The schedule creates incremental backup chains. - * @type \Google\Protobuf\Timestamp $update_time - * Output only. The timestamp at which the schedule was last updated. - * If the schedule has never been updated, this field contains the timestamp - * when the schedule was first created. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); - parent::__construct($data); - } - - /** - * Identifier. Output only for the - * [CreateBackupSchedule][DatabaseAdmin.CreateBackupSchededule] operation. - * Required for the - * [UpdateBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule] - * operation. A globally unique identifier for the backup schedule which - * cannot be changed. Values are of the form - * `projects//instances//databases//backupSchedules/[a-z][a-z0-9_\-]*[a-z0-9]` - * The final segment of the name must be between 2 and 60 characters in - * length. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Identifier. Output only for the - * [CreateBackupSchedule][DatabaseAdmin.CreateBackupSchededule] operation. - * Required for the - * [UpdateBackupSchedule][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackupSchedule] - * operation. A globally unique identifier for the backup schedule which - * cannot be changed. Values are of the form - * `projects//instances//databases//backupSchedules/[a-z][a-z0-9_\-]*[a-z0-9]` - * The final segment of the name must be between 2 and 60 characters in - * length. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Optional. The schedule specification based on which the backup creations - * are triggered. - * - * Generated from protobuf field .google.spanner.admin.database.v1.BackupScheduleSpec spec = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\Spanner\Admin\Database\V1\BackupScheduleSpec|null - */ - public function getSpec() - { - return $this->spec; - } - - public function hasSpec() - { - return isset($this->spec); - } - - public function clearSpec() - { - unset($this->spec); - } - - /** - * Optional. The schedule specification based on which the backup creations - * are triggered. - * - * Generated from protobuf field .google.spanner.admin.database.v1.BackupScheduleSpec spec = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\Spanner\Admin\Database\V1\BackupScheduleSpec $var - * @return $this - */ - public function setSpec($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\BackupScheduleSpec::class); - $this->spec = $var; - - return $this; - } - - /** - * Optional. The retention duration of a backup that must be at least 6 hours - * and at most 366 days. The backup is eligible to be automatically deleted - * once the retention period has elapsed. - * - * Generated from protobuf field .google.protobuf.Duration retention_duration = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Duration|null - */ - public function getRetentionDuration() - { - return $this->retention_duration; - } - - public function hasRetentionDuration() - { - return isset($this->retention_duration); - } - - public function clearRetentionDuration() - { - unset($this->retention_duration); - } - - /** - * Optional. The retention duration of a backup that must be at least 6 hours - * and at most 366 days. The backup is eligible to be automatically deleted - * once the retention period has elapsed. - * - * Generated from protobuf field .google.protobuf.Duration retention_duration = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Protobuf\Duration $var - * @return $this - */ - public function setRetentionDuration($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); - $this->retention_duration = $var; - - return $this; - } - - /** - * Optional. The encryption configuration that will be used to encrypt the - * backup. If this field is not specified, the backup will use the same - * encryption configuration as the database. - * - * Generated from protobuf field .google.spanner.admin.database.v1.CreateBackupEncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig|null - */ - public function getEncryptionConfig() - { - return $this->encryption_config; - } - - public function hasEncryptionConfig() - { - return isset($this->encryption_config); - } - - public function clearEncryptionConfig() - { - unset($this->encryption_config); - } - - /** - * Optional. The encryption configuration that will be used to encrypt the - * backup. If this field is not specified, the backup will use the same - * encryption configuration as the database. - * - * Generated from protobuf field .google.spanner.admin.database.v1.CreateBackupEncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig $var - * @return $this - */ - public function setEncryptionConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig::class); - $this->encryption_config = $var; - - return $this; - } - - /** - * The schedule creates only full backups. - * - * Generated from protobuf field .google.spanner.admin.database.v1.FullBackupSpec full_backup_spec = 7; - * @return \Google\Cloud\Spanner\Admin\Database\V1\FullBackupSpec|null - */ - public function getFullBackupSpec() - { - return $this->readOneof(7); - } - - public function hasFullBackupSpec() - { - return $this->hasOneof(7); - } - - /** - * The schedule creates only full backups. - * - * Generated from protobuf field .google.spanner.admin.database.v1.FullBackupSpec full_backup_spec = 7; - * @param \Google\Cloud\Spanner\Admin\Database\V1\FullBackupSpec $var - * @return $this - */ - public function setFullBackupSpec($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\FullBackupSpec::class); - $this->writeOneof(7, $var); - - return $this; - } - - /** - * The schedule creates incremental backup chains. - * - * Generated from protobuf field .google.spanner.admin.database.v1.IncrementalBackupSpec incremental_backup_spec = 8; - * @return \Google\Cloud\Spanner\Admin\Database\V1\IncrementalBackupSpec|null - */ - public function getIncrementalBackupSpec() - { - return $this->readOneof(8); - } - - public function hasIncrementalBackupSpec() - { - return $this->hasOneof(8); - } - - /** - * The schedule creates incremental backup chains. - * - * Generated from protobuf field .google.spanner.admin.database.v1.IncrementalBackupSpec incremental_backup_spec = 8; - * @param \Google\Cloud\Spanner\Admin\Database\V1\IncrementalBackupSpec $var - * @return $this - */ - public function setIncrementalBackupSpec($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\IncrementalBackupSpec::class); - $this->writeOneof(8, $var); - - return $this; - } - - /** - * Output only. The timestamp at which the schedule was last updated. - * If the schedule has never been updated, this field contains the timestamp - * when the schedule was first created. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getUpdateTime() - { - return $this->update_time; - } - - public function hasUpdateTime() - { - return isset($this->update_time); - } - - public function clearUpdateTime() - { - unset($this->update_time); - } - - /** - * Output only. The timestamp at which the schedule was last updated. - * If the schedule has never been updated, this field contains the timestamp - * when the schedule was first created. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setUpdateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->update_time = $var; - - return $this; - } - - /** - * @return string - */ - public function getBackupTypeSpec() - { - return $this->whichOneof("backup_type_spec"); - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupScheduleSpec.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupScheduleSpec.php deleted file mode 100644 index b78eef7af97d..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/BackupScheduleSpec.php +++ /dev/null @@ -1,75 +0,0 @@ -google.spanner.admin.database.v1.BackupScheduleSpec - */ -class BackupScheduleSpec extends \Google\Protobuf\Internal\Message -{ - protected $schedule_spec; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\Admin\Database\V1\CrontabSpec $cron_spec - * Cron style schedule specification. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); - parent::__construct($data); - } - - /** - * Cron style schedule specification. - * - * Generated from protobuf field .google.spanner.admin.database.v1.CrontabSpec cron_spec = 1; - * @return \Google\Cloud\Spanner\Admin\Database\V1\CrontabSpec|null - */ - public function getCronSpec() - { - return $this->readOneof(1); - } - - public function hasCronSpec() - { - return $this->hasOneof(1); - } - - /** - * Cron style schedule specification. - * - * Generated from protobuf field .google.spanner.admin.database.v1.CrontabSpec cron_spec = 1; - * @param \Google\Cloud\Spanner\Admin\Database\V1\CrontabSpec $var - * @return $this - */ - public function setCronSpec($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\CrontabSpec::class); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * @return string - */ - public function getScheduleSpec() - { - return $this->whichOneof("schedule_spec"); - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupEncryptionConfig.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupEncryptionConfig.php deleted file mode 100644 index 07325d77c3d1..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupEncryptionConfig.php +++ /dev/null @@ -1,207 +0,0 @@ -google.spanner.admin.database.v1.CopyBackupEncryptionConfig - */ -class CopyBackupEncryptionConfig extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The encryption type of the backup. - * - * Generated from protobuf field .google.spanner.admin.database.v1.CopyBackupEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $encryption_type = 0; - /** - * Optional. The Cloud KMS key that will be used to protect the backup. - * This field should be set only when - * [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] - * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - */ - protected $kms_key_name = ''; - /** - * Optional. Specifies the KMS configuration for the one or more keys used to - * protect the backup. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * Kms keys specified can be in any order. - * The keys referenced by kms_key_names must fully cover all - * regions of the backup's instance configuration. Some examples: - * * For single region instance configs, specify a single regional - * location KMS key. - * * For multi-regional instance configs of type GOOGLE_MANAGED, - * either specify a multi-regional location KMS key or multiple regional - * location KMS keys that cover all regions in the instance config. - * * For an instance config of type USER_MANAGED, please specify only - * regional location KMS keys to cover each region in the instance config. - * Multi-regional location KMS keys are not supported for USER_MANAGED - * instance configs. - * - * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - */ - private $kms_key_names; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $encryption_type - * Required. The encryption type of the backup. - * @type string $kms_key_name - * Optional. The Cloud KMS key that will be used to protect the backup. - * This field should be set only when - * [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] - * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * @type array|\Google\Protobuf\Internal\RepeatedField $kms_key_names - * Optional. Specifies the KMS configuration for the one or more keys used to - * protect the backup. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * Kms keys specified can be in any order. - * The keys referenced by kms_key_names must fully cover all - * regions of the backup's instance configuration. Some examples: - * * For single region instance configs, specify a single regional - * location KMS key. - * * For multi-regional instance configs of type GOOGLE_MANAGED, - * either specify a multi-regional location KMS key or multiple regional - * location KMS keys that cover all regions in the instance config. - * * For an instance config of type USER_MANAGED, please specify only - * regional location KMS keys to cover each region in the instance config. - * Multi-regional location KMS keys are not supported for USER_MANAGED - * instance configs. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); - parent::__construct($data); - } - - /** - * Required. The encryption type of the backup. - * - * Generated from protobuf field .google.spanner.admin.database.v1.CopyBackupEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return int - */ - public function getEncryptionType() - { - return $this->encryption_type; - } - - /** - * Required. The encryption type of the backup. - * - * Generated from protobuf field .google.spanner.admin.database.v1.CopyBackupEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param int $var - * @return $this - */ - public function setEncryptionType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\CopyBackupEncryptionConfig\EncryptionType::class); - $this->encryption_type = $var; - - return $this; - } - - /** - * Optional. The Cloud KMS key that will be used to protect the backup. - * This field should be set only when - * [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] - * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @return string - */ - public function getKmsKeyName() - { - return $this->kms_key_name; - } - - /** - * Optional. The Cloud KMS key that will be used to protect the backup. - * This field should be set only when - * [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] - * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setKmsKeyName($var) - { - GPBUtil::checkString($var, True); - $this->kms_key_name = $var; - - return $this; - } - - /** - * Optional. Specifies the KMS configuration for the one or more keys used to - * protect the backup. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * Kms keys specified can be in any order. - * The keys referenced by kms_key_names must fully cover all - * regions of the backup's instance configuration. Some examples: - * * For single region instance configs, specify a single regional - * location KMS key. - * * For multi-regional instance configs of type GOOGLE_MANAGED, - * either specify a multi-regional location KMS key or multiple regional - * location KMS keys that cover all regions in the instance config. - * * For an instance config of type USER_MANAGED, please specify only - * regional location KMS keys to cover each region in the instance config. - * Multi-regional location KMS keys are not supported for USER_MANAGED - * instance configs. - * - * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getKmsKeyNames() - { - return $this->kms_key_names; - } - - /** - * Optional. Specifies the KMS configuration for the one or more keys used to - * protect the backup. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * Kms keys specified can be in any order. - * The keys referenced by kms_key_names must fully cover all - * regions of the backup's instance configuration. Some examples: - * * For single region instance configs, specify a single regional - * location KMS key. - * * For multi-regional instance configs of type GOOGLE_MANAGED, - * either specify a multi-regional location KMS key or multiple regional - * location KMS keys that cover all regions in the instance config. - * * For an instance config of type USER_MANAGED, please specify only - * regional location KMS keys to cover each region in the instance config. - * Multi-regional location KMS keys are not supported for USER_MANAGED - * instance configs. - * - * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setKmsKeyNames($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->kms_key_names = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupEncryptionConfig/EncryptionType.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupEncryptionConfig/EncryptionType.php deleted file mode 100644 index 56fa3e3beb2b..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupEncryptionConfig/EncryptionType.php +++ /dev/null @@ -1,78 +0,0 @@ -google.spanner.admin.database.v1.CopyBackupEncryptionConfig.EncryptionType - */ -class EncryptionType -{ - /** - * Unspecified. Do not use. - * - * Generated from protobuf enum ENCRYPTION_TYPE_UNSPECIFIED = 0; - */ - const ENCRYPTION_TYPE_UNSPECIFIED = 0; - /** - * This is the default option for - * [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup] - * when - * [encryption_config][google.spanner.admin.database.v1.CopyBackupEncryptionConfig] - * is not specified. For example, if the source backup is using - * `Customer_Managed_Encryption`, the backup will be using the same Cloud - * KMS key as the source backup. - * - * Generated from protobuf enum USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION = 1; - */ - const USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION = 1; - /** - * Use Google default encryption. - * - * Generated from protobuf enum GOOGLE_DEFAULT_ENCRYPTION = 2; - */ - const GOOGLE_DEFAULT_ENCRYPTION = 2; - /** - * Use customer managed encryption. If specified, either `kms_key_name` or - * `kms_key_names` must contain valid Cloud KMS key(s). - * - * Generated from protobuf enum CUSTOMER_MANAGED_ENCRYPTION = 3; - */ - const CUSTOMER_MANAGED_ENCRYPTION = 3; - - private static $valueToName = [ - self::ENCRYPTION_TYPE_UNSPECIFIED => 'ENCRYPTION_TYPE_UNSPECIFIED', - self::USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION => 'USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION', - self::GOOGLE_DEFAULT_ENCRYPTION => 'GOOGLE_DEFAULT_ENCRYPTION', - self::CUSTOMER_MANAGED_ENCRYPTION => 'CUSTOMER_MANAGED_ENCRYPTION', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(EncryptionType::class, \Google\Cloud\Spanner\Admin\Database\V1\CopyBackupEncryptionConfig_EncryptionType::class); - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupMetadata.php deleted file mode 100644 index 833787dae626..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupMetadata.php +++ /dev/null @@ -1,258 +0,0 @@ -google.spanner.admin.database.v1.CopyBackupMetadata - */ -class CopyBackupMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The name of the backup being created through the copy operation. - * Values are of the form - * `projects//instances//backups/`. - * - * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * The name of the source backup that is being copied. - * Values are of the form - * `projects//instances//backups/`. - * - * Generated from protobuf field string source_backup = 2 [(.google.api.resource_reference) = { - */ - protected $source_backup = ''; - /** - * The progress of the - * [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup] - * operation. - * - * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 3; - */ - protected $progress = null; - /** - * The time at which cancellation of CopyBackup operation was received. - * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] - * starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not guaranteed. - * Clients can use - * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an [Operation.error][google.longrunning.Operation.error] value with a - * [google.rpc.Status.code][google.rpc.Status.code] of 1, - * corresponding to `Code.CANCELLED`. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 4; - */ - protected $cancel_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * The name of the backup being created through the copy operation. - * Values are of the form - * `projects//instances//backups/`. - * @type string $source_backup - * The name of the source backup that is being copied. - * Values are of the form - * `projects//instances//backups/`. - * @type \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress $progress - * The progress of the - * [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup] - * operation. - * @type \Google\Protobuf\Timestamp $cancel_time - * The time at which cancellation of CopyBackup operation was received. - * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] - * starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not guaranteed. - * Clients can use - * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an [Operation.error][google.longrunning.Operation.error] value with a - * [google.rpc.Status.code][google.rpc.Status.code] of 1, - * corresponding to `Code.CANCELLED`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); - parent::__construct($data); - } - - /** - * The name of the backup being created through the copy operation. - * Values are of the form - * `projects//instances//backups/`. - * - * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * The name of the backup being created through the copy operation. - * Values are of the form - * `projects//instances//backups/`. - * - * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The name of the source backup that is being copied. - * Values are of the form - * `projects//instances//backups/`. - * - * Generated from protobuf field string source_backup = 2 [(.google.api.resource_reference) = { - * @return string - */ - public function getSourceBackup() - { - return $this->source_backup; - } - - /** - * The name of the source backup that is being copied. - * Values are of the form - * `projects//instances//backups/`. - * - * Generated from protobuf field string source_backup = 2 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSourceBackup($var) - { - GPBUtil::checkString($var, True); - $this->source_backup = $var; - - return $this; - } - - /** - * The progress of the - * [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup] - * operation. - * - * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 3; - * @return \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress|null - */ - public function getProgress() - { - return $this->progress; - } - - public function hasProgress() - { - return isset($this->progress); - } - - public function clearProgress() - { - unset($this->progress); - } - - /** - * The progress of the - * [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup] - * operation. - * - * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 3; - * @param \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress $var - * @return $this - */ - public function setProgress($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress::class); - $this->progress = $var; - - return $this; - } - - /** - * The time at which cancellation of CopyBackup operation was received. - * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] - * starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not guaranteed. - * Clients can use - * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an [Operation.error][google.longrunning.Operation.error] value with a - * [google.rpc.Status.code][google.rpc.Status.code] of 1, - * corresponding to `Code.CANCELLED`. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 4; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCancelTime() - { - return $this->cancel_time; - } - - public function hasCancelTime() - { - return isset($this->cancel_time); - } - - public function clearCancelTime() - { - unset($this->cancel_time); - } - - /** - * The time at which cancellation of CopyBackup operation was received. - * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] - * starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not guaranteed. - * Clients can use - * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an [Operation.error][google.longrunning.Operation.error] value with a - * [google.rpc.Status.code][google.rpc.Status.code] of 1, - * corresponding to `Code.CANCELLED`. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 4; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCancelTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->cancel_time = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupRequest.php deleted file mode 100644 index 8a80683e54fa..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CopyBackupRequest.php +++ /dev/null @@ -1,321 +0,0 @@ -google.spanner.admin.database.v1.CopyBackupRequest - */ -class CopyBackupRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the destination instance that will contain the backup - * copy. Values are of the form: `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Required. The id of the backup copy. - * The `backup_id` appended to `parent` forms the full backup_uri of the form - * `projects//instances//backups/`. - * - * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $backup_id = ''; - /** - * Required. The source backup to be copied. - * The source backup needs to be in READY state for it to be copied. - * Once CopyBackup is in progress, the source backup cannot be deleted or - * cleaned up on expiration until CopyBackup is finished. - * Values are of the form: - * `projects//instances//backups/`. - * - * Generated from protobuf field string source_backup = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $source_backup = ''; - /** - * Required. The expiration time of the backup in microsecond granularity. - * The expiration time must be at least 6 hours and at most 366 days - * from the `create_time` of the source backup. Once the `expire_time` has - * passed, the backup is eligible to be automatically deleted by Cloud Spanner - * to free the resources used by the backup. - * - * Generated from protobuf field .google.protobuf.Timestamp expire_time = 4 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $expire_time = null; - /** - * Optional. The encryption configuration used to encrypt the backup. If this - * field is not specified, the backup will use the same encryption - * configuration as the source backup by default, namely - * [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] - * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`. - * - * Generated from protobuf field .google.spanner.admin.database.v1.CopyBackupEncryptionConfig encryption_config = 5 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $encryption_config = null; - - /** - * @param string $parent Required. The name of the destination instance that will contain the backup - * copy. Values are of the form: `projects//instances/`. Please see - * {@see DatabaseAdminClient::instanceName()} for help formatting this field. - * @param string $backupId Required. The id of the backup copy. - * The `backup_id` appended to `parent` forms the full backup_uri of the form - * `projects//instances//backups/`. - * @param string $sourceBackup Required. The source backup to be copied. - * The source backup needs to be in READY state for it to be copied. - * Once CopyBackup is in progress, the source backup cannot be deleted or - * cleaned up on expiration until CopyBackup is finished. - * Values are of the form: - * `projects//instances//backups/`. Please see - * {@see DatabaseAdminClient::backupName()} for help formatting this field. - * @param \Google\Protobuf\Timestamp $expireTime Required. The expiration time of the backup in microsecond granularity. - * The expiration time must be at least 6 hours and at most 366 days - * from the `create_time` of the source backup. Once the `expire_time` has - * passed, the backup is eligible to be automatically deleted by Cloud Spanner - * to free the resources used by the backup. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\CopyBackupRequest - * - * @experimental - */ - public static function build(string $parent, string $backupId, string $sourceBackup, \Google\Protobuf\Timestamp $expireTime): self - { - return (new self()) - ->setParent($parent) - ->setBackupId($backupId) - ->setSourceBackup($sourceBackup) - ->setExpireTime($expireTime); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The name of the destination instance that will contain the backup - * copy. Values are of the form: `projects//instances/`. - * @type string $backup_id - * Required. The id of the backup copy. - * The `backup_id` appended to `parent` forms the full backup_uri of the form - * `projects//instances//backups/`. - * @type string $source_backup - * Required. The source backup to be copied. - * The source backup needs to be in READY state for it to be copied. - * Once CopyBackup is in progress, the source backup cannot be deleted or - * cleaned up on expiration until CopyBackup is finished. - * Values are of the form: - * `projects//instances//backups/`. - * @type \Google\Protobuf\Timestamp $expire_time - * Required. The expiration time of the backup in microsecond granularity. - * The expiration time must be at least 6 hours and at most 366 days - * from the `create_time` of the source backup. Once the `expire_time` has - * passed, the backup is eligible to be automatically deleted by Cloud Spanner - * to free the resources used by the backup. - * @type \Google\Cloud\Spanner\Admin\Database\V1\CopyBackupEncryptionConfig $encryption_config - * Optional. The encryption configuration used to encrypt the backup. If this - * field is not specified, the backup will use the same encryption - * configuration as the source backup by default, namely - * [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] - * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the destination instance that will contain the backup - * copy. Values are of the form: `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The name of the destination instance that will contain the backup - * copy. Values are of the form: `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Required. The id of the backup copy. - * The `backup_id` appended to `parent` forms the full backup_uri of the form - * `projects//instances//backups/`. - * - * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getBackupId() - { - return $this->backup_id; - } - - /** - * Required. The id of the backup copy. - * The `backup_id` appended to `parent` forms the full backup_uri of the form - * `projects//instances//backups/`. - * - * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setBackupId($var) - { - GPBUtil::checkString($var, True); - $this->backup_id = $var; - - return $this; - } - - /** - * Required. The source backup to be copied. - * The source backup needs to be in READY state for it to be copied. - * Once CopyBackup is in progress, the source backup cannot be deleted or - * cleaned up on expiration until CopyBackup is finished. - * Values are of the form: - * `projects//instances//backups/`. - * - * Generated from protobuf field string source_backup = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSourceBackup() - { - return $this->source_backup; - } - - /** - * Required. The source backup to be copied. - * The source backup needs to be in READY state for it to be copied. - * Once CopyBackup is in progress, the source backup cannot be deleted or - * cleaned up on expiration until CopyBackup is finished. - * Values are of the form: - * `projects//instances//backups/`. - * - * Generated from protobuf field string source_backup = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSourceBackup($var) - { - GPBUtil::checkString($var, True); - $this->source_backup = $var; - - return $this; - } - - /** - * Required. The expiration time of the backup in microsecond granularity. - * The expiration time must be at least 6 hours and at most 366 days - * from the `create_time` of the source backup. Once the `expire_time` has - * passed, the backup is eligible to be automatically deleted by Cloud Spanner - * to free the resources used by the backup. - * - * Generated from protobuf field .google.protobuf.Timestamp expire_time = 4 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getExpireTime() - { - return $this->expire_time; - } - - public function hasExpireTime() - { - return isset($this->expire_time); - } - - public function clearExpireTime() - { - unset($this->expire_time); - } - - /** - * Required. The expiration time of the backup in microsecond granularity. - * The expiration time must be at least 6 hours and at most 366 days - * from the `create_time` of the source backup. Once the `expire_time` has - * passed, the backup is eligible to be automatically deleted by Cloud Spanner - * to free the resources used by the backup. - * - * Generated from protobuf field .google.protobuf.Timestamp expire_time = 4 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setExpireTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->expire_time = $var; - - return $this; - } - - /** - * Optional. The encryption configuration used to encrypt the backup. If this - * field is not specified, the backup will use the same encryption - * configuration as the source backup by default, namely - * [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] - * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`. - * - * Generated from protobuf field .google.spanner.admin.database.v1.CopyBackupEncryptionConfig encryption_config = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\Spanner\Admin\Database\V1\CopyBackupEncryptionConfig|null - */ - public function getEncryptionConfig() - { - return $this->encryption_config; - } - - public function hasEncryptionConfig() - { - return isset($this->encryption_config); - } - - public function clearEncryptionConfig() - { - unset($this->encryption_config); - } - - /** - * Optional. The encryption configuration used to encrypt the backup. If this - * field is not specified, the backup will use the same encryption - * configuration as the source backup by default, namely - * [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] - * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`. - * - * Generated from protobuf field .google.spanner.admin.database.v1.CopyBackupEncryptionConfig encryption_config = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\Spanner\Admin\Database\V1\CopyBackupEncryptionConfig $var - * @return $this - */ - public function setEncryptionConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\CopyBackupEncryptionConfig::class); - $this->encryption_config = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupEncryptionConfig.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupEncryptionConfig.php deleted file mode 100644 index 40ec928a4b04..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupEncryptionConfig.php +++ /dev/null @@ -1,203 +0,0 @@ -google.spanner.admin.database.v1.CreateBackupEncryptionConfig - */ -class CreateBackupEncryptionConfig extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The encryption type of the backup. - * - * Generated from protobuf field .google.spanner.admin.database.v1.CreateBackupEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $encryption_type = 0; - /** - * Optional. The Cloud KMS key that will be used to protect the backup. - * This field should be set only when - * [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type] - * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - */ - protected $kms_key_name = ''; - /** - * Optional. Specifies the KMS configuration for the one or more keys used to - * protect the backup. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * The keys referenced by kms_key_names must fully cover all - * regions of the backup's instance configuration. Some examples: - * * For single region instance configs, specify a single regional - * location KMS key. - * * For multi-regional instance configs of type GOOGLE_MANAGED, - * either specify a multi-regional location KMS key or multiple regional - * location KMS keys that cover all regions in the instance config. - * * For an instance config of type USER_MANAGED, please specify only - * regional location KMS keys to cover each region in the instance config. - * Multi-regional location KMS keys are not supported for USER_MANAGED - * instance configs. - * - * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - */ - private $kms_key_names; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $encryption_type - * Required. The encryption type of the backup. - * @type string $kms_key_name - * Optional. The Cloud KMS key that will be used to protect the backup. - * This field should be set only when - * [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type] - * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * @type array|\Google\Protobuf\Internal\RepeatedField $kms_key_names - * Optional. Specifies the KMS configuration for the one or more keys used to - * protect the backup. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * The keys referenced by kms_key_names must fully cover all - * regions of the backup's instance configuration. Some examples: - * * For single region instance configs, specify a single regional - * location KMS key. - * * For multi-regional instance configs of type GOOGLE_MANAGED, - * either specify a multi-regional location KMS key or multiple regional - * location KMS keys that cover all regions in the instance config. - * * For an instance config of type USER_MANAGED, please specify only - * regional location KMS keys to cover each region in the instance config. - * Multi-regional location KMS keys are not supported for USER_MANAGED - * instance configs. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); - parent::__construct($data); - } - - /** - * Required. The encryption type of the backup. - * - * Generated from protobuf field .google.spanner.admin.database.v1.CreateBackupEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return int - */ - public function getEncryptionType() - { - return $this->encryption_type; - } - - /** - * Required. The encryption type of the backup. - * - * Generated from protobuf field .google.spanner.admin.database.v1.CreateBackupEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param int $var - * @return $this - */ - public function setEncryptionType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig\EncryptionType::class); - $this->encryption_type = $var; - - return $this; - } - - /** - * Optional. The Cloud KMS key that will be used to protect the backup. - * This field should be set only when - * [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type] - * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @return string - */ - public function getKmsKeyName() - { - return $this->kms_key_name; - } - - /** - * Optional. The Cloud KMS key that will be used to protect the backup. - * This field should be set only when - * [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type] - * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setKmsKeyName($var) - { - GPBUtil::checkString($var, True); - $this->kms_key_name = $var; - - return $this; - } - - /** - * Optional. Specifies the KMS configuration for the one or more keys used to - * protect the backup. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * The keys referenced by kms_key_names must fully cover all - * regions of the backup's instance configuration. Some examples: - * * For single region instance configs, specify a single regional - * location KMS key. - * * For multi-regional instance configs of type GOOGLE_MANAGED, - * either specify a multi-regional location KMS key or multiple regional - * location KMS keys that cover all regions in the instance config. - * * For an instance config of type USER_MANAGED, please specify only - * regional location KMS keys to cover each region in the instance config. - * Multi-regional location KMS keys are not supported for USER_MANAGED - * instance configs. - * - * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getKmsKeyNames() - { - return $this->kms_key_names; - } - - /** - * Optional. Specifies the KMS configuration for the one or more keys used to - * protect the backup. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * The keys referenced by kms_key_names must fully cover all - * regions of the backup's instance configuration. Some examples: - * * For single region instance configs, specify a single regional - * location KMS key. - * * For multi-regional instance configs of type GOOGLE_MANAGED, - * either specify a multi-regional location KMS key or multiple regional - * location KMS keys that cover all regions in the instance config. - * * For an instance config of type USER_MANAGED, please specify only - * regional location KMS keys to cover each region in the instance config. - * Multi-regional location KMS keys are not supported for USER_MANAGED - * instance configs. - * - * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setKmsKeyNames($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->kms_key_names = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupEncryptionConfig/EncryptionType.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupEncryptionConfig/EncryptionType.php deleted file mode 100644 index be6e5fb5ea47..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupEncryptionConfig/EncryptionType.php +++ /dev/null @@ -1,77 +0,0 @@ -google.spanner.admin.database.v1.CreateBackupEncryptionConfig.EncryptionType - */ -class EncryptionType -{ - /** - * Unspecified. Do not use. - * - * Generated from protobuf enum ENCRYPTION_TYPE_UNSPECIFIED = 0; - */ - const ENCRYPTION_TYPE_UNSPECIFIED = 0; - /** - * Use the same encryption configuration as the database. This is the - * default option when - * [encryption_config][google.spanner.admin.database.v1.CreateBackupEncryptionConfig] - * is empty. For example, if the database is using - * `Customer_Managed_Encryption`, the backup will be using the same Cloud - * KMS key as the database. - * - * Generated from protobuf enum USE_DATABASE_ENCRYPTION = 1; - */ - const USE_DATABASE_ENCRYPTION = 1; - /** - * Use Google default encryption. - * - * Generated from protobuf enum GOOGLE_DEFAULT_ENCRYPTION = 2; - */ - const GOOGLE_DEFAULT_ENCRYPTION = 2; - /** - * Use customer managed encryption. If specified, `kms_key_name` - * must contain a valid Cloud KMS key. - * - * Generated from protobuf enum CUSTOMER_MANAGED_ENCRYPTION = 3; - */ - const CUSTOMER_MANAGED_ENCRYPTION = 3; - - private static $valueToName = [ - self::ENCRYPTION_TYPE_UNSPECIFIED => 'ENCRYPTION_TYPE_UNSPECIFIED', - self::USE_DATABASE_ENCRYPTION => 'USE_DATABASE_ENCRYPTION', - self::GOOGLE_DEFAULT_ENCRYPTION => 'GOOGLE_DEFAULT_ENCRYPTION', - self::CUSTOMER_MANAGED_ENCRYPTION => 'CUSTOMER_MANAGED_ENCRYPTION', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(EncryptionType::class, \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig_EncryptionType::class); - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupMetadata.php deleted file mode 100644 index 04df2f570b43..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupMetadata.php +++ /dev/null @@ -1,242 +0,0 @@ -google.spanner.admin.database.v1.CreateBackupMetadata - */ -class CreateBackupMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The name of the backup being created. - * - * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * The name of the database the backup is created from. - * - * Generated from protobuf field string database = 2 [(.google.api.resource_reference) = { - */ - protected $database = ''; - /** - * The progress of the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * operation. - * - * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 3; - */ - protected $progress = null; - /** - * The time at which cancellation of this operation was received. - * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] - * starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not guaranteed. - * Clients can use - * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an [Operation.error][google.longrunning.Operation.error] value with a - * [google.rpc.Status.code][google.rpc.Status.code] of 1, - * corresponding to `Code.CANCELLED`. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 4; - */ - protected $cancel_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * The name of the backup being created. - * @type string $database - * The name of the database the backup is created from. - * @type \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress $progress - * The progress of the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * operation. - * @type \Google\Protobuf\Timestamp $cancel_time - * The time at which cancellation of this operation was received. - * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] - * starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not guaranteed. - * Clients can use - * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an [Operation.error][google.longrunning.Operation.error] value with a - * [google.rpc.Status.code][google.rpc.Status.code] of 1, - * corresponding to `Code.CANCELLED`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); - parent::__construct($data); - } - - /** - * The name of the backup being created. - * - * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * The name of the backup being created. - * - * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The name of the database the backup is created from. - * - * Generated from protobuf field string database = 2 [(.google.api.resource_reference) = { - * @return string - */ - public function getDatabase() - { - return $this->database; - } - - /** - * The name of the database the backup is created from. - * - * Generated from protobuf field string database = 2 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setDatabase($var) - { - GPBUtil::checkString($var, True); - $this->database = $var; - - return $this; - } - - /** - * The progress of the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * operation. - * - * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 3; - * @return \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress|null - */ - public function getProgress() - { - return $this->progress; - } - - public function hasProgress() - { - return isset($this->progress); - } - - public function clearProgress() - { - unset($this->progress); - } - - /** - * The progress of the - * [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] - * operation. - * - * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 3; - * @param \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress $var - * @return $this - */ - public function setProgress($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress::class); - $this->progress = $var; - - return $this; - } - - /** - * The time at which cancellation of this operation was received. - * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] - * starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not guaranteed. - * Clients can use - * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an [Operation.error][google.longrunning.Operation.error] value with a - * [google.rpc.Status.code][google.rpc.Status.code] of 1, - * corresponding to `Code.CANCELLED`. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 4; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCancelTime() - { - return $this->cancel_time; - } - - public function hasCancelTime() - { - return isset($this->cancel_time); - } - - public function clearCancelTime() - { - unset($this->cancel_time); - } - - /** - * The time at which cancellation of this operation was received. - * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] - * starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not guaranteed. - * Clients can use - * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an [Operation.error][google.longrunning.Operation.error] value with a - * [google.rpc.Status.code][google.rpc.Status.code] of 1, - * corresponding to `Code.CANCELLED`. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 4; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCancelTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->cancel_time = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupRequest.php deleted file mode 100644 index 9c216c980f6f..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupRequest.php +++ /dev/null @@ -1,259 +0,0 @@ -google.spanner.admin.database.v1.CreateBackupRequest - */ -class CreateBackupRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the instance in which the backup will be - * created. This must be the same instance that contains the database the - * backup will be created from. The backup will be stored in the - * location(s) specified in the instance configuration of this - * instance. Values are of the form - * `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Required. The id of the backup to be created. The `backup_id` appended to - * `parent` forms the full backup name of the form - * `projects//instances//backups/`. - * - * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $backup_id = ''; - /** - * Required. The backup to create. - * - * Generated from protobuf field .google.spanner.admin.database.v1.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $backup = null; - /** - * Optional. The encryption configuration used to encrypt the backup. If this - * field is not specified, the backup will use the same encryption - * configuration as the database by default, namely - * [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type] - * = `USE_DATABASE_ENCRYPTION`. - * - * Generated from protobuf field .google.spanner.admin.database.v1.CreateBackupEncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $encryption_config = null; - - /** - * @param string $parent Required. The name of the instance in which the backup will be - * created. This must be the same instance that contains the database the - * backup will be created from. The backup will be stored in the - * location(s) specified in the instance configuration of this - * instance. Values are of the form - * `projects//instances/`. Please see - * {@see DatabaseAdminClient::instanceName()} for help formatting this field. - * @param \Google\Cloud\Spanner\Admin\Database\V1\Backup $backup Required. The backup to create. - * @param string $backupId Required. The id of the backup to be created. The `backup_id` appended to - * `parent` forms the full backup name of the form - * `projects//instances//backups/`. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupRequest - * - * @experimental - */ - public static function build(string $parent, \Google\Cloud\Spanner\Admin\Database\V1\Backup $backup, string $backupId): self - { - return (new self()) - ->setParent($parent) - ->setBackup($backup) - ->setBackupId($backupId); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The name of the instance in which the backup will be - * created. This must be the same instance that contains the database the - * backup will be created from. The backup will be stored in the - * location(s) specified in the instance configuration of this - * instance. Values are of the form - * `projects//instances/`. - * @type string $backup_id - * Required. The id of the backup to be created. The `backup_id` appended to - * `parent` forms the full backup name of the form - * `projects//instances//backups/`. - * @type \Google\Cloud\Spanner\Admin\Database\V1\Backup $backup - * Required. The backup to create. - * @type \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig $encryption_config - * Optional. The encryption configuration used to encrypt the backup. If this - * field is not specified, the backup will use the same encryption - * configuration as the database by default, namely - * [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type] - * = `USE_DATABASE_ENCRYPTION`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the instance in which the backup will be - * created. This must be the same instance that contains the database the - * backup will be created from. The backup will be stored in the - * location(s) specified in the instance configuration of this - * instance. Values are of the form - * `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The name of the instance in which the backup will be - * created. This must be the same instance that contains the database the - * backup will be created from. The backup will be stored in the - * location(s) specified in the instance configuration of this - * instance. Values are of the form - * `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Required. The id of the backup to be created. The `backup_id` appended to - * `parent` forms the full backup name of the form - * `projects//instances//backups/`. - * - * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getBackupId() - { - return $this->backup_id; - } - - /** - * Required. The id of the backup to be created. The `backup_id` appended to - * `parent` forms the full backup name of the form - * `projects//instances//backups/`. - * - * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setBackupId($var) - { - GPBUtil::checkString($var, True); - $this->backup_id = $var; - - return $this; - } - - /** - * Required. The backup to create. - * - * Generated from protobuf field .google.spanner.admin.database.v1.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\Admin\Database\V1\Backup|null - */ - public function getBackup() - { - return $this->backup; - } - - public function hasBackup() - { - return isset($this->backup); - } - - public function clearBackup() - { - unset($this->backup); - } - - /** - * Required. The backup to create. - * - * Generated from protobuf field .google.spanner.admin.database.v1.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\Admin\Database\V1\Backup $var - * @return $this - */ - public function setBackup($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\Backup::class); - $this->backup = $var; - - return $this; - } - - /** - * Optional. The encryption configuration used to encrypt the backup. If this - * field is not specified, the backup will use the same encryption - * configuration as the database by default, namely - * [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type] - * = `USE_DATABASE_ENCRYPTION`. - * - * Generated from protobuf field .google.spanner.admin.database.v1.CreateBackupEncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig|null - */ - public function getEncryptionConfig() - { - return $this->encryption_config; - } - - public function hasEncryptionConfig() - { - return isset($this->encryption_config); - } - - public function clearEncryptionConfig() - { - unset($this->encryption_config); - } - - /** - * Optional. The encryption configuration used to encrypt the backup. If this - * field is not specified, the backup will use the same encryption - * configuration as the database by default, namely - * [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type] - * = `USE_DATABASE_ENCRYPTION`. - * - * Generated from protobuf field .google.spanner.admin.database.v1.CreateBackupEncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig $var - * @return $this - */ - public function setEncryptionConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupEncryptionConfig::class); - $this->encryption_config = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupScheduleRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupScheduleRequest.php deleted file mode 100644 index 229fd26859de..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateBackupScheduleRequest.php +++ /dev/null @@ -1,174 +0,0 @@ -google.spanner.admin.database.v1.CreateBackupScheduleRequest - */ -class CreateBackupScheduleRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the database that this backup schedule applies to. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Required. The Id to use for the backup schedule. The `backup_schedule_id` - * appended to `parent` forms the full backup schedule name of the form - * `projects//instances//databases//backupSchedules/`. - * - * Generated from protobuf field string backup_schedule_id = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $backup_schedule_id = ''; - /** - * Required. The backup schedule to create. - * - * Generated from protobuf field .google.spanner.admin.database.v1.BackupSchedule backup_schedule = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $backup_schedule = null; - - /** - * @param string $parent Required. The name of the database that this backup schedule applies to. Please see - * {@see DatabaseAdminClient::databaseName()} for help formatting this field. - * @param \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule $backupSchedule Required. The backup schedule to create. - * @param string $backupScheduleId Required. The Id to use for the backup schedule. The `backup_schedule_id` - * appended to `parent` forms the full backup schedule name of the form - * `projects//instances//databases//backupSchedules/`. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\CreateBackupScheduleRequest - * - * @experimental - */ - public static function build(string $parent, \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule $backupSchedule, string $backupScheduleId): self - { - return (new self()) - ->setParent($parent) - ->setBackupSchedule($backupSchedule) - ->setBackupScheduleId($backupScheduleId); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The name of the database that this backup schedule applies to. - * @type string $backup_schedule_id - * Required. The Id to use for the backup schedule. The `backup_schedule_id` - * appended to `parent` forms the full backup schedule name of the form - * `projects//instances//databases//backupSchedules/`. - * @type \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule $backup_schedule - * Required. The backup schedule to create. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the database that this backup schedule applies to. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The name of the database that this backup schedule applies to. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Required. The Id to use for the backup schedule. The `backup_schedule_id` - * appended to `parent` forms the full backup schedule name of the form - * `projects//instances//databases//backupSchedules/`. - * - * Generated from protobuf field string backup_schedule_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getBackupScheduleId() - { - return $this->backup_schedule_id; - } - - /** - * Required. The Id to use for the backup schedule. The `backup_schedule_id` - * appended to `parent` forms the full backup schedule name of the form - * `projects//instances//databases//backupSchedules/`. - * - * Generated from protobuf field string backup_schedule_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setBackupScheduleId($var) - { - GPBUtil::checkString($var, True); - $this->backup_schedule_id = $var; - - return $this; - } - - /** - * Required. The backup schedule to create. - * - * Generated from protobuf field .google.spanner.admin.database.v1.BackupSchedule backup_schedule = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule|null - */ - public function getBackupSchedule() - { - return $this->backup_schedule; - } - - public function hasBackupSchedule() - { - return isset($this->backup_schedule); - } - - public function clearBackupSchedule() - { - unset($this->backup_schedule); - } - - /** - * Required. The backup schedule to create. - * - * Generated from protobuf field .google.spanner.admin.database.v1.BackupSchedule backup_schedule = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule $var - * @return $this - */ - public function setBackupSchedule($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule::class); - $this->backup_schedule = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateDatabaseMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateDatabaseMetadata.php deleted file mode 100644 index 15e141e01574..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateDatabaseMetadata.php +++ /dev/null @@ -1,68 +0,0 @@ -google.spanner.admin.database.v1.CreateDatabaseMetadata - */ -class CreateDatabaseMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The database being created. - * - * Generated from protobuf field string database = 1 [(.google.api.resource_reference) = { - */ - protected $database = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $database - * The database being created. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * The database being created. - * - * Generated from protobuf field string database = 1 [(.google.api.resource_reference) = { - * @return string - */ - public function getDatabase() - { - return $this->database; - } - - /** - * The database being created. - * - * Generated from protobuf field string database = 1 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setDatabase($var) - { - GPBUtil::checkString($var, True); - $this->database = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateDatabaseRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateDatabaseRequest.php deleted file mode 100644 index 52e40ad3836f..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CreateDatabaseRequest.php +++ /dev/null @@ -1,365 +0,0 @@ -google.spanner.admin.database.v1.CreateDatabaseRequest - */ -class CreateDatabaseRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the instance that will serve the new database. - * Values are of the form `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Required. A `CREATE DATABASE` statement, which specifies the ID of the - * new database. The database ID must conform to the regular expression - * `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length. - * If the database ID is a reserved word or if it contains a hyphen, the - * database ID must be enclosed in backticks (`` ` ``). - * - * Generated from protobuf field string create_statement = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $create_statement = ''; - /** - * Optional. A list of DDL statements to run inside the newly created - * database. Statements can create tables, indexes, etc. These - * statements execute atomically with the creation of the database: - * if there is an error in any statement, the database is not created. - * - * Generated from protobuf field repeated string extra_statements = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $extra_statements; - /** - * Optional. The encryption configuration for the database. If this field is - * not specified, Cloud Spanner will encrypt/decrypt all data at rest using - * Google default encryption. - * - * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $encryption_config = null; - /** - * Optional. The dialect of the Cloud Spanner Database. - * - * Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 5 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $database_dialect = 0; - /** - * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in - * 'extra_statements' above. - * Contains a protobuf-serialized - * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). - * To generate it, [install](https://grpc.io/docs/protoc-installation/) and - * run `protoc` with --include_imports and --descriptor_set_out. For example, - * to generate for moon/shot/app.proto, run - * ``` - * $protoc --proto_path=/app_path --proto_path=/lib_path \ - * --include_imports \ - * --descriptor_set_out=descriptors.data \ - * moon/shot/app.proto - * ``` - * For more details, see protobuffer [self - * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). - * - * Generated from protobuf field bytes proto_descriptors = 6 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $proto_descriptors = ''; - - /** - * @param string $parent Required. The name of the instance that will serve the new database. - * Values are of the form `projects//instances/`. Please see - * {@see DatabaseAdminClient::instanceName()} for help formatting this field. - * @param string $createStatement Required. A `CREATE DATABASE` statement, which specifies the ID of the - * new database. The database ID must conform to the regular expression - * `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length. - * If the database ID is a reserved word or if it contains a hyphen, the - * database ID must be enclosed in backticks (`` ` ``). - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\CreateDatabaseRequest - * - * @experimental - */ - public static function build(string $parent, string $createStatement): self - { - return (new self()) - ->setParent($parent) - ->setCreateStatement($createStatement); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The name of the instance that will serve the new database. - * Values are of the form `projects//instances/`. - * @type string $create_statement - * Required. A `CREATE DATABASE` statement, which specifies the ID of the - * new database. The database ID must conform to the regular expression - * `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length. - * If the database ID is a reserved word or if it contains a hyphen, the - * database ID must be enclosed in backticks (`` ` ``). - * @type array|\Google\Protobuf\Internal\RepeatedField $extra_statements - * Optional. A list of DDL statements to run inside the newly created - * database. Statements can create tables, indexes, etc. These - * statements execute atomically with the creation of the database: - * if there is an error in any statement, the database is not created. - * @type \Google\Cloud\Spanner\Admin\Database\V1\EncryptionConfig $encryption_config - * Optional. The encryption configuration for the database. If this field is - * not specified, Cloud Spanner will encrypt/decrypt all data at rest using - * Google default encryption. - * @type int $database_dialect - * Optional. The dialect of the Cloud Spanner Database. - * @type string $proto_descriptors - * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in - * 'extra_statements' above. - * Contains a protobuf-serialized - * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). - * To generate it, [install](https://grpc.io/docs/protoc-installation/) and - * run `protoc` with --include_imports and --descriptor_set_out. For example, - * to generate for moon/shot/app.proto, run - * ``` - * $protoc --proto_path=/app_path --proto_path=/lib_path \ - * --include_imports \ - * --descriptor_set_out=descriptors.data \ - * moon/shot/app.proto - * ``` - * For more details, see protobuffer [self - * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the instance that will serve the new database. - * Values are of the form `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The name of the instance that will serve the new database. - * Values are of the form `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Required. A `CREATE DATABASE` statement, which specifies the ID of the - * new database. The database ID must conform to the regular expression - * `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length. - * If the database ID is a reserved word or if it contains a hyphen, the - * database ID must be enclosed in backticks (`` ` ``). - * - * Generated from protobuf field string create_statement = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getCreateStatement() - { - return $this->create_statement; - } - - /** - * Required. A `CREATE DATABASE` statement, which specifies the ID of the - * new database. The database ID must conform to the regular expression - * `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length. - * If the database ID is a reserved word or if it contains a hyphen, the - * database ID must be enclosed in backticks (`` ` ``). - * - * Generated from protobuf field string create_statement = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setCreateStatement($var) - { - GPBUtil::checkString($var, True); - $this->create_statement = $var; - - return $this; - } - - /** - * Optional. A list of DDL statements to run inside the newly created - * database. Statements can create tables, indexes, etc. These - * statements execute atomically with the creation of the database: - * if there is an error in any statement, the database is not created. - * - * Generated from protobuf field repeated string extra_statements = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getExtraStatements() - { - return $this->extra_statements; - } - - /** - * Optional. A list of DDL statements to run inside the newly created - * database. Statements can create tables, indexes, etc. These - * statements execute atomically with the creation of the database: - * if there is an error in any statement, the database is not created. - * - * Generated from protobuf field repeated string extra_statements = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setExtraStatements($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->extra_statements = $arr; - - return $this; - } - - /** - * Optional. The encryption configuration for the database. If this field is - * not specified, Cloud Spanner will encrypt/decrypt all data at rest using - * Google default encryption. - * - * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\Spanner\Admin\Database\V1\EncryptionConfig|null - */ - public function getEncryptionConfig() - { - return $this->encryption_config; - } - - public function hasEncryptionConfig() - { - return isset($this->encryption_config); - } - - public function clearEncryptionConfig() - { - unset($this->encryption_config); - } - - /** - * Optional. The encryption configuration for the database. If this field is - * not specified, Cloud Spanner will encrypt/decrypt all data at rest using - * Google default encryption. - * - * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\Spanner\Admin\Database\V1\EncryptionConfig $var - * @return $this - */ - public function setEncryptionConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\EncryptionConfig::class); - $this->encryption_config = $var; - - return $this; - } - - /** - * Optional. The dialect of the Cloud Spanner Database. - * - * Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getDatabaseDialect() - { - return $this->database_dialect; - } - - /** - * Optional. The dialect of the Cloud Spanner Database. - * - * Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setDatabaseDialect($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\DatabaseDialect::class); - $this->database_dialect = $var; - - return $this; - } - - /** - * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in - * 'extra_statements' above. - * Contains a protobuf-serialized - * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). - * To generate it, [install](https://grpc.io/docs/protoc-installation/) and - * run `protoc` with --include_imports and --descriptor_set_out. For example, - * to generate for moon/shot/app.proto, run - * ``` - * $protoc --proto_path=/app_path --proto_path=/lib_path \ - * --include_imports \ - * --descriptor_set_out=descriptors.data \ - * moon/shot/app.proto - * ``` - * For more details, see protobuffer [self - * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). - * - * Generated from protobuf field bytes proto_descriptors = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getProtoDescriptors() - { - return $this->proto_descriptors; - } - - /** - * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in - * 'extra_statements' above. - * Contains a protobuf-serialized - * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). - * To generate it, [install](https://grpc.io/docs/protoc-installation/) and - * run `protoc` with --include_imports and --descriptor_set_out. For example, - * to generate for moon/shot/app.proto, run - * ``` - * $protoc --proto_path=/app_path --proto_path=/lib_path \ - * --include_imports \ - * --descriptor_set_out=descriptors.data \ - * moon/shot/app.proto - * ``` - * For more details, see protobuffer [self - * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). - * - * Generated from protobuf field bytes proto_descriptors = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setProtoDescriptors($var) - { - GPBUtil::checkString($var, False); - $this->proto_descriptors = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CrontabSpec.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CrontabSpec.php deleted file mode 100644 index ba03270160ca..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/CrontabSpec.php +++ /dev/null @@ -1,214 +0,0 @@ -google.spanner.admin.database.v1.CrontabSpec - */ -class CrontabSpec extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Textual representation of the crontab. User can customize the - * backup frequency and the backup version time using the cron - * expression. The version time must be in UTC timzeone. - * The backup will contain an externally consistent copy of the - * database at the version time. Allowed frequencies are 12 hour, 1 day, - * 1 week and 1 month. Examples of valid cron specifications: - * * `0 2/12 * * * ` : every 12 hours at (2, 14) hours past midnight in UTC. - * * `0 2,14 * * * ` : every 12 hours at (2,14) hours past midnight in UTC. - * * `0 2 * * * ` : once a day at 2 past midnight in UTC. - * * `0 2 * * 0 ` : once a week every Sunday at 2 past midnight in UTC. - * * `0 2 8 * * ` : once a month on 8th day at 2 past midnight in UTC. - * - * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $text = ''; - /** - * Output only. The time zone of the times in `CrontabSpec.text`. Currently - * only UTC is supported. - * - * Generated from protobuf field string time_zone = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $time_zone = ''; - /** - * Output only. Schedule backups will contain an externally consistent copy - * of the database at the version time specified in - * `schedule_spec.cron_spec`. However, Spanner may not initiate the creation - * of the scheduled backups at that version time. Spanner will initiate - * the creation of scheduled backups within the time window bounded by the - * version_time specified in `schedule_spec.cron_spec` and version_time + - * `creation_window`. - * - * Generated from protobuf field .google.protobuf.Duration creation_window = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $creation_window = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $text - * Required. Textual representation of the crontab. User can customize the - * backup frequency and the backup version time using the cron - * expression. The version time must be in UTC timzeone. - * The backup will contain an externally consistent copy of the - * database at the version time. Allowed frequencies are 12 hour, 1 day, - * 1 week and 1 month. Examples of valid cron specifications: - * * `0 2/12 * * * ` : every 12 hours at (2, 14) hours past midnight in UTC. - * * `0 2,14 * * * ` : every 12 hours at (2,14) hours past midnight in UTC. - * * `0 2 * * * ` : once a day at 2 past midnight in UTC. - * * `0 2 * * 0 ` : once a week every Sunday at 2 past midnight in UTC. - * * `0 2 8 * * ` : once a month on 8th day at 2 past midnight in UTC. - * @type string $time_zone - * Output only. The time zone of the times in `CrontabSpec.text`. Currently - * only UTC is supported. - * @type \Google\Protobuf\Duration $creation_window - * Output only. Schedule backups will contain an externally consistent copy - * of the database at the version time specified in - * `schedule_spec.cron_spec`. However, Spanner may not initiate the creation - * of the scheduled backups at that version time. Spanner will initiate - * the creation of scheduled backups within the time window bounded by the - * version_time specified in `schedule_spec.cron_spec` and version_time + - * `creation_window`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); - parent::__construct($data); - } - - /** - * Required. Textual representation of the crontab. User can customize the - * backup frequency and the backup version time using the cron - * expression. The version time must be in UTC timzeone. - * The backup will contain an externally consistent copy of the - * database at the version time. Allowed frequencies are 12 hour, 1 day, - * 1 week and 1 month. Examples of valid cron specifications: - * * `0 2/12 * * * ` : every 12 hours at (2, 14) hours past midnight in UTC. - * * `0 2,14 * * * ` : every 12 hours at (2,14) hours past midnight in UTC. - * * `0 2 * * * ` : once a day at 2 past midnight in UTC. - * * `0 2 * * 0 ` : once a week every Sunday at 2 past midnight in UTC. - * * `0 2 8 * * ` : once a month on 8th day at 2 past midnight in UTC. - * - * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getText() - { - return $this->text; - } - - /** - * Required. Textual representation of the crontab. User can customize the - * backup frequency and the backup version time using the cron - * expression. The version time must be in UTC timzeone. - * The backup will contain an externally consistent copy of the - * database at the version time. Allowed frequencies are 12 hour, 1 day, - * 1 week and 1 month. Examples of valid cron specifications: - * * `0 2/12 * * * ` : every 12 hours at (2, 14) hours past midnight in UTC. - * * `0 2,14 * * * ` : every 12 hours at (2,14) hours past midnight in UTC. - * * `0 2 * * * ` : once a day at 2 past midnight in UTC. - * * `0 2 * * 0 ` : once a week every Sunday at 2 past midnight in UTC. - * * `0 2 8 * * ` : once a month on 8th day at 2 past midnight in UTC. - * - * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setText($var) - { - GPBUtil::checkString($var, True); - $this->text = $var; - - return $this; - } - - /** - * Output only. The time zone of the times in `CrontabSpec.text`. Currently - * only UTC is supported. - * - * Generated from protobuf field string time_zone = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getTimeZone() - { - return $this->time_zone; - } - - /** - * Output only. The time zone of the times in `CrontabSpec.text`. Currently - * only UTC is supported. - * - * Generated from protobuf field string time_zone = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setTimeZone($var) - { - GPBUtil::checkString($var, True); - $this->time_zone = $var; - - return $this; - } - - /** - * Output only. Schedule backups will contain an externally consistent copy - * of the database at the version time specified in - * `schedule_spec.cron_spec`. However, Spanner may not initiate the creation - * of the scheduled backups at that version time. Spanner will initiate - * the creation of scheduled backups within the time window bounded by the - * version_time specified in `schedule_spec.cron_spec` and version_time + - * `creation_window`. - * - * Generated from protobuf field .google.protobuf.Duration creation_window = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Duration|null - */ - public function getCreationWindow() - { - return $this->creation_window; - } - - public function hasCreationWindow() - { - return isset($this->creation_window); - } - - public function clearCreationWindow() - { - unset($this->creation_window); - } - - /** - * Output only. Schedule backups will contain an externally consistent copy - * of the database at the version time specified in - * `schedule_spec.cron_spec`. However, Spanner may not initiate the creation - * of the scheduled backups at that version time. Spanner will initiate - * the creation of scheduled backups within the time window bounded by the - * version_time specified in `schedule_spec.cron_spec` and version_time + - * `creation_window`. - * - * Generated from protobuf field .google.protobuf.Duration creation_window = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Duration $var - * @return $this - */ - public function setCreationWindow($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); - $this->creation_window = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Database.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Database.php deleted file mode 100644 index 7116c55f5d1a..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Database.php +++ /dev/null @@ -1,605 +0,0 @@ -google.spanner.admin.database.v1.Database - */ -class Database extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the database. Values are of the form - * `projects//instances//databases/`, - * where `` is as specified in the `CREATE DATABASE` - * statement. This name can be passed to other API methods to - * identify the database. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - /** - * Output only. The current database state. - * - * Generated from protobuf field .google.spanner.admin.database.v1.Database.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $state = 0; - /** - * Output only. If exists, the time at which the database creation started. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $create_time = null; - /** - * Output only. Applicable only for restored databases. Contains information - * about the restore source. - * - * Generated from protobuf field .google.spanner.admin.database.v1.RestoreInfo restore_info = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $restore_info = null; - /** - * Output only. For databases that are using customer managed encryption, this - * field contains the encryption configuration for the database. - * For databases that are using Google default or other types of encryption, - * this field is empty. - * - * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $encryption_config = null; - /** - * Output only. For databases that are using customer managed encryption, this - * field contains the encryption information for the database, such as - * all Cloud KMS key versions that are in use. The `encryption_status' field - * inside of each `EncryptionInfo` is not populated. - * For databases that are using Google default or other types of encryption, - * this field is empty. - * This field is propagated lazily from the backend. There might be a delay - * from when a key version is being used and when it appears in this field. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.EncryptionInfo encryption_info = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $encryption_info; - /** - * Output only. The period in which Cloud Spanner retains all versions of data - * for the database. This is the same as the value of version_retention_period - * database option set using - * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]. - * Defaults to 1 hour, if not set. - * - * Generated from protobuf field string version_retention_period = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $version_retention_period = ''; - /** - * Output only. Earliest timestamp at which older versions of the data can be - * read. This value is continuously updated by Cloud Spanner and becomes stale - * the moment it is queried. If you are using this value to recover data, make - * sure to account for the time from the moment when the value is queried to - * the moment when you initiate the recovery. - * - * Generated from protobuf field .google.protobuf.Timestamp earliest_version_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $earliest_version_time = null; - /** - * Output only. The read-write region which contains the database's leader - * replicas. - * This is the same as the value of default_leader - * database option set using DatabaseAdmin.CreateDatabase or - * DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty. - * - * Generated from protobuf field string default_leader = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $default_leader = ''; - /** - * Output only. The dialect of the Cloud Spanner Database. - * - * Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $database_dialect = 0; - /** - * Whether drop protection is enabled for this database. Defaults to false, - * if not set. For more details, please see how to [prevent accidental - * database - * deletion](https://cloud.google.com/spanner/docs/prevent-database-deletion). - * - * Generated from protobuf field bool enable_drop_protection = 11; - */ - protected $enable_drop_protection = false; - /** - * Output only. If true, the database is being updated. If false, there are no - * ongoing update operations for the database. - * - * Generated from protobuf field bool reconciling = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $reconciling = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the database. Values are of the form - * `projects//instances//databases/`, - * where `` is as specified in the `CREATE DATABASE` - * statement. This name can be passed to other API methods to - * identify the database. - * @type int $state - * Output only. The current database state. - * @type \Google\Protobuf\Timestamp $create_time - * Output only. If exists, the time at which the database creation started. - * @type \Google\Cloud\Spanner\Admin\Database\V1\RestoreInfo $restore_info - * Output only. Applicable only for restored databases. Contains information - * about the restore source. - * @type \Google\Cloud\Spanner\Admin\Database\V1\EncryptionConfig $encryption_config - * Output only. For databases that are using customer managed encryption, this - * field contains the encryption configuration for the database. - * For databases that are using Google default or other types of encryption, - * this field is empty. - * @type array<\Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo>|\Google\Protobuf\Internal\RepeatedField $encryption_info - * Output only. For databases that are using customer managed encryption, this - * field contains the encryption information for the database, such as - * all Cloud KMS key versions that are in use. The `encryption_status' field - * inside of each `EncryptionInfo` is not populated. - * For databases that are using Google default or other types of encryption, - * this field is empty. - * This field is propagated lazily from the backend. There might be a delay - * from when a key version is being used and when it appears in this field. - * @type string $version_retention_period - * Output only. The period in which Cloud Spanner retains all versions of data - * for the database. This is the same as the value of version_retention_period - * database option set using - * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]. - * Defaults to 1 hour, if not set. - * @type \Google\Protobuf\Timestamp $earliest_version_time - * Output only. Earliest timestamp at which older versions of the data can be - * read. This value is continuously updated by Cloud Spanner and becomes stale - * the moment it is queried. If you are using this value to recover data, make - * sure to account for the time from the moment when the value is queried to - * the moment when you initiate the recovery. - * @type string $default_leader - * Output only. The read-write region which contains the database's leader - * replicas. - * This is the same as the value of default_leader - * database option set using DatabaseAdmin.CreateDatabase or - * DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty. - * @type int $database_dialect - * Output only. The dialect of the Cloud Spanner Database. - * @type bool $enable_drop_protection - * Whether drop protection is enabled for this database. Defaults to false, - * if not set. For more details, please see how to [prevent accidental - * database - * deletion](https://cloud.google.com/spanner/docs/prevent-database-deletion). - * @type bool $reconciling - * Output only. If true, the database is being updated. If false, there are no - * ongoing update operations for the database. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the database. Values are of the form - * `projects//instances//databases/`, - * where `` is as specified in the `CREATE DATABASE` - * statement. This name can be passed to other API methods to - * identify the database. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The name of the database. Values are of the form - * `projects//instances//databases/`, - * where `` is as specified in the `CREATE DATABASE` - * statement. This name can be passed to other API methods to - * identify the database. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Output only. The current database state. - * - * Generated from protobuf field .google.spanner.admin.database.v1.Database.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * Output only. The current database state. - * - * Generated from protobuf field .google.spanner.admin.database.v1.Database.State state = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\Database\State::class); - $this->state = $var; - - return $this; - } - - /** - * Output only. If exists, the time at which the database creation started. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCreateTime() - { - return $this->create_time; - } - - public function hasCreateTime() - { - return isset($this->create_time); - } - - public function clearCreateTime() - { - unset($this->create_time); - } - - /** - * Output only. If exists, the time at which the database creation started. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCreateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->create_time = $var; - - return $this; - } - - /** - * Output only. Applicable only for restored databases. Contains information - * about the restore source. - * - * Generated from protobuf field .google.spanner.admin.database.v1.RestoreInfo restore_info = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Cloud\Spanner\Admin\Database\V1\RestoreInfo|null - */ - public function getRestoreInfo() - { - return $this->restore_info; - } - - public function hasRestoreInfo() - { - return isset($this->restore_info); - } - - public function clearRestoreInfo() - { - unset($this->restore_info); - } - - /** - * Output only. Applicable only for restored databases. Contains information - * about the restore source. - * - * Generated from protobuf field .google.spanner.admin.database.v1.RestoreInfo restore_info = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Cloud\Spanner\Admin\Database\V1\RestoreInfo $var - * @return $this - */ - public function setRestoreInfo($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\RestoreInfo::class); - $this->restore_info = $var; - - return $this; - } - - /** - * Output only. For databases that are using customer managed encryption, this - * field contains the encryption configuration for the database. - * For databases that are using Google default or other types of encryption, - * this field is empty. - * - * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Cloud\Spanner\Admin\Database\V1\EncryptionConfig|null - */ - public function getEncryptionConfig() - { - return $this->encryption_config; - } - - public function hasEncryptionConfig() - { - return isset($this->encryption_config); - } - - public function clearEncryptionConfig() - { - unset($this->encryption_config); - } - - /** - * Output only. For databases that are using customer managed encryption, this - * field contains the encryption configuration for the database. - * For databases that are using Google default or other types of encryption, - * this field is empty. - * - * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionConfig encryption_config = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Cloud\Spanner\Admin\Database\V1\EncryptionConfig $var - * @return $this - */ - public function setEncryptionConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\EncryptionConfig::class); - $this->encryption_config = $var; - - return $this; - } - - /** - * Output only. For databases that are using customer managed encryption, this - * field contains the encryption information for the database, such as - * all Cloud KMS key versions that are in use. The `encryption_status' field - * inside of each `EncryptionInfo` is not populated. - * For databases that are using Google default or other types of encryption, - * this field is empty. - * This field is propagated lazily from the backend. There might be a delay - * from when a key version is being used and when it appears in this field. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.EncryptionInfo encryption_info = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getEncryptionInfo() - { - return $this->encryption_info; - } - - /** - * Output only. For databases that are using customer managed encryption, this - * field contains the encryption information for the database, such as - * all Cloud KMS key versions that are in use. The `encryption_status' field - * inside of each `EncryptionInfo` is not populated. - * For databases that are using Google default or other types of encryption, - * this field is empty. - * This field is propagated lazily from the backend. There might be a delay - * from when a key version is being used and when it appears in this field. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.EncryptionInfo encryption_info = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param array<\Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setEncryptionInfo($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo::class); - $this->encryption_info = $arr; - - return $this; - } - - /** - * Output only. The period in which Cloud Spanner retains all versions of data - * for the database. This is the same as the value of version_retention_period - * database option set using - * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]. - * Defaults to 1 hour, if not set. - * - * Generated from protobuf field string version_retention_period = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getVersionRetentionPeriod() - { - return $this->version_retention_period; - } - - /** - * Output only. The period in which Cloud Spanner retains all versions of data - * for the database. This is the same as the value of version_retention_period - * database option set using - * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]. - * Defaults to 1 hour, if not set. - * - * Generated from protobuf field string version_retention_period = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setVersionRetentionPeriod($var) - { - GPBUtil::checkString($var, True); - $this->version_retention_period = $var; - - return $this; - } - - /** - * Output only. Earliest timestamp at which older versions of the data can be - * read. This value is continuously updated by Cloud Spanner and becomes stale - * the moment it is queried. If you are using this value to recover data, make - * sure to account for the time from the moment when the value is queried to - * the moment when you initiate the recovery. - * - * Generated from protobuf field .google.protobuf.Timestamp earliest_version_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getEarliestVersionTime() - { - return $this->earliest_version_time; - } - - public function hasEarliestVersionTime() - { - return isset($this->earliest_version_time); - } - - public function clearEarliestVersionTime() - { - unset($this->earliest_version_time); - } - - /** - * Output only. Earliest timestamp at which older versions of the data can be - * read. This value is continuously updated by Cloud Spanner and becomes stale - * the moment it is queried. If you are using this value to recover data, make - * sure to account for the time from the moment when the value is queried to - * the moment when you initiate the recovery. - * - * Generated from protobuf field .google.protobuf.Timestamp earliest_version_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setEarliestVersionTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->earliest_version_time = $var; - - return $this; - } - - /** - * Output only. The read-write region which contains the database's leader - * replicas. - * This is the same as the value of default_leader - * database option set using DatabaseAdmin.CreateDatabase or - * DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty. - * - * Generated from protobuf field string default_leader = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getDefaultLeader() - { - return $this->default_leader; - } - - /** - * Output only. The read-write region which contains the database's leader - * replicas. - * This is the same as the value of default_leader - * database option set using DatabaseAdmin.CreateDatabase or - * DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty. - * - * Generated from protobuf field string default_leader = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setDefaultLeader($var) - { - GPBUtil::checkString($var, True); - $this->default_leader = $var; - - return $this; - } - - /** - * Output only. The dialect of the Cloud Spanner Database. - * - * Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getDatabaseDialect() - { - return $this->database_dialect; - } - - /** - * Output only. The dialect of the Cloud Spanner Database. - * - * Generated from protobuf field .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setDatabaseDialect($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\DatabaseDialect::class); - $this->database_dialect = $var; - - return $this; - } - - /** - * Whether drop protection is enabled for this database. Defaults to false, - * if not set. For more details, please see how to [prevent accidental - * database - * deletion](https://cloud.google.com/spanner/docs/prevent-database-deletion). - * - * Generated from protobuf field bool enable_drop_protection = 11; - * @return bool - */ - public function getEnableDropProtection() - { - return $this->enable_drop_protection; - } - - /** - * Whether drop protection is enabled for this database. Defaults to false, - * if not set. For more details, please see how to [prevent accidental - * database - * deletion](https://cloud.google.com/spanner/docs/prevent-database-deletion). - * - * Generated from protobuf field bool enable_drop_protection = 11; - * @param bool $var - * @return $this - */ - public function setEnableDropProtection($var) - { - GPBUtil::checkBool($var); - $this->enable_drop_protection = $var; - - return $this; - } - - /** - * Output only. If true, the database is being updated. If false, there are no - * ongoing update operations for the database. - * - * Generated from protobuf field bool reconciling = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return bool - */ - public function getReconciling() - { - return $this->reconciling; - } - - /** - * Output only. If true, the database is being updated. If false, there are no - * ongoing update operations for the database. - * - * Generated from protobuf field bool reconciling = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param bool $var - * @return $this - */ - public function setReconciling($var) - { - GPBUtil::checkBool($var); - $this->reconciling = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Database/State.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Database/State.php deleted file mode 100644 index 92c56529fbad..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Database/State.php +++ /dev/null @@ -1,78 +0,0 @@ -google.spanner.admin.database.v1.Database.State - */ -class State -{ - /** - * Not specified. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * The database is still being created. Operations on the database may fail - * with `FAILED_PRECONDITION` in this state. - * - * Generated from protobuf enum CREATING = 1; - */ - const CREATING = 1; - /** - * The database is fully created and ready for use. - * - * Generated from protobuf enum READY = 2; - */ - const READY = 2; - /** - * The database is fully created and ready for use, but is still - * being optimized for performance and cannot handle full load. - * In this state, the database still references the backup - * it was restore from, preventing the backup - * from being deleted. When optimizations are complete, the full performance - * of the database will be restored, and the database will transition to - * `READY` state. - * - * Generated from protobuf enum READY_OPTIMIZING = 3; - */ - const READY_OPTIMIZING = 3; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::CREATING => 'CREATING', - self::READY => 'READY', - self::READY_OPTIMIZING => 'READY_OPTIMIZING', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(State::class, \Google\Cloud\Spanner\Admin\Database\V1\Database_State::class); - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DatabaseDialect.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DatabaseDialect.php deleted file mode 100644 index ed173031894b..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DatabaseDialect.php +++ /dev/null @@ -1,62 +0,0 @@ -google.spanner.admin.database.v1.DatabaseDialect - */ -class DatabaseDialect -{ - /** - * Default value. This value will create a database with the - * GOOGLE_STANDARD_SQL dialect. - * - * Generated from protobuf enum DATABASE_DIALECT_UNSPECIFIED = 0; - */ - const DATABASE_DIALECT_UNSPECIFIED = 0; - /** - * GoogleSQL supported SQL. - * - * Generated from protobuf enum GOOGLE_STANDARD_SQL = 1; - */ - const GOOGLE_STANDARD_SQL = 1; - /** - * PostgreSQL supported SQL. - * - * Generated from protobuf enum POSTGRESQL = 2; - */ - const POSTGRESQL = 2; - - private static $valueToName = [ - self::DATABASE_DIALECT_UNSPECIFIED => 'DATABASE_DIALECT_UNSPECIFIED', - self::GOOGLE_STANDARD_SQL => 'GOOGLE_STANDARD_SQL', - self::POSTGRESQL => 'POSTGRESQL', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DatabaseRole.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DatabaseRole.php deleted file mode 100644 index f34003461bac..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DatabaseRole.php +++ /dev/null @@ -1,75 +0,0 @@ -google.spanner.admin.database.v1.DatabaseRole - */ -class DatabaseRole extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the database role. Values are of the form - * `projects//instances//databases//databaseRoles/` - * where `` is as specified in the `CREATE ROLE` DDL statement. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the database role. Values are of the form - * `projects//instances//databases//databaseRoles/` - * where `` is as specified in the `CREATE ROLE` DDL statement. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the database role. Values are of the form - * `projects//instances//databases//databaseRoles/` - * where `` is as specified in the `CREATE ROLE` DDL statement. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The name of the database role. Values are of the form - * `projects//instances//databases//databaseRoles/` - * where `` is as specified in the `CREATE ROLE` DDL statement. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DdlStatementActionInfo.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DdlStatementActionInfo.php deleted file mode 100644 index 10cae9737db2..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DdlStatementActionInfo.php +++ /dev/null @@ -1,165 +0,0 @@ -google.spanner.admin.database.v1.DdlStatementActionInfo - */ -class DdlStatementActionInfo extends \Google\Protobuf\Internal\Message -{ - /** - * The action for the DDL statement, e.g. CREATE, ALTER, DROP, GRANT, etc. - * This field is a non-empty string. - * - * Generated from protobuf field string action = 1; - */ - protected $action = ''; - /** - * The entity type for the DDL statement, e.g. TABLE, INDEX, VIEW, etc. - * This field can be empty string for some DDL statement, - * e.g. for statement "ANALYZE", `entity_type` = "". - * - * Generated from protobuf field string entity_type = 2; - */ - protected $entity_type = ''; - /** - * The entity name(s) being operated on the DDL statement. - * E.g. - * 1. For statement "CREATE TABLE t1(...)", `entity_names` = ["t1"]. - * 2. For statement "GRANT ROLE r1, r2 ...", `entity_names` = ["r1", "r2"]. - * 3. For statement "ANALYZE", `entity_names` = []. - * - * Generated from protobuf field repeated string entity_names = 3; - */ - private $entity_names; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $action - * The action for the DDL statement, e.g. CREATE, ALTER, DROP, GRANT, etc. - * This field is a non-empty string. - * @type string $entity_type - * The entity type for the DDL statement, e.g. TABLE, INDEX, VIEW, etc. - * This field can be empty string for some DDL statement, - * e.g. for statement "ANALYZE", `entity_type` = "". - * @type array|\Google\Protobuf\Internal\RepeatedField $entity_names - * The entity name(s) being operated on the DDL statement. - * E.g. - * 1. For statement "CREATE TABLE t1(...)", `entity_names` = ["t1"]. - * 2. For statement "GRANT ROLE r1, r2 ...", `entity_names` = ["r1", "r2"]. - * 3. For statement "ANALYZE", `entity_names` = []. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * The action for the DDL statement, e.g. CREATE, ALTER, DROP, GRANT, etc. - * This field is a non-empty string. - * - * Generated from protobuf field string action = 1; - * @return string - */ - public function getAction() - { - return $this->action; - } - - /** - * The action for the DDL statement, e.g. CREATE, ALTER, DROP, GRANT, etc. - * This field is a non-empty string. - * - * Generated from protobuf field string action = 1; - * @param string $var - * @return $this - */ - public function setAction($var) - { - GPBUtil::checkString($var, True); - $this->action = $var; - - return $this; - } - - /** - * The entity type for the DDL statement, e.g. TABLE, INDEX, VIEW, etc. - * This field can be empty string for some DDL statement, - * e.g. for statement "ANALYZE", `entity_type` = "". - * - * Generated from protobuf field string entity_type = 2; - * @return string - */ - public function getEntityType() - { - return $this->entity_type; - } - - /** - * The entity type for the DDL statement, e.g. TABLE, INDEX, VIEW, etc. - * This field can be empty string for some DDL statement, - * e.g. for statement "ANALYZE", `entity_type` = "". - * - * Generated from protobuf field string entity_type = 2; - * @param string $var - * @return $this - */ - public function setEntityType($var) - { - GPBUtil::checkString($var, True); - $this->entity_type = $var; - - return $this; - } - - /** - * The entity name(s) being operated on the DDL statement. - * E.g. - * 1. For statement "CREATE TABLE t1(...)", `entity_names` = ["t1"]. - * 2. For statement "GRANT ROLE r1, r2 ...", `entity_names` = ["r1", "r2"]. - * 3. For statement "ANALYZE", `entity_names` = []. - * - * Generated from protobuf field repeated string entity_names = 3; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getEntityNames() - { - return $this->entity_names; - } - - /** - * The entity name(s) being operated on the DDL statement. - * E.g. - * 1. For statement "CREATE TABLE t1(...)", `entity_names` = ["t1"]. - * 2. For statement "GRANT ROLE r1, r2 ...", `entity_names` = ["r1", "r2"]. - * 3. For statement "ANALYZE", `entity_names` = []. - * - * Generated from protobuf field repeated string entity_names = 3; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setEntityNames($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->entity_names = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DeleteBackupRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DeleteBackupRequest.php deleted file mode 100644 index a2418220b700..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DeleteBackupRequest.php +++ /dev/null @@ -1,92 +0,0 @@ -google.spanner.admin.database.v1.DeleteBackupRequest - */ -class DeleteBackupRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Name of the backup to delete. - * Values are of the form - * `projects//instances//backups/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - - /** - * @param string $name Required. Name of the backup to delete. - * Values are of the form - * `projects//instances//backups/`. Please see - * {@see DatabaseAdminClient::backupName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\DeleteBackupRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Name of the backup to delete. - * Values are of the form - * `projects//instances//backups/`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); - parent::__construct($data); - } - - /** - * Required. Name of the backup to delete. - * Values are of the form - * `projects//instances//backups/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. Name of the backup to delete. - * Values are of the form - * `projects//instances//backups/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DeleteBackupScheduleRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DeleteBackupScheduleRequest.php deleted file mode 100644 index 34083030de53..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DeleteBackupScheduleRequest.php +++ /dev/null @@ -1,92 +0,0 @@ -google.spanner.admin.database.v1.DeleteBackupScheduleRequest - */ -class DeleteBackupScheduleRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the schedule to delete. - * Values are of the form - * `projects//instances//databases//backupSchedules/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - - /** - * @param string $name Required. The name of the schedule to delete. - * Values are of the form - * `projects//instances//databases//backupSchedules/`. Please see - * {@see DatabaseAdminClient::backupScheduleName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\DeleteBackupScheduleRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the schedule to delete. - * Values are of the form - * `projects//instances//databases//backupSchedules/`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the schedule to delete. - * Values are of the form - * `projects//instances//databases//backupSchedules/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The name of the schedule to delete. - * Values are of the form - * `projects//instances//databases//backupSchedules/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DropDatabaseRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DropDatabaseRequest.php deleted file mode 100644 index 29d92fc6d153..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/DropDatabaseRequest.php +++ /dev/null @@ -1,82 +0,0 @@ -google.spanner.admin.database.v1.DropDatabaseRequest - */ -class DropDatabaseRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The database to be dropped. - * - * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $database = ''; - - /** - * @param string $database Required. The database to be dropped. Please see - * {@see DatabaseAdminClient::databaseName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\DropDatabaseRequest - * - * @experimental - */ - public static function build(string $database): self - { - return (new self()) - ->setDatabase($database); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $database - * Required. The database to be dropped. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The database to be dropped. - * - * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getDatabase() - { - return $this->database; - } - - /** - * Required. The database to be dropped. - * - * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setDatabase($var) - { - GPBUtil::checkString($var, True); - $this->database = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionConfig.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionConfig.php deleted file mode 100644 index c0bc45190b62..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionConfig.php +++ /dev/null @@ -1,161 +0,0 @@ -google.spanner.admin.database.v1.EncryptionConfig - */ -class EncryptionConfig extends \Google\Protobuf\Internal\Message -{ - /** - * The Cloud KMS key to be used for encrypting and decrypting - * the database. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { - */ - protected $kms_key_name = ''; - /** - * Specifies the KMS configuration for the one or more keys used to encrypt - * the database. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * The keys referenced by kms_key_names must fully cover all - * regions of the database instance configuration. Some examples: - * * For single region database instance configs, specify a single regional - * location KMS key. - * * For multi-regional database instance configs of type GOOGLE_MANAGED, - * either specify a multi-regional location KMS key or multiple regional - * location KMS keys that cover all regions in the instance config. - * * For a database instance config of type USER_MANAGED, please specify only - * regional location KMS keys to cover each region in the instance config. - * Multi-regional location KMS keys are not supported for USER_MANAGED - * instance configs. - * - * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.resource_reference) = { - */ - private $kms_key_names; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $kms_key_name - * The Cloud KMS key to be used for encrypting and decrypting - * the database. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * @type array|\Google\Protobuf\Internal\RepeatedField $kms_key_names - * Specifies the KMS configuration for the one or more keys used to encrypt - * the database. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * The keys referenced by kms_key_names must fully cover all - * regions of the database instance configuration. Some examples: - * * For single region database instance configs, specify a single regional - * location KMS key. - * * For multi-regional database instance configs of type GOOGLE_MANAGED, - * either specify a multi-regional location KMS key or multiple regional - * location KMS keys that cover all regions in the instance config. - * * For a database instance config of type USER_MANAGED, please specify only - * regional location KMS keys to cover each region in the instance config. - * Multi-regional location KMS keys are not supported for USER_MANAGED - * instance configs. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\Common::initOnce(); - parent::__construct($data); - } - - /** - * The Cloud KMS key to be used for encrypting and decrypting - * the database. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { - * @return string - */ - public function getKmsKeyName() - { - return $this->kms_key_name; - } - - /** - * The Cloud KMS key to be used for encrypting and decrypting - * the database. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setKmsKeyName($var) - { - GPBUtil::checkString($var, True); - $this->kms_key_name = $var; - - return $this; - } - - /** - * Specifies the KMS configuration for the one or more keys used to encrypt - * the database. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * The keys referenced by kms_key_names must fully cover all - * regions of the database instance configuration. Some examples: - * * For single region database instance configs, specify a single regional - * location KMS key. - * * For multi-regional database instance configs of type GOOGLE_MANAGED, - * either specify a multi-regional location KMS key or multiple regional - * location KMS keys that cover all regions in the instance config. - * * For a database instance config of type USER_MANAGED, please specify only - * regional location KMS keys to cover each region in the instance config. - * Multi-regional location KMS keys are not supported for USER_MANAGED - * instance configs. - * - * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.resource_reference) = { - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getKmsKeyNames() - { - return $this->kms_key_names; - } - - /** - * Specifies the KMS configuration for the one or more keys used to encrypt - * the database. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * The keys referenced by kms_key_names must fully cover all - * regions of the database instance configuration. Some examples: - * * For single region database instance configs, specify a single regional - * location KMS key. - * * For multi-regional database instance configs of type GOOGLE_MANAGED, - * either specify a multi-regional location KMS key or multiple regional - * location KMS keys that cover all regions in the instance config. - * * For a database instance config of type USER_MANAGED, please specify only - * regional location KMS keys to cover each region in the instance config. - * Multi-regional location KMS keys are not supported for USER_MANAGED - * instance configs. - * - * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.resource_reference) = { - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setKmsKeyNames($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->kms_key_names = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionInfo.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionInfo.php deleted file mode 100644 index 960ada451ae8..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionInfo.php +++ /dev/null @@ -1,157 +0,0 @@ -google.spanner.admin.database.v1.EncryptionInfo - */ -class EncryptionInfo extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. The type of encryption. - * - * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionInfo.Type encryption_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $encryption_type = 0; - /** - * Output only. If present, the status of a recent encrypt/decrypt call on - * underlying data for this database or backup. Regardless of status, data is - * always encrypted at rest. - * - * Generated from protobuf field .google.rpc.Status encryption_status = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $encryption_status = null; - /** - * Output only. A Cloud KMS key version that is being used to protect the - * database or backup. - * - * Generated from protobuf field string kms_key_version = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - */ - protected $kms_key_version = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $encryption_type - * Output only. The type of encryption. - * @type \Google\Rpc\Status $encryption_status - * Output only. If present, the status of a recent encrypt/decrypt call on - * underlying data for this database or backup. Regardless of status, data is - * always encrypted at rest. - * @type string $kms_key_version - * Output only. A Cloud KMS key version that is being used to protect the - * database or backup. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\Common::initOnce(); - parent::__construct($data); - } - - /** - * Output only. The type of encryption. - * - * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionInfo.Type encryption_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getEncryptionType() - { - return $this->encryption_type; - } - - /** - * Output only. The type of encryption. - * - * Generated from protobuf field .google.spanner.admin.database.v1.EncryptionInfo.Type encryption_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setEncryptionType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo\Type::class); - $this->encryption_type = $var; - - return $this; - } - - /** - * Output only. If present, the status of a recent encrypt/decrypt call on - * underlying data for this database or backup. Regardless of status, data is - * always encrypted at rest. - * - * Generated from protobuf field .google.rpc.Status encryption_status = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Rpc\Status|null - */ - public function getEncryptionStatus() - { - return $this->encryption_status; - } - - public function hasEncryptionStatus() - { - return isset($this->encryption_status); - } - - public function clearEncryptionStatus() - { - unset($this->encryption_status); - } - - /** - * Output only. If present, the status of a recent encrypt/decrypt call on - * underlying data for this database or backup. Regardless of status, data is - * always encrypted at rest. - * - * Generated from protobuf field .google.rpc.Status encryption_status = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Rpc\Status $var - * @return $this - */ - public function setEncryptionStatus($var) - { - GPBUtil::checkMessage($var, \Google\Rpc\Status::class); - $this->encryption_status = $var; - - return $this; - } - - /** - * Output only. A Cloud KMS key version that is being used to protect the - * database or backup. - * - * Generated from protobuf field string kms_key_version = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - * @return string - */ - public function getKmsKeyVersion() - { - return $this->kms_key_version; - } - - /** - * Output only. A Cloud KMS key version that is being used to protect the - * database or backup. - * - * Generated from protobuf field string kms_key_version = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setKmsKeyVersion($var) - { - GPBUtil::checkString($var, True); - $this->kms_key_version = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionInfo/Type.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionInfo/Type.php deleted file mode 100644 index d54274fba026..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/EncryptionInfo/Type.php +++ /dev/null @@ -1,68 +0,0 @@ -google.spanner.admin.database.v1.EncryptionInfo.Type - */ -class Type -{ - /** - * Encryption type was not specified, though data at rest remains encrypted. - * - * Generated from protobuf enum TYPE_UNSPECIFIED = 0; - */ - const TYPE_UNSPECIFIED = 0; - /** - * The data is encrypted at rest with a key that is - * fully managed by Google. No key version or status will be populated. - * This is the default state. - * - * Generated from protobuf enum GOOGLE_DEFAULT_ENCRYPTION = 1; - */ - const GOOGLE_DEFAULT_ENCRYPTION = 1; - /** - * The data is encrypted at rest with a key that is - * managed by the customer. The active version of the key. `kms_key_version` - * will be populated, and `encryption_status` may be populated. - * - * Generated from protobuf enum CUSTOMER_MANAGED_ENCRYPTION = 2; - */ - const CUSTOMER_MANAGED_ENCRYPTION = 2; - - private static $valueToName = [ - self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', - self::GOOGLE_DEFAULT_ENCRYPTION => 'GOOGLE_DEFAULT_ENCRYPTION', - self::CUSTOMER_MANAGED_ENCRYPTION => 'CUSTOMER_MANAGED_ENCRYPTION', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Type::class, \Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo_Type::class); - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/FullBackupSpec.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/FullBackupSpec.php deleted file mode 100644 index 3edbb8d4fd2b..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/FullBackupSpec.php +++ /dev/null @@ -1,35 +0,0 @@ -google.spanner.admin.database.v1.FullBackupSpec - */ -class FullBackupSpec extends \Google\Protobuf\Internal\Message -{ - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); - parent::__construct($data); - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetBackupRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetBackupRequest.php deleted file mode 100644 index 442d207b6386..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetBackupRequest.php +++ /dev/null @@ -1,92 +0,0 @@ -google.spanner.admin.database.v1.GetBackupRequest - */ -class GetBackupRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Name of the backup. - * Values are of the form - * `projects//instances//backups/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - - /** - * @param string $name Required. Name of the backup. - * Values are of the form - * `projects//instances//backups/`. Please see - * {@see DatabaseAdminClient::backupName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\GetBackupRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Name of the backup. - * Values are of the form - * `projects//instances//backups/`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); - parent::__construct($data); - } - - /** - * Required. Name of the backup. - * Values are of the form - * `projects//instances//backups/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. Name of the backup. - * Values are of the form - * `projects//instances//backups/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetBackupScheduleRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetBackupScheduleRequest.php deleted file mode 100644 index 75b5f8400005..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetBackupScheduleRequest.php +++ /dev/null @@ -1,92 +0,0 @@ -google.spanner.admin.database.v1.GetBackupScheduleRequest - */ -class GetBackupScheduleRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the schedule to retrieve. - * Values are of the form - * `projects//instances//databases//backupSchedules/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - - /** - * @param string $name Required. The name of the schedule to retrieve. - * Values are of the form - * `projects//instances//databases//backupSchedules/`. Please see - * {@see DatabaseAdminClient::backupScheduleName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\GetBackupScheduleRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the schedule to retrieve. - * Values are of the form - * `projects//instances//databases//backupSchedules/`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the schedule to retrieve. - * Values are of the form - * `projects//instances//databases//backupSchedules/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The name of the schedule to retrieve. - * Values are of the form - * `projects//instances//databases//backupSchedules/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseDdlRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseDdlRequest.php deleted file mode 100644 index 6e955af72d1a..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseDdlRequest.php +++ /dev/null @@ -1,92 +0,0 @@ -google.spanner.admin.database.v1.GetDatabaseDdlRequest - */ -class GetDatabaseDdlRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The database whose schema we wish to get. - * Values are of the form - * `projects//instances//databases/` - * - * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $database = ''; - - /** - * @param string $database Required. The database whose schema we wish to get. - * Values are of the form - * `projects//instances//databases/` - * Please see {@see DatabaseAdminClient::databaseName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\GetDatabaseDdlRequest - * - * @experimental - */ - public static function build(string $database): self - { - return (new self()) - ->setDatabase($database); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $database - * Required. The database whose schema we wish to get. - * Values are of the form - * `projects//instances//databases/` - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The database whose schema we wish to get. - * Values are of the form - * `projects//instances//databases/` - * - * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getDatabase() - { - return $this->database; - } - - /** - * Required. The database whose schema we wish to get. - * Values are of the form - * `projects//instances//databases/` - * - * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setDatabase($var) - { - GPBUtil::checkString($var, True); - $this->database = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseDdlResponse.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseDdlResponse.php deleted file mode 100644 index a190d7f20b13..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseDdlResponse.php +++ /dev/null @@ -1,122 +0,0 @@ -google.spanner.admin.database.v1.GetDatabaseDdlResponse - */ -class GetDatabaseDdlResponse extends \Google\Protobuf\Internal\Message -{ - /** - * A list of formatted DDL statements defining the schema of the database - * specified in the request. - * - * Generated from protobuf field repeated string statements = 1; - */ - private $statements; - /** - * Proto descriptors stored in the database. - * Contains a protobuf-serialized - * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). - * For more details, see protobuffer [self - * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). - * - * Generated from protobuf field bytes proto_descriptors = 2; - */ - protected $proto_descriptors = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array|\Google\Protobuf\Internal\RepeatedField $statements - * A list of formatted DDL statements defining the schema of the database - * specified in the request. - * @type string $proto_descriptors - * Proto descriptors stored in the database. - * Contains a protobuf-serialized - * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). - * For more details, see protobuffer [self - * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * A list of formatted DDL statements defining the schema of the database - * specified in the request. - * - * Generated from protobuf field repeated string statements = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getStatements() - { - return $this->statements; - } - - /** - * A list of formatted DDL statements defining the schema of the database - * specified in the request. - * - * Generated from protobuf field repeated string statements = 1; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setStatements($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->statements = $arr; - - return $this; - } - - /** - * Proto descriptors stored in the database. - * Contains a protobuf-serialized - * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). - * For more details, see protobuffer [self - * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). - * - * Generated from protobuf field bytes proto_descriptors = 2; - * @return string - */ - public function getProtoDescriptors() - { - return $this->proto_descriptors; - } - - /** - * Proto descriptors stored in the database. - * Contains a protobuf-serialized - * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). - * For more details, see protobuffer [self - * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). - * - * Generated from protobuf field bytes proto_descriptors = 2; - * @param string $var - * @return $this - */ - public function setProtoDescriptors($var) - { - GPBUtil::checkString($var, False); - $this->proto_descriptors = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseRequest.php deleted file mode 100644 index bacc542101f3..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/GetDatabaseRequest.php +++ /dev/null @@ -1,87 +0,0 @@ -google.spanner.admin.database.v1.GetDatabaseRequest - */ -class GetDatabaseRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the requested database. Values are of the form - * `projects//instances//databases/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - - /** - * @param string $name Required. The name of the requested database. Values are of the form - * `projects//instances//databases/`. Please see - * {@see DatabaseAdminClient::databaseName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\GetDatabaseRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the requested database. Values are of the form - * `projects//instances//databases/`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the requested database. Values are of the form - * `projects//instances//databases/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The name of the requested database. Values are of the form - * `projects//instances//databases/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/IncrementalBackupSpec.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/IncrementalBackupSpec.php deleted file mode 100644 index 8db0cd8de770..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/IncrementalBackupSpec.php +++ /dev/null @@ -1,38 +0,0 @@ -google.spanner.admin.database.v1.IncrementalBackupSpec - */ -class IncrementalBackupSpec extends \Google\Protobuf\Internal\Message -{ - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); - parent::__construct($data); - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupOperationsRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupOperationsRequest.php deleted file mode 100644 index c12ea71b9f7e..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupOperationsRequest.php +++ /dev/null @@ -1,461 +0,0 @@ -google.spanner.admin.database.v1.ListBackupOperationsRequest - */ -class ListBackupOperationsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The instance of the backup operations. Values are of - * the form `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * An expression that filters the list of returned backup operations. - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the [operation][google.longrunning.Operation] - * are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] - * is - * `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic, but - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ - * `metadata.database:prod` - Returns operations where: - * * The operation's metadata type is - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. - * * The source database name of backup contains the string "prod". - * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ - * `(metadata.name:howl) AND` \ - * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Returns operations where: - * * The operation's metadata type is - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. - * * The backup name contains the string "howl". - * * The operation started before 2018-03-28T14:50:00Z. - * * The operation resulted in an error. - * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \ - * `(metadata.source_backup:test) AND` \ - * `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \ - * `(error:*)` - Returns operations where: - * * The operation's metadata type is - * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. - * * The source backup name contains the string "test". - * * The operation started before 2022-01-18T14:50:00Z. - * * The operation resulted in an error. - * * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ - * `(metadata.database:test_db)) OR` \ - * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) - * AND` \ - * `(metadata.source_backup:test_bkp)) AND` \ - * `(error:*)` - Returns operations where: - * * The operation's metadata matches either of criteria: - * * The operation's metadata type is - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] - * AND the source database name of the backup contains the string - * "test_db" - * * The operation's metadata type is - * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata] - * AND the source backup name contains the string "test_bkp" - * * The operation resulted in an error. - * - * Generated from protobuf field string filter = 2; - */ - protected $filter = ''; - /** - * Number of operations to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 3; - */ - protected $page_size = 0; - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListBackupOperationsResponse.next_page_token] - * from a previous - * [ListBackupOperationsResponse][google.spanner.admin.database.v1.ListBackupOperationsResponse] - * to the same `parent` and with the same `filter`. - * - * Generated from protobuf field string page_token = 4; - */ - protected $page_token = ''; - - /** - * @param string $parent Required. The instance of the backup operations. Values are of - * the form `projects//instances/`. Please see - * {@see DatabaseAdminClient::instanceName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\ListBackupOperationsRequest - * - * @experimental - */ - public static function build(string $parent): self - { - return (new self()) - ->setParent($parent); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The instance of the backup operations. Values are of - * the form `projects//instances/`. - * @type string $filter - * An expression that filters the list of returned backup operations. - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the [operation][google.longrunning.Operation] - * are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] - * is - * `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic, but - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ - * `metadata.database:prod` - Returns operations where: - * * The operation's metadata type is - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. - * * The source database name of backup contains the string "prod". - * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ - * `(metadata.name:howl) AND` \ - * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Returns operations where: - * * The operation's metadata type is - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. - * * The backup name contains the string "howl". - * * The operation started before 2018-03-28T14:50:00Z. - * * The operation resulted in an error. - * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \ - * `(metadata.source_backup:test) AND` \ - * `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \ - * `(error:*)` - Returns operations where: - * * The operation's metadata type is - * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. - * * The source backup name contains the string "test". - * * The operation started before 2022-01-18T14:50:00Z. - * * The operation resulted in an error. - * * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ - * `(metadata.database:test_db)) OR` \ - * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) - * AND` \ - * `(metadata.source_backup:test_bkp)) AND` \ - * `(error:*)` - Returns operations where: - * * The operation's metadata matches either of criteria: - * * The operation's metadata type is - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] - * AND the source database name of the backup contains the string - * "test_db" - * * The operation's metadata type is - * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata] - * AND the source backup name contains the string "test_bkp" - * * The operation resulted in an error. - * @type int $page_size - * Number of operations to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * @type string $page_token - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListBackupOperationsResponse.next_page_token] - * from a previous - * [ListBackupOperationsResponse][google.spanner.admin.database.v1.ListBackupOperationsResponse] - * to the same `parent` and with the same `filter`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); - parent::__construct($data); - } - - /** - * Required. The instance of the backup operations. Values are of - * the form `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The instance of the backup operations. Values are of - * the form `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * An expression that filters the list of returned backup operations. - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the [operation][google.longrunning.Operation] - * are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] - * is - * `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic, but - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ - * `metadata.database:prod` - Returns operations where: - * * The operation's metadata type is - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. - * * The source database name of backup contains the string "prod". - * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ - * `(metadata.name:howl) AND` \ - * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Returns operations where: - * * The operation's metadata type is - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. - * * The backup name contains the string "howl". - * * The operation started before 2018-03-28T14:50:00Z. - * * The operation resulted in an error. - * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \ - * `(metadata.source_backup:test) AND` \ - * `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \ - * `(error:*)` - Returns operations where: - * * The operation's metadata type is - * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. - * * The source backup name contains the string "test". - * * The operation started before 2022-01-18T14:50:00Z. - * * The operation resulted in an error. - * * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ - * `(metadata.database:test_db)) OR` \ - * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) - * AND` \ - * `(metadata.source_backup:test_bkp)) AND` \ - * `(error:*)` - Returns operations where: - * * The operation's metadata matches either of criteria: - * * The operation's metadata type is - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] - * AND the source database name of the backup contains the string - * "test_db" - * * The operation's metadata type is - * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata] - * AND the source backup name contains the string "test_bkp" - * * The operation resulted in an error. - * - * Generated from protobuf field string filter = 2; - * @return string - */ - public function getFilter() - { - return $this->filter; - } - - /** - * An expression that filters the list of returned backup operations. - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the [operation][google.longrunning.Operation] - * are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] - * is - * `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic, but - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ - * `metadata.database:prod` - Returns operations where: - * * The operation's metadata type is - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. - * * The source database name of backup contains the string "prod". - * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ - * `(metadata.name:howl) AND` \ - * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Returns operations where: - * * The operation's metadata type is - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. - * * The backup name contains the string "howl". - * * The operation started before 2018-03-28T14:50:00Z. - * * The operation resulted in an error. - * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \ - * `(metadata.source_backup:test) AND` \ - * `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \ - * `(error:*)` - Returns operations where: - * * The operation's metadata type is - * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. - * * The source backup name contains the string "test". - * * The operation started before 2022-01-18T14:50:00Z. - * * The operation resulted in an error. - * * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ - * `(metadata.database:test_db)) OR` \ - * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) - * AND` \ - * `(metadata.source_backup:test_bkp)) AND` \ - * `(error:*)` - Returns operations where: - * * The operation's metadata matches either of criteria: - * * The operation's metadata type is - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] - * AND the source database name of the backup contains the string - * "test_db" - * * The operation's metadata type is - * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata] - * AND the source backup name contains the string "test_bkp" - * * The operation resulted in an error. - * - * Generated from protobuf field string filter = 2; - * @param string $var - * @return $this - */ - public function setFilter($var) - { - GPBUtil::checkString($var, True); - $this->filter = $var; - - return $this; - } - - /** - * Number of operations to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 3; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Number of operations to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 3; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListBackupOperationsResponse.next_page_token] - * from a previous - * [ListBackupOperationsResponse][google.spanner.admin.database.v1.ListBackupOperationsResponse] - * to the same `parent` and with the same `filter`. - * - * Generated from protobuf field string page_token = 4; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListBackupOperationsResponse.next_page_token] - * from a previous - * [ListBackupOperationsResponse][google.spanner.admin.database.v1.ListBackupOperationsResponse] - * to the same `parent` and with the same `filter`. - * - * Generated from protobuf field string page_token = 4; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupOperationsResponse.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupOperationsResponse.php deleted file mode 100644 index 145888a176cd..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupOperationsResponse.php +++ /dev/null @@ -1,142 +0,0 @@ -google.spanner.admin.database.v1.ListBackupOperationsResponse - */ -class ListBackupOperationsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The list of matching backup [long-running - * operations][google.longrunning.Operation]. Each operation's name will be - * prefixed by the backup's name. The operation's - * [metadata][google.longrunning.Operation.metadata] field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that are pending or have completed/failed/canceled within the - * last 7 days. Operations returned are ordered by - * `operation.metadata.value.progress.start_time` in descending order starting - * from the most recently started operation. - * - * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; - */ - private $operations; - /** - * `next_page_token` can be sent in a subsequent - * [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations] - * call to fetch more of the matching metadata. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\LongRunning\Operation>|\Google\Protobuf\Internal\RepeatedField $operations - * The list of matching backup [long-running - * operations][google.longrunning.Operation]. Each operation's name will be - * prefixed by the backup's name. The operation's - * [metadata][google.longrunning.Operation.metadata] field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that are pending or have completed/failed/canceled within the - * last 7 days. Operations returned are ordered by - * `operation.metadata.value.progress.start_time` in descending order starting - * from the most recently started operation. - * @type string $next_page_token - * `next_page_token` can be sent in a subsequent - * [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations] - * call to fetch more of the matching metadata. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); - parent::__construct($data); - } - - /** - * The list of matching backup [long-running - * operations][google.longrunning.Operation]. Each operation's name will be - * prefixed by the backup's name. The operation's - * [metadata][google.longrunning.Operation.metadata] field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that are pending or have completed/failed/canceled within the - * last 7 days. Operations returned are ordered by - * `operation.metadata.value.progress.start_time` in descending order starting - * from the most recently started operation. - * - * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getOperations() - { - return $this->operations; - } - - /** - * The list of matching backup [long-running - * operations][google.longrunning.Operation]. Each operation's name will be - * prefixed by the backup's name. The operation's - * [metadata][google.longrunning.Operation.metadata] field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that are pending or have completed/failed/canceled within the - * last 7 days. Operations returned are ordered by - * `operation.metadata.value.progress.start_time` in descending order starting - * from the most recently started operation. - * - * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; - * @param array<\Google\LongRunning\Operation>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setOperations($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\LongRunning\Operation::class); - $this->operations = $arr; - - return $this; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations] - * call to fetch more of the matching metadata. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations] - * call to fetch more of the matching metadata. - * - * Generated from protobuf field string next_page_token = 2; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupSchedulesRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupSchedulesRequest.php deleted file mode 100644 index 01af05ece7c9..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupSchedulesRequest.php +++ /dev/null @@ -1,180 +0,0 @@ -google.spanner.admin.database.v1.ListBackupSchedulesRequest - */ -class ListBackupSchedulesRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Database is the parent resource whose backup schedules should be - * listed. Values are of the form - * projects//instances//databases/ - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Optional. Number of backup schedules to be returned in the response. If 0 - * or less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $page_size = 0; - /** - * Optional. If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token] - * from a previous - * [ListBackupSchedulesResponse][google.spanner.admin.database.v1.ListBackupSchedulesResponse] - * to the same `parent`. - * - * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $page_token = ''; - - /** - * @param string $parent Required. Database is the parent resource whose backup schedules should be - * listed. Values are of the form - * projects//instances//databases/ - * Please see {@see DatabaseAdminClient::databaseName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\ListBackupSchedulesRequest - * - * @experimental - */ - public static function build(string $parent): self - { - return (new self()) - ->setParent($parent); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. Database is the parent resource whose backup schedules should be - * listed. Values are of the form - * projects//instances//databases/ - * @type int $page_size - * Optional. Number of backup schedules to be returned in the response. If 0 - * or less, defaults to the server's maximum allowed page size. - * @type string $page_token - * Optional. If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token] - * from a previous - * [ListBackupSchedulesResponse][google.spanner.admin.database.v1.ListBackupSchedulesResponse] - * to the same `parent`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); - parent::__construct($data); - } - - /** - * Required. Database is the parent resource whose backup schedules should be - * listed. Values are of the form - * projects//instances//databases/ - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. Database is the parent resource whose backup schedules should be - * listed. Values are of the form - * projects//instances//databases/ - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Optional. Number of backup schedules to be returned in the response. If 0 - * or less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Optional. Number of backup schedules to be returned in the response. If 0 - * or less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * Optional. If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token] - * from a previous - * [ListBackupSchedulesResponse][google.spanner.admin.database.v1.ListBackupSchedulesResponse] - * to the same `parent`. - * - * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * Optional. If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token] - * from a previous - * [ListBackupSchedulesResponse][google.spanner.admin.database.v1.ListBackupSchedulesResponse] - * to the same `parent`. - * - * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupSchedulesResponse.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupSchedulesResponse.php deleted file mode 100644 index 412a6c3800a9..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupSchedulesResponse.php +++ /dev/null @@ -1,110 +0,0 @@ -google.spanner.admin.database.v1.ListBackupSchedulesResponse - */ -class ListBackupSchedulesResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The list of backup schedules for a database. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.BackupSchedule backup_schedules = 1; - */ - private $backup_schedules; - /** - * `next_page_token` can be sent in a subsequent - * [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules] - * call to fetch more of the schedules. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule>|\Google\Protobuf\Internal\RepeatedField $backup_schedules - * The list of backup schedules for a database. - * @type string $next_page_token - * `next_page_token` can be sent in a subsequent - * [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules] - * call to fetch more of the schedules. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); - parent::__construct($data); - } - - /** - * The list of backup schedules for a database. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.BackupSchedule backup_schedules = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getBackupSchedules() - { - return $this->backup_schedules; - } - - /** - * The list of backup schedules for a database. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.BackupSchedule backup_schedules = 1; - * @param array<\Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setBackupSchedules($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule::class); - $this->backup_schedules = $arr; - - return $this; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules] - * call to fetch more of the schedules. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListBackupSchedules][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupSchedules] - * call to fetch more of the schedules. - * - * Generated from protobuf field string next_page_token = 2; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupsRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupsRequest.php deleted file mode 100644 index cdcfabb13d44..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupsRequest.php +++ /dev/null @@ -1,341 +0,0 @@ -google.spanner.admin.database.v1.ListBackupsRequest - */ -class ListBackupsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The instance to list backups from. Values are of the - * form `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * An expression that filters the list of returned backups. - * A filter expression consists of a field name, a comparison operator, and a - * value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the - * [Backup][google.spanner.admin.database.v1.Backup] are eligible for - * filtering: - * * `name` - * * `database` - * * `state` - * * `create_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `size_bytes` - * * `backup_schedules` - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic, but - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `name:Howl` - The backup's name contains the string "howl". - * * `database:prod` - * - The database's name contains the string "prod". - * * `state:CREATING` - The backup is pending creation. - * * `state:READY` - The backup is fully created and ready for use. - * * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")` - * - The backup name contains the string "howl" and `create_time` - * of the backup is before 2018-03-28T14:50:00Z. - * * `expire_time < \"2018-03-28T14:50:00Z\"` - * - The backup `expire_time` is before 2018-03-28T14:50:00Z. - * * `size_bytes > 10000000000` - The backup's size is greater than 10GB - * * `backup_schedules:daily` - * - The backup is created from a schedule with "daily" in its name. - * - * Generated from protobuf field string filter = 2; - */ - protected $filter = ''; - /** - * Number of backups to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 3; - */ - protected $page_size = 0; - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListBackupsResponse.next_page_token] - * from a previous - * [ListBackupsResponse][google.spanner.admin.database.v1.ListBackupsResponse] - * to the same `parent` and with the same `filter`. - * - * Generated from protobuf field string page_token = 4; - */ - protected $page_token = ''; - - /** - * @param string $parent Required. The instance to list backups from. Values are of the - * form `projects//instances/`. Please see - * {@see DatabaseAdminClient::instanceName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\ListBackupsRequest - * - * @experimental - */ - public static function build(string $parent): self - { - return (new self()) - ->setParent($parent); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The instance to list backups from. Values are of the - * form `projects//instances/`. - * @type string $filter - * An expression that filters the list of returned backups. - * A filter expression consists of a field name, a comparison operator, and a - * value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the - * [Backup][google.spanner.admin.database.v1.Backup] are eligible for - * filtering: - * * `name` - * * `database` - * * `state` - * * `create_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `size_bytes` - * * `backup_schedules` - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic, but - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `name:Howl` - The backup's name contains the string "howl". - * * `database:prod` - * - The database's name contains the string "prod". - * * `state:CREATING` - The backup is pending creation. - * * `state:READY` - The backup is fully created and ready for use. - * * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")` - * - The backup name contains the string "howl" and `create_time` - * of the backup is before 2018-03-28T14:50:00Z. - * * `expire_time < \"2018-03-28T14:50:00Z\"` - * - The backup `expire_time` is before 2018-03-28T14:50:00Z. - * * `size_bytes > 10000000000` - The backup's size is greater than 10GB - * * `backup_schedules:daily` - * - The backup is created from a schedule with "daily" in its name. - * @type int $page_size - * Number of backups to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * @type string $page_token - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListBackupsResponse.next_page_token] - * from a previous - * [ListBackupsResponse][google.spanner.admin.database.v1.ListBackupsResponse] - * to the same `parent` and with the same `filter`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); - parent::__construct($data); - } - - /** - * Required. The instance to list backups from. Values are of the - * form `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The instance to list backups from. Values are of the - * form `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * An expression that filters the list of returned backups. - * A filter expression consists of a field name, a comparison operator, and a - * value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the - * [Backup][google.spanner.admin.database.v1.Backup] are eligible for - * filtering: - * * `name` - * * `database` - * * `state` - * * `create_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `size_bytes` - * * `backup_schedules` - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic, but - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `name:Howl` - The backup's name contains the string "howl". - * * `database:prod` - * - The database's name contains the string "prod". - * * `state:CREATING` - The backup is pending creation. - * * `state:READY` - The backup is fully created and ready for use. - * * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")` - * - The backup name contains the string "howl" and `create_time` - * of the backup is before 2018-03-28T14:50:00Z. - * * `expire_time < \"2018-03-28T14:50:00Z\"` - * - The backup `expire_time` is before 2018-03-28T14:50:00Z. - * * `size_bytes > 10000000000` - The backup's size is greater than 10GB - * * `backup_schedules:daily` - * - The backup is created from a schedule with "daily" in its name. - * - * Generated from protobuf field string filter = 2; - * @return string - */ - public function getFilter() - { - return $this->filter; - } - - /** - * An expression that filters the list of returned backups. - * A filter expression consists of a field name, a comparison operator, and a - * value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the - * [Backup][google.spanner.admin.database.v1.Backup] are eligible for - * filtering: - * * `name` - * * `database` - * * `state` - * * `create_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `size_bytes` - * * `backup_schedules` - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic, but - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `name:Howl` - The backup's name contains the string "howl". - * * `database:prod` - * - The database's name contains the string "prod". - * * `state:CREATING` - The backup is pending creation. - * * `state:READY` - The backup is fully created and ready for use. - * * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")` - * - The backup name contains the string "howl" and `create_time` - * of the backup is before 2018-03-28T14:50:00Z. - * * `expire_time < \"2018-03-28T14:50:00Z\"` - * - The backup `expire_time` is before 2018-03-28T14:50:00Z. - * * `size_bytes > 10000000000` - The backup's size is greater than 10GB - * * `backup_schedules:daily` - * - The backup is created from a schedule with "daily" in its name. - * - * Generated from protobuf field string filter = 2; - * @param string $var - * @return $this - */ - public function setFilter($var) - { - GPBUtil::checkString($var, True); - $this->filter = $var; - - return $this; - } - - /** - * Number of backups to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 3; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Number of backups to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 3; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListBackupsResponse.next_page_token] - * from a previous - * [ListBackupsResponse][google.spanner.admin.database.v1.ListBackupsResponse] - * to the same `parent` and with the same `filter`. - * - * Generated from protobuf field string page_token = 4; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListBackupsResponse.next_page_token] - * from a previous - * [ListBackupsResponse][google.spanner.admin.database.v1.ListBackupsResponse] - * to the same `parent` and with the same `filter`. - * - * Generated from protobuf field string page_token = 4; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupsResponse.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupsResponse.php deleted file mode 100644 index 97493b3614f1..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupsResponse.php +++ /dev/null @@ -1,114 +0,0 @@ -google.spanner.admin.database.v1.ListBackupsResponse - */ -class ListBackupsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The list of matching backups. Backups returned are ordered by `create_time` - * in descending order, starting from the most recent `create_time`. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.Backup backups = 1; - */ - private $backups; - /** - * `next_page_token` can be sent in a subsequent - * [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups] - * call to fetch more of the matching backups. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Spanner\Admin\Database\V1\Backup>|\Google\Protobuf\Internal\RepeatedField $backups - * The list of matching backups. Backups returned are ordered by `create_time` - * in descending order, starting from the most recent `create_time`. - * @type string $next_page_token - * `next_page_token` can be sent in a subsequent - * [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups] - * call to fetch more of the matching backups. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); - parent::__construct($data); - } - - /** - * The list of matching backups. Backups returned are ordered by `create_time` - * in descending order, starting from the most recent `create_time`. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.Backup backups = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getBackups() - { - return $this->backups; - } - - /** - * The list of matching backups. Backups returned are ordered by `create_time` - * in descending order, starting from the most recent `create_time`. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.Backup backups = 1; - * @param array<\Google\Cloud\Spanner\Admin\Database\V1\Backup>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setBackups($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Database\V1\Backup::class); - $this->backups = $arr; - - return $this; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups] - * call to fetch more of the matching backups. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups] - * call to fetch more of the matching backups. - * - * Generated from protobuf field string next_page_token = 2; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseOperationsRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseOperationsRequest.php deleted file mode 100644 index b080b3ec6f4c..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseOperationsRequest.php +++ /dev/null @@ -1,361 +0,0 @@ -google.spanner.admin.database.v1.ListDatabaseOperationsRequest - */ -class ListDatabaseOperationsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The instance of the database operations. - * Values are of the form `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * An expression that filters the list of returned operations. - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the [Operation][google.longrunning.Operation] - * are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata] - * is - * `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \ - * `(metadata.source_type:BACKUP) AND` \ - * `(metadata.backup_info.backup:backup_howl) AND` \ - * `(metadata.name:restored_howl) AND` \ - * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. - * * The database is restored from a backup. - * * The backup name contains "backup_howl". - * * The restored database's name contains "restored_howl". - * * The operation started before 2018-03-28T14:50:00Z. - * * The operation resulted in an error. - * - * Generated from protobuf field string filter = 2; - */ - protected $filter = ''; - /** - * Number of operations to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 3; - */ - protected $page_size = 0; - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token] - * from a previous - * [ListDatabaseOperationsResponse][google.spanner.admin.database.v1.ListDatabaseOperationsResponse] - * to the same `parent` and with the same `filter`. - * - * Generated from protobuf field string page_token = 4; - */ - protected $page_token = ''; - - /** - * @param string $parent Required. The instance of the database operations. - * Values are of the form `projects//instances/`. Please see - * {@see DatabaseAdminClient::instanceName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\ListDatabaseOperationsRequest - * - * @experimental - */ - public static function build(string $parent): self - { - return (new self()) - ->setParent($parent); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The instance of the database operations. - * Values are of the form `projects//instances/`. - * @type string $filter - * An expression that filters the list of returned operations. - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the [Operation][google.longrunning.Operation] - * are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata] - * is - * `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \ - * `(metadata.source_type:BACKUP) AND` \ - * `(metadata.backup_info.backup:backup_howl) AND` \ - * `(metadata.name:restored_howl) AND` \ - * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. - * * The database is restored from a backup. - * * The backup name contains "backup_howl". - * * The restored database's name contains "restored_howl". - * * The operation started before 2018-03-28T14:50:00Z. - * * The operation resulted in an error. - * @type int $page_size - * Number of operations to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * @type string $page_token - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token] - * from a previous - * [ListDatabaseOperationsResponse][google.spanner.admin.database.v1.ListDatabaseOperationsResponse] - * to the same `parent` and with the same `filter`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The instance of the database operations. - * Values are of the form `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The instance of the database operations. - * Values are of the form `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * An expression that filters the list of returned operations. - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the [Operation][google.longrunning.Operation] - * are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata] - * is - * `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \ - * `(metadata.source_type:BACKUP) AND` \ - * `(metadata.backup_info.backup:backup_howl) AND` \ - * `(metadata.name:restored_howl) AND` \ - * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. - * * The database is restored from a backup. - * * The backup name contains "backup_howl". - * * The restored database's name contains "restored_howl". - * * The operation started before 2018-03-28T14:50:00Z. - * * The operation resulted in an error. - * - * Generated from protobuf field string filter = 2; - * @return string - */ - public function getFilter() - { - return $this->filter; - } - - /** - * An expression that filters the list of returned operations. - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the [Operation][google.longrunning.Operation] - * are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata] - * is - * `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \ - * `(metadata.source_type:BACKUP) AND` \ - * `(metadata.backup_info.backup:backup_howl) AND` \ - * `(metadata.name:restored_howl) AND` \ - * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. - * * The database is restored from a backup. - * * The backup name contains "backup_howl". - * * The restored database's name contains "restored_howl". - * * The operation started before 2018-03-28T14:50:00Z. - * * The operation resulted in an error. - * - * Generated from protobuf field string filter = 2; - * @param string $var - * @return $this - */ - public function setFilter($var) - { - GPBUtil::checkString($var, True); - $this->filter = $var; - - return $this; - } - - /** - * Number of operations to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 3; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Number of operations to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 3; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token] - * from a previous - * [ListDatabaseOperationsResponse][google.spanner.admin.database.v1.ListDatabaseOperationsResponse] - * to the same `parent` and with the same `filter`. - * - * Generated from protobuf field string page_token = 4; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token] - * from a previous - * [ListDatabaseOperationsResponse][google.spanner.admin.database.v1.ListDatabaseOperationsResponse] - * to the same `parent` and with the same `filter`. - * - * Generated from protobuf field string page_token = 4; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseOperationsResponse.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseOperationsResponse.php deleted file mode 100644 index 5e6f45741b25..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseOperationsResponse.php +++ /dev/null @@ -1,126 +0,0 @@ -google.spanner.admin.database.v1.ListDatabaseOperationsResponse - */ -class ListDatabaseOperationsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The list of matching database [long-running - * operations][google.longrunning.Operation]. Each operation's name will be - * prefixed by the database's name. The operation's - * [metadata][google.longrunning.Operation.metadata] field type - * `metadata.type_url` describes the type of the metadata. - * - * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; - */ - private $operations; - /** - * `next_page_token` can be sent in a subsequent - * [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations] - * call to fetch more of the matching metadata. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\LongRunning\Operation>|\Google\Protobuf\Internal\RepeatedField $operations - * The list of matching database [long-running - * operations][google.longrunning.Operation]. Each operation's name will be - * prefixed by the database's name. The operation's - * [metadata][google.longrunning.Operation.metadata] field type - * `metadata.type_url` describes the type of the metadata. - * @type string $next_page_token - * `next_page_token` can be sent in a subsequent - * [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations] - * call to fetch more of the matching metadata. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * The list of matching database [long-running - * operations][google.longrunning.Operation]. Each operation's name will be - * prefixed by the database's name. The operation's - * [metadata][google.longrunning.Operation.metadata] field type - * `metadata.type_url` describes the type of the metadata. - * - * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getOperations() - { - return $this->operations; - } - - /** - * The list of matching database [long-running - * operations][google.longrunning.Operation]. Each operation's name will be - * prefixed by the database's name. The operation's - * [metadata][google.longrunning.Operation.metadata] field type - * `metadata.type_url` describes the type of the metadata. - * - * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; - * @param array<\Google\LongRunning\Operation>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setOperations($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\LongRunning\Operation::class); - $this->operations = $arr; - - return $this; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations] - * call to fetch more of the matching metadata. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations] - * call to fetch more of the matching metadata. - * - * Generated from protobuf field string next_page_token = 2; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseRolesRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseRolesRequest.php deleted file mode 100644 index 789226a8d1cd..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseRolesRequest.php +++ /dev/null @@ -1,176 +0,0 @@ -google.spanner.admin.database.v1.ListDatabaseRolesRequest - */ -class ListDatabaseRolesRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The database whose roles should be listed. - * Values are of the form - * `projects//instances//databases/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Number of database roles to be returned in the response. If 0 or less, - * defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 2; - */ - protected $page_size = 0; - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token] - * from a previous - * [ListDatabaseRolesResponse][google.spanner.admin.database.v1.ListDatabaseRolesResponse]. - * - * Generated from protobuf field string page_token = 3; - */ - protected $page_token = ''; - - /** - * @param string $parent Required. The database whose roles should be listed. - * Values are of the form - * `projects//instances//databases/`. Please see - * {@see DatabaseAdminClient::databaseName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\ListDatabaseRolesRequest - * - * @experimental - */ - public static function build(string $parent): self - { - return (new self()) - ->setParent($parent); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The database whose roles should be listed. - * Values are of the form - * `projects//instances//databases/`. - * @type int $page_size - * Number of database roles to be returned in the response. If 0 or less, - * defaults to the server's maximum allowed page size. - * @type string $page_token - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token] - * from a previous - * [ListDatabaseRolesResponse][google.spanner.admin.database.v1.ListDatabaseRolesResponse]. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The database whose roles should be listed. - * Values are of the form - * `projects//instances//databases/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The database whose roles should be listed. - * Values are of the form - * `projects//instances//databases/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Number of database roles to be returned in the response. If 0 or less, - * defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 2; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Number of database roles to be returned in the response. If 0 or less, - * defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 2; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token] - * from a previous - * [ListDatabaseRolesResponse][google.spanner.admin.database.v1.ListDatabaseRolesResponse]. - * - * Generated from protobuf field string page_token = 3; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token] - * from a previous - * [ListDatabaseRolesResponse][google.spanner.admin.database.v1.ListDatabaseRolesResponse]. - * - * Generated from protobuf field string page_token = 3; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseRolesResponse.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseRolesResponse.php deleted file mode 100644 index e2f2c68f908e..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabaseRolesResponse.php +++ /dev/null @@ -1,110 +0,0 @@ -google.spanner.admin.database.v1.ListDatabaseRolesResponse - */ -class ListDatabaseRolesResponse extends \Google\Protobuf\Internal\Message -{ - /** - * Database roles that matched the request. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.DatabaseRole database_roles = 1; - */ - private $database_roles; - /** - * `next_page_token` can be sent in a subsequent - * [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles] - * call to fetch more of the matching roles. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Spanner\Admin\Database\V1\DatabaseRole>|\Google\Protobuf\Internal\RepeatedField $database_roles - * Database roles that matched the request. - * @type string $next_page_token - * `next_page_token` can be sent in a subsequent - * [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles] - * call to fetch more of the matching roles. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Database roles that matched the request. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.DatabaseRole database_roles = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getDatabaseRoles() - { - return $this->database_roles; - } - - /** - * Database roles that matched the request. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.DatabaseRole database_roles = 1; - * @param array<\Google\Cloud\Spanner\Admin\Database\V1\DatabaseRole>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setDatabaseRoles($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Database\V1\DatabaseRole::class); - $this->database_roles = $arr; - - return $this; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles] - * call to fetch more of the matching roles. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles] - * call to fetch more of the matching roles. - * - * Generated from protobuf field string next_page_token = 2; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabasesRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabasesRequest.php deleted file mode 100644 index 647992bff82d..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabasesRequest.php +++ /dev/null @@ -1,171 +0,0 @@ -google.spanner.admin.database.v1.ListDatabasesRequest - */ -class ListDatabasesRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The instance whose databases should be listed. - * Values are of the form `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Number of databases to be returned in the response. If 0 or less, - * defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 3; - */ - protected $page_size = 0; - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token] - * from a previous - * [ListDatabasesResponse][google.spanner.admin.database.v1.ListDatabasesResponse]. - * - * Generated from protobuf field string page_token = 4; - */ - protected $page_token = ''; - - /** - * @param string $parent Required. The instance whose databases should be listed. - * Values are of the form `projects//instances/`. Please see - * {@see DatabaseAdminClient::instanceName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\ListDatabasesRequest - * - * @experimental - */ - public static function build(string $parent): self - { - return (new self()) - ->setParent($parent); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The instance whose databases should be listed. - * Values are of the form `projects//instances/`. - * @type int $page_size - * Number of databases to be returned in the response. If 0 or less, - * defaults to the server's maximum allowed page size. - * @type string $page_token - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token] - * from a previous - * [ListDatabasesResponse][google.spanner.admin.database.v1.ListDatabasesResponse]. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The instance whose databases should be listed. - * Values are of the form `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The instance whose databases should be listed. - * Values are of the form `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Number of databases to be returned in the response. If 0 or less, - * defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 3; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Number of databases to be returned in the response. If 0 or less, - * defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 3; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token] - * from a previous - * [ListDatabasesResponse][google.spanner.admin.database.v1.ListDatabasesResponse]. - * - * Generated from protobuf field string page_token = 4; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token] - * from a previous - * [ListDatabasesResponse][google.spanner.admin.database.v1.ListDatabasesResponse]. - * - * Generated from protobuf field string page_token = 4; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabasesResponse.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabasesResponse.php deleted file mode 100644 index 91e10c3ba675..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListDatabasesResponse.php +++ /dev/null @@ -1,110 +0,0 @@ -google.spanner.admin.database.v1.ListDatabasesResponse - */ -class ListDatabasesResponse extends \Google\Protobuf\Internal\Message -{ - /** - * Databases that matched the request. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.Database databases = 1; - */ - private $databases; - /** - * `next_page_token` can be sent in a subsequent - * [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases] - * call to fetch more of the matching databases. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Spanner\Admin\Database\V1\Database>|\Google\Protobuf\Internal\RepeatedField $databases - * Databases that matched the request. - * @type string $next_page_token - * `next_page_token` can be sent in a subsequent - * [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases] - * call to fetch more of the matching databases. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Databases that matched the request. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.Database databases = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getDatabases() - { - return $this->databases; - } - - /** - * Databases that matched the request. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.Database databases = 1; - * @param array<\Google\Cloud\Spanner\Admin\Database\V1\Database>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setDatabases($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Database\V1\Database::class); - $this->databases = $arr; - - return $this; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases] - * call to fetch more of the matching databases. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases] - * call to fetch more of the matching databases. - * - * Generated from protobuf field string next_page_token = 2; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/OperationProgress.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/OperationProgress.php deleted file mode 100644 index 457e0f5b87d2..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/OperationProgress.php +++ /dev/null @@ -1,164 +0,0 @@ -google.spanner.admin.database.v1.OperationProgress - */ -class OperationProgress extends \Google\Protobuf\Internal\Message -{ - /** - * Percent completion of the operation. - * Values are between 0 and 100 inclusive. - * - * Generated from protobuf field int32 progress_percent = 1; - */ - protected $progress_percent = 0; - /** - * Time the request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; - */ - protected $start_time = null; - /** - * If set, the time at which this operation failed or was completed - * successfully. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; - */ - protected $end_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $progress_percent - * Percent completion of the operation. - * Values are between 0 and 100 inclusive. - * @type \Google\Protobuf\Timestamp $start_time - * Time the request was received. - * @type \Google\Protobuf\Timestamp $end_time - * If set, the time at which this operation failed or was completed - * successfully. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\Common::initOnce(); - parent::__construct($data); - } - - /** - * Percent completion of the operation. - * Values are between 0 and 100 inclusive. - * - * Generated from protobuf field int32 progress_percent = 1; - * @return int - */ - public function getProgressPercent() - { - return $this->progress_percent; - } - - /** - * Percent completion of the operation. - * Values are between 0 and 100 inclusive. - * - * Generated from protobuf field int32 progress_percent = 1; - * @param int $var - * @return $this - */ - public function setProgressPercent($var) - { - GPBUtil::checkInt32($var); - $this->progress_percent = $var; - - return $this; - } - - /** - * Time the request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; - * @return \Google\Protobuf\Timestamp|null - */ - public function getStartTime() - { - return $this->start_time; - } - - public function hasStartTime() - { - return isset($this->start_time); - } - - public function clearStartTime() - { - unset($this->start_time); - } - - /** - * Time the request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setStartTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->start_time = $var; - - return $this; - } - - /** - * If set, the time at which this operation failed or was completed - * successfully. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; - * @return \Google\Protobuf\Timestamp|null - */ - public function getEndTime() - { - return $this->end_time; - } - - public function hasEndTime() - { - return isset($this->end_time); - } - - public function clearEndTime() - { - unset($this->end_time); - } - - /** - * If set, the time at which this operation failed or was completed - * successfully. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setEndTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->end_time = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/OptimizeRestoredDatabaseMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/OptimizeRestoredDatabaseMetadata.php deleted file mode 100644 index 6030a18943a5..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/OptimizeRestoredDatabaseMetadata.php +++ /dev/null @@ -1,114 +0,0 @@ -google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata - */ -class OptimizeRestoredDatabaseMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * Name of the restored database being optimized. - * - * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * The progress of the post-restore optimizations. - * - * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 2; - */ - protected $progress = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Name of the restored database being optimized. - * @type \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress $progress - * The progress of the post-restore optimizations. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Name of the restored database being optimized. - * - * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Name of the restored database being optimized. - * - * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The progress of the post-restore optimizations. - * - * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 2; - * @return \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress|null - */ - public function getProgress() - { - return $this->progress; - } - - public function hasProgress() - { - return isset($this->progress); - } - - public function clearProgress() - { - unset($this->progress); - } - - /** - * The progress of the post-restore optimizations. - * - * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 2; - * @param \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress $var - * @return $this - */ - public function setProgress($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress::class); - $this->progress = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseEncryptionConfig.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseEncryptionConfig.php deleted file mode 100644 index 7826049bac09..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseEncryptionConfig.php +++ /dev/null @@ -1,203 +0,0 @@ -google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig - */ -class RestoreDatabaseEncryptionConfig extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The encryption type of the restored database. - * - * Generated from protobuf field .google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $encryption_type = 0; - /** - * Optional. The Cloud KMS key that will be used to encrypt/decrypt the - * restored database. This field should be set only when - * [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type] - * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - */ - protected $kms_key_name = ''; - /** - * Optional. Specifies the KMS configuration for the one or more keys used to - * encrypt the database. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * The keys referenced by kms_key_names must fully cover all - * regions of the database instance configuration. Some examples: - * * For single region database instance configs, specify a single regional - * location KMS key. - * * For multi-regional database instance configs of type GOOGLE_MANAGED, - * either specify a multi-regional location KMS key or multiple regional - * location KMS keys that cover all regions in the instance config. - * * For a database instance config of type USER_MANAGED, please specify only - * regional location KMS keys to cover each region in the instance config. - * Multi-regional location KMS keys are not supported for USER_MANAGED - * instance configs. - * - * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - */ - private $kms_key_names; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $encryption_type - * Required. The encryption type of the restored database. - * @type string $kms_key_name - * Optional. The Cloud KMS key that will be used to encrypt/decrypt the - * restored database. This field should be set only when - * [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type] - * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * @type array|\Google\Protobuf\Internal\RepeatedField $kms_key_names - * Optional. Specifies the KMS configuration for the one or more keys used to - * encrypt the database. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * The keys referenced by kms_key_names must fully cover all - * regions of the database instance configuration. Some examples: - * * For single region database instance configs, specify a single regional - * location KMS key. - * * For multi-regional database instance configs of type GOOGLE_MANAGED, - * either specify a multi-regional location KMS key or multiple regional - * location KMS keys that cover all regions in the instance config. - * * For a database instance config of type USER_MANAGED, please specify only - * regional location KMS keys to cover each region in the instance config. - * Multi-regional location KMS keys are not supported for USER_MANAGED - * instance configs. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The encryption type of the restored database. - * - * Generated from protobuf field .google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return int - */ - public function getEncryptionType() - { - return $this->encryption_type; - } - - /** - * Required. The encryption type of the restored database. - * - * Generated from protobuf field .google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.EncryptionType encryption_type = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param int $var - * @return $this - */ - public function setEncryptionType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\RestoreDatabaseEncryptionConfig\EncryptionType::class); - $this->encryption_type = $var; - - return $this; - } - - /** - * Optional. The Cloud KMS key that will be used to encrypt/decrypt the - * restored database. This field should be set only when - * [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type] - * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @return string - */ - public function getKmsKeyName() - { - return $this->kms_key_name; - } - - /** - * Optional. The Cloud KMS key that will be used to encrypt/decrypt the - * restored database. This field should be set only when - * [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type] - * is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * - * Generated from protobuf field string kms_key_name = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setKmsKeyName($var) - { - GPBUtil::checkString($var, True); - $this->kms_key_name = $var; - - return $this; - } - - /** - * Optional. Specifies the KMS configuration for the one or more keys used to - * encrypt the database. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * The keys referenced by kms_key_names must fully cover all - * regions of the database instance configuration. Some examples: - * * For single region database instance configs, specify a single regional - * location KMS key. - * * For multi-regional database instance configs of type GOOGLE_MANAGED, - * either specify a multi-regional location KMS key or multiple regional - * location KMS keys that cover all regions in the instance config. - * * For a database instance config of type USER_MANAGED, please specify only - * regional location KMS keys to cover each region in the instance config. - * Multi-regional location KMS keys are not supported for USER_MANAGED - * instance configs. - * - * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getKmsKeyNames() - { - return $this->kms_key_names; - } - - /** - * Optional. Specifies the KMS configuration for the one or more keys used to - * encrypt the database. Values are of the form - * `projects//locations//keyRings//cryptoKeys/`. - * The keys referenced by kms_key_names must fully cover all - * regions of the database instance configuration. Some examples: - * * For single region database instance configs, specify a single regional - * location KMS key. - * * For multi-regional database instance configs of type GOOGLE_MANAGED, - * either specify a multi-regional location KMS key or multiple regional - * location KMS keys that cover all regions in the instance config. - * * For a database instance config of type USER_MANAGED, please specify only - * regional location KMS keys to cover each region in the instance config. - * Multi-regional location KMS keys are not supported for USER_MANAGED - * instance configs. - * - * Generated from protobuf field repeated string kms_key_names = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setKmsKeyNames($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->kms_key_names = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseEncryptionConfig/EncryptionType.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseEncryptionConfig/EncryptionType.php deleted file mode 100644 index 6650757c3714..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseEncryptionConfig/EncryptionType.php +++ /dev/null @@ -1,74 +0,0 @@ -google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.EncryptionType - */ -class EncryptionType -{ - /** - * Unspecified. Do not use. - * - * Generated from protobuf enum ENCRYPTION_TYPE_UNSPECIFIED = 0; - */ - const ENCRYPTION_TYPE_UNSPECIFIED = 0; - /** - * This is the default option when - * [encryption_config][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig] - * is not specified. - * - * Generated from protobuf enum USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION = 1; - */ - const USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION = 1; - /** - * Use Google default encryption. - * - * Generated from protobuf enum GOOGLE_DEFAULT_ENCRYPTION = 2; - */ - const GOOGLE_DEFAULT_ENCRYPTION = 2; - /** - * Use customer managed encryption. If specified, `kms_key_name` must - * must contain a valid Cloud KMS key. - * - * Generated from protobuf enum CUSTOMER_MANAGED_ENCRYPTION = 3; - */ - const CUSTOMER_MANAGED_ENCRYPTION = 3; - - private static $valueToName = [ - self::ENCRYPTION_TYPE_UNSPECIFIED => 'ENCRYPTION_TYPE_UNSPECIFIED', - self::USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION => 'USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION', - self::GOOGLE_DEFAULT_ENCRYPTION => 'GOOGLE_DEFAULT_ENCRYPTION', - self::CUSTOMER_MANAGED_ENCRYPTION => 'CUSTOMER_MANAGED_ENCRYPTION', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(EncryptionType::class, \Google\Cloud\Spanner\Admin\Database\V1\RestoreDatabaseEncryptionConfig_EncryptionType::class); - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseMetadata.php deleted file mode 100644 index 176d1a1ee7ad..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseMetadata.php +++ /dev/null @@ -1,358 +0,0 @@ -google.spanner.admin.database.v1.RestoreDatabaseMetadata - */ -class RestoreDatabaseMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * Name of the database being created and restored to. - * - * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * The type of the restore source. - * - * Generated from protobuf field .google.spanner.admin.database.v1.RestoreSourceType source_type = 2; - */ - protected $source_type = 0; - /** - * The progress of the - * [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase] - * operation. - * - * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 4; - */ - protected $progress = null; - /** - * The time at which cancellation of this operation was received. - * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] - * starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not guaranteed. - * Clients can use - * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an [Operation.error][google.longrunning.Operation.error] value with a - * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - * `Code.CANCELLED`. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 5; - */ - protected $cancel_time = null; - /** - * If exists, the name of the long-running operation that will be used to - * track the post-restore optimization process to optimize the performance of - * the restored database, and remove the dependency on the restore source. - * The name is of the form - * `projects//instances//databases//operations/` - * where the is the name of database being created and restored to. - * The metadata type of the long-running operation is - * [OptimizeRestoredDatabaseMetadata][google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata]. - * This long-running operation will be automatically created by the system - * after the RestoreDatabase long-running operation completes successfully. - * This operation will not be created if the restore was not successful. - * - * Generated from protobuf field string optimize_database_operation_name = 6; - */ - protected $optimize_database_operation_name = ''; - protected $source_info; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Name of the database being created and restored to. - * @type int $source_type - * The type of the restore source. - * @type \Google\Cloud\Spanner\Admin\Database\V1\BackupInfo $backup_info - * Information about the backup used to restore the database. - * @type \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress $progress - * The progress of the - * [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase] - * operation. - * @type \Google\Protobuf\Timestamp $cancel_time - * The time at which cancellation of this operation was received. - * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] - * starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not guaranteed. - * Clients can use - * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an [Operation.error][google.longrunning.Operation.error] value with a - * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - * `Code.CANCELLED`. - * @type string $optimize_database_operation_name - * If exists, the name of the long-running operation that will be used to - * track the post-restore optimization process to optimize the performance of - * the restored database, and remove the dependency on the restore source. - * The name is of the form - * `projects//instances//databases//operations/` - * where the is the name of database being created and restored to. - * The metadata type of the long-running operation is - * [OptimizeRestoredDatabaseMetadata][google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata]. - * This long-running operation will be automatically created by the system - * after the RestoreDatabase long-running operation completes successfully. - * This operation will not be created if the restore was not successful. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Name of the database being created and restored to. - * - * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Name of the database being created and restored to. - * - * Generated from protobuf field string name = 1 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The type of the restore source. - * - * Generated from protobuf field .google.spanner.admin.database.v1.RestoreSourceType source_type = 2; - * @return int - */ - public function getSourceType() - { - return $this->source_type; - } - - /** - * The type of the restore source. - * - * Generated from protobuf field .google.spanner.admin.database.v1.RestoreSourceType source_type = 2; - * @param int $var - * @return $this - */ - public function setSourceType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\RestoreSourceType::class); - $this->source_type = $var; - - return $this; - } - - /** - * Information about the backup used to restore the database. - * - * Generated from protobuf field .google.spanner.admin.database.v1.BackupInfo backup_info = 3; - * @return \Google\Cloud\Spanner\Admin\Database\V1\BackupInfo|null - */ - public function getBackupInfo() - { - return $this->readOneof(3); - } - - public function hasBackupInfo() - { - return $this->hasOneof(3); - } - - /** - * Information about the backup used to restore the database. - * - * Generated from protobuf field .google.spanner.admin.database.v1.BackupInfo backup_info = 3; - * @param \Google\Cloud\Spanner\Admin\Database\V1\BackupInfo $var - * @return $this - */ - public function setBackupInfo($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\BackupInfo::class); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * The progress of the - * [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase] - * operation. - * - * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 4; - * @return \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress|null - */ - public function getProgress() - { - return $this->progress; - } - - public function hasProgress() - { - return isset($this->progress); - } - - public function clearProgress() - { - unset($this->progress); - } - - /** - * The progress of the - * [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase] - * operation. - * - * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 4; - * @param \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress $var - * @return $this - */ - public function setProgress($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress::class); - $this->progress = $var; - - return $this; - } - - /** - * The time at which cancellation of this operation was received. - * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] - * starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not guaranteed. - * Clients can use - * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an [Operation.error][google.longrunning.Operation.error] value with a - * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - * `Code.CANCELLED`. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 5; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCancelTime() - { - return $this->cancel_time; - } - - public function hasCancelTime() - { - return isset($this->cancel_time); - } - - public function clearCancelTime() - { - unset($this->cancel_time); - } - - /** - * The time at which cancellation of this operation was received. - * [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] - * starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not guaranteed. - * Clients can use - * [Operations.GetOperation][google.longrunning.Operations.GetOperation] or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an [Operation.error][google.longrunning.Operation.error] value with a - * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - * `Code.CANCELLED`. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 5; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCancelTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->cancel_time = $var; - - return $this; - } - - /** - * If exists, the name of the long-running operation that will be used to - * track the post-restore optimization process to optimize the performance of - * the restored database, and remove the dependency on the restore source. - * The name is of the form - * `projects//instances//databases//operations/` - * where the is the name of database being created and restored to. - * The metadata type of the long-running operation is - * [OptimizeRestoredDatabaseMetadata][google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata]. - * This long-running operation will be automatically created by the system - * after the RestoreDatabase long-running operation completes successfully. - * This operation will not be created if the restore was not successful. - * - * Generated from protobuf field string optimize_database_operation_name = 6; - * @return string - */ - public function getOptimizeDatabaseOperationName() - { - return $this->optimize_database_operation_name; - } - - /** - * If exists, the name of the long-running operation that will be used to - * track the post-restore optimization process to optimize the performance of - * the restored database, and remove the dependency on the restore source. - * The name is of the form - * `projects//instances//databases//operations/` - * where the is the name of database being created and restored to. - * The metadata type of the long-running operation is - * [OptimizeRestoredDatabaseMetadata][google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata]. - * This long-running operation will be automatically created by the system - * after the RestoreDatabase long-running operation completes successfully. - * This operation will not be created if the restore was not successful. - * - * Generated from protobuf field string optimize_database_operation_name = 6; - * @param string $var - * @return $this - */ - public function setOptimizeDatabaseOperationName($var) - { - GPBUtil::checkString($var, True); - $this->optimize_database_operation_name = $var; - - return $this; - } - - /** - * @return string - */ - public function getSourceInfo() - { - return $this->whichOneof("source_info"); - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseRequest.php deleted file mode 100644 index 7e9f39516096..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreDatabaseRequest.php +++ /dev/null @@ -1,265 +0,0 @@ -google.spanner.admin.database.v1.RestoreDatabaseRequest - */ -class RestoreDatabaseRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the instance in which to create the - * restored database. This instance must be in the same project and - * have the same instance configuration as the instance containing - * the source backup. Values are of the form - * `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Required. The id of the database to create and restore to. This - * database must not already exist. The `database_id` appended to - * `parent` forms the full database name of the form - * `projects//instances//databases/`. - * - * Generated from protobuf field string database_id = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $database_id = ''; - /** - * Optional. An encryption configuration describing the encryption type and - * key resources in Cloud KMS used to encrypt/decrypt the database to restore - * to. If this field is not specified, the restored database will use the same - * encryption configuration as the backup by default, namely - * [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type] - * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`. - * - * Generated from protobuf field .google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $encryption_config = null; - protected $source; - - /** - * @param string $parent Required. The name of the instance in which to create the - * restored database. This instance must be in the same project and - * have the same instance configuration as the instance containing - * the source backup. Values are of the form - * `projects//instances/`. Please see - * {@see DatabaseAdminClient::instanceName()} for help formatting this field. - * @param string $databaseId Required. The id of the database to create and restore to. This - * database must not already exist. The `database_id` appended to - * `parent` forms the full database name of the form - * `projects//instances//databases/`. - * @param string $backup Name of the backup from which to restore. Values are of the form - * `projects//instances//backups/`. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\RestoreDatabaseRequest - * - * @experimental - */ - public static function build(string $parent, string $databaseId, string $backup): self - { - return (new self()) - ->setParent($parent) - ->setDatabaseId($databaseId) - ->setBackup($backup); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The name of the instance in which to create the - * restored database. This instance must be in the same project and - * have the same instance configuration as the instance containing - * the source backup. Values are of the form - * `projects//instances/`. - * @type string $database_id - * Required. The id of the database to create and restore to. This - * database must not already exist. The `database_id` appended to - * `parent` forms the full database name of the form - * `projects//instances//databases/`. - * @type string $backup - * Name of the backup from which to restore. Values are of the form - * `projects//instances//backups/`. - * @type \Google\Cloud\Spanner\Admin\Database\V1\RestoreDatabaseEncryptionConfig $encryption_config - * Optional. An encryption configuration describing the encryption type and - * key resources in Cloud KMS used to encrypt/decrypt the database to restore - * to. If this field is not specified, the restored database will use the same - * encryption configuration as the backup by default, namely - * [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type] - * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the instance in which to create the - * restored database. This instance must be in the same project and - * have the same instance configuration as the instance containing - * the source backup. Values are of the form - * `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The name of the instance in which to create the - * restored database. This instance must be in the same project and - * have the same instance configuration as the instance containing - * the source backup. Values are of the form - * `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Required. The id of the database to create and restore to. This - * database must not already exist. The `database_id` appended to - * `parent` forms the full database name of the form - * `projects//instances//databases/`. - * - * Generated from protobuf field string database_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getDatabaseId() - { - return $this->database_id; - } - - /** - * Required. The id of the database to create and restore to. This - * database must not already exist. The `database_id` appended to - * `parent` forms the full database name of the form - * `projects//instances//databases/`. - * - * Generated from protobuf field string database_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setDatabaseId($var) - { - GPBUtil::checkString($var, True); - $this->database_id = $var; - - return $this; - } - - /** - * Name of the backup from which to restore. Values are of the form - * `projects//instances//backups/`. - * - * Generated from protobuf field string backup = 3 [(.google.api.resource_reference) = { - * @return string - */ - public function getBackup() - { - return $this->readOneof(3); - } - - public function hasBackup() - { - return $this->hasOneof(3); - } - - /** - * Name of the backup from which to restore. Values are of the form - * `projects//instances//backups/`. - * - * Generated from protobuf field string backup = 3 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setBackup($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * Optional. An encryption configuration describing the encryption type and - * key resources in Cloud KMS used to encrypt/decrypt the database to restore - * to. If this field is not specified, the restored database will use the same - * encryption configuration as the backup by default, namely - * [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type] - * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`. - * - * Generated from protobuf field .google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\Spanner\Admin\Database\V1\RestoreDatabaseEncryptionConfig|null - */ - public function getEncryptionConfig() - { - return $this->encryption_config; - } - - public function hasEncryptionConfig() - { - return isset($this->encryption_config); - } - - public function clearEncryptionConfig() - { - unset($this->encryption_config); - } - - /** - * Optional. An encryption configuration describing the encryption type and - * key resources in Cloud KMS used to encrypt/decrypt the database to restore - * to. If this field is not specified, the restored database will use the same - * encryption configuration as the backup by default, namely - * [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type] - * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`. - * - * Generated from protobuf field .google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig encryption_config = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\Spanner\Admin\Database\V1\RestoreDatabaseEncryptionConfig $var - * @return $this - */ - public function setEncryptionConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\RestoreDatabaseEncryptionConfig::class); - $this->encryption_config = $var; - - return $this; - } - - /** - * @return string - */ - public function getSource() - { - return $this->whichOneof("source"); - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreInfo.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreInfo.php deleted file mode 100644 index 2bcfe27d1868..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreInfo.php +++ /dev/null @@ -1,112 +0,0 @@ -google.spanner.admin.database.v1.RestoreInfo - */ -class RestoreInfo extends \Google\Protobuf\Internal\Message -{ - /** - * The type of the restore source. - * - * Generated from protobuf field .google.spanner.admin.database.v1.RestoreSourceType source_type = 1; - */ - protected $source_type = 0; - protected $source_info; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $source_type - * The type of the restore source. - * @type \Google\Cloud\Spanner\Admin\Database\V1\BackupInfo $backup_info - * Information about the backup used to restore the database. The backup - * may no longer exist. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * The type of the restore source. - * - * Generated from protobuf field .google.spanner.admin.database.v1.RestoreSourceType source_type = 1; - * @return int - */ - public function getSourceType() - { - return $this->source_type; - } - - /** - * The type of the restore source. - * - * Generated from protobuf field .google.spanner.admin.database.v1.RestoreSourceType source_type = 1; - * @param int $var - * @return $this - */ - public function setSourceType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Database\V1\RestoreSourceType::class); - $this->source_type = $var; - - return $this; - } - - /** - * Information about the backup used to restore the database. The backup - * may no longer exist. - * - * Generated from protobuf field .google.spanner.admin.database.v1.BackupInfo backup_info = 2; - * @return \Google\Cloud\Spanner\Admin\Database\V1\BackupInfo|null - */ - public function getBackupInfo() - { - return $this->readOneof(2); - } - - public function hasBackupInfo() - { - return $this->hasOneof(2); - } - - /** - * Information about the backup used to restore the database. The backup - * may no longer exist. - * - * Generated from protobuf field .google.spanner.admin.database.v1.BackupInfo backup_info = 2; - * @param \Google\Cloud\Spanner\Admin\Database\V1\BackupInfo $var - * @return $this - */ - public function setBackupInfo($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\BackupInfo::class); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * @return string - */ - public function getSourceInfo() - { - return $this->whichOneof("source_info"); - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreSourceType.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreSourceType.php deleted file mode 100644 index 9d51c00e2be6..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/RestoreSourceType.php +++ /dev/null @@ -1,54 +0,0 @@ -google.spanner.admin.database.v1.RestoreSourceType - */ -class RestoreSourceType -{ - /** - * No restore associated. - * - * Generated from protobuf enum TYPE_UNSPECIFIED = 0; - */ - const TYPE_UNSPECIFIED = 0; - /** - * A backup was used as the source of the restore. - * - * Generated from protobuf enum BACKUP = 1; - */ - const BACKUP = 1; - - private static $valueToName = [ - self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', - self::BACKUP => 'BACKUP', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateBackupRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateBackupRequest.php deleted file mode 100644 index 0c76d8690c85..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateBackupRequest.php +++ /dev/null @@ -1,172 +0,0 @@ -google.spanner.admin.database.v1.UpdateBackupRequest - */ -class UpdateBackupRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The backup to update. `backup.name`, and the fields to be updated - * as specified by `update_mask` are required. Other fields are ignored. - * Update is only supported for the following fields: - * * `backup.expire_time`. - * - * Generated from protobuf field .google.spanner.admin.database.v1.Backup backup = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $backup = null; - /** - * Required. A mask specifying which fields (e.g. `expire_time`) in the - * Backup resource should be updated. This mask is relative to the Backup - * resource, not to the request message. The field mask must always be - * specified; this prevents any future fields from being erased accidentally - * by clients that do not know about them. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $update_mask = null; - - /** - * @param \Google\Cloud\Spanner\Admin\Database\V1\Backup $backup Required. The backup to update. `backup.name`, and the fields to be updated - * as specified by `update_mask` are required. Other fields are ignored. - * Update is only supported for the following fields: - * * `backup.expire_time`. - * @param \Google\Protobuf\FieldMask $updateMask Required. A mask specifying which fields (e.g. `expire_time`) in the - * Backup resource should be updated. This mask is relative to the Backup - * resource, not to the request message. The field mask must always be - * specified; this prevents any future fields from being erased accidentally - * by clients that do not know about them. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\UpdateBackupRequest - * - * @experimental - */ - public static function build(\Google\Cloud\Spanner\Admin\Database\V1\Backup $backup, \Google\Protobuf\FieldMask $updateMask): self - { - return (new self()) - ->setBackup($backup) - ->setUpdateMask($updateMask); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\Admin\Database\V1\Backup $backup - * Required. The backup to update. `backup.name`, and the fields to be updated - * as specified by `update_mask` are required. Other fields are ignored. - * Update is only supported for the following fields: - * * `backup.expire_time`. - * @type \Google\Protobuf\FieldMask $update_mask - * Required. A mask specifying which fields (e.g. `expire_time`) in the - * Backup resource should be updated. This mask is relative to the Backup - * resource, not to the request message. The field mask must always be - * specified; this prevents any future fields from being erased accidentally - * by clients that do not know about them. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\Backup::initOnce(); - parent::__construct($data); - } - - /** - * Required. The backup to update. `backup.name`, and the fields to be updated - * as specified by `update_mask` are required. Other fields are ignored. - * Update is only supported for the following fields: - * * `backup.expire_time`. - * - * Generated from protobuf field .google.spanner.admin.database.v1.Backup backup = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\Admin\Database\V1\Backup|null - */ - public function getBackup() - { - return $this->backup; - } - - public function hasBackup() - { - return isset($this->backup); - } - - public function clearBackup() - { - unset($this->backup); - } - - /** - * Required. The backup to update. `backup.name`, and the fields to be updated - * as specified by `update_mask` are required. Other fields are ignored. - * Update is only supported for the following fields: - * * `backup.expire_time`. - * - * Generated from protobuf field .google.spanner.admin.database.v1.Backup backup = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\Admin\Database\V1\Backup $var - * @return $this - */ - public function setBackup($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\Backup::class); - $this->backup = $var; - - return $this; - } - - /** - * Required. A mask specifying which fields (e.g. `expire_time`) in the - * Backup resource should be updated. This mask is relative to the Backup - * resource, not to the request message. The field mask must always be - * specified; this prevents any future fields from being erased accidentally - * by clients that do not know about them. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\FieldMask|null - */ - public function getUpdateMask() - { - return $this->update_mask; - } - - public function hasUpdateMask() - { - return isset($this->update_mask); - } - - public function clearUpdateMask() - { - unset($this->update_mask); - } - - /** - * Required. A mask specifying which fields (e.g. `expire_time`) in the - * Backup resource should be updated. This mask is relative to the Backup - * resource, not to the request message. The field mask must always be - * specified; this prevents any future fields from being erased accidentally - * by clients that do not know about them. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Protobuf\FieldMask $var - * @return $this - */ - public function setUpdateMask($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); - $this->update_mask = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateBackupScheduleRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateBackupScheduleRequest.php deleted file mode 100644 index 9d0e58d7f5b8..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateBackupScheduleRequest.php +++ /dev/null @@ -1,167 +0,0 @@ -google.spanner.admin.database.v1.UpdateBackupScheduleRequest - */ -class UpdateBackupScheduleRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The backup schedule to update. `backup_schedule.name`, and the - * fields to be updated as specified by `update_mask` are required. Other - * fields are ignored. - * - * Generated from protobuf field .google.spanner.admin.database.v1.BackupSchedule backup_schedule = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $backup_schedule = null; - /** - * Required. A mask specifying which fields in the BackupSchedule resource - * should be updated. This mask is relative to the BackupSchedule resource, - * not to the request message. The field mask must always be - * specified; this prevents any future fields from being erased - * accidentally. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $update_mask = null; - - /** - * @param \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule $backupSchedule Required. The backup schedule to update. `backup_schedule.name`, and the - * fields to be updated as specified by `update_mask` are required. Other - * fields are ignored. - * @param \Google\Protobuf\FieldMask $updateMask Required. A mask specifying which fields in the BackupSchedule resource - * should be updated. This mask is relative to the BackupSchedule resource, - * not to the request message. The field mask must always be - * specified; this prevents any future fields from being erased - * accidentally. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\UpdateBackupScheduleRequest - * - * @experimental - */ - public static function build(\Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule $backupSchedule, \Google\Protobuf\FieldMask $updateMask): self - { - return (new self()) - ->setBackupSchedule($backupSchedule) - ->setUpdateMask($updateMask); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule $backup_schedule - * Required. The backup schedule to update. `backup_schedule.name`, and the - * fields to be updated as specified by `update_mask` are required. Other - * fields are ignored. - * @type \Google\Protobuf\FieldMask $update_mask - * Required. A mask specifying which fields in the BackupSchedule resource - * should be updated. This mask is relative to the BackupSchedule resource, - * not to the request message. The field mask must always be - * specified; this prevents any future fields from being erased - * accidentally. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\BackupSchedule::initOnce(); - parent::__construct($data); - } - - /** - * Required. The backup schedule to update. `backup_schedule.name`, and the - * fields to be updated as specified by `update_mask` are required. Other - * fields are ignored. - * - * Generated from protobuf field .google.spanner.admin.database.v1.BackupSchedule backup_schedule = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule|null - */ - public function getBackupSchedule() - { - return $this->backup_schedule; - } - - public function hasBackupSchedule() - { - return isset($this->backup_schedule); - } - - public function clearBackupSchedule() - { - unset($this->backup_schedule); - } - - /** - * Required. The backup schedule to update. `backup_schedule.name`, and the - * fields to be updated as specified by `update_mask` are required. Other - * fields are ignored. - * - * Generated from protobuf field .google.spanner.admin.database.v1.BackupSchedule backup_schedule = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule $var - * @return $this - */ - public function setBackupSchedule($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule::class); - $this->backup_schedule = $var; - - return $this; - } - - /** - * Required. A mask specifying which fields in the BackupSchedule resource - * should be updated. This mask is relative to the BackupSchedule resource, - * not to the request message. The field mask must always be - * specified; this prevents any future fields from being erased - * accidentally. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\FieldMask|null - */ - public function getUpdateMask() - { - return $this->update_mask; - } - - public function hasUpdateMask() - { - return isset($this->update_mask); - } - - public function clearUpdateMask() - { - unset($this->update_mask); - } - - /** - * Required. A mask specifying which fields in the BackupSchedule resource - * should be updated. This mask is relative to the BackupSchedule resource, - * not to the request message. The field mask must always be - * specified; this prevents any future fields from being erased - * accidentally. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Protobuf\FieldMask $var - * @return $this - */ - public function setUpdateMask($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); - $this->update_mask = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseDdlMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseDdlMetadata.php deleted file mode 100644 index 767766fad333..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseDdlMetadata.php +++ /dev/null @@ -1,286 +0,0 @@ -google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata - */ -class UpdateDatabaseDdlMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The database being modified. - * - * Generated from protobuf field string database = 1 [(.google.api.resource_reference) = { - */ - protected $database = ''; - /** - * For an update this list contains all the statements. For an - * individual statement, this list contains only that statement. - * - * Generated from protobuf field repeated string statements = 2; - */ - private $statements; - /** - * Reports the commit timestamps of all statements that have - * succeeded so far, where `commit_timestamps[i]` is the commit - * timestamp for the statement `statements[i]`. - * - * Generated from protobuf field repeated .google.protobuf.Timestamp commit_timestamps = 3; - */ - private $commit_timestamps; - /** - * Output only. When true, indicates that the operation is throttled e.g. - * due to resource constraints. When resources become available the operation - * will resume and this field will be false again. - * - * Generated from protobuf field bool throttled = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $throttled = false; - /** - * The progress of the - * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] - * operations. All DDL statements will have continuously updating progress, - * and `progress[i]` is the operation progress for `statements[i]`. Also, - * `progress[i]` will have start time and end time populated with commit - * timestamp of operation, as well as a progress of 100% once the operation - * has completed. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.OperationProgress progress = 5; - */ - private $progress; - /** - * The brief action info for the DDL statements. - * `actions[i]` is the brief info for `statements[i]`. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.DdlStatementActionInfo actions = 6; - */ - private $actions; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $database - * The database being modified. - * @type array|\Google\Protobuf\Internal\RepeatedField $statements - * For an update this list contains all the statements. For an - * individual statement, this list contains only that statement. - * @type array<\Google\Protobuf\Timestamp>|\Google\Protobuf\Internal\RepeatedField $commit_timestamps - * Reports the commit timestamps of all statements that have - * succeeded so far, where `commit_timestamps[i]` is the commit - * timestamp for the statement `statements[i]`. - * @type bool $throttled - * Output only. When true, indicates that the operation is throttled e.g. - * due to resource constraints. When resources become available the operation - * will resume and this field will be false again. - * @type array<\Google\Cloud\Spanner\Admin\Database\V1\OperationProgress>|\Google\Protobuf\Internal\RepeatedField $progress - * The progress of the - * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] - * operations. All DDL statements will have continuously updating progress, - * and `progress[i]` is the operation progress for `statements[i]`. Also, - * `progress[i]` will have start time and end time populated with commit - * timestamp of operation, as well as a progress of 100% once the operation - * has completed. - * @type array<\Google\Cloud\Spanner\Admin\Database\V1\DdlStatementActionInfo>|\Google\Protobuf\Internal\RepeatedField $actions - * The brief action info for the DDL statements. - * `actions[i]` is the brief info for `statements[i]`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * The database being modified. - * - * Generated from protobuf field string database = 1 [(.google.api.resource_reference) = { - * @return string - */ - public function getDatabase() - { - return $this->database; - } - - /** - * The database being modified. - * - * Generated from protobuf field string database = 1 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setDatabase($var) - { - GPBUtil::checkString($var, True); - $this->database = $var; - - return $this; - } - - /** - * For an update this list contains all the statements. For an - * individual statement, this list contains only that statement. - * - * Generated from protobuf field repeated string statements = 2; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getStatements() - { - return $this->statements; - } - - /** - * For an update this list contains all the statements. For an - * individual statement, this list contains only that statement. - * - * Generated from protobuf field repeated string statements = 2; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setStatements($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->statements = $arr; - - return $this; - } - - /** - * Reports the commit timestamps of all statements that have - * succeeded so far, where `commit_timestamps[i]` is the commit - * timestamp for the statement `statements[i]`. - * - * Generated from protobuf field repeated .google.protobuf.Timestamp commit_timestamps = 3; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getCommitTimestamps() - { - return $this->commit_timestamps; - } - - /** - * Reports the commit timestamps of all statements that have - * succeeded so far, where `commit_timestamps[i]` is the commit - * timestamp for the statement `statements[i]`. - * - * Generated from protobuf field repeated .google.protobuf.Timestamp commit_timestamps = 3; - * @param array<\Google\Protobuf\Timestamp>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setCommitTimestamps($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Timestamp::class); - $this->commit_timestamps = $arr; - - return $this; - } - - /** - * Output only. When true, indicates that the operation is throttled e.g. - * due to resource constraints. When resources become available the operation - * will resume and this field will be false again. - * - * Generated from protobuf field bool throttled = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return bool - */ - public function getThrottled() - { - return $this->throttled; - } - - /** - * Output only. When true, indicates that the operation is throttled e.g. - * due to resource constraints. When resources become available the operation - * will resume and this field will be false again. - * - * Generated from protobuf field bool throttled = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param bool $var - * @return $this - */ - public function setThrottled($var) - { - GPBUtil::checkBool($var); - $this->throttled = $var; - - return $this; - } - - /** - * The progress of the - * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] - * operations. All DDL statements will have continuously updating progress, - * and `progress[i]` is the operation progress for `statements[i]`. Also, - * `progress[i]` will have start time and end time populated with commit - * timestamp of operation, as well as a progress of 100% once the operation - * has completed. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.OperationProgress progress = 5; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getProgress() - { - return $this->progress; - } - - /** - * The progress of the - * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] - * operations. All DDL statements will have continuously updating progress, - * and `progress[i]` is the operation progress for `statements[i]`. Also, - * `progress[i]` will have start time and end time populated with commit - * timestamp of operation, as well as a progress of 100% once the operation - * has completed. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.OperationProgress progress = 5; - * @param array<\Google\Cloud\Spanner\Admin\Database\V1\OperationProgress>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setProgress($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress::class); - $this->progress = $arr; - - return $this; - } - - /** - * The brief action info for the DDL statements. - * `actions[i]` is the brief info for `statements[i]`. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.DdlStatementActionInfo actions = 6; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getActions() - { - return $this->actions; - } - - /** - * The brief action info for the DDL statements. - * `actions[i]` is the brief info for `statements[i]`. - * - * Generated from protobuf field repeated .google.spanner.admin.database.v1.DdlStatementActionInfo actions = 6; - * @param array<\Google\Cloud\Spanner\Admin\Database\V1\DdlStatementActionInfo>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setActions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Database\V1\DdlStatementActionInfo::class); - $this->actions = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseDdlRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseDdlRequest.php deleted file mode 100644 index d520012a1ad1..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseDdlRequest.php +++ /dev/null @@ -1,323 +0,0 @@ -google.spanner.admin.database.v1.UpdateDatabaseDdlRequest - */ -class UpdateDatabaseDdlRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The database to update. - * - * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $database = ''; - /** - * Required. DDL statements to be applied to the database. - * - * Generated from protobuf field repeated string statements = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - private $statements; - /** - * If empty, the new update request is assigned an - * automatically-generated operation ID. Otherwise, `operation_id` - * is used to construct the name of the resulting - * [Operation][google.longrunning.Operation]. - * Specifying an explicit operation ID simplifies determining - * whether the statements were executed in the event that the - * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] - * call is replayed, or the return value is otherwise lost: the - * [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database] - * and `operation_id` fields can be combined to form the - * [name][google.longrunning.Operation.name] of the resulting - * [longrunning.Operation][google.longrunning.Operation]: - * `/operations/`. - * `operation_id` should be unique within the database, and must be - * a valid identifier: `[a-z][a-z0-9_]*`. Note that - * automatically-generated operation IDs always begin with an - * underscore. If the named operation already exists, - * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] - * returns `ALREADY_EXISTS`. - * - * Generated from protobuf field string operation_id = 3; - */ - protected $operation_id = ''; - /** - * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements. - * Contains a protobuf-serialized - * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). - * To generate it, [install](https://grpc.io/docs/protoc-installation/) and - * run `protoc` with --include_imports and --descriptor_set_out. For example, - * to generate for moon/shot/app.proto, run - * ``` - * $protoc --proto_path=/app_path --proto_path=/lib_path \ - * --include_imports \ - * --descriptor_set_out=descriptors.data \ - * moon/shot/app.proto - * ``` - * For more details, see protobuffer [self - * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). - * - * Generated from protobuf field bytes proto_descriptors = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $proto_descriptors = ''; - - /** - * @param string $database Required. The database to update. Please see - * {@see DatabaseAdminClient::databaseName()} for help formatting this field. - * @param string[] $statements Required. DDL statements to be applied to the database. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseDdlRequest - * - * @experimental - */ - public static function build(string $database, array $statements): self - { - return (new self()) - ->setDatabase($database) - ->setStatements($statements); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $database - * Required. The database to update. - * @type array|\Google\Protobuf\Internal\RepeatedField $statements - * Required. DDL statements to be applied to the database. - * @type string $operation_id - * If empty, the new update request is assigned an - * automatically-generated operation ID. Otherwise, `operation_id` - * is used to construct the name of the resulting - * [Operation][google.longrunning.Operation]. - * Specifying an explicit operation ID simplifies determining - * whether the statements were executed in the event that the - * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] - * call is replayed, or the return value is otherwise lost: the - * [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database] - * and `operation_id` fields can be combined to form the - * [name][google.longrunning.Operation.name] of the resulting - * [longrunning.Operation][google.longrunning.Operation]: - * `/operations/`. - * `operation_id` should be unique within the database, and must be - * a valid identifier: `[a-z][a-z0-9_]*`. Note that - * automatically-generated operation IDs always begin with an - * underscore. If the named operation already exists, - * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] - * returns `ALREADY_EXISTS`. - * @type string $proto_descriptors - * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements. - * Contains a protobuf-serialized - * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). - * To generate it, [install](https://grpc.io/docs/protoc-installation/) and - * run `protoc` with --include_imports and --descriptor_set_out. For example, - * to generate for moon/shot/app.proto, run - * ``` - * $protoc --proto_path=/app_path --proto_path=/lib_path \ - * --include_imports \ - * --descriptor_set_out=descriptors.data \ - * moon/shot/app.proto - * ``` - * For more details, see protobuffer [self - * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The database to update. - * - * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getDatabase() - { - return $this->database; - } - - /** - * Required. The database to update. - * - * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setDatabase($var) - { - GPBUtil::checkString($var, True); - $this->database = $var; - - return $this; - } - - /** - * Required. DDL statements to be applied to the database. - * - * Generated from protobuf field repeated string statements = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getStatements() - { - return $this->statements; - } - - /** - * Required. DDL statements to be applied to the database. - * - * Generated from protobuf field repeated string statements = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setStatements($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->statements = $arr; - - return $this; - } - - /** - * If empty, the new update request is assigned an - * automatically-generated operation ID. Otherwise, `operation_id` - * is used to construct the name of the resulting - * [Operation][google.longrunning.Operation]. - * Specifying an explicit operation ID simplifies determining - * whether the statements were executed in the event that the - * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] - * call is replayed, or the return value is otherwise lost: the - * [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database] - * and `operation_id` fields can be combined to form the - * [name][google.longrunning.Operation.name] of the resulting - * [longrunning.Operation][google.longrunning.Operation]: - * `/operations/`. - * `operation_id` should be unique within the database, and must be - * a valid identifier: `[a-z][a-z0-9_]*`. Note that - * automatically-generated operation IDs always begin with an - * underscore. If the named operation already exists, - * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] - * returns `ALREADY_EXISTS`. - * - * Generated from protobuf field string operation_id = 3; - * @return string - */ - public function getOperationId() - { - return $this->operation_id; - } - - /** - * If empty, the new update request is assigned an - * automatically-generated operation ID. Otherwise, `operation_id` - * is used to construct the name of the resulting - * [Operation][google.longrunning.Operation]. - * Specifying an explicit operation ID simplifies determining - * whether the statements were executed in the event that the - * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] - * call is replayed, or the return value is otherwise lost: the - * [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database] - * and `operation_id` fields can be combined to form the - * [name][google.longrunning.Operation.name] of the resulting - * [longrunning.Operation][google.longrunning.Operation]: - * `/operations/`. - * `operation_id` should be unique within the database, and must be - * a valid identifier: `[a-z][a-z0-9_]*`. Note that - * automatically-generated operation IDs always begin with an - * underscore. If the named operation already exists, - * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] - * returns `ALREADY_EXISTS`. - * - * Generated from protobuf field string operation_id = 3; - * @param string $var - * @return $this - */ - public function setOperationId($var) - { - GPBUtil::checkString($var, True); - $this->operation_id = $var; - - return $this; - } - - /** - * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements. - * Contains a protobuf-serialized - * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). - * To generate it, [install](https://grpc.io/docs/protoc-installation/) and - * run `protoc` with --include_imports and --descriptor_set_out. For example, - * to generate for moon/shot/app.proto, run - * ``` - * $protoc --proto_path=/app_path --proto_path=/lib_path \ - * --include_imports \ - * --descriptor_set_out=descriptors.data \ - * moon/shot/app.proto - * ``` - * For more details, see protobuffer [self - * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). - * - * Generated from protobuf field bytes proto_descriptors = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getProtoDescriptors() - { - return $this->proto_descriptors; - } - - /** - * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements. - * Contains a protobuf-serialized - * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). - * To generate it, [install](https://grpc.io/docs/protoc-installation/) and - * run `protoc` with --include_imports and --descriptor_set_out. For example, - * to generate for moon/shot/app.proto, run - * ``` - * $protoc --proto_path=/app_path --proto_path=/lib_path \ - * --include_imports \ - * --descriptor_set_out=descriptors.data \ - * moon/shot/app.proto - * ``` - * For more details, see protobuffer [self - * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). - * - * Generated from protobuf field bytes proto_descriptors = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setProtoDescriptors($var) - { - GPBUtil::checkString($var, False); - $this->proto_descriptors = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseMetadata.php deleted file mode 100644 index 19c926a4aa5e..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseMetadata.php +++ /dev/null @@ -1,182 +0,0 @@ -google.spanner.admin.database.v1.UpdateDatabaseMetadata - */ -class UpdateDatabaseMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The request for - * [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]. - * - * Generated from protobuf field .google.spanner.admin.database.v1.UpdateDatabaseRequest request = 1; - */ - protected $request = null; - /** - * The progress of the - * [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase] - * operation. - * - * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 2; - */ - protected $progress = null; - /** - * The time at which this operation was cancelled. If set, this operation is - * in the process of undoing itself (which is best-effort). - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - */ - protected $cancel_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseRequest $request - * The request for - * [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]. - * @type \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress $progress - * The progress of the - * [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase] - * operation. - * @type \Google\Protobuf\Timestamp $cancel_time - * The time at which this operation was cancelled. If set, this operation is - * in the process of undoing itself (which is best-effort). - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * The request for - * [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]. - * - * Generated from protobuf field .google.spanner.admin.database.v1.UpdateDatabaseRequest request = 1; - * @return \Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseRequest|null - */ - public function getRequest() - { - return $this->request; - } - - public function hasRequest() - { - return isset($this->request); - } - - public function clearRequest() - { - unset($this->request); - } - - /** - * The request for - * [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]. - * - * Generated from protobuf field .google.spanner.admin.database.v1.UpdateDatabaseRequest request = 1; - * @param \Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseRequest $var - * @return $this - */ - public function setRequest($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseRequest::class); - $this->request = $var; - - return $this; - } - - /** - * The progress of the - * [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase] - * operation. - * - * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 2; - * @return \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress|null - */ - public function getProgress() - { - return $this->progress; - } - - public function hasProgress() - { - return isset($this->progress); - } - - public function clearProgress() - { - unset($this->progress); - } - - /** - * The progress of the - * [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase] - * operation. - * - * Generated from protobuf field .google.spanner.admin.database.v1.OperationProgress progress = 2; - * @param \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress $var - * @return $this - */ - public function setProgress($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\OperationProgress::class); - $this->progress = $var; - - return $this; - } - - /** - * The time at which this operation was cancelled. If set, this operation is - * in the process of undoing itself (which is best-effort). - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCancelTime() - { - return $this->cancel_time; - } - - public function hasCancelTime() - { - return isset($this->cancel_time); - } - - public function clearCancelTime() - { - unset($this->cancel_time); - } - - /** - * The time at which this operation was cancelled. If set, this operation is - * in the process of undoing itself (which is best-effort). - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCancelTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->cancel_time = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseRequest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseRequest.php deleted file mode 100644 index 7fecddf2dd12..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/UpdateDatabaseRequest.php +++ /dev/null @@ -1,152 +0,0 @@ -google.spanner.admin.database.v1.UpdateDatabaseRequest - */ -class UpdateDatabaseRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The database to update. - * The `name` field of the database is of the form - * `projects//instances//databases/`. - * - * Generated from protobuf field .google.spanner.admin.database.v1.Database database = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $database = null; - /** - * Required. The list of fields to update. Currently, only - * `enable_drop_protection` field can be updated. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $update_mask = null; - - /** - * @param \Google\Cloud\Spanner\Admin\Database\V1\Database $database Required. The database to update. - * The `name` field of the database is of the form - * `projects//instances//databases/`. - * @param \Google\Protobuf\FieldMask $updateMask Required. The list of fields to update. Currently, only - * `enable_drop_protection` field can be updated. - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseRequest - * - * @experimental - */ - public static function build(\Google\Cloud\Spanner\Admin\Database\V1\Database $database, \Google\Protobuf\FieldMask $updateMask): self - { - return (new self()) - ->setDatabase($database) - ->setUpdateMask($updateMask); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\Admin\Database\V1\Database $database - * Required. The database to update. - * The `name` field of the database is of the form - * `projects//instances//databases/`. - * @type \Google\Protobuf\FieldMask $update_mask - * Required. The list of fields to update. Currently, only - * `enable_drop_protection` field can be updated. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Database\V1\SpannerDatabaseAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The database to update. - * The `name` field of the database is of the form - * `projects//instances//databases/`. - * - * Generated from protobuf field .google.spanner.admin.database.v1.Database database = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\Admin\Database\V1\Database|null - */ - public function getDatabase() - { - return $this->database; - } - - public function hasDatabase() - { - return isset($this->database); - } - - public function clearDatabase() - { - unset($this->database); - } - - /** - * Required. The database to update. - * The `name` field of the database is of the form - * `projects//instances//databases/`. - * - * Generated from protobuf field .google.spanner.admin.database.v1.Database database = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\Admin\Database\V1\Database $var - * @return $this - */ - public function setDatabase($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Database\V1\Database::class); - $this->database = $var; - - return $this; - } - - /** - * Required. The list of fields to update. Currently, only - * `enable_drop_protection` field can be updated. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\FieldMask|null - */ - public function getUpdateMask() - { - return $this->update_mask; - } - - public function hasUpdateMask() - { - return isset($this->update_mask); - } - - public function clearUpdateMask() - { - unset($this->update_mask); - } - - /** - * Required. The list of fields to update. Currently, only - * `enable_drop_protection` field can be updated. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Protobuf\FieldMask $var - * @return $this - */ - public function setUpdateMask($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); - $this->update_mask = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/copy_backup.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/copy_backup.php deleted file mode 100644 index bf4780852402..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/copy_backup.php +++ /dev/null @@ -1,116 +0,0 @@ -/instances//backups//operations/` - * and can be used to track copying of the backup. The operation is associated - * with the destination backup. - * The [metadata][google.longrunning.Operation.metadata] field type is - * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [Backup][google.spanner.admin.database.v1.Backup], if successful. - * Cancelling the returned operation will stop the copying and delete the - * destination backup. Concurrent CopyBackup requests can run on the same - * source backup. - * - * @param string $formattedParent The name of the destination instance that will contain the backup - * copy. Values are of the form: `projects//instances/`. Please see - * {@see DatabaseAdminClient::instanceName()} for help formatting this field. - * @param string $backupId The id of the backup copy. - * The `backup_id` appended to `parent` forms the full backup_uri of the form - * `projects//instances//backups/`. - * @param string $formattedSourceBackup The source backup to be copied. - * The source backup needs to be in READY state for it to be copied. - * Once CopyBackup is in progress, the source backup cannot be deleted or - * cleaned up on expiration until CopyBackup is finished. - * Values are of the form: - * `projects//instances//backups/`. Please see - * {@see DatabaseAdminClient::backupName()} for help formatting this field. - */ -function copy_backup_sample( - string $formattedParent, - string $backupId, - string $formattedSourceBackup -): void { - // Create a client. - $databaseAdminClient = new DatabaseAdminClient(); - - // Prepare the request message. - $expireTime = new Timestamp(); - $request = (new CopyBackupRequest()) - ->setParent($formattedParent) - ->setBackupId($backupId) - ->setSourceBackup($formattedSourceBackup) - ->setExpireTime($expireTime); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $databaseAdminClient->copyBackup($request); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var Backup $result */ - $result = $response->getResult(); - printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); - } else { - /** @var Status $error */ - $error = $response->getError(); - printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = DatabaseAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); - $backupId = '[BACKUP_ID]'; - $formattedSourceBackup = DatabaseAdminClient::backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); - - copy_backup_sample($formattedParent, $backupId, $formattedSourceBackup); -} -// [END spanner_v1_generated_DatabaseAdmin_CopyBackup_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_backup.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_backup.php deleted file mode 100644 index f37b442933b9..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_backup.php +++ /dev/null @@ -1,106 +0,0 @@ -/instances//backups//operations/` - * and can be used to track creation of the backup. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [Backup][google.spanner.admin.database.v1.Backup], if successful. - * Cancelling the returned operation will stop the creation and delete the - * backup. There can be only one pending backup creation per database. Backup - * creation of different databases can run concurrently. - * - * @param string $formattedParent The name of the instance in which the backup will be - * created. This must be the same instance that contains the database the - * backup will be created from. The backup will be stored in the - * location(s) specified in the instance configuration of this - * instance. Values are of the form - * `projects//instances/`. Please see - * {@see DatabaseAdminClient::instanceName()} for help formatting this field. - * @param string $backupId The id of the backup to be created. The `backup_id` appended to - * `parent` forms the full backup name of the form - * `projects//instances//backups/`. - */ -function create_backup_sample(string $formattedParent, string $backupId): void -{ - // Create a client. - $databaseAdminClient = new DatabaseAdminClient(); - - // Prepare the request message. - $backup = new Backup(); - $request = (new CreateBackupRequest()) - ->setParent($formattedParent) - ->setBackupId($backupId) - ->setBackup($backup); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $databaseAdminClient->createBackup($request); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var Backup $result */ - $result = $response->getResult(); - printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); - } else { - /** @var Status $error */ - $error = $response->getError(); - printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = DatabaseAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); - $backupId = '[BACKUP_ID]'; - - create_backup_sample($formattedParent, $backupId); -} -// [END spanner_v1_generated_DatabaseAdmin_CreateBackup_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_backup_schedule.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_backup_schedule.php deleted file mode 100644 index ba14928345f0..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_backup_schedule.php +++ /dev/null @@ -1,78 +0,0 @@ -/instances//databases//backupSchedules/`. - */ -function create_backup_schedule_sample(string $formattedParent, string $backupScheduleId): void -{ - // Create a client. - $databaseAdminClient = new DatabaseAdminClient(); - - // Prepare the request message. - $backupSchedule = new BackupSchedule(); - $request = (new CreateBackupScheduleRequest()) - ->setParent($formattedParent) - ->setBackupScheduleId($backupScheduleId) - ->setBackupSchedule($backupSchedule); - - // Call the API and handle any network failures. - try { - /** @var BackupSchedule $response */ - $response = $databaseAdminClient->createBackupSchedule($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = DatabaseAdminClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $backupScheduleId = '[BACKUP_SCHEDULE_ID]'; - - create_backup_schedule_sample($formattedParent, $backupScheduleId); -} -// [END spanner_v1_generated_DatabaseAdmin_CreateBackupSchedule_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_database.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_database.php deleted file mode 100644 index 308c9926dcd8..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/create_database.php +++ /dev/null @@ -1,98 +0,0 @@ -/operations/` and - * can be used to track preparation of the database. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [Database][google.spanner.admin.database.v1.Database], if successful. - * - * @param string $formattedParent The name of the instance that will serve the new database. - * Values are of the form `projects//instances/`. Please see - * {@see DatabaseAdminClient::instanceName()} for help formatting this field. - * @param string $createStatement A `CREATE DATABASE` statement, which specifies the ID of the - * new database. The database ID must conform to the regular expression - * `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length. - * If the database ID is a reserved word or if it contains a hyphen, the - * database ID must be enclosed in backticks (`` ` ``). - */ -function create_database_sample(string $formattedParent, string $createStatement): void -{ - // Create a client. - $databaseAdminClient = new DatabaseAdminClient(); - - // Prepare the request message. - $request = (new CreateDatabaseRequest()) - ->setParent($formattedParent) - ->setCreateStatement($createStatement); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $databaseAdminClient->createDatabase($request); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var Database $result */ - $result = $response->getResult(); - printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); - } else { - /** @var Status $error */ - $error = $response->getError(); - printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = DatabaseAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); - $createStatement = '[CREATE_STATEMENT]'; - - create_database_sample($formattedParent, $createStatement); -} -// [END spanner_v1_generated_DatabaseAdmin_CreateDatabase_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/delete_backup.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/delete_backup.php deleted file mode 100644 index 46ba2aa004e1..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/delete_backup.php +++ /dev/null @@ -1,72 +0,0 @@ -/instances//backups/`. Please see - * {@see DatabaseAdminClient::backupName()} for help formatting this field. - */ -function delete_backup_sample(string $formattedName): void -{ - // Create a client. - $databaseAdminClient = new DatabaseAdminClient(); - - // Prepare the request message. - $request = (new DeleteBackupRequest()) - ->setName($formattedName); - - // Call the API and handle any network failures. - try { - $databaseAdminClient->deleteBackup($request); - printf('Call completed successfully.' . PHP_EOL); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = DatabaseAdminClient::backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); - - delete_backup_sample($formattedName); -} -// [END spanner_v1_generated_DatabaseAdmin_DeleteBackup_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/delete_backup_schedule.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/delete_backup_schedule.php deleted file mode 100644 index ed7fab2b6c98..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/delete_backup_schedule.php +++ /dev/null @@ -1,76 +0,0 @@ -/instances//databases//backupSchedules/`. Please see - * {@see DatabaseAdminClient::backupScheduleName()} for help formatting this field. - */ -function delete_backup_schedule_sample(string $formattedName): void -{ - // Create a client. - $databaseAdminClient = new DatabaseAdminClient(); - - // Prepare the request message. - $request = (new DeleteBackupScheduleRequest()) - ->setName($formattedName); - - // Call the API and handle any network failures. - try { - $databaseAdminClient->deleteBackupSchedule($request); - printf('Call completed successfully.' . PHP_EOL); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = DatabaseAdminClient::backupScheduleName( - '[PROJECT]', - '[INSTANCE]', - '[DATABASE]', - '[SCHEDULE]' - ); - - delete_backup_schedule_sample($formattedName); -} -// [END spanner_v1_generated_DatabaseAdmin_DeleteBackupSchedule_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/drop_database.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/drop_database.php deleted file mode 100644 index 691a64182331..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/drop_database.php +++ /dev/null @@ -1,73 +0,0 @@ -setDatabase($formattedDatabase); - - // Call the API and handle any network failures. - try { - $databaseAdminClient->dropDatabase($request); - printf('Call completed successfully.' . PHP_EOL); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedDatabase = DatabaseAdminClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - - drop_database_sample($formattedDatabase); -} -// [END spanner_v1_generated_DatabaseAdmin_DropDatabase_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_backup.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_backup.php deleted file mode 100644 index dd0c37e50d96..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_backup.php +++ /dev/null @@ -1,74 +0,0 @@ -/instances//backups/`. Please see - * {@see DatabaseAdminClient::backupName()} for help formatting this field. - */ -function get_backup_sample(string $formattedName): void -{ - // Create a client. - $databaseAdminClient = new DatabaseAdminClient(); - - // Prepare the request message. - $request = (new GetBackupRequest()) - ->setName($formattedName); - - // Call the API and handle any network failures. - try { - /** @var Backup $response */ - $response = $databaseAdminClient->getBackup($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = DatabaseAdminClient::backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); - - get_backup_sample($formattedName); -} -// [END spanner_v1_generated_DatabaseAdmin_GetBackup_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_backup_schedule.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_backup_schedule.php deleted file mode 100644 index d6b4b6d9996b..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_backup_schedule.php +++ /dev/null @@ -1,78 +0,0 @@ -/instances//databases//backupSchedules/`. Please see - * {@see DatabaseAdminClient::backupScheduleName()} for help formatting this field. - */ -function get_backup_schedule_sample(string $formattedName): void -{ - // Create a client. - $databaseAdminClient = new DatabaseAdminClient(); - - // Prepare the request message. - $request = (new GetBackupScheduleRequest()) - ->setName($formattedName); - - // Call the API and handle any network failures. - try { - /** @var BackupSchedule $response */ - $response = $databaseAdminClient->getBackupSchedule($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = DatabaseAdminClient::backupScheduleName( - '[PROJECT]', - '[INSTANCE]', - '[DATABASE]', - '[SCHEDULE]' - ); - - get_backup_schedule_sample($formattedName); -} -// [END spanner_v1_generated_DatabaseAdmin_GetBackupSchedule_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_database.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_database.php deleted file mode 100644 index 2d3f26df97fe..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_database.php +++ /dev/null @@ -1,72 +0,0 @@ -/instances//databases/`. Please see - * {@see DatabaseAdminClient::databaseName()} for help formatting this field. - */ -function get_database_sample(string $formattedName): void -{ - // Create a client. - $databaseAdminClient = new DatabaseAdminClient(); - - // Prepare the request message. - $request = (new GetDatabaseRequest()) - ->setName($formattedName); - - // Call the API and handle any network failures. - try { - /** @var Database $response */ - $response = $databaseAdminClient->getDatabase($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = DatabaseAdminClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - - get_database_sample($formattedName); -} -// [END spanner_v1_generated_DatabaseAdmin_GetDatabase_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_database_ddl.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_database_ddl.php deleted file mode 100644 index 011dd8892cfb..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_database_ddl.php +++ /dev/null @@ -1,75 +0,0 @@ -/instances//databases/` - * Please see {@see DatabaseAdminClient::databaseName()} for help formatting this field. - */ -function get_database_ddl_sample(string $formattedDatabase): void -{ - // Create a client. - $databaseAdminClient = new DatabaseAdminClient(); - - // Prepare the request message. - $request = (new GetDatabaseDdlRequest()) - ->setDatabase($formattedDatabase); - - // Call the API and handle any network failures. - try { - /** @var GetDatabaseDdlResponse $response */ - $response = $databaseAdminClient->getDatabaseDdl($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedDatabase = DatabaseAdminClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - - get_database_ddl_sample($formattedDatabase); -} -// [END spanner_v1_generated_DatabaseAdmin_GetDatabaseDdl_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_iam_policy.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_iam_policy.php deleted file mode 100644 index 4bbbe40d0e1f..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/get_iam_policy.php +++ /dev/null @@ -1,78 +0,0 @@ -setResource($resource); - - // Call the API and handle any network failures. - try { - /** @var Policy $response */ - $response = $databaseAdminClient->getIamPolicy($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $resource = '[RESOURCE]'; - - get_iam_policy_sample($resource); -} -// [END spanner_v1_generated_DatabaseAdmin_GetIamPolicy_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backup_operations.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backup_operations.php deleted file mode 100644 index 2298fb55c22a..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backup_operations.php +++ /dev/null @@ -1,86 +0,0 @@ -/instances//backups//operations/`. - * The long-running operation - * [metadata][google.longrunning.Operation.metadata] field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that have completed/failed/canceled within the last 7 days, - * and pending operations. Operations returned are ordered by - * `operation.metadata.value.progress.start_time` in descending order starting - * from the most recently started operation. - * - * @param string $formattedParent The instance of the backup operations. Values are of - * the form `projects//instances/`. Please see - * {@see DatabaseAdminClient::instanceName()} for help formatting this field. - */ -function list_backup_operations_sample(string $formattedParent): void -{ - // Create a client. - $databaseAdminClient = new DatabaseAdminClient(); - - // Prepare the request message. - $request = (new ListBackupOperationsRequest()) - ->setParent($formattedParent); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $databaseAdminClient->listBackupOperations($request); - - /** @var Operation $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = DatabaseAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); - - list_backup_operations_sample($formattedParent); -} -// [END spanner_v1_generated_DatabaseAdmin_ListBackupOperations_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backup_schedules.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backup_schedules.php deleted file mode 100644 index 82cd57070834..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backup_schedules.php +++ /dev/null @@ -1,78 +0,0 @@ -/instances//databases/ - * Please see {@see DatabaseAdminClient::databaseName()} for help formatting this field. - */ -function list_backup_schedules_sample(string $formattedParent): void -{ - // Create a client. - $databaseAdminClient = new DatabaseAdminClient(); - - // Prepare the request message. - $request = (new ListBackupSchedulesRequest()) - ->setParent($formattedParent); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $databaseAdminClient->listBackupSchedules($request); - - /** @var BackupSchedule $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = DatabaseAdminClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - - list_backup_schedules_sample($formattedParent); -} -// [END spanner_v1_generated_DatabaseAdmin_ListBackupSchedules_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backups.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backups.php deleted file mode 100644 index d687264c7a41..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_backups.php +++ /dev/null @@ -1,79 +0,0 @@ -/instances/`. Please see - * {@see DatabaseAdminClient::instanceName()} for help formatting this field. - */ -function list_backups_sample(string $formattedParent): void -{ - // Create a client. - $databaseAdminClient = new DatabaseAdminClient(); - - // Prepare the request message. - $request = (new ListBackupsRequest()) - ->setParent($formattedParent); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $databaseAdminClient->listBackups($request); - - /** @var Backup $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = DatabaseAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); - - list_backups_sample($formattedParent); -} -// [END spanner_v1_generated_DatabaseAdmin_ListBackups_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_database_operations.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_database_operations.php deleted file mode 100644 index b5fdc2e72e1f..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_database_operations.php +++ /dev/null @@ -1,84 +0,0 @@ -/instances//databases//operations/`. - * The long-running operation - * [metadata][google.longrunning.Operation.metadata] field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that have completed/failed/canceled within the last 7 days, - * and pending operations. - * - * @param string $formattedParent The instance of the database operations. - * Values are of the form `projects//instances/`. Please see - * {@see DatabaseAdminClient::instanceName()} for help formatting this field. - */ -function list_database_operations_sample(string $formattedParent): void -{ - // Create a client. - $databaseAdminClient = new DatabaseAdminClient(); - - // Prepare the request message. - $request = (new ListDatabaseOperationsRequest()) - ->setParent($formattedParent); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $databaseAdminClient->listDatabaseOperations($request); - - /** @var Operation $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = DatabaseAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); - - list_database_operations_sample($formattedParent); -} -// [END spanner_v1_generated_DatabaseAdmin_ListDatabaseOperations_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_database_roles.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_database_roles.php deleted file mode 100644 index adad9a597fe4..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_database_roles.php +++ /dev/null @@ -1,78 +0,0 @@ -/instances//databases/`. Please see - * {@see DatabaseAdminClient::databaseName()} for help formatting this field. - */ -function list_database_roles_sample(string $formattedParent): void -{ - // Create a client. - $databaseAdminClient = new DatabaseAdminClient(); - - // Prepare the request message. - $request = (new ListDatabaseRolesRequest()) - ->setParent($formattedParent); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $databaseAdminClient->listDatabaseRoles($request); - - /** @var DatabaseRole $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = DatabaseAdminClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - - list_database_roles_sample($formattedParent); -} -// [END spanner_v1_generated_DatabaseAdmin_ListDatabaseRoles_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_databases.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_databases.php deleted file mode 100644 index 34951db4e1cf..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/list_databases.php +++ /dev/null @@ -1,77 +0,0 @@ -/instances/`. Please see - * {@see DatabaseAdminClient::instanceName()} for help formatting this field. - */ -function list_databases_sample(string $formattedParent): void -{ - // Create a client. - $databaseAdminClient = new DatabaseAdminClient(); - - // Prepare the request message. - $request = (new ListDatabasesRequest()) - ->setParent($formattedParent); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $databaseAdminClient->listDatabases($request); - - /** @var Database $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = DatabaseAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); - - list_databases_sample($formattedParent); -} -// [END spanner_v1_generated_DatabaseAdmin_ListDatabases_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/restore_database.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/restore_database.php deleted file mode 100644 index bc4a42a8b5e1..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/restore_database.php +++ /dev/null @@ -1,109 +0,0 @@ -/instances//databases//operations/`, - * and can be used to track the progress of the operation, and to cancel it. - * The [metadata][google.longrunning.Operation.metadata] field type is - * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. - * The [response][google.longrunning.Operation.response] type - * is [Database][google.spanner.admin.database.v1.Database], if - * successful. Cancelling the returned operation will stop the restore and - * delete the database. - * There can be only one database being restored into an instance at a time. - * Once the restore operation completes, a new restore operation can be - * initiated, without waiting for the optimize operation associated with the - * first restore to complete. - * - * @param string $formattedParent The name of the instance in which to create the - * restored database. This instance must be in the same project and - * have the same instance configuration as the instance containing - * the source backup. Values are of the form - * `projects//instances/`. Please see - * {@see DatabaseAdminClient::instanceName()} for help formatting this field. - * @param string $databaseId The id of the database to create and restore to. This - * database must not already exist. The `database_id` appended to - * `parent` forms the full database name of the form - * `projects//instances//databases/`. - */ -function restore_database_sample(string $formattedParent, string $databaseId): void -{ - // Create a client. - $databaseAdminClient = new DatabaseAdminClient(); - - // Prepare the request message. - $request = (new RestoreDatabaseRequest()) - ->setParent($formattedParent) - ->setDatabaseId($databaseId); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $databaseAdminClient->restoreDatabase($request); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var Database $result */ - $result = $response->getResult(); - printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); - } else { - /** @var Status $error */ - $error = $response->getError(); - printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = DatabaseAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); - $databaseId = '[DATABASE_ID]'; - - restore_database_sample($formattedParent, $databaseId); -} -// [END spanner_v1_generated_DatabaseAdmin_RestoreDatabase_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/set_iam_policy.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/set_iam_policy.php deleted file mode 100644 index 3b13570033d8..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/set_iam_policy.php +++ /dev/null @@ -1,79 +0,0 @@ -setResource($resource) - ->setPolicy($policy); - - // Call the API and handle any network failures. - try { - /** @var Policy $response */ - $response = $databaseAdminClient->setIamPolicy($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $resource = '[RESOURCE]'; - - set_iam_policy_sample($resource); -} -// [END spanner_v1_generated_DatabaseAdmin_SetIamPolicy_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/test_iam_permissions.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/test_iam_permissions.php deleted file mode 100644 index 5dabcf6475f4..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/test_iam_permissions.php +++ /dev/null @@ -1,87 +0,0 @@ -setResource($resource) - ->setPermissions($permissions); - - // Call the API and handle any network failures. - try { - /** @var TestIamPermissionsResponse $response */ - $response = $databaseAdminClient->testIamPermissions($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $resource = '[RESOURCE]'; - $permissionsElement = '[PERMISSIONS]'; - - test_iam_permissions_sample($resource, $permissionsElement); -} -// [END spanner_v1_generated_DatabaseAdmin_TestIamPermissions_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_backup.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_backup.php deleted file mode 100644 index af4bc1f93d3f..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_backup.php +++ /dev/null @@ -1,63 +0,0 @@ -setBackup($backup) - ->setUpdateMask($updateMask); - - // Call the API and handle any network failures. - try { - /** @var Backup $response */ - $response = $databaseAdminClient->updateBackup($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} -// [END spanner_v1_generated_DatabaseAdmin_UpdateBackup_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_backup_schedule.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_backup_schedule.php deleted file mode 100644 index b00ed6cc827e..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_backup_schedule.php +++ /dev/null @@ -1,62 +0,0 @@ -setBackupSchedule($backupSchedule) - ->setUpdateMask($updateMask); - - // Call the API and handle any network failures. - try { - /** @var BackupSchedule $response */ - $response = $databaseAdminClient->updateBackupSchedule($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} -// [END spanner_v1_generated_DatabaseAdmin_UpdateBackupSchedule_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_database.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_database.php deleted file mode 100644 index 2897445d8857..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_database.php +++ /dev/null @@ -1,126 +0,0 @@ -/instances//databases//operations/` - * and can be used to track the database modification. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [Database][google.spanner.admin.database.v1.Database], if successful. - * - * @param string $databaseName The name of the database. Values are of the form - * `projects//instances//databases/`, - * where `` is as specified in the `CREATE DATABASE` - * statement. This name can be passed to other API methods to - * identify the database. - */ -function update_database_sample(string $databaseName): void -{ - // Create a client. - $databaseAdminClient = new DatabaseAdminClient(); - - // Prepare the request message. - $database = (new Database()) - ->setName($databaseName); - $updateMask = new FieldMask(); - $request = (new UpdateDatabaseRequest()) - ->setDatabase($database) - ->setUpdateMask($updateMask); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $databaseAdminClient->updateDatabase($request); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var Database $result */ - $result = $response->getResult(); - printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); - } else { - /** @var Status $error */ - $error = $response->getError(); - printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $databaseName = '[NAME]'; - - update_database_sample($databaseName); -} -// [END spanner_v1_generated_DatabaseAdmin_UpdateDatabase_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_database_ddl.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_database_ddl.php deleted file mode 100644 index 9597e1cda6ef..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/samples/V1/DatabaseAdminClient/update_database_ddl.php +++ /dev/null @@ -1,91 +0,0 @@ -/operations/` and can be used to - * track execution of the schema change(s). The - * [metadata][google.longrunning.Operation.metadata] field type is - * [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]. - * The operation has no response. - * - * @param string $formattedDatabase The database to update. Please see - * {@see DatabaseAdminClient::databaseName()} for help formatting this field. - * @param string $statementsElement DDL statements to be applied to the database. - */ -function update_database_ddl_sample(string $formattedDatabase, string $statementsElement): void -{ - // Create a client. - $databaseAdminClient = new DatabaseAdminClient(); - - // Prepare the request message. - $statements = [$statementsElement,]; - $request = (new UpdateDatabaseDdlRequest()) - ->setDatabase($formattedDatabase) - ->setStatements($statements); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $databaseAdminClient->updateDatabaseDdl($request); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - printf('Operation completed successfully.' . PHP_EOL); - } else { - /** @var Status $error */ - $error = $response->getError(); - printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedDatabase = DatabaseAdminClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $statementsElement = '[STATEMENTS]'; - - update_database_ddl_sample($formattedDatabase, $statementsElement); -} -// [END spanner_v1_generated_DatabaseAdmin_UpdateDatabaseDdl_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/Client/DatabaseAdminClient.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/Client/DatabaseAdminClient.php deleted file mode 100644 index 6b925d2de9e4..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/Client/DatabaseAdminClient.php +++ /dev/null @@ -1,1232 +0,0 @@ - copyBackupAsync(CopyBackupRequest $request, array $optionalArgs = []) - * @method PromiseInterface createBackupAsync(CreateBackupRequest $request, array $optionalArgs = []) - * @method PromiseInterface createBackupScheduleAsync(CreateBackupScheduleRequest $request, array $optionalArgs = []) - * @method PromiseInterface createDatabaseAsync(CreateDatabaseRequest $request, array $optionalArgs = []) - * @method PromiseInterface deleteBackupAsync(DeleteBackupRequest $request, array $optionalArgs = []) - * @method PromiseInterface deleteBackupScheduleAsync(DeleteBackupScheduleRequest $request, array $optionalArgs = []) - * @method PromiseInterface dropDatabaseAsync(DropDatabaseRequest $request, array $optionalArgs = []) - * @method PromiseInterface getBackupAsync(GetBackupRequest $request, array $optionalArgs = []) - * @method PromiseInterface getBackupScheduleAsync(GetBackupScheduleRequest $request, array $optionalArgs = []) - * @method PromiseInterface getDatabaseAsync(GetDatabaseRequest $request, array $optionalArgs = []) - * @method PromiseInterface getDatabaseDdlAsync(GetDatabaseDdlRequest $request, array $optionalArgs = []) - * @method PromiseInterface getIamPolicyAsync(GetIamPolicyRequest $request, array $optionalArgs = []) - * @method PromiseInterface listBackupOperationsAsync(ListBackupOperationsRequest $request, array $optionalArgs = []) - * @method PromiseInterface listBackupSchedulesAsync(ListBackupSchedulesRequest $request, array $optionalArgs = []) - * @method PromiseInterface listBackupsAsync(ListBackupsRequest $request, array $optionalArgs = []) - * @method PromiseInterface listDatabaseOperationsAsync(ListDatabaseOperationsRequest $request, array $optionalArgs = []) - * @method PromiseInterface listDatabaseRolesAsync(ListDatabaseRolesRequest $request, array $optionalArgs = []) - * @method PromiseInterface listDatabasesAsync(ListDatabasesRequest $request, array $optionalArgs = []) - * @method PromiseInterface restoreDatabaseAsync(RestoreDatabaseRequest $request, array $optionalArgs = []) - * @method PromiseInterface setIamPolicyAsync(SetIamPolicyRequest $request, array $optionalArgs = []) - * @method PromiseInterface testIamPermissionsAsync(TestIamPermissionsRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateBackupAsync(UpdateBackupRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateBackupScheduleAsync(UpdateBackupScheduleRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateDatabaseAsync(UpdateDatabaseRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateDatabaseDdlAsync(UpdateDatabaseDdlRequest $request, array $optionalArgs = []) - */ -final class DatabaseAdminClient -{ - use GapicClientTrait; - use ResourceHelperTrait; - - /** The name of the service. */ - private const SERVICE_NAME = 'google.spanner.admin.database.v1.DatabaseAdmin'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - private const SERVICE_ADDRESS = 'spanner.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'spanner.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - private const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - private const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/spanner.admin', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/database_admin_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/database_admin_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/database_admin_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/database_admin_rest_client_config.php', - ], - ], - ]; - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; - $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); - $operation->reload(); - return $operation; - } - - /** - * Formats a string containing the fully-qualified path to represent a backup - * resource. - * - * @param string $project - * @param string $instance - * @param string $backup - * - * @return string The formatted backup resource. - */ - public static function backupName(string $project, string $instance, string $backup): string - { - return self::getPathTemplate('backup')->render([ - 'project' => $project, - 'instance' => $instance, - 'backup' => $backup, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * backup_schedule resource. - * - * @param string $project - * @param string $instance - * @param string $database - * @param string $schedule - * - * @return string The formatted backup_schedule resource. - */ - public static function backupScheduleName(string $project, string $instance, string $database, string $schedule): string - { - return self::getPathTemplate('backupSchedule')->render([ - 'project' => $project, - 'instance' => $instance, - 'database' => $database, - 'schedule' => $schedule, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a crypto_key - * resource. - * - * @param string $project - * @param string $location - * @param string $keyRing - * @param string $cryptoKey - * - * @return string The formatted crypto_key resource. - */ - public static function cryptoKeyName(string $project, string $location, string $keyRing, string $cryptoKey): string - { - return self::getPathTemplate('cryptoKey')->render([ - 'project' => $project, - 'location' => $location, - 'key_ring' => $keyRing, - 'crypto_key' => $cryptoKey, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * crypto_key_version resource. - * - * @param string $project - * @param string $location - * @param string $keyRing - * @param string $cryptoKey - * @param string $cryptoKeyVersion - * - * @return string The formatted crypto_key_version resource. - */ - public static function cryptoKeyVersionName(string $project, string $location, string $keyRing, string $cryptoKey, string $cryptoKeyVersion): string - { - return self::getPathTemplate('cryptoKeyVersion')->render([ - 'project' => $project, - 'location' => $location, - 'key_ring' => $keyRing, - 'crypto_key' => $cryptoKey, - 'crypto_key_version' => $cryptoKeyVersion, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a database - * resource. - * - * @param string $project - * @param string $instance - * @param string $database - * - * @return string The formatted database resource. - */ - public static function databaseName(string $project, string $instance, string $database): string - { - return self::getPathTemplate('database')->render([ - 'project' => $project, - 'instance' => $instance, - 'database' => $database, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a instance - * resource. - * - * @param string $project - * @param string $instance - * - * @return string The formatted instance resource. - */ - public static function instanceName(string $project, string $instance): string - { - return self::getPathTemplate('instance')->render([ - 'project' => $project, - 'instance' => $instance, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - backup: projects/{project}/instances/{instance}/backups/{backup} - * - backupSchedule: projects/{project}/instances/{instance}/databases/{database}/backupSchedules/{schedule} - * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key} - * - cryptoKeyVersion: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version} - * - database: projects/{project}/instances/{instance}/databases/{database} - * - instance: projects/{project}/instances/{instance} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param ?string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName(string $formattedName, ?string $template = null): array - { - return self::parseFormattedName($formattedName, $template); - } - - /** - * Constructor. - * - * Setting the "SPANNER_EMULATOR_HOST" environment variable will automatically set - * the API Endpoint to the value specified in the variable, as well as ensure that - * empty credentials are used in the transport layer. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'spanner.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * @type false|LoggerInterface $logger - * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the - * 'GOOGLE_SDK_PHP_LOGGING' environment flag - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $options = $this->setDefaultEmulatorConfig($options); - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** Handles execution of the async variants for each documented method. */ - public function __call($method, $args) - { - if (substr($method, -5) !== 'Async') { - trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); - } - - array_unshift($args, substr($method, 0, -5)); - return call_user_func_array([$this, 'startAsyncCall'], $args); - } - - /** - * Starts copying a Cloud Spanner Backup. - * The returned backup [long-running operation][google.longrunning.Operation] - * will have a name of the format - * `projects//instances//backups//operations/` - * and can be used to track copying of the backup. The operation is associated - * with the destination backup. - * The [metadata][google.longrunning.Operation.metadata] field type is - * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [Backup][google.spanner.admin.database.v1.Backup], if successful. - * Cancelling the returned operation will stop the copying and delete the - * destination backup. Concurrent CopyBackup requests can run on the same - * source backup. - * - * The async variant is {@see DatabaseAdminClient::copyBackupAsync()} . - * - * @example samples/V1/DatabaseAdminClient/copy_backup.php - * - * @param CopyBackupRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function copyBackup(CopyBackupRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('CopyBackup', $request, $callOptions)->wait(); - } - - /** - * Starts creating a new Cloud Spanner Backup. - * The returned backup [long-running operation][google.longrunning.Operation] - * will have a name of the format - * `projects//instances//backups//operations/` - * and can be used to track creation of the backup. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [Backup][google.spanner.admin.database.v1.Backup], if successful. - * Cancelling the returned operation will stop the creation and delete the - * backup. There can be only one pending backup creation per database. Backup - * creation of different databases can run concurrently. - * - * The async variant is {@see DatabaseAdminClient::createBackupAsync()} . - * - * @example samples/V1/DatabaseAdminClient/create_backup.php - * - * @param CreateBackupRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function createBackup(CreateBackupRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('CreateBackup', $request, $callOptions)->wait(); - } - - /** - * Creates a new backup schedule. - * - * The async variant is {@see DatabaseAdminClient::createBackupScheduleAsync()} . - * - * @example samples/V1/DatabaseAdminClient/create_backup_schedule.php - * - * @param CreateBackupScheduleRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return BackupSchedule - * - * @throws ApiException Thrown if the API call fails. - */ - public function createBackupSchedule(CreateBackupScheduleRequest $request, array $callOptions = []): BackupSchedule - { - return $this->startApiCall('CreateBackupSchedule', $request, $callOptions)->wait(); - } - - /** - * Creates a new Cloud Spanner database and starts to prepare it for serving. - * The returned [long-running operation][google.longrunning.Operation] will - * have a name of the format `/operations/` and - * can be used to track preparation of the database. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [Database][google.spanner.admin.database.v1.Database], if successful. - * - * The async variant is {@see DatabaseAdminClient::createDatabaseAsync()} . - * - * @example samples/V1/DatabaseAdminClient/create_database.php - * - * @param CreateDatabaseRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function createDatabase(CreateDatabaseRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('CreateDatabase', $request, $callOptions)->wait(); - } - - /** - * Deletes a pending or completed - * [Backup][google.spanner.admin.database.v1.Backup]. - * - * The async variant is {@see DatabaseAdminClient::deleteBackupAsync()} . - * - * @example samples/V1/DatabaseAdminClient/delete_backup.php - * - * @param DeleteBackupRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteBackup(DeleteBackupRequest $request, array $callOptions = []): void - { - $this->startApiCall('DeleteBackup', $request, $callOptions)->wait(); - } - - /** - * Deletes a backup schedule. - * - * The async variant is {@see DatabaseAdminClient::deleteBackupScheduleAsync()} . - * - * @example samples/V1/DatabaseAdminClient/delete_backup_schedule.php - * - * @param DeleteBackupScheduleRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteBackupSchedule(DeleteBackupScheduleRequest $request, array $callOptions = []): void - { - $this->startApiCall('DeleteBackupSchedule', $request, $callOptions)->wait(); - } - - /** - * Drops (aka deletes) a Cloud Spanner database. - * Completed backups for the database will be retained according to their - * `expire_time`. - * Note: Cloud Spanner might continue to accept requests for a few seconds - * after the database has been deleted. - * - * The async variant is {@see DatabaseAdminClient::dropDatabaseAsync()} . - * - * @example samples/V1/DatabaseAdminClient/drop_database.php - * - * @param DropDatabaseRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException Thrown if the API call fails. - */ - public function dropDatabase(DropDatabaseRequest $request, array $callOptions = []): void - { - $this->startApiCall('DropDatabase', $request, $callOptions)->wait(); - } - - /** - * Gets metadata on a pending or completed - * [Backup][google.spanner.admin.database.v1.Backup]. - * - * The async variant is {@see DatabaseAdminClient::getBackupAsync()} . - * - * @example samples/V1/DatabaseAdminClient/get_backup.php - * - * @param GetBackupRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Backup - * - * @throws ApiException Thrown if the API call fails. - */ - public function getBackup(GetBackupRequest $request, array $callOptions = []): Backup - { - return $this->startApiCall('GetBackup', $request, $callOptions)->wait(); - } - - /** - * Gets backup schedule for the input schedule name. - * - * The async variant is {@see DatabaseAdminClient::getBackupScheduleAsync()} . - * - * @example samples/V1/DatabaseAdminClient/get_backup_schedule.php - * - * @param GetBackupScheduleRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return BackupSchedule - * - * @throws ApiException Thrown if the API call fails. - */ - public function getBackupSchedule(GetBackupScheduleRequest $request, array $callOptions = []): BackupSchedule - { - return $this->startApiCall('GetBackupSchedule', $request, $callOptions)->wait(); - } - - /** - * Gets the state of a Cloud Spanner database. - * - * The async variant is {@see DatabaseAdminClient::getDatabaseAsync()} . - * - * @example samples/V1/DatabaseAdminClient/get_database.php - * - * @param GetDatabaseRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Database - * - * @throws ApiException Thrown if the API call fails. - */ - public function getDatabase(GetDatabaseRequest $request, array $callOptions = []): Database - { - return $this->startApiCall('GetDatabase', $request, $callOptions)->wait(); - } - - /** - * Returns the schema of a Cloud Spanner database as a list of formatted - * DDL statements. This method does not show pending schema updates, those may - * be queried using the [Operations][google.longrunning.Operations] API. - * - * The async variant is {@see DatabaseAdminClient::getDatabaseDdlAsync()} . - * - * @example samples/V1/DatabaseAdminClient/get_database_ddl.php - * - * @param GetDatabaseDdlRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return GetDatabaseDdlResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function getDatabaseDdl(GetDatabaseDdlRequest $request, array $callOptions = []): GetDatabaseDdlResponse - { - return $this->startApiCall('GetDatabaseDdl', $request, $callOptions)->wait(); - } - - /** - * Gets the access control policy for a database or backup resource. - * Returns an empty policy if a database or backup exists but does not have a - * policy set. - * - * Authorization requires `spanner.databases.getIamPolicy` permission on - * [resource][google.iam.v1.GetIamPolicyRequest.resource]. - * For backups, authorization requires `spanner.backups.getIamPolicy` - * permission on [resource][google.iam.v1.GetIamPolicyRequest.resource]. - * - * The async variant is {@see DatabaseAdminClient::getIamPolicyAsync()} . - * - * @example samples/V1/DatabaseAdminClient/get_iam_policy.php - * - * @param GetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * Lists the backup [long-running operations][google.longrunning.Operation] in - * the given instance. A backup operation has a name of the form - * `projects//instances//backups//operations/`. - * The long-running operation - * [metadata][google.longrunning.Operation.metadata] field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that have completed/failed/canceled within the last 7 days, - * and pending operations. Operations returned are ordered by - * `operation.metadata.value.progress.start_time` in descending order starting - * from the most recently started operation. - * - * The async variant is {@see DatabaseAdminClient::listBackupOperationsAsync()} . - * - * @example samples/V1/DatabaseAdminClient/list_backup_operations.php - * - * @param ListBackupOperationsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listBackupOperations(ListBackupOperationsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListBackupOperations', $request, $callOptions); - } - - /** - * Lists all the backup schedules for the database. - * - * The async variant is {@see DatabaseAdminClient::listBackupSchedulesAsync()} . - * - * @example samples/V1/DatabaseAdminClient/list_backup_schedules.php - * - * @param ListBackupSchedulesRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listBackupSchedules(ListBackupSchedulesRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListBackupSchedules', $request, $callOptions); - } - - /** - * Lists completed and pending backups. - * Backups returned are ordered by `create_time` in descending order, - * starting from the most recent `create_time`. - * - * The async variant is {@see DatabaseAdminClient::listBackupsAsync()} . - * - * @example samples/V1/DatabaseAdminClient/list_backups.php - * - * @param ListBackupsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listBackups(ListBackupsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListBackups', $request, $callOptions); - } - - /** - * Lists database [longrunning-operations][google.longrunning.Operation]. - * A database operation has a name of the form - * `projects//instances//databases//operations/`. - * The long-running operation - * [metadata][google.longrunning.Operation.metadata] field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that have completed/failed/canceled within the last 7 days, - * and pending operations. - * - * The async variant is {@see DatabaseAdminClient::listDatabaseOperationsAsync()} . - * - * @example samples/V1/DatabaseAdminClient/list_database_operations.php - * - * @param ListDatabaseOperationsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listDatabaseOperations(ListDatabaseOperationsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListDatabaseOperations', $request, $callOptions); - } - - /** - * Lists Cloud Spanner database roles. - * - * The async variant is {@see DatabaseAdminClient::listDatabaseRolesAsync()} . - * - * @example samples/V1/DatabaseAdminClient/list_database_roles.php - * - * @param ListDatabaseRolesRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listDatabaseRoles(ListDatabaseRolesRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListDatabaseRoles', $request, $callOptions); - } - - /** - * Lists Cloud Spanner databases. - * - * The async variant is {@see DatabaseAdminClient::listDatabasesAsync()} . - * - * @example samples/V1/DatabaseAdminClient/list_databases.php - * - * @param ListDatabasesRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listDatabases(ListDatabasesRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListDatabases', $request, $callOptions); - } - - /** - * Create a new database by restoring from a completed backup. The new - * database must be in the same project and in an instance with the same - * instance configuration as the instance containing - * the backup. The returned database [long-running - * operation][google.longrunning.Operation] has a name of the format - * `projects//instances//databases//operations/`, - * and can be used to track the progress of the operation, and to cancel it. - * The [metadata][google.longrunning.Operation.metadata] field type is - * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. - * The [response][google.longrunning.Operation.response] type - * is [Database][google.spanner.admin.database.v1.Database], if - * successful. Cancelling the returned operation will stop the restore and - * delete the database. - * There can be only one database being restored into an instance at a time. - * Once the restore operation completes, a new restore operation can be - * initiated, without waiting for the optimize operation associated with the - * first restore to complete. - * - * The async variant is {@see DatabaseAdminClient::restoreDatabaseAsync()} . - * - * @example samples/V1/DatabaseAdminClient/restore_database.php - * - * @param RestoreDatabaseRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function restoreDatabase(RestoreDatabaseRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('RestoreDatabase', $request, $callOptions)->wait(); - } - - /** - * Sets the access control policy on a database or backup resource. - * Replaces any existing policy. - * - * Authorization requires `spanner.databases.setIamPolicy` - * permission on [resource][google.iam.v1.SetIamPolicyRequest.resource]. - * For backups, authorization requires `spanner.backups.setIamPolicy` - * permission on [resource][google.iam.v1.SetIamPolicyRequest.resource]. - * - * The async variant is {@see DatabaseAdminClient::setIamPolicyAsync()} . - * - * @example samples/V1/DatabaseAdminClient/set_iam_policy.php - * - * @param SetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * Returns permissions that the caller has on the specified database or backup - * resource. - * - * Attempting this RPC on a non-existent Cloud Spanner database will - * result in a NOT_FOUND error if the user has - * `spanner.databases.list` permission on the containing Cloud - * Spanner instance. Otherwise returns an empty set of permissions. - * Calling this method on a backup that does not exist will - * result in a NOT_FOUND error if the user has - * `spanner.backups.list` permission on the containing instance. - * - * The async variant is {@see DatabaseAdminClient::testIamPermissionsAsync()} . - * - * @example samples/V1/DatabaseAdminClient/test_iam_permissions.php - * - * @param TestIamPermissionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return TestIamPermissionsResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { - return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); - } - - /** - * Updates a pending or completed - * [Backup][google.spanner.admin.database.v1.Backup]. - * - * The async variant is {@see DatabaseAdminClient::updateBackupAsync()} . - * - * @example samples/V1/DatabaseAdminClient/update_backup.php - * - * @param UpdateBackupRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Backup - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateBackup(UpdateBackupRequest $request, array $callOptions = []): Backup - { - return $this->startApiCall('UpdateBackup', $request, $callOptions)->wait(); - } - - /** - * Updates a backup schedule. - * - * The async variant is {@see DatabaseAdminClient::updateBackupScheduleAsync()} . - * - * @example samples/V1/DatabaseAdminClient/update_backup_schedule.php - * - * @param UpdateBackupScheduleRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return BackupSchedule - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateBackupSchedule(UpdateBackupScheduleRequest $request, array $callOptions = []): BackupSchedule - { - return $this->startApiCall('UpdateBackupSchedule', $request, $callOptions)->wait(); - } - - /** - * Updates a Cloud Spanner database. The returned - * [long-running operation][google.longrunning.Operation] can be used to track - * the progress of updating the database. If the named database does not - * exist, returns `NOT_FOUND`. - * - * While the operation is pending: - * - * * The database's - * [reconciling][google.spanner.admin.database.v1.Database.reconciling] - * field is set to true. - * * Cancelling the operation is best-effort. If the cancellation succeeds, - * the operation metadata's - * [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time] - * is set, the updates are reverted, and the operation terminates with a - * `CANCELLED` status. - * * New UpdateDatabase requests will return a `FAILED_PRECONDITION` error - * until the pending operation is done (returns successfully or with - * error). - * * Reading the database via the API continues to give the pre-request - * values. - * - * Upon completion of the returned operation: - * - * * The new values are in effect and readable via the API. - * * The database's - * [reconciling][google.spanner.admin.database.v1.Database.reconciling] - * field becomes false. - * - * The returned [long-running operation][google.longrunning.Operation] will - * have a name of the format - * `projects//instances//databases//operations/` - * and can be used to track the database modification. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [Database][google.spanner.admin.database.v1.Database], if successful. - * - * The async variant is {@see DatabaseAdminClient::updateDatabaseAsync()} . - * - * @example samples/V1/DatabaseAdminClient/update_database.php - * - * @param UpdateDatabaseRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateDatabase(UpdateDatabaseRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('UpdateDatabase', $request, $callOptions)->wait(); - } - - /** - * Updates the schema of a Cloud Spanner database by - * creating/altering/dropping tables, columns, indexes, etc. The returned - * [long-running operation][google.longrunning.Operation] will have a name of - * the format `/operations/` and can be used to - * track execution of the schema change(s). The - * [metadata][google.longrunning.Operation.metadata] field type is - * [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]. - * The operation has no response. - * - * The async variant is {@see DatabaseAdminClient::updateDatabaseDdlAsync()} . - * - * @example samples/V1/DatabaseAdminClient/update_database_ddl.php - * - * @param UpdateDatabaseDdlRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateDatabaseDdl(UpdateDatabaseDdlRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('UpdateDatabaseDdl', $request, $callOptions)->wait(); - } - - /** Configure the gapic configuration to use a service emulator. */ - private function setDefaultEmulatorConfig(array $options): array - { - $emulatorHost = getenv('SPANNER_EMULATOR_HOST'); - if (empty($emulatorHost)) { - return $options; - } - - if ($scheme = parse_url($emulatorHost, PHP_URL_SCHEME)) { - $search = $scheme . '://'; - $emulatorHost = str_replace($search, '', $emulatorHost); - } - - $options['apiEndpoint'] ??= $emulatorHost; - $options['transportConfig']['grpc']['stubOpts']['credentials'] ??= ChannelCredentials::createInsecure(); - $options['credentials'] ??= new InsecureCredentialsWrapper(); - return $options; - } -} diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/DatabaseAdminClient.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/DatabaseAdminClient.php deleted file mode 100644 index b3ac00fb0866..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/DatabaseAdminClient.php +++ /dev/null @@ -1,34 +0,0 @@ -instanceName('[PROJECT]', '[INSTANCE]'); - * $backupId = 'backup_id'; - * $formattedSourceBackup = $databaseAdminClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); - * $expireTime = new Timestamp(); - * $operationResponse = $databaseAdminClient->copyBackup($formattedParent, $backupId, $formattedSourceBackup, $expireTime); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $databaseAdminClient->copyBackup($formattedParent, $backupId, $formattedSourceBackup, $expireTime); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'copyBackup'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\Spanner\Admin\Database\V1\Client\DatabaseAdminClient}. - */ -class DatabaseAdminGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.spanner.admin.database.v1.DatabaseAdmin'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'spanner.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'spanner.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/spanner.admin', - ]; - - private static $backupNameTemplate; - - private static $backupScheduleNameTemplate; - - private static $cryptoKeyNameTemplate; - - private static $cryptoKeyVersionNameTemplate; - - private static $databaseNameTemplate; - - private static $instanceNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/database_admin_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/database_admin_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/database_admin_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/database_admin_rest_client_config.php', - ], - ], - ]; - } - - private static function getBackupNameTemplate() - { - if (self::$backupNameTemplate == null) { - self::$backupNameTemplate = new PathTemplate('projects/{project}/instances/{instance}/backups/{backup}'); - } - - return self::$backupNameTemplate; - } - - private static function getBackupScheduleNameTemplate() - { - if (self::$backupScheduleNameTemplate == null) { - self::$backupScheduleNameTemplate = new PathTemplate('projects/{project}/instances/{instance}/databases/{database}/backupSchedules/{schedule}'); - } - - return self::$backupScheduleNameTemplate; - } - - private static function getCryptoKeyNameTemplate() - { - if (self::$cryptoKeyNameTemplate == null) { - self::$cryptoKeyNameTemplate = new PathTemplate('projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}'); - } - - return self::$cryptoKeyNameTemplate; - } - - private static function getCryptoKeyVersionNameTemplate() - { - if (self::$cryptoKeyVersionNameTemplate == null) { - self::$cryptoKeyVersionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}'); - } - - return self::$cryptoKeyVersionNameTemplate; - } - - private static function getDatabaseNameTemplate() - { - if (self::$databaseNameTemplate == null) { - self::$databaseNameTemplate = new PathTemplate('projects/{project}/instances/{instance}/databases/{database}'); - } - - return self::$databaseNameTemplate; - } - - private static function getInstanceNameTemplate() - { - if (self::$instanceNameTemplate == null) { - self::$instanceNameTemplate = new PathTemplate('projects/{project}/instances/{instance}'); - } - - return self::$instanceNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'backup' => self::getBackupNameTemplate(), - 'backupSchedule' => self::getBackupScheduleNameTemplate(), - 'cryptoKey' => self::getCryptoKeyNameTemplate(), - 'cryptoKeyVersion' => self::getCryptoKeyVersionNameTemplate(), - 'database' => self::getDatabaseNameTemplate(), - 'instance' => self::getInstanceNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a backup - * resource. - * - * @param string $project - * @param string $instance - * @param string $backup - * - * @return string The formatted backup resource. - */ - public static function backupName($project, $instance, $backup) - { - return self::getBackupNameTemplate()->render([ - 'project' => $project, - 'instance' => $instance, - 'backup' => $backup, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * backup_schedule resource. - * - * @param string $project - * @param string $instance - * @param string $database - * @param string $schedule - * - * @return string The formatted backup_schedule resource. - */ - public static function backupScheduleName($project, $instance, $database, $schedule) - { - return self::getBackupScheduleNameTemplate()->render([ - 'project' => $project, - 'instance' => $instance, - 'database' => $database, - 'schedule' => $schedule, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a crypto_key - * resource. - * - * @param string $project - * @param string $location - * @param string $keyRing - * @param string $cryptoKey - * - * @return string The formatted crypto_key resource. - */ - public static function cryptoKeyName($project, $location, $keyRing, $cryptoKey) - { - return self::getCryptoKeyNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'key_ring' => $keyRing, - 'crypto_key' => $cryptoKey, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * crypto_key_version resource. - * - * @param string $project - * @param string $location - * @param string $keyRing - * @param string $cryptoKey - * @param string $cryptoKeyVersion - * - * @return string The formatted crypto_key_version resource. - */ - public static function cryptoKeyVersionName($project, $location, $keyRing, $cryptoKey, $cryptoKeyVersion) - { - return self::getCryptoKeyVersionNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'key_ring' => $keyRing, - 'crypto_key' => $cryptoKey, - 'crypto_key_version' => $cryptoKeyVersion, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a database - * resource. - * - * @param string $project - * @param string $instance - * @param string $database - * - * @return string The formatted database resource. - */ - public static function databaseName($project, $instance, $database) - { - return self::getDatabaseNameTemplate()->render([ - 'project' => $project, - 'instance' => $instance, - 'database' => $database, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a instance - * resource. - * - * @param string $project - * @param string $instance - * - * @return string The formatted instance resource. - */ - public static function instanceName($project, $instance) - { - return self::getInstanceNameTemplate()->render([ - 'project' => $project, - 'instance' => $instance, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - backup: projects/{project}/instances/{instance}/backups/{backup} - * - backupSchedule: projects/{project}/instances/{instance}/databases/{database}/backupSchedules/{schedule} - * - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key} - * - cryptoKeyVersion: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version} - * - database: projects/{project}/instances/{instance}/databases/{database} - * - instance: projects/{project}/instances/{instance} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException("Template name $template does not exist"); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException("Input did not match any known format. Input: $formattedName"); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; - $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'spanner.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Starts copying a Cloud Spanner Backup. - * The returned backup [long-running operation][google.longrunning.Operation] - * will have a name of the format - * `projects//instances//backups//operations/` - * and can be used to track copying of the backup. The operation is associated - * with the destination backup. - * The [metadata][google.longrunning.Operation.metadata] field type is - * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [Backup][google.spanner.admin.database.v1.Backup], if successful. - * Cancelling the returned operation will stop the copying and delete the - * destination backup. Concurrent CopyBackup requests can run on the same - * source backup. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); - * $backupId = 'backup_id'; - * $formattedSourceBackup = $databaseAdminClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); - * $expireTime = new Timestamp(); - * $operationResponse = $databaseAdminClient->copyBackup($formattedParent, $backupId, $formattedSourceBackup, $expireTime); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $databaseAdminClient->copyBackup($formattedParent, $backupId, $formattedSourceBackup, $expireTime); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'copyBackup'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the destination instance that will contain the backup - * copy. Values are of the form: `projects//instances/`. - * @param string $backupId Required. The id of the backup copy. - * The `backup_id` appended to `parent` forms the full backup_uri of the form - * `projects//instances//backups/`. - * @param string $sourceBackup Required. The source backup to be copied. - * The source backup needs to be in READY state for it to be copied. - * Once CopyBackup is in progress, the source backup cannot be deleted or - * cleaned up on expiration until CopyBackup is finished. - * Values are of the form: - * `projects//instances//backups/`. - * @param Timestamp $expireTime Required. The expiration time of the backup in microsecond granularity. - * The expiration time must be at least 6 hours and at most 366 days - * from the `create_time` of the source backup. Once the `expire_time` has - * passed, the backup is eligible to be automatically deleted by Cloud Spanner - * to free the resources used by the backup. - * @param array $optionalArgs { - * Optional. - * - * @type CopyBackupEncryptionConfig $encryptionConfig - * Optional. The encryption configuration used to encrypt the backup. If this - * field is not specified, the backup will use the same encryption - * configuration as the source backup by default, namely - * [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] - * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function copyBackup($parent, $backupId, $sourceBackup, $expireTime, array $optionalArgs = []) - { - $request = new CopyBackupRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setBackupId($backupId); - $request->setSourceBackup($sourceBackup); - $request->setExpireTime($expireTime); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['encryptionConfig'])) { - $request->setEncryptionConfig($optionalArgs['encryptionConfig']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CopyBackup', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Starts creating a new Cloud Spanner Backup. - * The returned backup [long-running operation][google.longrunning.Operation] - * will have a name of the format - * `projects//instances//backups//operations/` - * and can be used to track creation of the backup. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [Backup][google.spanner.admin.database.v1.Backup], if successful. - * Cancelling the returned operation will stop the creation and delete the - * backup. There can be only one pending backup creation per database. Backup - * creation of different databases can run concurrently. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); - * $backupId = 'backup_id'; - * $backup = new Backup(); - * $operationResponse = $databaseAdminClient->createBackup($formattedParent, $backupId, $backup); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $databaseAdminClient->createBackup($formattedParent, $backupId, $backup); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'createBackup'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the instance in which the backup will be - * created. This must be the same instance that contains the database the - * backup will be created from. The backup will be stored in the - * location(s) specified in the instance configuration of this - * instance. Values are of the form - * `projects//instances/`. - * @param string $backupId Required. The id of the backup to be created. The `backup_id` appended to - * `parent` forms the full backup name of the form - * `projects//instances//backups/`. - * @param Backup $backup Required. The backup to create. - * @param array $optionalArgs { - * Optional. - * - * @type CreateBackupEncryptionConfig $encryptionConfig - * Optional. The encryption configuration used to encrypt the backup. If this - * field is not specified, the backup will use the same encryption - * configuration as the database by default, namely - * [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type] - * = `USE_DATABASE_ENCRYPTION`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createBackup($parent, $backupId, $backup, array $optionalArgs = []) - { - $request = new CreateBackupRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setBackupId($backupId); - $request->setBackup($backup); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['encryptionConfig'])) { - $request->setEncryptionConfig($optionalArgs['encryptionConfig']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CreateBackup', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Creates a new backup schedule. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $formattedParent = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - * $backupScheduleId = 'backup_schedule_id'; - * $backupSchedule = new BackupSchedule(); - * $response = $databaseAdminClient->createBackupSchedule($formattedParent, $backupScheduleId, $backupSchedule); - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the database that this backup schedule applies to. - * @param string $backupScheduleId Required. The Id to use for the backup schedule. The `backup_schedule_id` - * appended to `parent` forms the full backup schedule name of the form - * `projects//instances//databases//backupSchedules/`. - * @param BackupSchedule $backupSchedule Required. The backup schedule to create. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule - * - * @throws ApiException if the remote call fails - */ - public function createBackupSchedule($parent, $backupScheduleId, $backupSchedule, array $optionalArgs = []) - { - $request = new CreateBackupScheduleRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setBackupScheduleId($backupScheduleId); - $request->setBackupSchedule($backupSchedule); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('CreateBackupSchedule', BackupSchedule::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a new Cloud Spanner database and starts to prepare it for serving. - * The returned [long-running operation][google.longrunning.Operation] will - * have a name of the format `/operations/` and - * can be used to track preparation of the database. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [Database][google.spanner.admin.database.v1.Database], if successful. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); - * $createStatement = 'create_statement'; - * $operationResponse = $databaseAdminClient->createDatabase($formattedParent, $createStatement); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $databaseAdminClient->createDatabase($formattedParent, $createStatement); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'createDatabase'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the instance that will serve the new database. - * Values are of the form `projects//instances/`. - * @param string $createStatement Required. A `CREATE DATABASE` statement, which specifies the ID of the - * new database. The database ID must conform to the regular expression - * `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length. - * If the database ID is a reserved word or if it contains a hyphen, the - * database ID must be enclosed in backticks (`` ` ``). - * @param array $optionalArgs { - * Optional. - * - * @type string[] $extraStatements - * Optional. A list of DDL statements to run inside the newly created - * database. Statements can create tables, indexes, etc. These - * statements execute atomically with the creation of the database: - * if there is an error in any statement, the database is not created. - * @type EncryptionConfig $encryptionConfig - * Optional. The encryption configuration for the database. If this field is - * not specified, Cloud Spanner will encrypt/decrypt all data at rest using - * Google default encryption. - * @type int $databaseDialect - * Optional. The dialect of the Cloud Spanner Database. - * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\Admin\Database\V1\DatabaseDialect} - * @type string $protoDescriptors - * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in - * 'extra_statements' above. - * Contains a protobuf-serialized - * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). - * To generate it, [install](https://grpc.io/docs/protoc-installation/) and - * run `protoc` with --include_imports and --descriptor_set_out. For example, - * to generate for moon/shot/app.proto, run - * ``` - * $protoc --proto_path=/app_path --proto_path=/lib_path \ - * --include_imports \ - * --descriptor_set_out=descriptors.data \ - * moon/shot/app.proto - * ``` - * For more details, see protobuffer [self - * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createDatabase($parent, $createStatement, array $optionalArgs = []) - { - $request = new CreateDatabaseRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setCreateStatement($createStatement); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['extraStatements'])) { - $request->setExtraStatements($optionalArgs['extraStatements']); - } - - if (isset($optionalArgs['encryptionConfig'])) { - $request->setEncryptionConfig($optionalArgs['encryptionConfig']); - } - - if (isset($optionalArgs['databaseDialect'])) { - $request->setDatabaseDialect($optionalArgs['databaseDialect']); - } - - if (isset($optionalArgs['protoDescriptors'])) { - $request->setProtoDescriptors($optionalArgs['protoDescriptors']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CreateDatabase', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Deletes a pending or completed - * [Backup][google.spanner.admin.database.v1.Backup]. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $formattedName = $databaseAdminClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); - * $databaseAdminClient->deleteBackup($formattedName); - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $name Required. Name of the backup to delete. - * Values are of the form - * `projects//instances//backups/`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function deleteBackup($name, array $optionalArgs = []) - { - $request = new DeleteBackupRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DeleteBackup', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Deletes a backup schedule. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $formattedName = $databaseAdminClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]'); - * $databaseAdminClient->deleteBackupSchedule($formattedName); - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the schedule to delete. - * Values are of the form - * `projects//instances//databases//backupSchedules/`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function deleteBackupSchedule($name, array $optionalArgs = []) - { - $request = new DeleteBackupScheduleRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DeleteBackupSchedule', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Drops (aka deletes) a Cloud Spanner database. - * Completed backups for the database will be retained according to their - * `expire_time`. - * Note: Cloud Spanner might continue to accept requests for a few seconds - * after the database has been deleted. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $formattedDatabase = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - * $databaseAdminClient->dropDatabase($formattedDatabase); - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $database Required. The database to be dropped. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function dropDatabase($database, array $optionalArgs = []) - { - $request = new DropDatabaseRequest(); - $requestParamHeaders = []; - $request->setDatabase($database); - $requestParamHeaders['database'] = $database; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DropDatabase', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets metadata on a pending or completed - * [Backup][google.spanner.admin.database.v1.Backup]. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $formattedName = $databaseAdminClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); - * $response = $databaseAdminClient->getBackup($formattedName); - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $name Required. Name of the backup. - * Values are of the form - * `projects//instances//backups/`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\Backup - * - * @throws ApiException if the remote call fails - */ - public function getBackup($name, array $optionalArgs = []) - { - $request = new GetBackupRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetBackup', Backup::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets backup schedule for the input schedule name. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $formattedName = $databaseAdminClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]'); - * $response = $databaseAdminClient->getBackupSchedule($formattedName); - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the schedule to retrieve. - * Values are of the form - * `projects//instances//databases//backupSchedules/`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule - * - * @throws ApiException if the remote call fails - */ - public function getBackupSchedule($name, array $optionalArgs = []) - { - $request = new GetBackupScheduleRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetBackupSchedule', BackupSchedule::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the state of a Cloud Spanner database. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $formattedName = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - * $response = $databaseAdminClient->getDatabase($formattedName); - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the requested database. Values are of the form - * `projects//instances//databases/`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\Database - * - * @throws ApiException if the remote call fails - */ - public function getDatabase($name, array $optionalArgs = []) - { - $request = new GetDatabaseRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetDatabase', Database::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns the schema of a Cloud Spanner database as a list of formatted - * DDL statements. This method does not show pending schema updates, those may - * be queried using the [Operations][google.longrunning.Operations] API. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $formattedDatabase = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - * $response = $databaseAdminClient->getDatabaseDdl($formattedDatabase); - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $database Required. The database whose schema we wish to get. - * Values are of the form - * `projects//instances//databases/` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\GetDatabaseDdlResponse - * - * @throws ApiException if the remote call fails - */ - public function getDatabaseDdl($database, array $optionalArgs = []) - { - $request = new GetDatabaseDdlRequest(); - $requestParamHeaders = []; - $request->setDatabase($database); - $requestParamHeaders['database'] = $database; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetDatabaseDdl', GetDatabaseDdlResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a database or backup resource. - * Returns an empty policy if a database or backup exists but does not have a - * policy set. - * - * Authorization requires `spanner.databases.getIamPolicy` permission on - * [resource][google.iam.v1.GetIamPolicyRequest.resource]. - * For backups, authorization requires `spanner.backups.getIamPolicy` - * permission on [resource][google.iam.v1.GetIamPolicyRequest.resource]. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $resource = 'resource'; - * $response = $databaseAdminClient->getIamPolicy($resource); - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request)->wait(); - } - - /** - * Lists the backup [long-running operations][google.longrunning.Operation] in - * the given instance. A backup operation has a name of the form - * `projects//instances//backups//operations/`. - * The long-running operation - * [metadata][google.longrunning.Operation.metadata] field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that have completed/failed/canceled within the last 7 days, - * and pending operations. Operations returned are ordered by - * `operation.metadata.value.progress.start_time` in descending order starting - * from the most recently started operation. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); - * // Iterate over pages of elements - * $pagedResponse = $databaseAdminClient->listBackupOperations($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $databaseAdminClient->listBackupOperations($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The instance of the backup operations. Values are of - * the form `projects//instances/`. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * An expression that filters the list of returned backup operations. - * - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * - * The following fields in the [operation][google.longrunning.Operation] - * are eligible for filtering: - * - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] - * is - * `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic, but - * you can specify AND, OR, and NOT logic explicitly. - * - * Here are a few examples: - * - * * `done:true` - The operation is complete. - * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ - * `metadata.database:prod` - Returns operations where: - * * The operation's metadata type is - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. - * * The source database name of backup contains the string "prod". - * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ - * `(metadata.name:howl) AND` \ - * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Returns operations where: - * * The operation's metadata type is - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. - * * The backup name contains the string "howl". - * * The operation started before 2018-03-28T14:50:00Z. - * * The operation resulted in an error. - * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \ - * `(metadata.source_backup:test) AND` \ - * `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \ - * `(error:*)` - Returns operations where: - * * The operation's metadata type is - * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. - * * The source backup name contains the string "test". - * * The operation started before 2022-01-18T14:50:00Z. - * * The operation resulted in an error. - * * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \ - * `(metadata.database:test_db)) OR` \ - * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) - * AND` \ - * `(metadata.source_backup:test_bkp)) AND` \ - * `(error:*)` - Returns operations where: - * * The operation's metadata matches either of criteria: - * * The operation's metadata type is - * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] - * AND the source database name of the backup contains the string - * "test_db" - * * The operation's metadata type is - * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata] - * AND the source backup name contains the string "test_bkp" - * * The operation resulted in an error. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listBackupOperations($parent, array $optionalArgs = []) - { - $request = new ListBackupOperationsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListBackupOperations', $optionalArgs, ListBackupOperationsResponse::class, $request); - } - - /** - * Lists all the backup schedules for the database. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $formattedParent = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - * // Iterate over pages of elements - * $pagedResponse = $databaseAdminClient->listBackupSchedules($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $databaseAdminClient->listBackupSchedules($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. Database is the parent resource whose backup schedules should be - * listed. Values are of the form - * projects//instances//databases/ - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listBackupSchedules($parent, array $optionalArgs = []) - { - $request = new ListBackupSchedulesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListBackupSchedules', $optionalArgs, ListBackupSchedulesResponse::class, $request); - } - - /** - * Lists completed and pending backups. - * Backups returned are ordered by `create_time` in descending order, - * starting from the most recent `create_time`. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); - * // Iterate over pages of elements - * $pagedResponse = $databaseAdminClient->listBackups($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $databaseAdminClient->listBackups($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The instance to list backups from. Values are of the - * form `projects//instances/`. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * An expression that filters the list of returned backups. - * - * A filter expression consists of a field name, a comparison operator, and a - * value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * - * The following fields in the - * [Backup][google.spanner.admin.database.v1.Backup] are eligible for - * filtering: - * - * * `name` - * * `database` - * * `state` - * * `create_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ) - * * `size_bytes` - * * `backup_schedules` - * - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic, but - * you can specify AND, OR, and NOT logic explicitly. - * - * Here are a few examples: - * - * * `name:Howl` - The backup's name contains the string "howl". - * * `database:prod` - * - The database's name contains the string "prod". - * * `state:CREATING` - The backup is pending creation. - * * `state:READY` - The backup is fully created and ready for use. - * * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")` - * - The backup name contains the string "howl" and `create_time` - * of the backup is before 2018-03-28T14:50:00Z. - * * `expire_time < \"2018-03-28T14:50:00Z\"` - * - The backup `expire_time` is before 2018-03-28T14:50:00Z. - * * `size_bytes > 10000000000` - The backup's size is greater than 10GB - * * `backup_schedules:daily` - * - The backup is created from a schedule with "daily" in its name. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listBackups($parent, array $optionalArgs = []) - { - $request = new ListBackupsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListBackups', $optionalArgs, ListBackupsResponse::class, $request); - } - - /** - * Lists database [longrunning-operations][google.longrunning.Operation]. - * A database operation has a name of the form - * `projects//instances//databases//operations/`. - * The long-running operation - * [metadata][google.longrunning.Operation.metadata] field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that have completed/failed/canceled within the last 7 days, - * and pending operations. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); - * // Iterate over pages of elements - * $pagedResponse = $databaseAdminClient->listDatabaseOperations($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $databaseAdminClient->listDatabaseOperations($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The instance of the database operations. - * Values are of the form `projects//instances/`. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * An expression that filters the list of returned operations. - * - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * - * The following fields in the [Operation][google.longrunning.Operation] - * are eligible for filtering: - * - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata] - * is - * `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * - * Here are a few examples: - * - * * `done:true` - The operation is complete. - * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \ - * `(metadata.source_type:BACKUP) AND` \ - * `(metadata.backup_info.backup:backup_howl) AND` \ - * `(metadata.name:restored_howl) AND` \ - * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. - * * The database is restored from a backup. - * * The backup name contains "backup_howl". - * * The restored database's name contains "restored_howl". - * * The operation started before 2018-03-28T14:50:00Z. - * * The operation resulted in an error. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listDatabaseOperations($parent, array $optionalArgs = []) - { - $request = new ListDatabaseOperationsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListDatabaseOperations', $optionalArgs, ListDatabaseOperationsResponse::class, $request); - } - - /** - * Lists Cloud Spanner database roles. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $formattedParent = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - * // Iterate over pages of elements - * $pagedResponse = $databaseAdminClient->listDatabaseRoles($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $databaseAdminClient->listDatabaseRoles($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The database whose roles should be listed. - * Values are of the form - * `projects//instances//databases/`. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listDatabaseRoles($parent, array $optionalArgs = []) - { - $request = new ListDatabaseRolesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListDatabaseRoles', $optionalArgs, ListDatabaseRolesResponse::class, $request); - } - - /** - * Lists Cloud Spanner databases. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); - * // Iterate over pages of elements - * $pagedResponse = $databaseAdminClient->listDatabases($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $databaseAdminClient->listDatabases($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The instance whose databases should be listed. - * Values are of the form `projects//instances/`. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listDatabases($parent, array $optionalArgs = []) - { - $request = new ListDatabasesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListDatabases', $optionalArgs, ListDatabasesResponse::class, $request); - } - - /** - * Create a new database by restoring from a completed backup. The new - * database must be in the same project and in an instance with the same - * instance configuration as the instance containing - * the backup. The returned database [long-running - * operation][google.longrunning.Operation] has a name of the format - * `projects//instances//databases//operations/`, - * and can be used to track the progress of the operation, and to cancel it. - * The [metadata][google.longrunning.Operation.metadata] field type is - * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. - * The [response][google.longrunning.Operation.response] type - * is [Database][google.spanner.admin.database.v1.Database], if - * successful. Cancelling the returned operation will stop the restore and - * delete the database. - * There can be only one database being restored into an instance at a time. - * Once the restore operation completes, a new restore operation can be - * initiated, without waiting for the optimize operation associated with the - * first restore to complete. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $formattedParent = $databaseAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); - * $databaseId = 'database_id'; - * $operationResponse = $databaseAdminClient->restoreDatabase($formattedParent, $databaseId); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $databaseAdminClient->restoreDatabase($formattedParent, $databaseId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'restoreDatabase'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the instance in which to create the - * restored database. This instance must be in the same project and - * have the same instance configuration as the instance containing - * the source backup. Values are of the form - * `projects//instances/`. - * @param string $databaseId Required. The id of the database to create and restore to. This - * database must not already exist. The `database_id` appended to - * `parent` forms the full database name of the form - * `projects//instances//databases/`. - * @param array $optionalArgs { - * Optional. - * - * @type string $backup - * Name of the backup from which to restore. Values are of the form - * `projects//instances//backups/`. - * @type RestoreDatabaseEncryptionConfig $encryptionConfig - * Optional. An encryption configuration describing the encryption type and - * key resources in Cloud KMS used to encrypt/decrypt the database to restore - * to. If this field is not specified, the restored database will use the same - * encryption configuration as the backup by default, namely - * [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type] - * = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function restoreDatabase($parent, $databaseId, array $optionalArgs = []) - { - $request = new RestoreDatabaseRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setDatabaseId($databaseId); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['backup'])) { - $request->setBackup($optionalArgs['backup']); - } - - if (isset($optionalArgs['encryptionConfig'])) { - $request->setEncryptionConfig($optionalArgs['encryptionConfig']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('RestoreDatabase', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Sets the access control policy on a database or backup resource. - * Replaces any existing policy. - * - * Authorization requires `spanner.databases.setIamPolicy` - * permission on [resource][google.iam.v1.SetIamPolicyRequest.resource]. - * For backups, authorization requires `spanner.backups.setIamPolicy` - * permission on [resource][google.iam.v1.SetIamPolicyRequest.resource]. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $databaseAdminClient->setIamPolicy($resource, $policy); - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns permissions that the caller has on the specified database or backup - * resource. - * - * Attempting this RPC on a non-existent Cloud Spanner database will - * result in a NOT_FOUND error if the user has - * `spanner.databases.list` permission on the containing Cloud - * Spanner instance. Otherwise returns an empty set of permissions. - * Calling this method on a backup that does not exist will - * result in a NOT_FOUND error if the user has - * `spanner.backups.list` permission on the containing instance. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $databaseAdminClient->testIamPermissions($resource, $permissions); - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($resource, $permissions, array $optionalArgs = []) - { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Updates a pending or completed - * [Backup][google.spanner.admin.database.v1.Backup]. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $backup = new Backup(); - * $updateMask = new FieldMask(); - * $response = $databaseAdminClient->updateBackup($backup, $updateMask); - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param Backup $backup Required. The backup to update. `backup.name`, and the fields to be updated - * as specified by `update_mask` are required. Other fields are ignored. - * Update is only supported for the following fields: - * * `backup.expire_time`. - * @param FieldMask $updateMask Required. A mask specifying which fields (e.g. `expire_time`) in the - * Backup resource should be updated. This mask is relative to the Backup - * resource, not to the request message. The field mask must always be - * specified; this prevents any future fields from being erased accidentally - * by clients that do not know about them. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\Backup - * - * @throws ApiException if the remote call fails - */ - public function updateBackup($backup, $updateMask, array $optionalArgs = []) - { - $request = new UpdateBackupRequest(); - $requestParamHeaders = []; - $request->setBackup($backup); - $request->setUpdateMask($updateMask); - $requestParamHeaders['backup.name'] = $backup->getName(); - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('UpdateBackup', Backup::class, $optionalArgs, $request)->wait(); - } - - /** - * Updates a backup schedule. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $backupSchedule = new BackupSchedule(); - * $updateMask = new FieldMask(); - * $response = $databaseAdminClient->updateBackupSchedule($backupSchedule, $updateMask); - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param BackupSchedule $backupSchedule Required. The backup schedule to update. `backup_schedule.name`, and the - * fields to be updated as specified by `update_mask` are required. Other - * fields are ignored. - * @param FieldMask $updateMask Required. A mask specifying which fields in the BackupSchedule resource - * should be updated. This mask is relative to the BackupSchedule resource, - * not to the request message. The field mask must always be - * specified; this prevents any future fields from being erased - * accidentally. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule - * - * @throws ApiException if the remote call fails - */ - public function updateBackupSchedule($backupSchedule, $updateMask, array $optionalArgs = []) - { - $request = new UpdateBackupScheduleRequest(); - $requestParamHeaders = []; - $request->setBackupSchedule($backupSchedule); - $request->setUpdateMask($updateMask); - $requestParamHeaders['backup_schedule.name'] = $backupSchedule->getName(); - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('UpdateBackupSchedule', BackupSchedule::class, $optionalArgs, $request)->wait(); - } - - /** - * Updates a Cloud Spanner database. The returned - * [long-running operation][google.longrunning.Operation] can be used to track - * the progress of updating the database. If the named database does not - * exist, returns `NOT_FOUND`. - * - * While the operation is pending: - * - * * The database's - * [reconciling][google.spanner.admin.database.v1.Database.reconciling] - * field is set to true. - * * Cancelling the operation is best-effort. If the cancellation succeeds, - * the operation metadata's - * [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time] - * is set, the updates are reverted, and the operation terminates with a - * `CANCELLED` status. - * * New UpdateDatabase requests will return a `FAILED_PRECONDITION` error - * until the pending operation is done (returns successfully or with - * error). - * * Reading the database via the API continues to give the pre-request - * values. - * - * Upon completion of the returned operation: - * - * * The new values are in effect and readable via the API. - * * The database's - * [reconciling][google.spanner.admin.database.v1.Database.reconciling] - * field becomes false. - * - * The returned [long-running operation][google.longrunning.Operation] will - * have a name of the format - * `projects//instances//databases//operations/` - * and can be used to track the database modification. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [Database][google.spanner.admin.database.v1.Database], if successful. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $database = new Database(); - * $updateMask = new FieldMask(); - * $operationResponse = $databaseAdminClient->updateDatabase($database, $updateMask); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $databaseAdminClient->updateDatabase($database, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'updateDatabase'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param Database $database Required. The database to update. - * The `name` field of the database is of the form - * `projects//instances//databases/`. - * @param FieldMask $updateMask Required. The list of fields to update. Currently, only - * `enable_drop_protection` field can be updated. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateDatabase($database, $updateMask, array $optionalArgs = []) - { - $request = new UpdateDatabaseRequest(); - $requestParamHeaders = []; - $request->setDatabase($database); - $request->setUpdateMask($updateMask); - $requestParamHeaders['database.name'] = $database->getName(); - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('UpdateDatabase', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Updates the schema of a Cloud Spanner database by - * creating/altering/dropping tables, columns, indexes, etc. The returned - * [long-running operation][google.longrunning.Operation] will have a name of - * the format `/operations/` and can be used to - * track execution of the schema change(s). The - * [metadata][google.longrunning.Operation.metadata] field type is - * [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]. - * The operation has no response. - * - * Sample code: - * ``` - * $databaseAdminClient = new DatabaseAdminClient(); - * try { - * $formattedDatabase = $databaseAdminClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - * $statements = []; - * $operationResponse = $databaseAdminClient->updateDatabaseDdl($formattedDatabase, $statements); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $databaseAdminClient->updateDatabaseDdl($formattedDatabase, $statements); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $databaseAdminClient->resumeOperation($operationName, 'updateDatabaseDdl'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $databaseAdminClient->close(); - * } - * ``` - * - * @param string $database Required. The database to update. - * @param string[] $statements Required. DDL statements to be applied to the database. - * @param array $optionalArgs { - * Optional. - * - * @type string $operationId - * If empty, the new update request is assigned an - * automatically-generated operation ID. Otherwise, `operation_id` - * is used to construct the name of the resulting - * [Operation][google.longrunning.Operation]. - * - * Specifying an explicit operation ID simplifies determining - * whether the statements were executed in the event that the - * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] - * call is replayed, or the return value is otherwise lost: the - * [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database] - * and `operation_id` fields can be combined to form the - * [name][google.longrunning.Operation.name] of the resulting - * [longrunning.Operation][google.longrunning.Operation]: - * `/operations/`. - * - * `operation_id` should be unique within the database, and must be - * a valid identifier: `[a-z][a-z0-9_]*`. Note that - * automatically-generated operation IDs always begin with an - * underscore. If the named operation already exists, - * [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] - * returns `ALREADY_EXISTS`. - * @type string $protoDescriptors - * Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements. - * Contains a protobuf-serialized - * [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto). - * To generate it, [install](https://grpc.io/docs/protoc-installation/) and - * run `protoc` with --include_imports and --descriptor_set_out. For example, - * to generate for moon/shot/app.proto, run - * ``` - * $protoc --proto_path=/app_path --proto_path=/lib_path \ - * --include_imports \ - * --descriptor_set_out=descriptors.data \ - * moon/shot/app.proto - * ``` - * For more details, see protobuffer [self - * description](https://developers.google.com/protocol-buffers/docs/techniques#self-description). - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateDatabaseDdl($database, $statements, array $optionalArgs = []) - { - $request = new UpdateDatabaseDdlRequest(); - $requestParamHeaders = []; - $request->setDatabase($database); - $request->setStatements($statements); - $requestParamHeaders['database'] = $database; - if (isset($optionalArgs['operationId'])) { - $request->setOperationId($optionalArgs['operationId']); - } - - if (isset($optionalArgs['protoDescriptors'])) { - $request->setProtoDescriptors($optionalArgs['protoDescriptors']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('UpdateDatabaseDdl', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } -} diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/gapic_metadata.json b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/gapic_metadata.json deleted file mode 100644 index 42f9576de062..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/gapic_metadata.json +++ /dev/null @@ -1,143 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", - "language": "php", - "protoPackage": "google.spanner.admin.database.v1", - "libraryPackage": "Google\\Cloud\\Spanner\\Admin\\Database\\V1", - "services": { - "DatabaseAdmin": { - "clients": { - "grpc": { - "libraryClient": "DatabaseAdminGapicClient", - "rpcs": { - "CopyBackup": { - "methods": [ - "copyBackup" - ] - }, - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "CreateBackupSchedule": { - "methods": [ - "createBackupSchedule" - ] - }, - "CreateDatabase": { - "methods": [ - "createDatabase" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "DeleteBackupSchedule": { - "methods": [ - "deleteBackupSchedule" - ] - }, - "DropDatabase": { - "methods": [ - "dropDatabase" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "GetBackupSchedule": { - "methods": [ - "getBackupSchedule" - ] - }, - "GetDatabase": { - "methods": [ - "getDatabase" - ] - }, - "GetDatabaseDdl": { - "methods": [ - "getDatabaseDdl" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "ListBackupOperations": { - "methods": [ - "listBackupOperations" - ] - }, - "ListBackupSchedules": { - "methods": [ - "listBackupSchedules" - ] - }, - "ListBackups": { - "methods": [ - "listBackups" - ] - }, - "ListDatabaseOperations": { - "methods": [ - "listDatabaseOperations" - ] - }, - "ListDatabaseRoles": { - "methods": [ - "listDatabaseRoles" - ] - }, - "ListDatabases": { - "methods": [ - "listDatabases" - ] - }, - "RestoreDatabase": { - "methods": [ - "restoreDatabase" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "UpdateBackup": { - "methods": [ - "updateBackup" - ] - }, - "UpdateBackupSchedule": { - "methods": [ - "updateBackupSchedule" - ] - }, - "UpdateDatabase": { - "methods": [ - "updateDatabase" - ] - }, - "UpdateDatabaseDdl": { - "methods": [ - "updateDatabaseDdl" - ] - } - } - } - } - } - } -} \ No newline at end of file diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_client_config.json b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_client_config.json deleted file mode 100644 index c39bb9e64ee2..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_client_config.json +++ /dev/null @@ -1,193 +0,0 @@ -{ - "interfaces": { - "google.spanner.admin.database.v1.DatabaseAdmin": { - "retry_codes": { - "no_retry_codes": [], - "retry_policy_1_codes": [ - "UNAVAILABLE", - "DEADLINE_EXCEEDED" - ], - "retry_policy_2_codes": [ - "UNAVAILABLE", - "DEADLINE_EXCEEDED" - ], - "no_retry_1_codes": [], - "no_retry_2_codes": [] - }, - "retry_params": { - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0 - }, - "retry_policy_1_params": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 32000, - "initial_rpc_timeout_millis": 3600000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 3600000, - "total_timeout_millis": 3600000 - }, - "retry_policy_2_params": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 32000, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000 - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 3600000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 3600000, - "total_timeout_millis": 3600000 - }, - "no_retry_2_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000 - } - }, - "methods": { - "CopyBackup": { - "timeout_millis": 3600000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "CreateBackup": { - "timeout_millis": 3600000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "CreateBackupSchedule": { - "timeout_millis": 3600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "CreateDatabase": { - "timeout_millis": 3600000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "DeleteBackup": { - "timeout_millis": 3600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "DeleteBackupSchedule": { - "timeout_millis": 3600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "DropDatabase": { - "timeout_millis": 3600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "GetBackup": { - "timeout_millis": 3600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "GetBackupSchedule": { - "timeout_millis": 3600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "GetDatabase": { - "timeout_millis": 3600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "GetDatabaseDdl": { - "timeout_millis": 3600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "GetIamPolicy": { - "timeout_millis": 30000, - "retry_codes_name": "retry_policy_2_codes", - "retry_params_name": "retry_policy_2_params" - }, - "ListBackupOperations": { - "timeout_millis": 3600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "ListBackupSchedules": { - "timeout_millis": 3600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "ListBackups": { - "timeout_millis": 3600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "ListDatabaseOperations": { - "timeout_millis": 3600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "ListDatabaseRoles": { - "timeout_millis": 3600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "ListDatabases": { - "timeout_millis": 3600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "RestoreDatabase": { - "timeout_millis": 3600000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params" - }, - "SetIamPolicy": { - "timeout_millis": 30000, - "retry_codes_name": "no_retry_2_codes", - "retry_params_name": "no_retry_2_params" - }, - "TestIamPermissions": { - "timeout_millis": 30000, - "retry_codes_name": "no_retry_2_codes", - "retry_params_name": "no_retry_2_params" - }, - "UpdateBackup": { - "timeout_millis": 3600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "UpdateBackupSchedule": { - "timeout_millis": 3600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "UpdateDatabase": { - "timeout_millis": 3600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - }, - "UpdateDatabaseDdl": { - "timeout_millis": 3600000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params" - } - } - } - } -} diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_descriptor_config.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_descriptor_config.php deleted file mode 100644 index 8c838a9fed43..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_descriptor_config.php +++ /dev/null @@ -1,429 +0,0 @@ - [ - 'google.spanner.admin.database.v1.DatabaseAdmin' => [ - 'CopyBackup' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\Backup', - 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\CopyBackupMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'CreateBackup' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\Backup', - 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\CreateBackupMetadata', - 'initialPollDelayMillis' => '20000', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '45000', - 'totalPollTimeoutMillis' => '172800000', - ], - 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'CreateDatabase' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\Database', - 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\CreateDatabaseMetadata', - 'initialPollDelayMillis' => '20000', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '45000', - 'totalPollTimeoutMillis' => '86400000', - ], - 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'RestoreDatabase' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\Database', - 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\RestoreDatabaseMetadata', - 'initialPollDelayMillis' => '20000', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '45000', - 'totalPollTimeoutMillis' => '86400000', - ], - 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'UpdateDatabase' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\Database', - 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, - 'headerParams' => [ - [ - 'keyName' => 'database.name', - 'fieldAccessors' => [ - 'getDatabase', - 'getName', - ], - ], - ], - ], - 'UpdateDatabaseDdl' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Protobuf\GPBEmpty', - 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Database\V1\UpdateDatabaseDdlMetadata', - 'initialPollDelayMillis' => '20000', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '45000', - 'totalPollTimeoutMillis' => '86400000', - ], - 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, - 'headerParams' => [ - [ - 'keyName' => 'database', - 'fieldAccessors' => [ - 'getDatabase', - ], - ], - ], - ], - 'CreateBackupSchedule' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'DeleteBackup' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Protobuf\GPBEmpty', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'DeleteBackupSchedule' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Protobuf\GPBEmpty', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'DropDatabase' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Protobuf\GPBEmpty', - 'headerParams' => [ - [ - 'keyName' => 'database', - 'fieldAccessors' => [ - 'getDatabase', - ], - ], - ], - ], - 'GetBackup' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\Backup', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'GetBackupSchedule' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'GetDatabase' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\Database', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'GetDatabaseDdl' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\GetDatabaseDdlResponse', - 'headerParams' => [ - [ - 'keyName' => 'database', - 'fieldAccessors' => [ - 'getDatabase', - ], - ], - ], - ], - 'GetIamPolicy' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\Policy', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - ], - 'ListBackupOperations' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getOperations', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\ListBackupOperationsResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'ListBackupSchedules' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getBackupSchedules', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\ListBackupSchedulesResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'ListBackups' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getBackups', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\ListBackupsResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'ListDatabaseOperations' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getOperations', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\ListDatabaseOperationsResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'ListDatabaseRoles' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getDatabaseRoles', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\ListDatabaseRolesResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'ListDatabases' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getDatabases', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\ListDatabasesResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'SetIamPolicy' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\Policy', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - ], - 'TestIamPermissions' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\TestIamPermissionsResponse', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - ], - 'UpdateBackup' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\Backup', - 'headerParams' => [ - [ - 'keyName' => 'backup.name', - 'fieldAccessors' => [ - 'getBackup', - 'getName', - ], - ], - ], - ], - 'UpdateBackupSchedule' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Database\V1\BackupSchedule', - 'headerParams' => [ - [ - 'keyName' => 'backup_schedule.name', - 'fieldAccessors' => [ - 'getBackupSchedule', - 'getName', - ], - ], - ], - ], - 'templateMap' => [ - 'backup' => 'projects/{project}/instances/{instance}/backups/{backup}', - 'backupSchedule' => 'projects/{project}/instances/{instance}/databases/{database}/backupSchedules/{schedule}', - 'cryptoKey' => 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}', - 'cryptoKeyVersion' => 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}', - 'database' => 'projects/{project}/instances/{instance}/databases/{database}', - 'instance' => 'projects/{project}/instances/{instance}', - ], - ], - ], -]; diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_rest_client_config.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_rest_client_config.php deleted file mode 100644 index 1bf0d796614f..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_rest_client_config.php +++ /dev/null @@ -1,477 +0,0 @@ - [ - 'google.longrunning.Operations' => [ - 'CancelOperation' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations/*}:cancel', - 'additionalBindings' => [ - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations/*}:cancel', - ], - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/backups/*/operations/*}:cancel', - ], - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/instanceConfigs/*/operations/*}:cancel', - ], - ], - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'DeleteOperation' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations/*}', - 'additionalBindings' => [ - [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations/*}', - ], - [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/backups/*/operations/*}', - ], - [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/instanceConfigs/*/operations/*}', - ], - ], - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetOperation' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations/*}', - 'additionalBindings' => [ - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations/*}', - ], - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/backups/*/operations/*}', - ], - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instanceConfigs/*/operations/*}', - ], - ], - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListOperations' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations}', - 'additionalBindings' => [ - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations}', - ], - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/backups/*/operations}', - ], - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instanceConfigs/*/operations}', - ], - ], - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - ], - 'google.spanner.admin.database.v1.DatabaseAdmin' => [ - 'CopyBackup' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/backups:copy', - 'body' => '*', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'CreateBackup' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/backups', - 'body' => 'backup', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - 'queryParams' => [ - 'backup_id', - ], - ], - 'CreateBackupSchedule' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{parent=projects/*/instances/*/databases/*}/backupSchedules', - 'body' => 'backup_schedule', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - 'queryParams' => [ - 'backup_schedule_id', - ], - ], - 'CreateDatabase' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/databases', - 'body' => '*', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'DeleteBackup' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/backups/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'DeleteBackupSchedule' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/backupSchedules/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'DropDatabase' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{database=projects/*/instances/*/databases/*}', - 'placeholders' => [ - 'database' => [ - 'getters' => [ - 'getDatabase', - ], - ], - ], - ], - 'GetBackup' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/backups/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetBackupSchedule' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/backupSchedules/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetDatabase' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetDatabaseDdl' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{database=projects/*/instances/*/databases/*}/ddl', - 'placeholders' => [ - 'database' => [ - 'getters' => [ - 'getDatabase', - ], - ], - ], - ], - 'GetIamPolicy' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/instances/*/databases/*}:getIamPolicy', - 'body' => '*', - 'additionalBindings' => [ - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/instances/*/backups/*}:getIamPolicy', - 'body' => '*', - ], - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:getIamPolicy', - 'body' => '*', - ], - ], - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'ListBackupOperations' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/backupOperations', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'ListBackupSchedules' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=projects/*/instances/*/databases/*}/backupSchedules', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'ListBackups' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/backups', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'ListDatabaseOperations' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/databaseOperations', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'ListDatabaseRoles' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=projects/*/instances/*/databases/*}/databaseRoles', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'ListDatabases' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/databases', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'RestoreDatabase' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/databases:restore', - 'body' => '*', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'SetIamPolicy' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/instances/*/databases/*}:setIamPolicy', - 'body' => '*', - 'additionalBindings' => [ - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/instances/*/backups/*}:setIamPolicy', - 'body' => '*', - ], - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:setIamPolicy', - 'body' => '*', - ], - ], - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'TestIamPermissions' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/instances/*/databases/*}:testIamPermissions', - 'body' => '*', - 'additionalBindings' => [ - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/instances/*/backups/*}:testIamPermissions', - 'body' => '*', - ], - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:testIamPermissions', - 'body' => '*', - ], - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/instances/*/databases/*/databaseRoles/*}:testIamPermissions', - 'body' => '*', - ], - ], - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'UpdateBackup' => [ - 'method' => 'patch', - 'uriTemplate' => '/v1/{backup.name=projects/*/instances/*/backups/*}', - 'body' => 'backup', - 'placeholders' => [ - 'backup.name' => [ - 'getters' => [ - 'getBackup', - 'getName', - ], - ], - ], - 'queryParams' => [ - 'update_mask', - ], - ], - 'UpdateBackupSchedule' => [ - 'method' => 'patch', - 'uriTemplate' => '/v1/{backup_schedule.name=projects/*/instances/*/databases/*/backupSchedules/*}', - 'body' => 'backup_schedule', - 'placeholders' => [ - 'backup_schedule.name' => [ - 'getters' => [ - 'getBackupSchedule', - 'getName', - ], - ], - ], - 'queryParams' => [ - 'update_mask', - ], - ], - 'UpdateDatabase' => [ - 'method' => 'patch', - 'uriTemplate' => '/v1/{database.name=projects/*/instances/*/databases/*}', - 'body' => 'database', - 'placeholders' => [ - 'database.name' => [ - 'getters' => [ - 'getDatabase', - 'getName', - ], - ], - ], - 'queryParams' => [ - 'update_mask', - ], - ], - 'UpdateDatabaseDdl' => [ - 'method' => 'patch', - 'uriTemplate' => '/v1/{database=projects/*/instances/*/databases/*}/ddl', - 'body' => '*', - 'placeholders' => [ - 'database' => [ - 'getters' => [ - 'getDatabase', - ], - ], - ], - ], - ], - ], - 'numericEnums' => true, -]; diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/tests/Unit/V1/Client/DatabaseAdminClientTest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/tests/Unit/V1/Client/DatabaseAdminClientTest.php deleted file mode 100644 index 9f3811b985fd..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/tests/Unit/V1/Client/DatabaseAdminClientTest.php +++ /dev/null @@ -1,2352 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return DatabaseAdminClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new DatabaseAdminClient($options); - } - - /** @test */ - public function copyBackupTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/copyBackupTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $database = 'database1789464955'; - $name = 'name3373707'; - $sizeBytes = 1796325715; - $freeableSizeBytes = 1302251206; - $exclusiveSizeBytes = 1085921554; - $incrementalBackupChainId = 'incrementalBackupChainId-792099119'; - $expectedResponse = new Backup(); - $expectedResponse->setDatabase($database); - $expectedResponse->setName($name); - $expectedResponse->setSizeBytes($sizeBytes); - $expectedResponse->setFreeableSizeBytes($freeableSizeBytes); - $expectedResponse->setExclusiveSizeBytes($exclusiveSizeBytes); - $expectedResponse->setIncrementalBackupChainId($incrementalBackupChainId); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/copyBackupTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $backupId = 'backupId1355353272'; - $formattedSourceBackup = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); - $expireTime = new Timestamp(); - $request = (new CopyBackupRequest()) - ->setParent($formattedParent) - ->setBackupId($backupId) - ->setSourceBackup($formattedSourceBackup) - ->setExpireTime($expireTime); - $response = $gapicClient->copyBackup($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/CopyBackup', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getBackupId(); - $this->assertProtobufEquals($backupId, $actualValue); - $actualValue = $actualApiRequestObject->getSourceBackup(); - $this->assertProtobufEquals($formattedSourceBackup, $actualValue); - $actualValue = $actualApiRequestObject->getExpireTime(); - $this->assertProtobufEquals($expireTime, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/copyBackupTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function copyBackupExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/copyBackupTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $backupId = 'backupId1355353272'; - $formattedSourceBackup = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); - $expireTime = new Timestamp(); - $request = (new CopyBackupRequest()) - ->setParent($formattedParent) - ->setBackupId($backupId) - ->setSourceBackup($formattedSourceBackup) - ->setExpireTime($expireTime); - $response = $gapicClient->copyBackup($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/copyBackupTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createBackupTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createBackupTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $database = 'database1789464955'; - $name = 'name3373707'; - $sizeBytes = 1796325715; - $freeableSizeBytes = 1302251206; - $exclusiveSizeBytes = 1085921554; - $incrementalBackupChainId = 'incrementalBackupChainId-792099119'; - $expectedResponse = new Backup(); - $expectedResponse->setDatabase($database); - $expectedResponse->setName($name); - $expectedResponse->setSizeBytes($sizeBytes); - $expectedResponse->setFreeableSizeBytes($freeableSizeBytes); - $expectedResponse->setExclusiveSizeBytes($exclusiveSizeBytes); - $expectedResponse->setIncrementalBackupChainId($incrementalBackupChainId); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createBackupTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $backupId = 'backupId1355353272'; - $backup = new Backup(); - $request = (new CreateBackupRequest()) - ->setParent($formattedParent) - ->setBackupId($backupId) - ->setBackup($backup); - $response = $gapicClient->createBackup($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/CreateBackup', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getBackupId(); - $this->assertProtobufEquals($backupId, $actualValue); - $actualValue = $actualApiRequestObject->getBackup(); - $this->assertProtobufEquals($backup, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createBackupTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createBackupExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createBackupTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $backupId = 'backupId1355353272'; - $backup = new Backup(); - $request = (new CreateBackupRequest()) - ->setParent($formattedParent) - ->setBackupId($backupId) - ->setBackup($backup); - $response = $gapicClient->createBackup($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createBackupTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createBackupScheduleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $expectedResponse = new BackupSchedule(); - $expectedResponse->setName($name); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $backupScheduleId = 'backupScheduleId326010054'; - $backupSchedule = new BackupSchedule(); - $request = (new CreateBackupScheduleRequest()) - ->setParent($formattedParent) - ->setBackupScheduleId($backupScheduleId) - ->setBackupSchedule($backupSchedule); - $response = $gapicClient->createBackupSchedule($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/CreateBackupSchedule', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getBackupScheduleId(); - $this->assertProtobufEquals($backupScheduleId, $actualValue); - $actualValue = $actualRequestObject->getBackupSchedule(); - $this->assertProtobufEquals($backupSchedule, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createBackupScheduleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $backupScheduleId = 'backupScheduleId326010054'; - $backupSchedule = new BackupSchedule(); - $request = (new CreateBackupScheduleRequest()) - ->setParent($formattedParent) - ->setBackupScheduleId($backupScheduleId) - ->setBackupSchedule($backupSchedule); - try { - $gapicClient->createBackupSchedule($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createDatabaseTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createDatabaseTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $versionRetentionPeriod = 'versionRetentionPeriod907249289'; - $defaultLeader = 'defaultLeader1941180615'; - $enableDropProtection = false; - $reconciling = false; - $expectedResponse = new Database(); - $expectedResponse->setName($name); - $expectedResponse->setVersionRetentionPeriod($versionRetentionPeriod); - $expectedResponse->setDefaultLeader($defaultLeader); - $expectedResponse->setEnableDropProtection($enableDropProtection); - $expectedResponse->setReconciling($reconciling); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createDatabaseTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $createStatement = 'createStatement552974828'; - $request = (new CreateDatabaseRequest()) - ->setParent($formattedParent) - ->setCreateStatement($createStatement); - $response = $gapicClient->createDatabase($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/CreateDatabase', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getCreateStatement(); - $this->assertProtobufEquals($createStatement, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createDatabaseTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createDatabaseExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createDatabaseTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $createStatement = 'createStatement552974828'; - $request = (new CreateDatabaseRequest()) - ->setParent($formattedParent) - ->setCreateStatement($createStatement); - $response = $gapicClient->createDatabase($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createDatabaseTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteBackupTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); - $request = (new DeleteBackupRequest()) - ->setName($formattedName); - $gapicClient->deleteBackup($request); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/DeleteBackup', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteBackupExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); - $request = (new DeleteBackupRequest()) - ->setName($formattedName); - try { - $gapicClient->deleteBackup($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteBackupScheduleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]'); - $request = (new DeleteBackupScheduleRequest()) - ->setName($formattedName); - $gapicClient->deleteBackupSchedule($request); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/DeleteBackupSchedule', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteBackupScheduleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]'); - $request = (new DeleteBackupScheduleRequest()) - ->setName($formattedName); - try { - $gapicClient->deleteBackupSchedule($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function dropDatabaseTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $request = (new DropDatabaseRequest()) - ->setDatabase($formattedDatabase); - $gapicClient->dropDatabase($request); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/DropDatabase', $actualFuncCall); - $actualValue = $actualRequestObject->getDatabase(); - $this->assertProtobufEquals($formattedDatabase, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function dropDatabaseExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $request = (new DropDatabaseRequest()) - ->setDatabase($formattedDatabase); - try { - $gapicClient->dropDatabase($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getBackupTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $database = 'database1789464955'; - $name2 = 'name2-1052831874'; - $sizeBytes = 1796325715; - $freeableSizeBytes = 1302251206; - $exclusiveSizeBytes = 1085921554; - $incrementalBackupChainId = 'incrementalBackupChainId-792099119'; - $expectedResponse = new Backup(); - $expectedResponse->setDatabase($database); - $expectedResponse->setName($name2); - $expectedResponse->setSizeBytes($sizeBytes); - $expectedResponse->setFreeableSizeBytes($freeableSizeBytes); - $expectedResponse->setExclusiveSizeBytes($exclusiveSizeBytes); - $expectedResponse->setIncrementalBackupChainId($incrementalBackupChainId); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); - $request = (new GetBackupRequest()) - ->setName($formattedName); - $response = $gapicClient->getBackup($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/GetBackup', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getBackupExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); - $request = (new GetBackupRequest()) - ->setName($formattedName); - try { - $gapicClient->getBackup($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getBackupScheduleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $expectedResponse = new BackupSchedule(); - $expectedResponse->setName($name2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]'); - $request = (new GetBackupScheduleRequest()) - ->setName($formattedName); - $response = $gapicClient->getBackupSchedule($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/GetBackupSchedule', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getBackupScheduleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]'); - $request = (new GetBackupScheduleRequest()) - ->setName($formattedName); - try { - $gapicClient->getBackupSchedule($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDatabaseTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $versionRetentionPeriod = 'versionRetentionPeriod907249289'; - $defaultLeader = 'defaultLeader1941180615'; - $enableDropProtection = false; - $reconciling = false; - $expectedResponse = new Database(); - $expectedResponse->setName($name2); - $expectedResponse->setVersionRetentionPeriod($versionRetentionPeriod); - $expectedResponse->setDefaultLeader($defaultLeader); - $expectedResponse->setEnableDropProtection($enableDropProtection); - $expectedResponse->setReconciling($reconciling); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $request = (new GetDatabaseRequest()) - ->setName($formattedName); - $response = $gapicClient->getDatabase($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/GetDatabase', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDatabaseExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $request = (new GetDatabaseRequest()) - ->setName($formattedName); - try { - $gapicClient->getDatabase($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDatabaseDdlTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $protoDescriptors = '13'; - $expectedResponse = new GetDatabaseDdlResponse(); - $expectedResponse->setProtoDescriptors($protoDescriptors); - $transport->addResponse($expectedResponse); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $request = (new GetDatabaseDdlRequest()) - ->setDatabase($formattedDatabase); - $response = $gapicClient->getDatabaseDdl($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/GetDatabaseDdl', $actualFuncCall); - $actualValue = $actualRequestObject->getDatabase(); - $this->assertProtobufEquals($formattedDatabase, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDatabaseDdlExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $request = (new GetDatabaseDdlRequest()) - ->setDatabase($formattedDatabase); - try { - $gapicClient->getDatabaseDdl($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); - $response = $gapicClient->getIamPolicy($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); - try { - $gapicClient->getIamPolicy($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listBackupOperationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $operationsElement = new Operation(); - $operations = [ - $operationsElement, - ]; - $expectedResponse = new ListBackupOperationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setOperations($operations); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $request = (new ListBackupOperationsRequest()) - ->setParent($formattedParent); - $response = $gapicClient->listBackupOperations($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getOperations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListBackupOperations', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listBackupOperationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $request = (new ListBackupOperationsRequest()) - ->setParent($formattedParent); - try { - $gapicClient->listBackupOperations($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listBackupSchedulesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $backupSchedulesElement = new BackupSchedule(); - $backupSchedules = [ - $backupSchedulesElement, - ]; - $expectedResponse = new ListBackupSchedulesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setBackupSchedules($backupSchedules); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $request = (new ListBackupSchedulesRequest()) - ->setParent($formattedParent); - $response = $gapicClient->listBackupSchedules($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getBackupSchedules()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListBackupSchedules', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listBackupSchedulesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $request = (new ListBackupSchedulesRequest()) - ->setParent($formattedParent); - try { - $gapicClient->listBackupSchedules($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listBackupsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $backupsElement = new Backup(); - $backups = [ - $backupsElement, - ]; - $expectedResponse = new ListBackupsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setBackups($backups); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $request = (new ListBackupsRequest()) - ->setParent($formattedParent); - $response = $gapicClient->listBackups($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getBackups()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListBackups', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listBackupsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $request = (new ListBackupsRequest()) - ->setParent($formattedParent); - try { - $gapicClient->listBackups($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDatabaseOperationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $operationsElement = new Operation(); - $operations = [ - $operationsElement, - ]; - $expectedResponse = new ListDatabaseOperationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setOperations($operations); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $request = (new ListDatabaseOperationsRequest()) - ->setParent($formattedParent); - $response = $gapicClient->listDatabaseOperations($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getOperations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabaseOperations', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDatabaseOperationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $request = (new ListDatabaseOperationsRequest()) - ->setParent($formattedParent); - try { - $gapicClient->listDatabaseOperations($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDatabaseRolesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $databaseRolesElement = new DatabaseRole(); - $databaseRoles = [ - $databaseRolesElement, - ]; - $expectedResponse = new ListDatabaseRolesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setDatabaseRoles($databaseRoles); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $request = (new ListDatabaseRolesRequest()) - ->setParent($formattedParent); - $response = $gapicClient->listDatabaseRoles($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getDatabaseRoles()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabaseRoles', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDatabaseRolesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $request = (new ListDatabaseRolesRequest()) - ->setParent($formattedParent); - try { - $gapicClient->listDatabaseRoles($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDatabasesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $databasesElement = new Database(); - $databases = [ - $databasesElement, - ]; - $expectedResponse = new ListDatabasesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setDatabases($databases); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $request = (new ListDatabasesRequest()) - ->setParent($formattedParent); - $response = $gapicClient->listDatabases($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getDatabases()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabases', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDatabasesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $request = (new ListDatabasesRequest()) - ->setParent($formattedParent); - try { - $gapicClient->listDatabases($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function restoreDatabaseTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/restoreDatabaseTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $versionRetentionPeriod = 'versionRetentionPeriod907249289'; - $defaultLeader = 'defaultLeader1941180615'; - $enableDropProtection = false; - $reconciling = false; - $expectedResponse = new Database(); - $expectedResponse->setName($name); - $expectedResponse->setVersionRetentionPeriod($versionRetentionPeriod); - $expectedResponse->setDefaultLeader($defaultLeader); - $expectedResponse->setEnableDropProtection($enableDropProtection); - $expectedResponse->setReconciling($reconciling); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/restoreDatabaseTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $databaseId = 'databaseId816491103'; - $request = (new RestoreDatabaseRequest()) - ->setParent($formattedParent) - ->setDatabaseId($databaseId); - $response = $gapicClient->restoreDatabase($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/RestoreDatabase', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getDatabaseId(); - $this->assertProtobufEquals($databaseId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/restoreDatabaseTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function restoreDatabaseExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/restoreDatabaseTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $databaseId = 'databaseId816491103'; - $request = (new RestoreDatabaseRequest()) - ->setParent($formattedParent) - ->setDatabaseId($databaseId); - $response = $gapicClient->restoreDatabase($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/restoreDatabaseTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); - $response = $gapicClient->setIamPolicy($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); - try { - $gapicClient->setIamPolicy($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); - $response = $gapicClient->testIamPermissions($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); - try { - $gapicClient->testIamPermissions($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateBackupTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $database = 'database1789464955'; - $name = 'name3373707'; - $sizeBytes = 1796325715; - $freeableSizeBytes = 1302251206; - $exclusiveSizeBytes = 1085921554; - $incrementalBackupChainId = 'incrementalBackupChainId-792099119'; - $expectedResponse = new Backup(); - $expectedResponse->setDatabase($database); - $expectedResponse->setName($name); - $expectedResponse->setSizeBytes($sizeBytes); - $expectedResponse->setFreeableSizeBytes($freeableSizeBytes); - $expectedResponse->setExclusiveSizeBytes($exclusiveSizeBytes); - $expectedResponse->setIncrementalBackupChainId($incrementalBackupChainId); - $transport->addResponse($expectedResponse); - // Mock request - $backup = new Backup(); - $updateMask = new FieldMask(); - $request = (new UpdateBackupRequest()) - ->setBackup($backup) - ->setUpdateMask($updateMask); - $response = $gapicClient->updateBackup($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/UpdateBackup', $actualFuncCall); - $actualValue = $actualRequestObject->getBackup(); - $this->assertProtobufEquals($backup, $actualValue); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateBackupExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $backup = new Backup(); - $updateMask = new FieldMask(); - $request = (new UpdateBackupRequest()) - ->setBackup($backup) - ->setUpdateMask($updateMask); - try { - $gapicClient->updateBackup($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateBackupScheduleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $expectedResponse = new BackupSchedule(); - $expectedResponse->setName($name); - $transport->addResponse($expectedResponse); - // Mock request - $backupSchedule = new BackupSchedule(); - $updateMask = new FieldMask(); - $request = (new UpdateBackupScheduleRequest()) - ->setBackupSchedule($backupSchedule) - ->setUpdateMask($updateMask); - $response = $gapicClient->updateBackupSchedule($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/UpdateBackupSchedule', $actualFuncCall); - $actualValue = $actualRequestObject->getBackupSchedule(); - $this->assertProtobufEquals($backupSchedule, $actualValue); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateBackupScheduleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $backupSchedule = new BackupSchedule(); - $updateMask = new FieldMask(); - $request = (new UpdateBackupScheduleRequest()) - ->setBackupSchedule($backupSchedule) - ->setUpdateMask($updateMask); - try { - $gapicClient->updateBackupSchedule($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateDatabaseTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateDatabaseTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $versionRetentionPeriod = 'versionRetentionPeriod907249289'; - $defaultLeader = 'defaultLeader1941180615'; - $enableDropProtection = false; - $reconciling = false; - $expectedResponse = new Database(); - $expectedResponse->setName($name); - $expectedResponse->setVersionRetentionPeriod($versionRetentionPeriod); - $expectedResponse->setDefaultLeader($defaultLeader); - $expectedResponse->setEnableDropProtection($enableDropProtection); - $expectedResponse->setReconciling($reconciling); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateDatabaseTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $database = new Database(); - $databaseName = 'databaseName-459093338'; - $database->setName($databaseName); - $updateMask = new FieldMask(); - $request = (new UpdateDatabaseRequest()) - ->setDatabase($database) - ->setUpdateMask($updateMask); - $response = $gapicClient->updateDatabase($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/UpdateDatabase', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDatabase(); - $this->assertProtobufEquals($database, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateDatabaseTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateDatabaseExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateDatabaseTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $database = new Database(); - $databaseName = 'databaseName-459093338'; - $database->setName($databaseName); - $updateMask = new FieldMask(); - $request = (new UpdateDatabaseRequest()) - ->setDatabase($database) - ->setUpdateMask($updateMask); - $response = $gapicClient->updateDatabase($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateDatabaseTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateDatabaseDdlTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateDatabaseDdlTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateDatabaseDdlTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $statements = []; - $request = (new UpdateDatabaseDdlRequest()) - ->setDatabase($formattedDatabase) - ->setStatements($statements); - $response = $gapicClient->updateDatabaseDdl($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/UpdateDatabaseDdl', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDatabase(); - $this->assertProtobufEquals($formattedDatabase, $actualValue); - $actualValue = $actualApiRequestObject->getStatements(); - $this->assertProtobufEquals($statements, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateDatabaseDdlTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateDatabaseDdlExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateDatabaseDdlTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $statements = []; - $request = (new UpdateDatabaseDdlRequest()) - ->setDatabase($formattedDatabase) - ->setStatements($statements); - $response = $gapicClient->updateDatabaseDdl($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateDatabaseDdlTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function copyBackupAsyncTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/copyBackupTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $database = 'database1789464955'; - $name = 'name3373707'; - $sizeBytes = 1796325715; - $freeableSizeBytes = 1302251206; - $exclusiveSizeBytes = 1085921554; - $incrementalBackupChainId = 'incrementalBackupChainId-792099119'; - $expectedResponse = new Backup(); - $expectedResponse->setDatabase($database); - $expectedResponse->setName($name); - $expectedResponse->setSizeBytes($sizeBytes); - $expectedResponse->setFreeableSizeBytes($freeableSizeBytes); - $expectedResponse->setExclusiveSizeBytes($exclusiveSizeBytes); - $expectedResponse->setIncrementalBackupChainId($incrementalBackupChainId); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/copyBackupTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $backupId = 'backupId1355353272'; - $formattedSourceBackup = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); - $expireTime = new Timestamp(); - $request = (new CopyBackupRequest()) - ->setParent($formattedParent) - ->setBackupId($backupId) - ->setSourceBackup($formattedSourceBackup) - ->setExpireTime($expireTime); - $response = $gapicClient->copyBackupAsync($request)->wait(); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/CopyBackup', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getBackupId(); - $this->assertProtobufEquals($backupId, $actualValue); - $actualValue = $actualApiRequestObject->getSourceBackup(); - $this->assertProtobufEquals($formattedSourceBackup, $actualValue); - $actualValue = $actualApiRequestObject->getExpireTime(); - $this->assertProtobufEquals($expireTime, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/copyBackupTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } -} diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/tests/Unit/V1/DatabaseAdminClientTest.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/tests/Unit/V1/DatabaseAdminClientTest.php deleted file mode 100644 index 2371125aab73..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/tests/Unit/V1/DatabaseAdminClientTest.php +++ /dev/null @@ -1,2109 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return DatabaseAdminClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new DatabaseAdminClient($options); - } - - /** @test */ - public function copyBackupTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/copyBackupTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $database = 'database1789464955'; - $name = 'name3373707'; - $sizeBytes = 1796325715; - $freeableSizeBytes = 1302251206; - $exclusiveSizeBytes = 1085921554; - $incrementalBackupChainId = 'incrementalBackupChainId-792099119'; - $expectedResponse = new Backup(); - $expectedResponse->setDatabase($database); - $expectedResponse->setName($name); - $expectedResponse->setSizeBytes($sizeBytes); - $expectedResponse->setFreeableSizeBytes($freeableSizeBytes); - $expectedResponse->setExclusiveSizeBytes($exclusiveSizeBytes); - $expectedResponse->setIncrementalBackupChainId($incrementalBackupChainId); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/copyBackupTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $backupId = 'backupId1355353272'; - $formattedSourceBackup = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); - $expireTime = new Timestamp(); - $response = $gapicClient->copyBackup($formattedParent, $backupId, $formattedSourceBackup, $expireTime); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/CopyBackup', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getBackupId(); - $this->assertProtobufEquals($backupId, $actualValue); - $actualValue = $actualApiRequestObject->getSourceBackup(); - $this->assertProtobufEquals($formattedSourceBackup, $actualValue); - $actualValue = $actualApiRequestObject->getExpireTime(); - $this->assertProtobufEquals($expireTime, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/copyBackupTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function copyBackupExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/copyBackupTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $backupId = 'backupId1355353272'; - $formattedSourceBackup = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); - $expireTime = new Timestamp(); - $response = $gapicClient->copyBackup($formattedParent, $backupId, $formattedSourceBackup, $expireTime); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/copyBackupTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createBackupTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createBackupTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $database = 'database1789464955'; - $name = 'name3373707'; - $sizeBytes = 1796325715; - $freeableSizeBytes = 1302251206; - $exclusiveSizeBytes = 1085921554; - $incrementalBackupChainId = 'incrementalBackupChainId-792099119'; - $expectedResponse = new Backup(); - $expectedResponse->setDatabase($database); - $expectedResponse->setName($name); - $expectedResponse->setSizeBytes($sizeBytes); - $expectedResponse->setFreeableSizeBytes($freeableSizeBytes); - $expectedResponse->setExclusiveSizeBytes($exclusiveSizeBytes); - $expectedResponse->setIncrementalBackupChainId($incrementalBackupChainId); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createBackupTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $backupId = 'backupId1355353272'; - $backup = new Backup(); - $response = $gapicClient->createBackup($formattedParent, $backupId, $backup); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/CreateBackup', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getBackupId(); - $this->assertProtobufEquals($backupId, $actualValue); - $actualValue = $actualApiRequestObject->getBackup(); - $this->assertProtobufEquals($backup, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createBackupTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createBackupExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createBackupTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $backupId = 'backupId1355353272'; - $backup = new Backup(); - $response = $gapicClient->createBackup($formattedParent, $backupId, $backup); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createBackupTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createBackupScheduleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $expectedResponse = new BackupSchedule(); - $expectedResponse->setName($name); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $backupScheduleId = 'backupScheduleId326010054'; - $backupSchedule = new BackupSchedule(); - $response = $gapicClient->createBackupSchedule($formattedParent, $backupScheduleId, $backupSchedule); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/CreateBackupSchedule', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getBackupScheduleId(); - $this->assertProtobufEquals($backupScheduleId, $actualValue); - $actualValue = $actualRequestObject->getBackupSchedule(); - $this->assertProtobufEquals($backupSchedule, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createBackupScheduleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $backupScheduleId = 'backupScheduleId326010054'; - $backupSchedule = new BackupSchedule(); - try { - $gapicClient->createBackupSchedule($formattedParent, $backupScheduleId, $backupSchedule); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createDatabaseTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createDatabaseTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $versionRetentionPeriod = 'versionRetentionPeriod907249289'; - $defaultLeader = 'defaultLeader1941180615'; - $enableDropProtection = false; - $reconciling = false; - $expectedResponse = new Database(); - $expectedResponse->setName($name); - $expectedResponse->setVersionRetentionPeriod($versionRetentionPeriod); - $expectedResponse->setDefaultLeader($defaultLeader); - $expectedResponse->setEnableDropProtection($enableDropProtection); - $expectedResponse->setReconciling($reconciling); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createDatabaseTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $createStatement = 'createStatement552974828'; - $response = $gapicClient->createDatabase($formattedParent, $createStatement); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/CreateDatabase', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getCreateStatement(); - $this->assertProtobufEquals($createStatement, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createDatabaseTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createDatabaseExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createDatabaseTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $createStatement = 'createStatement552974828'; - $response = $gapicClient->createDatabase($formattedParent, $createStatement); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createDatabaseTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteBackupTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); - $gapicClient->deleteBackup($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/DeleteBackup', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteBackupExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); - try { - $gapicClient->deleteBackup($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteBackupScheduleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]'); - $gapicClient->deleteBackupSchedule($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/DeleteBackupSchedule', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteBackupScheduleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]'); - try { - $gapicClient->deleteBackupSchedule($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function dropDatabaseTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $gapicClient->dropDatabase($formattedDatabase); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/DropDatabase', $actualFuncCall); - $actualValue = $actualRequestObject->getDatabase(); - $this->assertProtobufEquals($formattedDatabase, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function dropDatabaseExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - try { - $gapicClient->dropDatabase($formattedDatabase); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getBackupTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $database = 'database1789464955'; - $name2 = 'name2-1052831874'; - $sizeBytes = 1796325715; - $freeableSizeBytes = 1302251206; - $exclusiveSizeBytes = 1085921554; - $incrementalBackupChainId = 'incrementalBackupChainId-792099119'; - $expectedResponse = new Backup(); - $expectedResponse->setDatabase($database); - $expectedResponse->setName($name2); - $expectedResponse->setSizeBytes($sizeBytes); - $expectedResponse->setFreeableSizeBytes($freeableSizeBytes); - $expectedResponse->setExclusiveSizeBytes($exclusiveSizeBytes); - $expectedResponse->setIncrementalBackupChainId($incrementalBackupChainId); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); - $response = $gapicClient->getBackup($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/GetBackup', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getBackupExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->backupName('[PROJECT]', '[INSTANCE]', '[BACKUP]'); - try { - $gapicClient->getBackup($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getBackupScheduleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $expectedResponse = new BackupSchedule(); - $expectedResponse->setName($name2); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]'); - $response = $gapicClient->getBackupSchedule($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/GetBackupSchedule', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getBackupScheduleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->backupScheduleName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SCHEDULE]'); - try { - $gapicClient->getBackupSchedule($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDatabaseTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $versionRetentionPeriod = 'versionRetentionPeriod907249289'; - $defaultLeader = 'defaultLeader1941180615'; - $enableDropProtection = false; - $reconciling = false; - $expectedResponse = new Database(); - $expectedResponse->setName($name2); - $expectedResponse->setVersionRetentionPeriod($versionRetentionPeriod); - $expectedResponse->setDefaultLeader($defaultLeader); - $expectedResponse->setEnableDropProtection($enableDropProtection); - $expectedResponse->setReconciling($reconciling); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $response = $gapicClient->getDatabase($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/GetDatabase', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDatabaseExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - try { - $gapicClient->getDatabase($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDatabaseDdlTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $protoDescriptors = '13'; - $expectedResponse = new GetDatabaseDdlResponse(); - $expectedResponse->setProtoDescriptors($protoDescriptors); - $transport->addResponse($expectedResponse); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $response = $gapicClient->getDatabaseDdl($formattedDatabase); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/GetDatabaseDdl', $actualFuncCall); - $actualValue = $actualRequestObject->getDatabase(); - $this->assertProtobufEquals($formattedDatabase, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDatabaseDdlExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - try { - $gapicClient->getDatabaseDdl($formattedDatabase); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listBackupOperationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $operationsElement = new Operation(); - $operations = [ - $operationsElement, - ]; - $expectedResponse = new ListBackupOperationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setOperations($operations); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $response = $gapicClient->listBackupOperations($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getOperations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListBackupOperations', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listBackupOperationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - try { - $gapicClient->listBackupOperations($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listBackupSchedulesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $backupSchedulesElement = new BackupSchedule(); - $backupSchedules = [ - $backupSchedulesElement, - ]; - $expectedResponse = new ListBackupSchedulesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setBackupSchedules($backupSchedules); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $response = $gapicClient->listBackupSchedules($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getBackupSchedules()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListBackupSchedules', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listBackupSchedulesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - try { - $gapicClient->listBackupSchedules($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listBackupsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $backupsElement = new Backup(); - $backups = [ - $backupsElement, - ]; - $expectedResponse = new ListBackupsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setBackups($backups); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $response = $gapicClient->listBackups($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getBackups()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListBackups', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listBackupsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - try { - $gapicClient->listBackups($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDatabaseOperationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $operationsElement = new Operation(); - $operations = [ - $operationsElement, - ]; - $expectedResponse = new ListDatabaseOperationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setOperations($operations); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $response = $gapicClient->listDatabaseOperations($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getOperations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabaseOperations', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDatabaseOperationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - try { - $gapicClient->listDatabaseOperations($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDatabaseRolesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $databaseRolesElement = new DatabaseRole(); - $databaseRoles = [ - $databaseRolesElement, - ]; - $expectedResponse = new ListDatabaseRolesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setDatabaseRoles($databaseRoles); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $response = $gapicClient->listDatabaseRoles($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getDatabaseRoles()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabaseRoles', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDatabaseRolesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - try { - $gapicClient->listDatabaseRoles($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDatabasesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $databasesElement = new Database(); - $databases = [ - $databasesElement, - ]; - $expectedResponse = new ListDatabasesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setDatabases($databases); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $response = $gapicClient->listDatabases($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getDatabases()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/ListDatabases', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDatabasesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - try { - $gapicClient->listDatabases($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function restoreDatabaseTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/restoreDatabaseTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $versionRetentionPeriod = 'versionRetentionPeriod907249289'; - $defaultLeader = 'defaultLeader1941180615'; - $enableDropProtection = false; - $reconciling = false; - $expectedResponse = new Database(); - $expectedResponse->setName($name); - $expectedResponse->setVersionRetentionPeriod($versionRetentionPeriod); - $expectedResponse->setDefaultLeader($defaultLeader); - $expectedResponse->setEnableDropProtection($enableDropProtection); - $expectedResponse->setReconciling($reconciling); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/restoreDatabaseTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $databaseId = 'databaseId816491103'; - $response = $gapicClient->restoreDatabase($formattedParent, $databaseId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/RestoreDatabase', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getDatabaseId(); - $this->assertProtobufEquals($databaseId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/restoreDatabaseTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function restoreDatabaseExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/restoreDatabaseTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $databaseId = 'databaseId816491103'; - $response = $gapicClient->restoreDatabase($formattedParent, $databaseId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/restoreDatabaseTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateBackupTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $database = 'database1789464955'; - $name = 'name3373707'; - $sizeBytes = 1796325715; - $freeableSizeBytes = 1302251206; - $exclusiveSizeBytes = 1085921554; - $incrementalBackupChainId = 'incrementalBackupChainId-792099119'; - $expectedResponse = new Backup(); - $expectedResponse->setDatabase($database); - $expectedResponse->setName($name); - $expectedResponse->setSizeBytes($sizeBytes); - $expectedResponse->setFreeableSizeBytes($freeableSizeBytes); - $expectedResponse->setExclusiveSizeBytes($exclusiveSizeBytes); - $expectedResponse->setIncrementalBackupChainId($incrementalBackupChainId); - $transport->addResponse($expectedResponse); - // Mock request - $backup = new Backup(); - $updateMask = new FieldMask(); - $response = $gapicClient->updateBackup($backup, $updateMask); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/UpdateBackup', $actualFuncCall); - $actualValue = $actualRequestObject->getBackup(); - $this->assertProtobufEquals($backup, $actualValue); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateBackupExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $backup = new Backup(); - $updateMask = new FieldMask(); - try { - $gapicClient->updateBackup($backup, $updateMask); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateBackupScheduleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $expectedResponse = new BackupSchedule(); - $expectedResponse->setName($name); - $transport->addResponse($expectedResponse); - // Mock request - $backupSchedule = new BackupSchedule(); - $updateMask = new FieldMask(); - $response = $gapicClient->updateBackupSchedule($backupSchedule, $updateMask); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/UpdateBackupSchedule', $actualFuncCall); - $actualValue = $actualRequestObject->getBackupSchedule(); - $this->assertProtobufEquals($backupSchedule, $actualValue); - $actualValue = $actualRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateBackupScheduleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $backupSchedule = new BackupSchedule(); - $updateMask = new FieldMask(); - try { - $gapicClient->updateBackupSchedule($backupSchedule, $updateMask); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateDatabaseTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateDatabaseTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $versionRetentionPeriod = 'versionRetentionPeriod907249289'; - $defaultLeader = 'defaultLeader1941180615'; - $enableDropProtection = false; - $reconciling = false; - $expectedResponse = new Database(); - $expectedResponse->setName($name); - $expectedResponse->setVersionRetentionPeriod($versionRetentionPeriod); - $expectedResponse->setDefaultLeader($defaultLeader); - $expectedResponse->setEnableDropProtection($enableDropProtection); - $expectedResponse->setReconciling($reconciling); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateDatabaseTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $database = new Database(); - $databaseName = 'databaseName-459093338'; - $database->setName($databaseName); - $updateMask = new FieldMask(); - $response = $gapicClient->updateDatabase($database, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/UpdateDatabase', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDatabase(); - $this->assertProtobufEquals($database, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateDatabaseTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateDatabaseExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateDatabaseTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $database = new Database(); - $databaseName = 'databaseName-459093338'; - $database->setName($databaseName); - $updateMask = new FieldMask(); - $response = $gapicClient->updateDatabase($database, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateDatabaseTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateDatabaseDdlTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateDatabaseDdlTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateDatabaseDdlTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $statements = []; - $response = $gapicClient->updateDatabaseDdl($formattedDatabase, $statements); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.database.v1.DatabaseAdmin/UpdateDatabaseDdl', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDatabase(); - $this->assertProtobufEquals($formattedDatabase, $actualValue); - $actualValue = $actualApiRequestObject->getStatements(); - $this->assertProtobufEquals($statements, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateDatabaseDdlTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateDatabaseDdlExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateDatabaseDdlTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $statements = []; - $response = $gapicClient->updateDatabaseDdl($formattedDatabase, $statements); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateDatabaseDdlTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } -} diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Instance/V1/Common.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Instance/V1/Common.php deleted file mode 100644 index ce280a9688c2e93af7b4ae16afde68b380f0c3af..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1447 zcmb7E-D(p-7&R%CI=x93gtnp`Yq6=eyF~A%R!N#40%;P`w1_N($?hZ_*z7E`vlW#- zfp6lA2tI|^zJuVmvp*>`LCsBuo%5aV@637gF1QNNGu&c6lTR zv$Fc}P+%ZXkz&%Po?U05BYB{N>;sgLDO33<<1gidG;K`BC%Bx{NXVTcPq2~^yPX|l z$y6l$V_kPlaFd_x1w*R_+-`E_xixl0uep$f%)6SCEDIg5bd&!am5*b{VV8=|g2fs2 z7?0labZAxA&1cjEO_lSm;vVTCUt%&+?U||eOszdL)1G-<+1^SCX}~R+Hkv4L zdndipx`gFgD(fZz?0zkvjb0Ex4-g9UJOzT#*hD3W(B~0cI?Pv_1zaev8YV(845>yj z(Pk08t-snflPn1(WHIxZ8HZ?%`EG(<`5Suo0F?$T0J+n1<}oc^;~`q}grn=zH9V-T z{HzvVd_)_~$eVD_n?ZGbCb@8pUG$`R(P_3jowG)FIO;bB?OuI!(LL`sPTS3Pqh7ja zJVsj!Fx}qZtlB9Rj2-l7!FA*Pu+gnUe6jYsfcD_EXFV@nOKm-Q##%`I!iT2giO9{u zfWexIWrhNq1W(C!9E^|W$8W{wE$t)bspd=F#MEwLW^Q6$R(@na+tx@sH=fja=GFt= x^Q-tWp(RA42}y|w(aeNo)P!7C#`m?LUhn7XK1^QtEkjsp1{#?>*&B3&&>v5k+K2!E diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Instance/V1/SpannerInstanceAdmin.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/GPBMetadata/Google/Spanner/Admin/Instance/V1/SpannerInstanceAdmin.php deleted file mode 100644 index 3bca763a961b13aecf62ffb380c5bb00eef2dfc6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17768 zcmeHPPjDRRRZovBTk}SerBAXgOIdricVo+1d94c5X-Ok_f~1)pjl8?5fv(m} zOX}?WOLvcVl|?{O971tORdS$;0t!+Ehj1drfpCEXRKY?~753&6RONz;RB_?LiTC~M z>7GC89<4W_0AH->{=WCU_rCXj@6XrWZ@t|*Zox~*Ewf?ThHF-n2PaAQ*i5$UrrWGE zYsrK5;h||KE6sY#s+o2wncT=Hck`uWb|Y7M5vMxMwp}qZ$)jfTsAjG>Eu(?7R*Y)h zYOGid$2A%ibLGiBc}JJmbT%Z#Rsv`kbra`S%;Z*KZO3$ts^J>tEk?Aw$BC9TO0=94 zM9YuwJp`!K497`|5%Lxr2p>Zd|Fzl&HLH?DMqK>wWy?VhEY~t>);Cbz)#Ra3b4(=E zJNB^MsJK?Mk)#vyD8}NQB&SKozT9e}epZu`$pTdwstfsZO}k;#${VIrv8|TdvVXf~WorXy2_#Gr}mHOp+c!_C>W%vyELJT{(KO?$YhMN=46WF~V)9j&2^{}r0J z*(cH06ElaMw%u$T+3iNdY8;jGE$TbNY1K0p+^TH7j7rHxyX?Oi)4u5~UDL zC=#VO%t+KpJ-Ii3O)Oxvtd$BgZH_|oH+?q_sr~8)!hpqq>%IZDuu^gBhPY)Jb&7WQ zpWb4&DDKY(?+5O^B<|HZR<+XftV$4A5QAC*XI4yVH{zy*U+*SozmC=+Mo8Jb5w0`= zG2pJCFZ9+2!7&KnKJ($~Qw0)5vxVMfNV4-nzrt(G=j9p)V#+E8$SzErS}V2eSdea zkX_Gh=CT`8Um%kJ#jLiWzgx_evQr9~fH?b|-`#$HDn=4;>D^puH@mktHKP7Cz@&^N z>&?cYbwtMD0*z5ZwpkdjT28BGoapQ-l`&3`j|v;DGr>oh;BSNr9$YF#g;*Q;7j1;R z4P!Rfu`@T499c}H?}k(Jsgdl!bhAaV$*AcbrHkjFB>71k7>=oPDd#Rxsn?eNODo@o zFG+vn+l;>Dq|jhig0hiqxL7j|%$hSd#<+MZT%I6>)Ha)*ZMgOc-4sj}j^^S_{a0a9 z*aw%{nY(~%#K{~aY!g|oST)4!Il#eVT%NDMD2=)1T!L-Yn?p0RM`v?dHq0N|rs>OX zo){L&ii^4@bK`7*+|UbbB1x$L%}0>0xetl2x0`mm&JB*RMIH{l$UBTi$Lvz@qJvqB zab)T>t8TeEVv&x(Q866{HK?~SADWxN#YPw#^LHWP-<1T6d|;jkPnm$xCq}K!VIZD~ zJy6s&xNwG_5}4e|=eM@A`i{1%ZK3Zf2rlFMd)cCQC8pkoQKoxx1*Z2(TB+OH$6;(8 z-Mf_A-NN~C7^S|Bey)C7fw@6SB};H?vzX25xm~2WyPnmx$69V%Tgz?dO7C~!3F3#i zyG`NbG9(ah_6vo4v4lLw&^E_5a(mj^HvSqRDAhar`I4q*-&@aSH}Kj8^*w-&=E(wF z!x6>(9lZ~D0bDF*w{rPizS73Nwylc`F{+)N{q0gtUKz=JQ+cNST2z;O9e4I?X2o?@ zJ{EtSdWky+KfGg!q+7WD>C$C+MGQ$#1}~^TRN$(BB1{lkZP#2kFu_M>AVruKV5B={ z4VOlMV&;-ar^Ag`5Z#kAsSU=+EY=XsDut$Y!(}mN^wAf{JWO@jEd^3#5$~-Lm_mS} zjOi7@nfe!FFs-%Src=TCpmD@yBZokY&PDDMj$k+&&TtRGl<&$mbufp^a11m4bzH;7 zlEGoZB+{FoaiJ2Y##j1PxM4Ua^}6ZWRz>$ODxs5yoBX*J^(gz~%(E~=S6AkLM+s<| ztANZv9LqbM?jlz%-M||#OE30pA`Q6oKAmKIBqs5lRoEoF*fZ$@o20BI_(}}h*bf}c ze$3lId^`)4ku-ei*g85!f>_I-0qd1kTW`CF?B8Gs55>m{R!GbwM!AL;VL@VOzmbf8 zHgf)NMqoi3tg_F=TfU`0y!phmZHp?KGLuMu?K$tY-^#fo<>iXp4E{lZd7rks#{7)D zP9a%%;CBG-b$YZ7_qI_{e~^GN8L7#%KU?Gmu?iO}EIDNAj<4NC)EXvpy55y?Qe%&E z(jP4q^B48Xqq%ibeNOq+l_x1)M=9WAlwrABRgehgp`7CDWsleM)q1b=^m3{ z)Jolnm~b4;C8X z2(uo;)nEdP(Sfz$<|Y_{2&(cYRFEEiXAtM@v}@x5n{a5O)AT0auaC67iA%M zU{pS6w{)j+Y*yPf6qHt)*BJQ?sUBI8^mG7H9{CMkSFSN?dxDrugq2|v+jA$S@4&cZ ziCM!7aNSEm`(%TdYZi+6$GJUB2w8qS4HJR974zJExFmE(uE7lL*5cr<6c$rdn&)n4 zMVe$|ft=kfWs8MkZZC@o>9->%X*L(D&9K zWjFRQm+vFR7+lyz{&8iRO7EBQJD9GoPsK6^&omuw%H11KPm=O&H2*<)t1n|cU5Z;G zd3Dlb@=sa^%x_zcEA`H!k5e?i-p0-tS%-@)!$~turPgd$W$&kMG_Xjr zg~53>Z-Fz0Q6S!;MU;cBW}cE_9RTc-+x)<6uv9dzVlZCl%Zk&&R;@|C0#lN0k$%(s zhywKxAjsuITe#dXKf;QR^2M2;F)XgW3v*j$mo}s_9tNV>kbz5mhT^R=5DV&BQhzS0 zz6qpDN4ixNk(Sj5yWmwUvVB1#=s9#qu_%Uh=LFWZ7DL%)qjrM52HJ}HOB8mWVQ+t7 z`>;W~W#?w21NF4mCo;L-0O9qD2QW`nF{b`HENoy^<$4_lZZvYEK9d=Ey&7h2z3Sr} z{E-4L^}0f*!!B8QE;cg>7Z0r(9@cO>3A!ugXSB;*=@!RT8(uz}Md7yh06I-v;jk~r z*yL;VrabWmd*{bMeBLRw@J7Hd%eNUuy%-LiDS%FYINWB`A1QDp=)sbM=dusjpYwb- z=(HMmfX%QnkzSGtl;L4;aA&5j{=EXT{_XmCAUuXvX=%)a$Qv;2NnFL2Huf6KIhwbh znWm|~iTltci?Fp-=ma@oYC~vhpxt2(kZ3m$yDP`WLCs`6=(zeFWFv@i(j5Hz#bIp- zE;uy3Hk@tpP2PnoLEw@Mozp|qzly=tpv8OX>{~vY99l+#u7@3G+vWK@FT8u<+RNw3 z3KjtL1ii*5@Q`)Zgk>1RLV}N`#&)Jfk@sN1{HTQ;IJ2rBwrdE7wK^s}w4q@&tIQ-P z(-CU6&Cc8co60m8G?M?i z7rV+9tY=uYQ_AbXG6>72VsyZ?PM{%91YWp-UaEM>igpK;4A zc-+8RZUc@RXuFDbs&{1nik_NAIuGxW(cj4G>I{vAK|S~8PPxGPNwgt&W`N+cRJdZB z_!yXpN2qxGM<30i$G{FArQ-Rj95dq|!}~K1cC6@#(K&@ekUXxX4XOCKkMJ^of~Q;G zS71@5fCD-N9n;81>=dlXq|BS@>my*vEKKcm$*VOx1Jhnc=UwZ2!t~7;+zf({H{Qdc zyswz`R%M3^i73Ii$8P?IWgY6L3fvf=1DUwp@9MuqFK*CS)5NE)Y{2a3h$7dOItn`f{LPdzIB|OG6m4bRgcc`DIw}6@|}xG4)Szmx7_BXNmrL zdAOqT(&UOz%RnFM1x^8?p%gsRFn9vgjpo&q3)kUf+OuJW~$2>hCJEHWj~qEznwK zjRt-rWKTl-4t!7kK!Nh@P>G*^?+Y9KaMRa>=saN6k^z}N92Zx=tH8_-9&1Z{mau!y zE&v+ygg6bZe1?--^(xE;x#CJv{}@|S{u>@nVQ)FOE=AP%&#R_LKgAuGkUC|L){}ok zP5W(u7a0zT@Hk(eX=0z|SHqioeP;`OK6t8$Lz{1X`jhX)?x5w+M{z$!JHejDs+R;V z^*rB1u){g+i=|u~k_qRhXOfg<=%X3+&8HfB#5Bk}eZ17ix|gB~jjt@7lE1@7K`@;X z{72Adzj;!GvzyiGkCjif7OaFm)+;SXG8H|q-@J&r{PgqEWj~%ey6nVip~NXNVFA{=mB}NzeFC2JBZ)j51%Y}4w~?V7V>&H zYrf%9pdk)l)K~q{M{dO+*P(2a-;2Ry5UNQ8QwYwGoQ8y&KSOw|!ky5_AwvzhA38M1 zhYu3F!;4k*LJNb$TWYwOQtd;fty2zM5vLlK1+hcT7u;j}f7=aq8v+ne*QaVeZjW z4c{%|FIo=A)sc?_$`y7UNC}^rqHLLV-NJW7@UbPb*rk--A(F#85k?At{pwR~R&u?J zhm>+PCc&!uAevs?9&V`|KgMju2cjMtlL%>azj;!;^E4yWtRIeL967^s`veh+(f<~M zYeA&zh!r8+4VWq=3qkFFM_76S=};(^sO@7dbj|?IIzYA3jpO*6pA>m;9%v6U3wo%Y zGhkEu!AHNY1>wmjkTmhZxygX3QrCkZE@&uAod4ksmilnvQj={_LGDxV+tzF;auhmP;X6?WNEyD}S zS2r0Ck_ghn=8*jENB8^W$UJ>bUObuII(XRm^9Qk8TkOLhsdXw-N-UXTYo+AMsmJ#| zkps(RHnQw}DMWlKr1Py1{5-_7*ejfDCc{Q&GJ!zgDml5{5X_};-q)?9e)w)cgC dW&RNk-#0t(NiO`RNT2U@u#x<`8mDjy@ZZDIm@NPR diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig.php deleted file mode 100644 index 2dd5cea37d14..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig.php +++ /dev/null @@ -1,183 +0,0 @@ -google.spanner.admin.instance.v1.AutoscalingConfig - */ -class AutoscalingConfig extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Autoscaling limits for an instance. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $autoscaling_limits = null; - /** - * Required. The autoscaling targets for an instance. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets autoscaling_targets = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $autoscaling_targets = null; - /** - * Optional. Optional asymmetric autoscaling options. - * Replicas matching the replica selection criteria will be autoscaled - * independently from other replicas. The autoscaler will scale the replicas - * based on the utilization of replicas identified by the replica selection. - * Replica selections should not overlap with each other. - * Other replicas (those do not match any replica selection) will be - * autoscaled together and will have the same compute capacity allocated to - * them. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $asymmetric_autoscaling_options; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingLimits $autoscaling_limits - * Required. Autoscaling limits for an instance. - * @type \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingTargets $autoscaling_targets - * Required. The autoscaling targets for an instance. - * @type array<\Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AsymmetricAutoscalingOption>|\Google\Protobuf\Internal\RepeatedField $asymmetric_autoscaling_options - * Optional. Optional asymmetric autoscaling options. - * Replicas matching the replica selection criteria will be autoscaled - * independently from other replicas. The autoscaler will scale the replicas - * based on the utilization of replicas identified by the replica selection. - * Replica selections should not overlap with each other. - * Other replicas (those do not match any replica selection) will be - * autoscaled together and will have the same compute capacity allocated to - * them. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. Autoscaling limits for an instance. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingLimits|null - */ - public function getAutoscalingLimits() - { - return $this->autoscaling_limits; - } - - public function hasAutoscalingLimits() - { - return isset($this->autoscaling_limits); - } - - public function clearAutoscalingLimits() - { - unset($this->autoscaling_limits); - } - - /** - * Required. Autoscaling limits for an instance. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingLimits $var - * @return $this - */ - public function setAutoscalingLimits($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingLimits::class); - $this->autoscaling_limits = $var; - - return $this; - } - - /** - * Required. The autoscaling targets for an instance. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets autoscaling_targets = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingTargets|null - */ - public function getAutoscalingTargets() - { - return $this->autoscaling_targets; - } - - public function hasAutoscalingTargets() - { - return isset($this->autoscaling_targets); - } - - public function clearAutoscalingTargets() - { - unset($this->autoscaling_targets); - } - - /** - * Required. The autoscaling targets for an instance. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets autoscaling_targets = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingTargets $var - * @return $this - */ - public function setAutoscalingTargets($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingTargets::class); - $this->autoscaling_targets = $var; - - return $this; - } - - /** - * Optional. Optional asymmetric autoscaling options. - * Replicas matching the replica selection criteria will be autoscaled - * independently from other replicas. The autoscaler will scale the replicas - * based on the utilization of replicas identified by the replica selection. - * Replica selections should not overlap with each other. - * Other replicas (those do not match any replica selection) will be - * autoscaled together and will have the same compute capacity allocated to - * them. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getAsymmetricAutoscalingOptions() - { - return $this->asymmetric_autoscaling_options; - } - - /** - * Optional. Optional asymmetric autoscaling options. - * Replicas matching the replica selection criteria will be autoscaled - * independently from other replicas. The autoscaler will scale the replicas - * based on the utilization of replicas identified by the replica selection. - * Replica selections should not overlap with each other. - * Other replicas (those do not match any replica selection) will be - * autoscaled together and will have the same compute capacity allocated to - * them. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param array<\Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AsymmetricAutoscalingOption>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setAsymmetricAutoscalingOptions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AsymmetricAutoscalingOption::class); - $this->asymmetric_autoscaling_options = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AsymmetricAutoscalingOption.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AsymmetricAutoscalingOption.php deleted file mode 100644 index f2f31e0b6c2c..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AsymmetricAutoscalingOption.php +++ /dev/null @@ -1,133 +0,0 @@ -google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption - */ -class AsymmetricAutoscalingOption extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Selects the replicas to which this AsymmetricAutoscalingOption - * applies. Only read-only replicas are supported. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $replica_selection = null; - /** - * Optional. Overrides applied to the top-level autoscaling configuration - * for the selected replicas. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $overrides = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaSelection $replica_selection - * Required. Selects the replicas to which this AsymmetricAutoscalingOption - * applies. Only read-only replicas are supported. - * @type \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AsymmetricAutoscalingOption\AutoscalingConfigOverrides $overrides - * Optional. Overrides applied to the top-level autoscaling configuration - * for the selected replicas. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. Selects the replicas to which this AsymmetricAutoscalingOption - * applies. Only read-only replicas are supported. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaSelection|null - */ - public function getReplicaSelection() - { - return $this->replica_selection; - } - - public function hasReplicaSelection() - { - return isset($this->replica_selection); - } - - public function clearReplicaSelection() - { - unset($this->replica_selection); - } - - /** - * Required. Selects the replicas to which this AsymmetricAutoscalingOption - * applies. Only read-only replicas are supported. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaSelection $var - * @return $this - */ - public function setReplicaSelection($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaSelection::class); - $this->replica_selection = $var; - - return $this; - } - - /** - * Optional. Overrides applied to the top-level autoscaling configuration - * for the selected replicas. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AsymmetricAutoscalingOption\AutoscalingConfigOverrides|null - */ - public function getOverrides() - { - return $this->overrides; - } - - public function hasOverrides() - { - return isset($this->overrides); - } - - public function clearOverrides() - { - unset($this->overrides); - } - - /** - * Optional. Overrides applied to the top-level autoscaling configuration - * for the selected replicas. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AsymmetricAutoscalingOption\AutoscalingConfigOverrides $var - * @return $this - */ - public function setOverrides($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AsymmetricAutoscalingOption\AutoscalingConfigOverrides::class); - $this->overrides = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(AsymmetricAutoscalingOption::class, \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig_AsymmetricAutoscalingOption::class); - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AsymmetricAutoscalingOption/AutoscalingConfigOverrides.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AsymmetricAutoscalingOption/AutoscalingConfigOverrides.php deleted file mode 100644 index e6c06e4f4013..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AsymmetricAutoscalingOption/AutoscalingConfigOverrides.php +++ /dev/null @@ -1,129 +0,0 @@ -google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides - */ -class AutoscalingConfigOverrides extends \Google\Protobuf\Internal\Message -{ - /** - * Optional. If specified, overrides the min/max limit in the top-level - * autoscaling configuration for the selected replicas. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $autoscaling_limits = null; - /** - * Optional. If specified, overrides the autoscaling target - * high_priority_cpu_utilization_percent in the top-level autoscaling - * configuration for the selected replicas. - * - * Generated from protobuf field int32 autoscaling_target_high_priority_cpu_utilization_percent = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $autoscaling_target_high_priority_cpu_utilization_percent = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingLimits $autoscaling_limits - * Optional. If specified, overrides the min/max limit in the top-level - * autoscaling configuration for the selected replicas. - * @type int $autoscaling_target_high_priority_cpu_utilization_percent - * Optional. If specified, overrides the autoscaling target - * high_priority_cpu_utilization_percent in the top-level autoscaling - * configuration for the selected replicas. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Optional. If specified, overrides the min/max limit in the top-level - * autoscaling configuration for the selected replicas. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingLimits|null - */ - public function getAutoscalingLimits() - { - return $this->autoscaling_limits; - } - - public function hasAutoscalingLimits() - { - return isset($this->autoscaling_limits); - } - - public function clearAutoscalingLimits() - { - unset($this->autoscaling_limits); - } - - /** - * Optional. If specified, overrides the min/max limit in the top-level - * autoscaling configuration for the selected replicas. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingLimits $var - * @return $this - */ - public function setAutoscalingLimits($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig\AutoscalingLimits::class); - $this->autoscaling_limits = $var; - - return $this; - } - - /** - * Optional. If specified, overrides the autoscaling target - * high_priority_cpu_utilization_percent in the top-level autoscaling - * configuration for the selected replicas. - * - * Generated from protobuf field int32 autoscaling_target_high_priority_cpu_utilization_percent = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getAutoscalingTargetHighPriorityCpuUtilizationPercent() - { - return $this->autoscaling_target_high_priority_cpu_utilization_percent; - } - - /** - * Optional. If specified, overrides the autoscaling target - * high_priority_cpu_utilization_percent in the top-level autoscaling - * configuration for the selected replicas. - * - * Generated from protobuf field int32 autoscaling_target_high_priority_cpu_utilization_percent = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setAutoscalingTargetHighPriorityCpuUtilizationPercent($var) - { - GPBUtil::checkInt32($var); - $this->autoscaling_target_high_priority_cpu_utilization_percent = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(AutoscalingConfigOverrides::class, \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig_AsymmetricAutoscalingOption_AutoscalingConfigOverrides::class); - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AutoscalingLimits.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AutoscalingLimits.php deleted file mode 100644 index 48ac73c059f5..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AutoscalingLimits.php +++ /dev/null @@ -1,205 +0,0 @@ -google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits - */ -class AutoscalingLimits extends \Google\Protobuf\Internal\Message -{ - protected $min_limit; - protected $max_limit; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $min_nodes - * Minimum number of nodes allocated to the instance. If set, this number - * should be greater than or equal to 1. - * @type int $min_processing_units - * Minimum number of processing units allocated to the instance. If set, - * this number should be multiples of 1000. - * @type int $max_nodes - * Maximum number of nodes allocated to the instance. If set, this number - * should be greater than or equal to min_nodes. - * @type int $max_processing_units - * Maximum number of processing units allocated to the instance. If set, - * this number should be multiples of 1000 and be greater than or equal to - * min_processing_units. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Minimum number of nodes allocated to the instance. If set, this number - * should be greater than or equal to 1. - * - * Generated from protobuf field int32 min_nodes = 1; - * @return int - */ - public function getMinNodes() - { - return $this->readOneof(1); - } - - public function hasMinNodes() - { - return $this->hasOneof(1); - } - - /** - * Minimum number of nodes allocated to the instance. If set, this number - * should be greater than or equal to 1. - * - * Generated from protobuf field int32 min_nodes = 1; - * @param int $var - * @return $this - */ - public function setMinNodes($var) - { - GPBUtil::checkInt32($var); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * Minimum number of processing units allocated to the instance. If set, - * this number should be multiples of 1000. - * - * Generated from protobuf field int32 min_processing_units = 2; - * @return int - */ - public function getMinProcessingUnits() - { - return $this->readOneof(2); - } - - public function hasMinProcessingUnits() - { - return $this->hasOneof(2); - } - - /** - * Minimum number of processing units allocated to the instance. If set, - * this number should be multiples of 1000. - * - * Generated from protobuf field int32 min_processing_units = 2; - * @param int $var - * @return $this - */ - public function setMinProcessingUnits($var) - { - GPBUtil::checkInt32($var); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * Maximum number of nodes allocated to the instance. If set, this number - * should be greater than or equal to min_nodes. - * - * Generated from protobuf field int32 max_nodes = 3; - * @return int - */ - public function getMaxNodes() - { - return $this->readOneof(3); - } - - public function hasMaxNodes() - { - return $this->hasOneof(3); - } - - /** - * Maximum number of nodes allocated to the instance. If set, this number - * should be greater than or equal to min_nodes. - * - * Generated from protobuf field int32 max_nodes = 3; - * @param int $var - * @return $this - */ - public function setMaxNodes($var) - { - GPBUtil::checkInt32($var); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * Maximum number of processing units allocated to the instance. If set, - * this number should be multiples of 1000 and be greater than or equal to - * min_processing_units. - * - * Generated from protobuf field int32 max_processing_units = 4; - * @return int - */ - public function getMaxProcessingUnits() - { - return $this->readOneof(4); - } - - public function hasMaxProcessingUnits() - { - return $this->hasOneof(4); - } - - /** - * Maximum number of processing units allocated to the instance. If set, - * this number should be multiples of 1000 and be greater than or equal to - * min_processing_units. - * - * Generated from protobuf field int32 max_processing_units = 4; - * @param int $var - * @return $this - */ - public function setMaxProcessingUnits($var) - { - GPBUtil::checkInt32($var); - $this->writeOneof(4, $var); - - return $this; - } - - /** - * @return string - */ - public function getMinLimit() - { - return $this->whichOneof("min_limit"); - } - - /** - * @return string - */ - public function getMaxLimit() - { - return $this->whichOneof("max_limit"); - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(AutoscalingLimits::class, \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig_AutoscalingLimits::class); - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AutoscalingTargets.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AutoscalingTargets.php deleted file mode 100644 index a1b2d41cc75b..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig/AutoscalingTargets.php +++ /dev/null @@ -1,128 +0,0 @@ -google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets - */ -class AutoscalingTargets extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The target high priority cpu utilization percentage that the - * autoscaler should be trying to achieve for the instance. This number is - * on a scale from 0 (no utilization) to 100 (full utilization). The valid - * range is [10, 90] inclusive. - * - * Generated from protobuf field int32 high_priority_cpu_utilization_percent = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $high_priority_cpu_utilization_percent = 0; - /** - * Required. The target storage utilization percentage that the autoscaler - * should be trying to achieve for the instance. This number is on a scale - * from 0 (no utilization) to 100 (full utilization). The valid range is - * [10, 99] inclusive. - * - * Generated from protobuf field int32 storage_utilization_percent = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $storage_utilization_percent = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $high_priority_cpu_utilization_percent - * Required. The target high priority cpu utilization percentage that the - * autoscaler should be trying to achieve for the instance. This number is - * on a scale from 0 (no utilization) to 100 (full utilization). The valid - * range is [10, 90] inclusive. - * @type int $storage_utilization_percent - * Required. The target storage utilization percentage that the autoscaler - * should be trying to achieve for the instance. This number is on a scale - * from 0 (no utilization) to 100 (full utilization). The valid range is - * [10, 99] inclusive. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The target high priority cpu utilization percentage that the - * autoscaler should be trying to achieve for the instance. This number is - * on a scale from 0 (no utilization) to 100 (full utilization). The valid - * range is [10, 90] inclusive. - * - * Generated from protobuf field int32 high_priority_cpu_utilization_percent = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return int - */ - public function getHighPriorityCpuUtilizationPercent() - { - return $this->high_priority_cpu_utilization_percent; - } - - /** - * Required. The target high priority cpu utilization percentage that the - * autoscaler should be trying to achieve for the instance. This number is - * on a scale from 0 (no utilization) to 100 (full utilization). The valid - * range is [10, 90] inclusive. - * - * Generated from protobuf field int32 high_priority_cpu_utilization_percent = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param int $var - * @return $this - */ - public function setHighPriorityCpuUtilizationPercent($var) - { - GPBUtil::checkInt32($var); - $this->high_priority_cpu_utilization_percent = $var; - - return $this; - } - - /** - * Required. The target storage utilization percentage that the autoscaler - * should be trying to achieve for the instance. This number is on a scale - * from 0 (no utilization) to 100 (full utilization). The valid range is - * [10, 99] inclusive. - * - * Generated from protobuf field int32 storage_utilization_percent = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return int - */ - public function getStorageUtilizationPercent() - { - return $this->storage_utilization_percent; - } - - /** - * Required. The target storage utilization percentage that the autoscaler - * should be trying to achieve for the instance. This number is on a scale - * from 0 (no utilization) to 100 (full utilization). The valid range is - * [10, 99] inclusive. - * - * Generated from protobuf field int32 storage_utilization_percent = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param int $var - * @return $this - */ - public function setStorageUtilizationPercent($var) - { - GPBUtil::checkInt32($var); - $this->storage_utilization_percent = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(AutoscalingTargets::class, \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig_AutoscalingTargets::class); - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceConfigMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceConfigMetadata.php deleted file mode 100644 index ef9454d09d96..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceConfigMetadata.php +++ /dev/null @@ -1,174 +0,0 @@ -google.spanner.admin.instance.v1.CreateInstanceConfigMetadata - */ -class CreateInstanceConfigMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The target instance configuration end state. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 1; - */ - protected $instance_config = null; - /** - * The progress of the - * [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig] - * operation. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.OperationProgress progress = 2; - */ - protected $progress = null; - /** - * The time at which this operation was cancelled. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - */ - protected $cancel_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $instance_config - * The target instance configuration end state. - * @type \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress $progress - * The progress of the - * [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig] - * operation. - * @type \Google\Protobuf\Timestamp $cancel_time - * The time at which this operation was cancelled. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * The target instance configuration end state. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 1; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig|null - */ - public function getInstanceConfig() - { - return $this->instance_config; - } - - public function hasInstanceConfig() - { - return isset($this->instance_config); - } - - public function clearInstanceConfig() - { - unset($this->instance_config); - } - - /** - * The target instance configuration end state. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 1; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $var - * @return $this - */ - public function setInstanceConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig::class); - $this->instance_config = $var; - - return $this; - } - - /** - * The progress of the - * [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig] - * operation. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.OperationProgress progress = 2; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress|null - */ - public function getProgress() - { - return $this->progress; - } - - public function hasProgress() - { - return isset($this->progress); - } - - public function clearProgress() - { - unset($this->progress); - } - - /** - * The progress of the - * [CreateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstanceConfig] - * operation. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.OperationProgress progress = 2; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress $var - * @return $this - */ - public function setProgress($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress::class); - $this->progress = $var; - - return $this; - } - - /** - * The time at which this operation was cancelled. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCancelTime() - { - return $this->cancel_time; - } - - public function hasCancelTime() - { - return isset($this->cancel_time); - } - - public function clearCancelTime() - { - unset($this->cancel_time); - } - - /** - * The time at which this operation was cancelled. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCancelTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->cancel_time = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceConfigRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceConfigRequest.php deleted file mode 100644 index c714bc17563b..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceConfigRequest.php +++ /dev/null @@ -1,242 +0,0 @@ -google.spanner.admin.instance.v1.CreateInstanceConfigRequest - */ -class CreateInstanceConfigRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the project in which to create the instance - * configuration. Values are of the form `projects/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Required. The ID of the instance configuration to create. Valid identifiers - * are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 - * characters in length. The `custom-` prefix is required to avoid name - * conflicts with Google-managed configurations. - * - * Generated from protobuf field string instance_config_id = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $instance_config_id = ''; - /** - * Required. The `InstanceConfig` proto of the configuration to create. - * `instance_config.name` must be - * `/instanceConfigs/`. - * `instance_config.base_config` must be a Google-managed configuration name, - * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $instance_config = null; - /** - * An option to validate, but not actually execute, a request, - * and provide the same response. - * - * Generated from protobuf field bool validate_only = 4; - */ - protected $validate_only = false; - - /** - * @param string $parent Required. The name of the project in which to create the instance - * configuration. Values are of the form `projects/`. Please see - * {@see InstanceAdminClient::projectName()} for help formatting this field. - * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $instanceConfig Required. The `InstanceConfig` proto of the configuration to create. - * `instance_config.name` must be - * `/instanceConfigs/`. - * `instance_config.base_config` must be a Google-managed configuration name, - * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3. - * @param string $instanceConfigId Required. The ID of the instance configuration to create. Valid identifiers - * are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 - * characters in length. The `custom-` prefix is required to avoid name - * conflicts with Google-managed configurations. - * - * @return \Google\Cloud\Spanner\Admin\Instance\V1\CreateInstanceConfigRequest - * - * @experimental - */ - public static function build(string $parent, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $instanceConfig, string $instanceConfigId): self - { - return (new self()) - ->setParent($parent) - ->setInstanceConfig($instanceConfig) - ->setInstanceConfigId($instanceConfigId); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The name of the project in which to create the instance - * configuration. Values are of the form `projects/`. - * @type string $instance_config_id - * Required. The ID of the instance configuration to create. Valid identifiers - * are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 - * characters in length. The `custom-` prefix is required to avoid name - * conflicts with Google-managed configurations. - * @type \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $instance_config - * Required. The `InstanceConfig` proto of the configuration to create. - * `instance_config.name` must be - * `/instanceConfigs/`. - * `instance_config.base_config` must be a Google-managed configuration name, - * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3. - * @type bool $validate_only - * An option to validate, but not actually execute, a request, - * and provide the same response. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the project in which to create the instance - * configuration. Values are of the form `projects/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The name of the project in which to create the instance - * configuration. Values are of the form `projects/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Required. The ID of the instance configuration to create. Valid identifiers - * are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 - * characters in length. The `custom-` prefix is required to avoid name - * conflicts with Google-managed configurations. - * - * Generated from protobuf field string instance_config_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getInstanceConfigId() - { - return $this->instance_config_id; - } - - /** - * Required. The ID of the instance configuration to create. Valid identifiers - * are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 - * characters in length. The `custom-` prefix is required to avoid name - * conflicts with Google-managed configurations. - * - * Generated from protobuf field string instance_config_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setInstanceConfigId($var) - { - GPBUtil::checkString($var, True); - $this->instance_config_id = $var; - - return $this; - } - - /** - * Required. The `InstanceConfig` proto of the configuration to create. - * `instance_config.name` must be - * `/instanceConfigs/`. - * `instance_config.base_config` must be a Google-managed configuration name, - * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig|null - */ - public function getInstanceConfig() - { - return $this->instance_config; - } - - public function hasInstanceConfig() - { - return isset($this->instance_config); - } - - public function clearInstanceConfig() - { - unset($this->instance_config); - } - - /** - * Required. The `InstanceConfig` proto of the configuration to create. - * `instance_config.name` must be - * `/instanceConfigs/`. - * `instance_config.base_config` must be a Google-managed configuration name, - * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $var - * @return $this - */ - public function setInstanceConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig::class); - $this->instance_config = $var; - - return $this; - } - - /** - * An option to validate, but not actually execute, a request, - * and provide the same response. - * - * Generated from protobuf field bool validate_only = 4; - * @return bool - */ - public function getValidateOnly() - { - return $this->validate_only; - } - - /** - * An option to validate, but not actually execute, a request, - * and provide the same response. - * - * Generated from protobuf field bool validate_only = 4; - * @param bool $var - * @return $this - */ - public function setValidateOnly($var) - { - GPBUtil::checkBool($var); - $this->validate_only = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceMetadata.php deleted file mode 100644 index 0b08f1253a6f..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceMetadata.php +++ /dev/null @@ -1,260 +0,0 @@ -google.spanner.admin.instance.v1.CreateInstanceMetadata - */ -class CreateInstanceMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The instance being created. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1; - */ - protected $instance = null; - /** - * The time at which the - * [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance] - * request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; - */ - protected $start_time = null; - /** - * The time at which this operation was cancelled. If set, this operation is - * in the process of undoing itself (which is guaranteed to succeed) and - * cannot be cancelled again. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - */ - protected $cancel_time = null; - /** - * The time at which this operation failed or was completed successfully. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; - */ - protected $end_time = null; - /** - * The expected fulfillment period of this create operation. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.FulfillmentPeriod expected_fulfillment_period = 5; - */ - protected $expected_fulfillment_period = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\Admin\Instance\V1\Instance $instance - * The instance being created. - * @type \Google\Protobuf\Timestamp $start_time - * The time at which the - * [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance] - * request was received. - * @type \Google\Protobuf\Timestamp $cancel_time - * The time at which this operation was cancelled. If set, this operation is - * in the process of undoing itself (which is guaranteed to succeed) and - * cannot be cancelled again. - * @type \Google\Protobuf\Timestamp $end_time - * The time at which this operation failed or was completed successfully. - * @type int $expected_fulfillment_period - * The expected fulfillment period of this create operation. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * The instance being created. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\Instance|null - */ - public function getInstance() - { - return $this->instance; - } - - public function hasInstance() - { - return isset($this->instance); - } - - public function clearInstance() - { - unset($this->instance); - } - - /** - * The instance being created. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\Instance $var - * @return $this - */ - public function setInstance($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\Instance::class); - $this->instance = $var; - - return $this; - } - - /** - * The time at which the - * [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance] - * request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; - * @return \Google\Protobuf\Timestamp|null - */ - public function getStartTime() - { - return $this->start_time; - } - - public function hasStartTime() - { - return isset($this->start_time); - } - - public function clearStartTime() - { - unset($this->start_time); - } - - /** - * The time at which the - * [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance] - * request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setStartTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->start_time = $var; - - return $this; - } - - /** - * The time at which this operation was cancelled. If set, this operation is - * in the process of undoing itself (which is guaranteed to succeed) and - * cannot be cancelled again. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCancelTime() - { - return $this->cancel_time; - } - - public function hasCancelTime() - { - return isset($this->cancel_time); - } - - public function clearCancelTime() - { - unset($this->cancel_time); - } - - /** - * The time at which this operation was cancelled. If set, this operation is - * in the process of undoing itself (which is guaranteed to succeed) and - * cannot be cancelled again. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCancelTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->cancel_time = $var; - - return $this; - } - - /** - * The time at which this operation failed or was completed successfully. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; - * @return \Google\Protobuf\Timestamp|null - */ - public function getEndTime() - { - return $this->end_time; - } - - public function hasEndTime() - { - return isset($this->end_time); - } - - public function clearEndTime() - { - unset($this->end_time); - } - - /** - * The time at which this operation failed or was completed successfully. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setEndTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->end_time = $var; - - return $this; - } - - /** - * The expected fulfillment period of this create operation. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.FulfillmentPeriod expected_fulfillment_period = 5; - * @return int - */ - public function getExpectedFulfillmentPeriod() - { - return $this->expected_fulfillment_period; - } - - /** - * The expected fulfillment period of this create operation. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.FulfillmentPeriod expected_fulfillment_period = 5; - * @param int $var - * @return $this - */ - public function setExpectedFulfillmentPeriod($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\FulfillmentPeriod::class); - $this->expected_fulfillment_period = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstancePartitionMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstancePartitionMetadata.php deleted file mode 100644 index 3494bbcea33a..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstancePartitionMetadata.php +++ /dev/null @@ -1,226 +0,0 @@ -google.spanner.admin.instance.v1.CreateInstancePartitionMetadata - */ -class CreateInstancePartitionMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The instance partition being created. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; - */ - protected $instance_partition = null; - /** - * The time at which the - * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition] - * request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; - */ - protected $start_time = null; - /** - * The time at which this operation was cancelled. If set, this operation is - * in the process of undoing itself (which is guaranteed to succeed) and - * cannot be cancelled again. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - */ - protected $cancel_time = null; - /** - * The time at which this operation failed or was completed successfully. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; - */ - protected $end_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $instance_partition - * The instance partition being created. - * @type \Google\Protobuf\Timestamp $start_time - * The time at which the - * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition] - * request was received. - * @type \Google\Protobuf\Timestamp $cancel_time - * The time at which this operation was cancelled. If set, this operation is - * in the process of undoing itself (which is guaranteed to succeed) and - * cannot be cancelled again. - * @type \Google\Protobuf\Timestamp $end_time - * The time at which this operation failed or was completed successfully. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * The instance partition being created. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition|null - */ - public function getInstancePartition() - { - return $this->instance_partition; - } - - public function hasInstancePartition() - { - return isset($this->instance_partition); - } - - public function clearInstancePartition() - { - unset($this->instance_partition); - } - - /** - * The instance partition being created. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $var - * @return $this - */ - public function setInstancePartition($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition::class); - $this->instance_partition = $var; - - return $this; - } - - /** - * The time at which the - * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition] - * request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; - * @return \Google\Protobuf\Timestamp|null - */ - public function getStartTime() - { - return $this->start_time; - } - - public function hasStartTime() - { - return isset($this->start_time); - } - - public function clearStartTime() - { - unset($this->start_time); - } - - /** - * The time at which the - * [CreateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstancePartition] - * request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setStartTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->start_time = $var; - - return $this; - } - - /** - * The time at which this operation was cancelled. If set, this operation is - * in the process of undoing itself (which is guaranteed to succeed) and - * cannot be cancelled again. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCancelTime() - { - return $this->cancel_time; - } - - public function hasCancelTime() - { - return isset($this->cancel_time); - } - - public function clearCancelTime() - { - unset($this->cancel_time); - } - - /** - * The time at which this operation was cancelled. If set, this operation is - * in the process of undoing itself (which is guaranteed to succeed) and - * cannot be cancelled again. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCancelTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->cancel_time = $var; - - return $this; - } - - /** - * The time at which this operation failed or was completed successfully. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; - * @return \Google\Protobuf\Timestamp|null - */ - public function getEndTime() - { - return $this->end_time; - } - - public function hasEndTime() - { - return isset($this->end_time); - } - - public function clearEndTime() - { - unset($this->end_time); - } - - /** - * The time at which this operation failed or was completed successfully. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setEndTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->end_time = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstancePartitionRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstancePartitionRequest.php deleted file mode 100644 index d12f2223ea98..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstancePartitionRequest.php +++ /dev/null @@ -1,194 +0,0 @@ -google.spanner.admin.instance.v1.CreateInstancePartitionRequest - */ -class CreateInstancePartitionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the instance in which to create the instance - * partition. Values are of the form - * `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Required. The ID of the instance partition to create. Valid identifiers are - * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 - * characters in length. - * - * Generated from protobuf field string instance_partition_id = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $instance_partition_id = ''; - /** - * Required. The instance partition to create. The instance_partition.name may - * be omitted, but if specified must be - * `/instancePartitions/`. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $instance_partition = null; - - /** - * @param string $parent Required. The name of the instance in which to create the instance - * partition. Values are of the form - * `projects//instances/`. Please see - * {@see InstanceAdminClient::instanceName()} for help formatting this field. - * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $instancePartition Required. The instance partition to create. The instance_partition.name may - * be omitted, but if specified must be - * `/instancePartitions/`. - * @param string $instancePartitionId Required. The ID of the instance partition to create. Valid identifiers are - * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 - * characters in length. - * - * @return \Google\Cloud\Spanner\Admin\Instance\V1\CreateInstancePartitionRequest - * - * @experimental - */ - public static function build(string $parent, \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $instancePartition, string $instancePartitionId): self - { - return (new self()) - ->setParent($parent) - ->setInstancePartition($instancePartition) - ->setInstancePartitionId($instancePartitionId); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The name of the instance in which to create the instance - * partition. Values are of the form - * `projects//instances/`. - * @type string $instance_partition_id - * Required. The ID of the instance partition to create. Valid identifiers are - * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 - * characters in length. - * @type \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $instance_partition - * Required. The instance partition to create. The instance_partition.name may - * be omitted, but if specified must be - * `/instancePartitions/`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the instance in which to create the instance - * partition. Values are of the form - * `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The name of the instance in which to create the instance - * partition. Values are of the form - * `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Required. The ID of the instance partition to create. Valid identifiers are - * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 - * characters in length. - * - * Generated from protobuf field string instance_partition_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getInstancePartitionId() - { - return $this->instance_partition_id; - } - - /** - * Required. The ID of the instance partition to create. Valid identifiers are - * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 - * characters in length. - * - * Generated from protobuf field string instance_partition_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setInstancePartitionId($var) - { - GPBUtil::checkString($var, True); - $this->instance_partition_id = $var; - - return $this; - } - - /** - * Required. The instance partition to create. The instance_partition.name may - * be omitted, but if specified must be - * `/instancePartitions/`. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition|null - */ - public function getInstancePartition() - { - return $this->instance_partition; - } - - public function hasInstancePartition() - { - return isset($this->instance_partition); - } - - public function clearInstancePartition() - { - unset($this->instance_partition); - } - - /** - * Required. The instance partition to create. The instance_partition.name may - * be omitted, but if specified must be - * `/instancePartitions/`. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $var - * @return $this - */ - public function setInstancePartition($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition::class); - $this->instance_partition = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceRequest.php deleted file mode 100644 index 1954b4933248..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/CreateInstanceRequest.php +++ /dev/null @@ -1,184 +0,0 @@ -google.spanner.admin.instance.v1.CreateInstanceRequest - */ -class CreateInstanceRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the project in which to create the instance. Values - * are of the form `projects/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Required. The ID of the instance to create. Valid identifiers are of the - * form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in - * length. - * - * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $instance_id = ''; - /** - * Required. The instance to create. The name may be omitted, but if - * specified must be `/instances/`. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $instance = null; - - /** - * @param string $parent Required. The name of the project in which to create the instance. Values - * are of the form `projects/`. Please see - * {@see InstanceAdminClient::projectName()} for help formatting this field. - * @param string $instanceId Required. The ID of the instance to create. Valid identifiers are of the - * form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in - * length. - * @param \Google\Cloud\Spanner\Admin\Instance\V1\Instance $instance Required. The instance to create. The name may be omitted, but if - * specified must be `/instances/`. - * - * @return \Google\Cloud\Spanner\Admin\Instance\V1\CreateInstanceRequest - * - * @experimental - */ - public static function build(string $parent, string $instanceId, \Google\Cloud\Spanner\Admin\Instance\V1\Instance $instance): self - { - return (new self()) - ->setParent($parent) - ->setInstanceId($instanceId) - ->setInstance($instance); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The name of the project in which to create the instance. Values - * are of the form `projects/`. - * @type string $instance_id - * Required. The ID of the instance to create. Valid identifiers are of the - * form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in - * length. - * @type \Google\Cloud\Spanner\Admin\Instance\V1\Instance $instance - * Required. The instance to create. The name may be omitted, but if - * specified must be `/instances/`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the project in which to create the instance. Values - * are of the form `projects/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The name of the project in which to create the instance. Values - * are of the form `projects/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Required. The ID of the instance to create. Valid identifiers are of the - * form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in - * length. - * - * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getInstanceId() - { - return $this->instance_id; - } - - /** - * Required. The ID of the instance to create. Valid identifiers are of the - * form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in - * length. - * - * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setInstanceId($var) - { - GPBUtil::checkString($var, True); - $this->instance_id = $var; - - return $this; - } - - /** - * Required. The instance to create. The name may be omitted, but if - * specified must be `/instances/`. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\Instance|null - */ - public function getInstance() - { - return $this->instance; - } - - public function hasInstance() - { - return isset($this->instance); - } - - public function clearInstance() - { - unset($this->instance); - } - - /** - * Required. The instance to create. The name may be omitted, but if - * specified must be `/instances/`. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\Instance $var - * @return $this - */ - public function setInstance($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\Instance::class); - $this->instance = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstanceConfigRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstanceConfigRequest.php deleted file mode 100644 index 8b9edba36c3f..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstanceConfigRequest.php +++ /dev/null @@ -1,188 +0,0 @@ -google.spanner.admin.instance.v1.DeleteInstanceConfigRequest - */ -class DeleteInstanceConfigRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the instance configuration to be deleted. - * Values are of the form - * `projects//instanceConfigs/` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * Used for optimistic concurrency control as a way to help prevent - * simultaneous deletes of an instance configuration from overwriting each - * other. If not empty, the API - * only deletes the instance configuration when the etag provided matches the - * current status of the requested instance configuration. Otherwise, deletes - * the instance configuration without checking the current status of the - * requested instance configuration. - * - * Generated from protobuf field string etag = 2; - */ - protected $etag = ''; - /** - * An option to validate, but not actually execute, a request, - * and provide the same response. - * - * Generated from protobuf field bool validate_only = 3; - */ - protected $validate_only = false; - - /** - * @param string $name Required. The name of the instance configuration to be deleted. - * Values are of the form - * `projects//instanceConfigs/` - * Please see {@see InstanceAdminClient::instanceConfigName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Instance\V1\DeleteInstanceConfigRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the instance configuration to be deleted. - * Values are of the form - * `projects//instanceConfigs/` - * @type string $etag - * Used for optimistic concurrency control as a way to help prevent - * simultaneous deletes of an instance configuration from overwriting each - * other. If not empty, the API - * only deletes the instance configuration when the etag provided matches the - * current status of the requested instance configuration. Otherwise, deletes - * the instance configuration without checking the current status of the - * requested instance configuration. - * @type bool $validate_only - * An option to validate, but not actually execute, a request, - * and provide the same response. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the instance configuration to be deleted. - * Values are of the form - * `projects//instanceConfigs/` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The name of the instance configuration to be deleted. - * Values are of the form - * `projects//instanceConfigs/` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Used for optimistic concurrency control as a way to help prevent - * simultaneous deletes of an instance configuration from overwriting each - * other. If not empty, the API - * only deletes the instance configuration when the etag provided matches the - * current status of the requested instance configuration. Otherwise, deletes - * the instance configuration without checking the current status of the - * requested instance configuration. - * - * Generated from protobuf field string etag = 2; - * @return string - */ - public function getEtag() - { - return $this->etag; - } - - /** - * Used for optimistic concurrency control as a way to help prevent - * simultaneous deletes of an instance configuration from overwriting each - * other. If not empty, the API - * only deletes the instance configuration when the etag provided matches the - * current status of the requested instance configuration. Otherwise, deletes - * the instance configuration without checking the current status of the - * requested instance configuration. - * - * Generated from protobuf field string etag = 2; - * @param string $var - * @return $this - */ - public function setEtag($var) - { - GPBUtil::checkString($var, True); - $this->etag = $var; - - return $this; - } - - /** - * An option to validate, but not actually execute, a request, - * and provide the same response. - * - * Generated from protobuf field bool validate_only = 3; - * @return bool - */ - public function getValidateOnly() - { - return $this->validate_only; - } - - /** - * An option to validate, but not actually execute, a request, - * and provide the same response. - * - * Generated from protobuf field bool validate_only = 3; - * @param bool $var - * @return $this - */ - public function setValidateOnly($var) - { - GPBUtil::checkBool($var); - $this->validate_only = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstancePartitionRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstancePartitionRequest.php deleted file mode 100644 index 430f00f61956..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstancePartitionRequest.php +++ /dev/null @@ -1,138 +0,0 @@ -google.spanner.admin.instance.v1.DeleteInstancePartitionRequest - */ -class DeleteInstancePartitionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the instance partition to be deleted. - * Values are of the form - * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * Optional. If not empty, the API only deletes the instance partition when - * the etag provided matches the current status of the requested instance - * partition. Otherwise, deletes the instance partition without checking the - * current status of the requested instance partition. - * - * Generated from protobuf field string etag = 2; - */ - protected $etag = ''; - - /** - * @param string $name Required. The name of the instance partition to be deleted. - * Values are of the form - * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}` - * Please see {@see InstanceAdminClient::instancePartitionName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Instance\V1\DeleteInstancePartitionRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the instance partition to be deleted. - * Values are of the form - * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}` - * @type string $etag - * Optional. If not empty, the API only deletes the instance partition when - * the etag provided matches the current status of the requested instance - * partition. Otherwise, deletes the instance partition without checking the - * current status of the requested instance partition. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the instance partition to be deleted. - * Values are of the form - * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The name of the instance partition to be deleted. - * Values are of the form - * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Optional. If not empty, the API only deletes the instance partition when - * the etag provided matches the current status of the requested instance - * partition. Otherwise, deletes the instance partition without checking the - * current status of the requested instance partition. - * - * Generated from protobuf field string etag = 2; - * @return string - */ - public function getEtag() - { - return $this->etag; - } - - /** - * Optional. If not empty, the API only deletes the instance partition when - * the etag provided matches the current status of the requested instance - * partition. Otherwise, deletes the instance partition without checking the - * current status of the requested instance partition. - * - * Generated from protobuf field string etag = 2; - * @param string $var - * @return $this - */ - public function setEtag($var) - { - GPBUtil::checkString($var, True); - $this->etag = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstanceRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstanceRequest.php deleted file mode 100644 index f8633ecef64d..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/DeleteInstanceRequest.php +++ /dev/null @@ -1,87 +0,0 @@ -google.spanner.admin.instance.v1.DeleteInstanceRequest - */ -class DeleteInstanceRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the instance to be deleted. Values are of the form - * `projects//instances/` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - - /** - * @param string $name Required. The name of the instance to be deleted. Values are of the form - * `projects//instances/` - * Please see {@see InstanceAdminClient::instanceName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Instance\V1\DeleteInstanceRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the instance to be deleted. Values are of the form - * `projects//instances/` - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the instance to be deleted. Values are of the form - * `projects//instances/` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The name of the instance to be deleted. Values are of the form - * `projects//instances/` - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FulfillmentPeriod.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FulfillmentPeriod.php deleted file mode 100644 index 3fa91d6d998b..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/FulfillmentPeriod.php +++ /dev/null @@ -1,63 +0,0 @@ -google.spanner.admin.instance.v1.FulfillmentPeriod - */ -class FulfillmentPeriod -{ - /** - * Not specified. - * - * Generated from protobuf enum FULFILLMENT_PERIOD_UNSPECIFIED = 0; - */ - const FULFILLMENT_PERIOD_UNSPECIFIED = 0; - /** - * Normal fulfillment period. The operation is expected to complete within - * minutes. - * - * Generated from protobuf enum FULFILLMENT_PERIOD_NORMAL = 1; - */ - const FULFILLMENT_PERIOD_NORMAL = 1; - /** - * Extended fulfillment period. It can take up to an hour for the operation - * to complete. - * - * Generated from protobuf enum FULFILLMENT_PERIOD_EXTENDED = 2; - */ - const FULFILLMENT_PERIOD_EXTENDED = 2; - - private static $valueToName = [ - self::FULFILLMENT_PERIOD_UNSPECIFIED => 'FULFILLMENT_PERIOD_UNSPECIFIED', - self::FULFILLMENT_PERIOD_NORMAL => 'FULFILLMENT_PERIOD_NORMAL', - self::FULFILLMENT_PERIOD_EXTENDED => 'FULFILLMENT_PERIOD_EXTENDED', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstanceConfigRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstanceConfigRequest.php deleted file mode 100644 index c0d299ac0b80..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstanceConfigRequest.php +++ /dev/null @@ -1,87 +0,0 @@ -google.spanner.admin.instance.v1.GetInstanceConfigRequest - */ -class GetInstanceConfigRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the requested instance configuration. Values are of - * the form `projects//instanceConfigs/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - - /** - * @param string $name Required. The name of the requested instance configuration. Values are of - * the form `projects//instanceConfigs/`. Please see - * {@see InstanceAdminClient::instanceConfigName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Instance\V1\GetInstanceConfigRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the requested instance configuration. Values are of - * the form `projects//instanceConfigs/`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the requested instance configuration. Values are of - * the form `projects//instanceConfigs/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The name of the requested instance configuration. Values are of - * the form `projects//instanceConfigs/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstancePartitionRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstancePartitionRequest.php deleted file mode 100644 index e703503feb23..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstancePartitionRequest.php +++ /dev/null @@ -1,92 +0,0 @@ -google.spanner.admin.instance.v1.GetInstancePartitionRequest - */ -class GetInstancePartitionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the requested instance partition. Values are of - * the form - * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - - /** - * @param string $name Required. The name of the requested instance partition. Values are of - * the form - * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`. Please see - * {@see InstanceAdminClient::instancePartitionName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Instance\V1\GetInstancePartitionRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the requested instance partition. Values are of - * the form - * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the requested instance partition. Values are of - * the form - * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The name of the requested instance partition. Values are of - * the form - * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstanceRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstanceRequest.php deleted file mode 100644 index 6f054759ba44..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/GetInstanceRequest.php +++ /dev/null @@ -1,143 +0,0 @@ -google.spanner.admin.instance.v1.GetInstanceRequest - */ -class GetInstanceRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the requested instance. Values are of the form - * `projects//instances/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * If field_mask is present, specifies the subset of - * [Instance][google.spanner.admin.instance.v1.Instance] fields that should be - * returned. If absent, all - * [Instance][google.spanner.admin.instance.v1.Instance] fields are returned. - * - * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2; - */ - protected $field_mask = null; - - /** - * @param string $name Required. The name of the requested instance. Values are of the form - * `projects//instances/`. Please see - * {@see InstanceAdminClient::instanceName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Instance\V1\GetInstanceRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the requested instance. Values are of the form - * `projects//instances/`. - * @type \Google\Protobuf\FieldMask $field_mask - * If field_mask is present, specifies the subset of - * [Instance][google.spanner.admin.instance.v1.Instance] fields that should be - * returned. If absent, all - * [Instance][google.spanner.admin.instance.v1.Instance] fields are returned. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the requested instance. Values are of the form - * `projects//instances/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The name of the requested instance. Values are of the form - * `projects//instances/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * If field_mask is present, specifies the subset of - * [Instance][google.spanner.admin.instance.v1.Instance] fields that should be - * returned. If absent, all - * [Instance][google.spanner.admin.instance.v1.Instance] fields are returned. - * - * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2; - * @return \Google\Protobuf\FieldMask|null - */ - public function getFieldMask() - { - return $this->field_mask; - } - - public function hasFieldMask() - { - return isset($this->field_mask); - } - - public function clearFieldMask() - { - unset($this->field_mask); - } - - /** - * If field_mask is present, specifies the subset of - * [Instance][google.spanner.admin.instance.v1.Instance] fields that should be - * returned. If absent, all - * [Instance][google.spanner.admin.instance.v1.Instance] fields are returned. - * - * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2; - * @param \Google\Protobuf\FieldMask $var - * @return $this - */ - public function setFieldMask($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); - $this->field_mask = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance.php deleted file mode 100644 index 1bfe83d9e4fb..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance.php +++ /dev/null @@ -1,861 +0,0 @@ -google.spanner.admin.instance.v1.Instance - */ -class Instance extends \Google\Protobuf\Internal\Message -{ - /** - * Required. A unique identifier for the instance, which cannot be changed - * after the instance is created. Values are of the form - * `projects//instances/[a-z][-a-z0-9]*[a-z0-9]`. The final - * segment of the name must be between 2 and 64 characters in length. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - /** - * Required. The name of the instance's configuration. Values are of the form - * `projects//instanceConfigs/`. See - * also [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and - * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. - * - * Generated from protobuf field string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $config = ''; - /** - * Required. The descriptive name for this instance as it appears in UIs. - * Must be unique per project and between 4 and 30 characters in length. - * - * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $display_name = ''; - /** - * The number of nodes allocated to this instance. At most, one of either - * `node_count` or `processing_units` should be present in the message. - * Users can set the `node_count` field to specify the target number of nodes - * allocated to the instance. - * If autoscaling is enabled, `node_count` is treated as an `OUTPUT_ONLY` - * field and reflects the current number of nodes allocated to the instance. - * This might be zero in API responses for instances that are not yet in the - * `READY` state. - * For more information, see - * [Compute capacity, nodes, and processing - * units](https://cloud.google.com/spanner/docs/compute-capacity). - * - * Generated from protobuf field int32 node_count = 5; - */ - protected $node_count = 0; - /** - * The number of processing units allocated to this instance. At most, one of - * either `processing_units` or `node_count` should be present in the message. - * Users can set the `processing_units` field to specify the target number of - * processing units allocated to the instance. - * If autoscaling is enabled, `processing_units` is treated as an - * `OUTPUT_ONLY` field and reflects the current number of processing units - * allocated to the instance. - * This might be zero in API responses for instances that are not yet in the - * `READY` state. - * For more information, see - * [Compute capacity, nodes and processing - * units](https://cloud.google.com/spanner/docs/compute-capacity). - * - * Generated from protobuf field int32 processing_units = 9; - */ - protected $processing_units = 0; - /** - * Output only. Lists the compute capacity per ReplicaSelection. A replica - * selection identifies a set of replicas with common properties. Replicas - * identified by a ReplicaSelection are scaled with the same compute capacity. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $replica_compute_capacity; - /** - * Optional. The autoscaling configuration. Autoscaling is enabled if this - * field is set. When autoscaling is enabled, node_count and processing_units - * are treated as OUTPUT_ONLY fields and reflect the current compute capacity - * allocated to the instance. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig autoscaling_config = 17 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $autoscaling_config = null; - /** - * Output only. The current instance state. For - * [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance], - * the state must be either omitted or set to `CREATING`. For - * [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance], - * the state must be either omitted or set to `READY`. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $state = 0; - /** - * Cloud Labels are a flexible and lightweight mechanism for organizing cloud - * resources into groups that reflect a customer's organizational needs and - * deployment strategies. Cloud Labels can be used to filter collections of - * resources. They can be used to control how resource metrics are aggregated. - * And they can be used as arguments to policy management rules (e.g. route, - * firewall, load balancing, etc.). - * * Label keys must be between 1 and 63 characters long and must conform to - * the following regular expression: `[a-z][a-z0-9_-]{0,62}`. - * * Label values must be between 0 and 63 characters long and must conform - * to the regular expression `[a-z0-9_-]{0,63}`. - * * No more than 64 labels can be associated with a given resource. - * See https://goo.gl/xmQnxf for more information on and examples of labels. - * If you plan to use labels in your own code, please note that additional - * characters may be allowed in the future. And so you are advised to use an - * internal label representation, such as JSON, which doesn't rely upon - * specific characters being disallowed. For example, representing labels - * as the string: name + "_" + value would prove problematic if we were to - * allow "_" in a future release. - * - * Generated from protobuf field map labels = 7; - */ - private $labels; - /** - * The `InstanceType` of the current instance. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.InstanceType instance_type = 10; - */ - protected $instance_type = 0; - /** - * Deprecated. This field is not populated. - * - * Generated from protobuf field repeated string endpoint_uris = 8; - */ - private $endpoint_uris; - /** - * Output only. The time at which the instance was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $create_time = null; - /** - * Output only. The time at which the instance was most recently updated. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $update_time = null; - /** - * Free instance metadata. Only populated for free instances. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.FreeInstanceMetadata free_instance_metadata = 13; - */ - protected $free_instance_metadata = null; - /** - * Optional. The `Edition` of the current instance. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.Edition edition = 20 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $edition = 0; - /** - * Optional. Controls the default backup schedule behavior for new databases - * within the instance. By default, a backup schedule is created automatically - * when a new database is created in a new instance. - * Note that the `AUTOMATIC` value isn't permitted for free instances, - * as backups and backup schedules aren't supported for free instances. - * In the `GetInstance` or `ListInstances` response, if the value of - * `default_backup_schedule_type` isn't set, or set to `NONE`, Spanner doesn't - * create a default backup schedule for new databases in the instance. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.DefaultBackupScheduleType default_backup_schedule_type = 23 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $default_backup_schedule_type = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. A unique identifier for the instance, which cannot be changed - * after the instance is created. Values are of the form - * `projects//instances/[a-z][-a-z0-9]*[a-z0-9]`. The final - * segment of the name must be between 2 and 64 characters in length. - * @type string $config - * Required. The name of the instance's configuration. Values are of the form - * `projects//instanceConfigs/`. See - * also [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and - * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. - * @type string $display_name - * Required. The descriptive name for this instance as it appears in UIs. - * Must be unique per project and between 4 and 30 characters in length. - * @type int $node_count - * The number of nodes allocated to this instance. At most, one of either - * `node_count` or `processing_units` should be present in the message. - * Users can set the `node_count` field to specify the target number of nodes - * allocated to the instance. - * If autoscaling is enabled, `node_count` is treated as an `OUTPUT_ONLY` - * field and reflects the current number of nodes allocated to the instance. - * This might be zero in API responses for instances that are not yet in the - * `READY` state. - * For more information, see - * [Compute capacity, nodes, and processing - * units](https://cloud.google.com/spanner/docs/compute-capacity). - * @type int $processing_units - * The number of processing units allocated to this instance. At most, one of - * either `processing_units` or `node_count` should be present in the message. - * Users can set the `processing_units` field to specify the target number of - * processing units allocated to the instance. - * If autoscaling is enabled, `processing_units` is treated as an - * `OUTPUT_ONLY` field and reflects the current number of processing units - * allocated to the instance. - * This might be zero in API responses for instances that are not yet in the - * `READY` state. - * For more information, see - * [Compute capacity, nodes and processing - * units](https://cloud.google.com/spanner/docs/compute-capacity). - * @type array<\Google\Cloud\Spanner\Admin\Instance\V1\ReplicaComputeCapacity>|\Google\Protobuf\Internal\RepeatedField $replica_compute_capacity - * Output only. Lists the compute capacity per ReplicaSelection. A replica - * selection identifies a set of replicas with common properties. Replicas - * identified by a ReplicaSelection are scaled with the same compute capacity. - * @type \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig $autoscaling_config - * Optional. The autoscaling configuration. Autoscaling is enabled if this - * field is set. When autoscaling is enabled, node_count and processing_units - * are treated as OUTPUT_ONLY fields and reflect the current compute capacity - * allocated to the instance. - * @type int $state - * Output only. The current instance state. For - * [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance], - * the state must be either omitted or set to `CREATING`. For - * [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance], - * the state must be either omitted or set to `READY`. - * @type array|\Google\Protobuf\Internal\MapField $labels - * Cloud Labels are a flexible and lightweight mechanism for organizing cloud - * resources into groups that reflect a customer's organizational needs and - * deployment strategies. Cloud Labels can be used to filter collections of - * resources. They can be used to control how resource metrics are aggregated. - * And they can be used as arguments to policy management rules (e.g. route, - * firewall, load balancing, etc.). - * * Label keys must be between 1 and 63 characters long and must conform to - * the following regular expression: `[a-z][a-z0-9_-]{0,62}`. - * * Label values must be between 0 and 63 characters long and must conform - * to the regular expression `[a-z0-9_-]{0,63}`. - * * No more than 64 labels can be associated with a given resource. - * See https://goo.gl/xmQnxf for more information on and examples of labels. - * If you plan to use labels in your own code, please note that additional - * characters may be allowed in the future. And so you are advised to use an - * internal label representation, such as JSON, which doesn't rely upon - * specific characters being disallowed. For example, representing labels - * as the string: name + "_" + value would prove problematic if we were to - * allow "_" in a future release. - * @type int $instance_type - * The `InstanceType` of the current instance. - * @type array|\Google\Protobuf\Internal\RepeatedField $endpoint_uris - * Deprecated. This field is not populated. - * @type \Google\Protobuf\Timestamp $create_time - * Output only. The time at which the instance was created. - * @type \Google\Protobuf\Timestamp $update_time - * Output only. The time at which the instance was most recently updated. - * @type \Google\Cloud\Spanner\Admin\Instance\V1\FreeInstanceMetadata $free_instance_metadata - * Free instance metadata. Only populated for free instances. - * @type int $edition - * Optional. The `Edition` of the current instance. - * @type int $default_backup_schedule_type - * Optional. Controls the default backup schedule behavior for new databases - * within the instance. By default, a backup schedule is created automatically - * when a new database is created in a new instance. - * Note that the `AUTOMATIC` value isn't permitted for free instances, - * as backups and backup schedules aren't supported for free instances. - * In the `GetInstance` or `ListInstances` response, if the value of - * `default_backup_schedule_type` isn't set, or set to `NONE`, Spanner doesn't - * create a default backup schedule for new databases in the instance. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. A unique identifier for the instance, which cannot be changed - * after the instance is created. Values are of the form - * `projects//instances/[a-z][-a-z0-9]*[a-z0-9]`. The final - * segment of the name must be between 2 and 64 characters in length. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. A unique identifier for the instance, which cannot be changed - * after the instance is created. Values are of the form - * `projects//instances/[a-z][-a-z0-9]*[a-z0-9]`. The final - * segment of the name must be between 2 and 64 characters in length. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Required. The name of the instance's configuration. Values are of the form - * `projects//instanceConfigs/`. See - * also [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and - * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. - * - * Generated from protobuf field string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getConfig() - { - return $this->config; - } - - /** - * Required. The name of the instance's configuration. Values are of the form - * `projects//instanceConfigs/`. See - * also [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and - * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. - * - * Generated from protobuf field string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setConfig($var) - { - GPBUtil::checkString($var, True); - $this->config = $var; - - return $this; - } - - /** - * Required. The descriptive name for this instance as it appears in UIs. - * Must be unique per project and between 4 and 30 characters in length. - * - * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getDisplayName() - { - return $this->display_name; - } - - /** - * Required. The descriptive name for this instance as it appears in UIs. - * Must be unique per project and between 4 and 30 characters in length. - * - * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setDisplayName($var) - { - GPBUtil::checkString($var, True); - $this->display_name = $var; - - return $this; - } - - /** - * The number of nodes allocated to this instance. At most, one of either - * `node_count` or `processing_units` should be present in the message. - * Users can set the `node_count` field to specify the target number of nodes - * allocated to the instance. - * If autoscaling is enabled, `node_count` is treated as an `OUTPUT_ONLY` - * field and reflects the current number of nodes allocated to the instance. - * This might be zero in API responses for instances that are not yet in the - * `READY` state. - * For more information, see - * [Compute capacity, nodes, and processing - * units](https://cloud.google.com/spanner/docs/compute-capacity). - * - * Generated from protobuf field int32 node_count = 5; - * @return int - */ - public function getNodeCount() - { - return $this->node_count; - } - - /** - * The number of nodes allocated to this instance. At most, one of either - * `node_count` or `processing_units` should be present in the message. - * Users can set the `node_count` field to specify the target number of nodes - * allocated to the instance. - * If autoscaling is enabled, `node_count` is treated as an `OUTPUT_ONLY` - * field and reflects the current number of nodes allocated to the instance. - * This might be zero in API responses for instances that are not yet in the - * `READY` state. - * For more information, see - * [Compute capacity, nodes, and processing - * units](https://cloud.google.com/spanner/docs/compute-capacity). - * - * Generated from protobuf field int32 node_count = 5; - * @param int $var - * @return $this - */ - public function setNodeCount($var) - { - GPBUtil::checkInt32($var); - $this->node_count = $var; - - return $this; - } - - /** - * The number of processing units allocated to this instance. At most, one of - * either `processing_units` or `node_count` should be present in the message. - * Users can set the `processing_units` field to specify the target number of - * processing units allocated to the instance. - * If autoscaling is enabled, `processing_units` is treated as an - * `OUTPUT_ONLY` field and reflects the current number of processing units - * allocated to the instance. - * This might be zero in API responses for instances that are not yet in the - * `READY` state. - * For more information, see - * [Compute capacity, nodes and processing - * units](https://cloud.google.com/spanner/docs/compute-capacity). - * - * Generated from protobuf field int32 processing_units = 9; - * @return int - */ - public function getProcessingUnits() - { - return $this->processing_units; - } - - /** - * The number of processing units allocated to this instance. At most, one of - * either `processing_units` or `node_count` should be present in the message. - * Users can set the `processing_units` field to specify the target number of - * processing units allocated to the instance. - * If autoscaling is enabled, `processing_units` is treated as an - * `OUTPUT_ONLY` field and reflects the current number of processing units - * allocated to the instance. - * This might be zero in API responses for instances that are not yet in the - * `READY` state. - * For more information, see - * [Compute capacity, nodes and processing - * units](https://cloud.google.com/spanner/docs/compute-capacity). - * - * Generated from protobuf field int32 processing_units = 9; - * @param int $var - * @return $this - */ - public function setProcessingUnits($var) - { - GPBUtil::checkInt32($var); - $this->processing_units = $var; - - return $this; - } - - /** - * Output only. Lists the compute capacity per ReplicaSelection. A replica - * selection identifies a set of replicas with common properties. Replicas - * identified by a ReplicaSelection are scaled with the same compute capacity. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getReplicaComputeCapacity() - { - return $this->replica_compute_capacity; - } - - /** - * Output only. Lists the compute capacity per ReplicaSelection. A replica - * selection identifies a set of replicas with common properties. Replicas - * identified by a ReplicaSelection are scaled with the same compute capacity. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param array<\Google\Cloud\Spanner\Admin\Instance\V1\ReplicaComputeCapacity>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setReplicaComputeCapacity($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaComputeCapacity::class); - $this->replica_compute_capacity = $arr; - - return $this; - } - - /** - * Optional. The autoscaling configuration. Autoscaling is enabled if this - * field is set. When autoscaling is enabled, node_count and processing_units - * are treated as OUTPUT_ONLY fields and reflect the current compute capacity - * allocated to the instance. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig autoscaling_config = 17 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig|null - */ - public function getAutoscalingConfig() - { - return $this->autoscaling_config; - } - - public function hasAutoscalingConfig() - { - return isset($this->autoscaling_config); - } - - public function clearAutoscalingConfig() - { - unset($this->autoscaling_config); - } - - /** - * Optional. The autoscaling configuration. Autoscaling is enabled if this - * field is set. When autoscaling is enabled, node_count and processing_units - * are treated as OUTPUT_ONLY fields and reflect the current compute capacity - * allocated to the instance. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.AutoscalingConfig autoscaling_config = 17 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig $var - * @return $this - */ - public function setAutoscalingConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\AutoscalingConfig::class); - $this->autoscaling_config = $var; - - return $this; - } - - /** - * Output only. The current instance state. For - * [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance], - * the state must be either omitted or set to `CREATING`. For - * [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance], - * the state must be either omitted or set to `READY`. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * Output only. The current instance state. For - * [CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance], - * the state must be either omitted or set to `CREATING`. For - * [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance], - * the state must be either omitted or set to `READY`. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.State state = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\Instance\State::class); - $this->state = $var; - - return $this; - } - - /** - * Cloud Labels are a flexible and lightweight mechanism for organizing cloud - * resources into groups that reflect a customer's organizational needs and - * deployment strategies. Cloud Labels can be used to filter collections of - * resources. They can be used to control how resource metrics are aggregated. - * And they can be used as arguments to policy management rules (e.g. route, - * firewall, load balancing, etc.). - * * Label keys must be between 1 and 63 characters long and must conform to - * the following regular expression: `[a-z][a-z0-9_-]{0,62}`. - * * Label values must be between 0 and 63 characters long and must conform - * to the regular expression `[a-z0-9_-]{0,63}`. - * * No more than 64 labels can be associated with a given resource. - * See https://goo.gl/xmQnxf for more information on and examples of labels. - * If you plan to use labels in your own code, please note that additional - * characters may be allowed in the future. And so you are advised to use an - * internal label representation, such as JSON, which doesn't rely upon - * specific characters being disallowed. For example, representing labels - * as the string: name + "_" + value would prove problematic if we were to - * allow "_" in a future release. - * - * Generated from protobuf field map labels = 7; - * @return \Google\Protobuf\Internal\MapField - */ - public function getLabels() - { - return $this->labels; - } - - /** - * Cloud Labels are a flexible and lightweight mechanism for organizing cloud - * resources into groups that reflect a customer's organizational needs and - * deployment strategies. Cloud Labels can be used to filter collections of - * resources. They can be used to control how resource metrics are aggregated. - * And they can be used as arguments to policy management rules (e.g. route, - * firewall, load balancing, etc.). - * * Label keys must be between 1 and 63 characters long and must conform to - * the following regular expression: `[a-z][a-z0-9_-]{0,62}`. - * * Label values must be between 0 and 63 characters long and must conform - * to the regular expression `[a-z0-9_-]{0,63}`. - * * No more than 64 labels can be associated with a given resource. - * See https://goo.gl/xmQnxf for more information on and examples of labels. - * If you plan to use labels in your own code, please note that additional - * characters may be allowed in the future. And so you are advised to use an - * internal label representation, such as JSON, which doesn't rely upon - * specific characters being disallowed. For example, representing labels - * as the string: name + "_" + value would prove problematic if we were to - * allow "_" in a future release. - * - * Generated from protobuf field map labels = 7; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setLabels($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->labels = $arr; - - return $this; - } - - /** - * The `InstanceType` of the current instance. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.InstanceType instance_type = 10; - * @return int - */ - public function getInstanceType() - { - return $this->instance_type; - } - - /** - * The `InstanceType` of the current instance. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.InstanceType instance_type = 10; - * @param int $var - * @return $this - */ - public function setInstanceType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\Instance\InstanceType::class); - $this->instance_type = $var; - - return $this; - } - - /** - * Deprecated. This field is not populated. - * - * Generated from protobuf field repeated string endpoint_uris = 8; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getEndpointUris() - { - return $this->endpoint_uris; - } - - /** - * Deprecated. This field is not populated. - * - * Generated from protobuf field repeated string endpoint_uris = 8; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setEndpointUris($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->endpoint_uris = $arr; - - return $this; - } - - /** - * Output only. The time at which the instance was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCreateTime() - { - return $this->create_time; - } - - public function hasCreateTime() - { - return isset($this->create_time); - } - - public function clearCreateTime() - { - unset($this->create_time); - } - - /** - * Output only. The time at which the instance was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCreateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->create_time = $var; - - return $this; - } - - /** - * Output only. The time at which the instance was most recently updated. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getUpdateTime() - { - return $this->update_time; - } - - public function hasUpdateTime() - { - return isset($this->update_time); - } - - public function clearUpdateTime() - { - unset($this->update_time); - } - - /** - * Output only. The time at which the instance was most recently updated. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setUpdateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->update_time = $var; - - return $this; - } - - /** - * Free instance metadata. Only populated for free instances. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.FreeInstanceMetadata free_instance_metadata = 13; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\FreeInstanceMetadata|null - */ - public function getFreeInstanceMetadata() - { - return $this->free_instance_metadata; - } - - public function hasFreeInstanceMetadata() - { - return isset($this->free_instance_metadata); - } - - public function clearFreeInstanceMetadata() - { - unset($this->free_instance_metadata); - } - - /** - * Free instance metadata. Only populated for free instances. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.FreeInstanceMetadata free_instance_metadata = 13; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\FreeInstanceMetadata $var - * @return $this - */ - public function setFreeInstanceMetadata($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\FreeInstanceMetadata::class); - $this->free_instance_metadata = $var; - - return $this; - } - - /** - * Optional. The `Edition` of the current instance. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.Edition edition = 20 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getEdition() - { - return $this->edition; - } - - /** - * Optional. The `Edition` of the current instance. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.Edition edition = 20 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setEdition($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\Instance\Edition::class); - $this->edition = $var; - - return $this; - } - - /** - * Optional. Controls the default backup schedule behavior for new databases - * within the instance. By default, a backup schedule is created automatically - * when a new database is created in a new instance. - * Note that the `AUTOMATIC` value isn't permitted for free instances, - * as backups and backup schedules aren't supported for free instances. - * In the `GetInstance` or `ListInstances` response, if the value of - * `default_backup_schedule_type` isn't set, or set to `NONE`, Spanner doesn't - * create a default backup schedule for new databases in the instance. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.DefaultBackupScheduleType default_backup_schedule_type = 23 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getDefaultBackupScheduleType() - { - return $this->default_backup_schedule_type; - } - - /** - * Optional. Controls the default backup schedule behavior for new databases - * within the instance. By default, a backup schedule is created automatically - * when a new database is created in a new instance. - * Note that the `AUTOMATIC` value isn't permitted for free instances, - * as backups and backup schedules aren't supported for free instances. - * In the `GetInstance` or `ListInstances` response, if the value of - * `default_backup_schedule_type` isn't set, or set to `NONE`, Spanner doesn't - * create a default backup schedule for new databases in the instance. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance.DefaultBackupScheduleType default_backup_schedule_type = 23 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setDefaultBackupScheduleType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\Instance\DefaultBackupScheduleType::class); - $this->default_backup_schedule_type = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/DefaultBackupScheduleType.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/DefaultBackupScheduleType.php deleted file mode 100644 index ca0a5ec8fd95..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/DefaultBackupScheduleType.php +++ /dev/null @@ -1,71 +0,0 @@ -google.spanner.admin.instance.v1.Instance.DefaultBackupScheduleType - */ -class DefaultBackupScheduleType -{ - /** - * Not specified. - * - * Generated from protobuf enum DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIED = 0; - */ - const DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIED = 0; - /** - * A default backup schedule isn't created automatically when a new database - * is created in the instance. - * - * Generated from protobuf enum NONE = 1; - */ - const NONE = 1; - /** - * A default backup schedule is created automatically when a new database - * is created in the instance. The default backup schedule creates a full - * backup every 24 hours. These full backups are retained for 7 days. - * You can edit or delete the default backup schedule once it's created. - * - * Generated from protobuf enum AUTOMATIC = 2; - */ - const AUTOMATIC = 2; - - private static $valueToName = [ - self::DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIED => 'DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIED', - self::NONE => 'NONE', - self::AUTOMATIC => 'AUTOMATIC', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(DefaultBackupScheduleType::class, \Google\Cloud\Spanner\Admin\Instance\V1\Instance_DefaultBackupScheduleType::class); - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/Edition.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/Edition.php deleted file mode 100644 index f05fa2f3b48d..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/Edition.php +++ /dev/null @@ -1,72 +0,0 @@ -google.spanner.admin.instance.v1.Instance.Edition - */ -class Edition -{ - /** - * Edition not specified. - * - * Generated from protobuf enum EDITION_UNSPECIFIED = 0; - */ - const EDITION_UNSPECIFIED = 0; - /** - * Standard edition. - * - * Generated from protobuf enum STANDARD = 1; - */ - const STANDARD = 1; - /** - * Enterprise edition. - * - * Generated from protobuf enum ENTERPRISE = 2; - */ - const ENTERPRISE = 2; - /** - * Enterprise Plus edition. - * - * Generated from protobuf enum ENTERPRISE_PLUS = 3; - */ - const ENTERPRISE_PLUS = 3; - - private static $valueToName = [ - self::EDITION_UNSPECIFIED => 'EDITION_UNSPECIFIED', - self::STANDARD => 'STANDARD', - self::ENTERPRISE => 'ENTERPRISE', - self::ENTERPRISE_PLUS => 'ENTERPRISE_PLUS', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Edition::class, \Google\Cloud\Spanner\Admin\Instance\V1\Instance_Edition::class); - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/State.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/State.php deleted file mode 100644 index 6490899edb93..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance/State.php +++ /dev/null @@ -1,67 +0,0 @@ -google.spanner.admin.instance.v1.Instance.State - */ -class State -{ - /** - * Not specified. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * The instance is still being created. Resources may not be - * available yet, and operations such as database creation may not - * work. - * - * Generated from protobuf enum CREATING = 1; - */ - const CREATING = 1; - /** - * The instance is fully created and ready to do work such as - * creating databases. - * - * Generated from protobuf enum READY = 2; - */ - const READY = 2; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::CREATING => 'CREATING', - self::READY => 'READY', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(State::class, \Google\Cloud\Spanner\Admin\Instance\V1\Instance_State::class); - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig.php deleted file mode 100644 index 0fc49ee6a9a1..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig.php +++ /dev/null @@ -1,690 +0,0 @@ -google.spanner.admin.instance.v1.InstanceConfig - */ -class InstanceConfig extends \Google\Protobuf\Internal\Message -{ - /** - * A unique identifier for the instance configuration. Values - * are of the form - * `projects//instanceConfigs/[a-z][-a-z0-9]*`. - * User instance configuration must start with `custom-`. - * - * Generated from protobuf field string name = 1; - */ - protected $name = ''; - /** - * The name of this instance configuration as it appears in UIs. - * - * Generated from protobuf field string display_name = 2; - */ - protected $display_name = ''; - /** - * Output only. Whether this instance configuration is a Google-managed or - * user-managed configuration. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.Type config_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $config_type = 0; - /** - * The geographic placement of nodes in this instance configuration and their - * replication properties. - * To create user-managed configurations, input - * `replicas` must include all replicas in `replicas` of the `base_config` - * and include one or more replicas in the `optional_replicas` of the - * `base_config`. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaInfo replicas = 3; - */ - private $replicas; - /** - * Output only. The available optional replicas to choose from for - * user-managed configurations. Populated for Google-managed configurations. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaInfo optional_replicas = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $optional_replicas; - /** - * Base configuration name, e.g. projects//instanceConfigs/nam3, - * based on which this configuration is created. Only set for user-managed - * configurations. `base_config` must refer to a configuration of type - * `GOOGLE_MANAGED` in the same project as this configuration. - * - * Generated from protobuf field string base_config = 7 [(.google.api.resource_reference) = { - */ - protected $base_config = ''; - /** - * Cloud Labels are a flexible and lightweight mechanism for organizing cloud - * resources into groups that reflect a customer's organizational needs and - * deployment strategies. Cloud Labels can be used to filter collections of - * resources. They can be used to control how resource metrics are aggregated. - * And they can be used as arguments to policy management rules (e.g. route, - * firewall, load balancing, etc.). - * * Label keys must be between 1 and 63 characters long and must conform to - * the following regular expression: `[a-z][a-z0-9_-]{0,62}`. - * * Label values must be between 0 and 63 characters long and must conform - * to the regular expression `[a-z0-9_-]{0,63}`. - * * No more than 64 labels can be associated with a given resource. - * See https://goo.gl/xmQnxf for more information on and examples of labels. - * If you plan to use labels in your own code, please note that additional - * characters may be allowed in the future. Therefore, you are advised to use - * an internal label representation, such as JSON, which doesn't rely upon - * specific characters being disallowed. For example, representing labels - * as the string: name + "_" + value would prove problematic if we were to - * allow "_" in a future release. - * - * Generated from protobuf field map labels = 8; - */ - private $labels; - /** - * etag is used for optimistic concurrency control as a way - * to help prevent simultaneous updates of a instance configuration from - * overwriting each other. It is strongly suggested that systems make use of - * the etag in the read-modify-write cycle to perform instance configuration - * updates in order to avoid race conditions: An etag is returned in the - * response which contains instance configurations, and systems are expected - * to put that etag in the request to update instance configuration to ensure - * that their change is applied to the same version of the instance - * configuration. If no etag is provided in the call to update the instance - * configuration, then the existing instance configuration is overwritten - * blindly. - * - * Generated from protobuf field string etag = 9; - */ - protected $etag = ''; - /** - * Allowed values of the "default_leader" schema option for databases in - * instances that use this instance configuration. - * - * Generated from protobuf field repeated string leader_options = 4; - */ - private $leader_options; - /** - * Output only. If true, the instance configuration is being created or - * updated. If false, there are no ongoing operations for the instance - * configuration. - * - * Generated from protobuf field bool reconciling = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $reconciling = false; - /** - * Output only. The current instance configuration state. Applicable only for - * `USER_MANAGED` configurations. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.State state = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $state = 0; - /** - * Output only. Describes whether free instances are available to be created - * in this instance configuration. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.FreeInstanceAvailability free_instance_availability = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $free_instance_availability = 0; - /** - * Output only. The `QuorumType` of the instance configuration. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.QuorumType quorum_type = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $quorum_type = 0; - /** - * Output only. The storage limit in bytes per processing unit. - * - * Generated from protobuf field int64 storage_limit_per_processing_unit = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $storage_limit_per_processing_unit = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * A unique identifier for the instance configuration. Values - * are of the form - * `projects//instanceConfigs/[a-z][-a-z0-9]*`. - * User instance configuration must start with `custom-`. - * @type string $display_name - * The name of this instance configuration as it appears in UIs. - * @type int $config_type - * Output only. Whether this instance configuration is a Google-managed or - * user-managed configuration. - * @type array<\Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo>|\Google\Protobuf\Internal\RepeatedField $replicas - * The geographic placement of nodes in this instance configuration and their - * replication properties. - * To create user-managed configurations, input - * `replicas` must include all replicas in `replicas` of the `base_config` - * and include one or more replicas in the `optional_replicas` of the - * `base_config`. - * @type array<\Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo>|\Google\Protobuf\Internal\RepeatedField $optional_replicas - * Output only. The available optional replicas to choose from for - * user-managed configurations. Populated for Google-managed configurations. - * @type string $base_config - * Base configuration name, e.g. projects//instanceConfigs/nam3, - * based on which this configuration is created. Only set for user-managed - * configurations. `base_config` must refer to a configuration of type - * `GOOGLE_MANAGED` in the same project as this configuration. - * @type array|\Google\Protobuf\Internal\MapField $labels - * Cloud Labels are a flexible and lightweight mechanism for organizing cloud - * resources into groups that reflect a customer's organizational needs and - * deployment strategies. Cloud Labels can be used to filter collections of - * resources. They can be used to control how resource metrics are aggregated. - * And they can be used as arguments to policy management rules (e.g. route, - * firewall, load balancing, etc.). - * * Label keys must be between 1 and 63 characters long and must conform to - * the following regular expression: `[a-z][a-z0-9_-]{0,62}`. - * * Label values must be between 0 and 63 characters long and must conform - * to the regular expression `[a-z0-9_-]{0,63}`. - * * No more than 64 labels can be associated with a given resource. - * See https://goo.gl/xmQnxf for more information on and examples of labels. - * If you plan to use labels in your own code, please note that additional - * characters may be allowed in the future. Therefore, you are advised to use - * an internal label representation, such as JSON, which doesn't rely upon - * specific characters being disallowed. For example, representing labels - * as the string: name + "_" + value would prove problematic if we were to - * allow "_" in a future release. - * @type string $etag - * etag is used for optimistic concurrency control as a way - * to help prevent simultaneous updates of a instance configuration from - * overwriting each other. It is strongly suggested that systems make use of - * the etag in the read-modify-write cycle to perform instance configuration - * updates in order to avoid race conditions: An etag is returned in the - * response which contains instance configurations, and systems are expected - * to put that etag in the request to update instance configuration to ensure - * that their change is applied to the same version of the instance - * configuration. If no etag is provided in the call to update the instance - * configuration, then the existing instance configuration is overwritten - * blindly. - * @type array|\Google\Protobuf\Internal\RepeatedField $leader_options - * Allowed values of the "default_leader" schema option for databases in - * instances that use this instance configuration. - * @type bool $reconciling - * Output only. If true, the instance configuration is being created or - * updated. If false, there are no ongoing operations for the instance - * configuration. - * @type int $state - * Output only. The current instance configuration state. Applicable only for - * `USER_MANAGED` configurations. - * @type int $free_instance_availability - * Output only. Describes whether free instances are available to be created - * in this instance configuration. - * @type int $quorum_type - * Output only. The `QuorumType` of the instance configuration. - * @type int|string $storage_limit_per_processing_unit - * Output only. The storage limit in bytes per processing unit. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * A unique identifier for the instance configuration. Values - * are of the form - * `projects//instanceConfigs/[a-z][-a-z0-9]*`. - * User instance configuration must start with `custom-`. - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * A unique identifier for the instance configuration. Values - * are of the form - * `projects//instanceConfigs/[a-z][-a-z0-9]*`. - * User instance configuration must start with `custom-`. - * - * Generated from protobuf field string name = 1; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The name of this instance configuration as it appears in UIs. - * - * Generated from protobuf field string display_name = 2; - * @return string - */ - public function getDisplayName() - { - return $this->display_name; - } - - /** - * The name of this instance configuration as it appears in UIs. - * - * Generated from protobuf field string display_name = 2; - * @param string $var - * @return $this - */ - public function setDisplayName($var) - { - GPBUtil::checkString($var, True); - $this->display_name = $var; - - return $this; - } - - /** - * Output only. Whether this instance configuration is a Google-managed or - * user-managed configuration. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.Type config_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getConfigType() - { - return $this->config_type; - } - - /** - * Output only. Whether this instance configuration is a Google-managed or - * user-managed configuration. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.Type config_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setConfigType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig\Type::class); - $this->config_type = $var; - - return $this; - } - - /** - * The geographic placement of nodes in this instance configuration and their - * replication properties. - * To create user-managed configurations, input - * `replicas` must include all replicas in `replicas` of the `base_config` - * and include one or more replicas in the `optional_replicas` of the - * `base_config`. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaInfo replicas = 3; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getReplicas() - { - return $this->replicas; - } - - /** - * The geographic placement of nodes in this instance configuration and their - * replication properties. - * To create user-managed configurations, input - * `replicas` must include all replicas in `replicas` of the `base_config` - * and include one or more replicas in the `optional_replicas` of the - * `base_config`. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaInfo replicas = 3; - * @param array<\Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setReplicas($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo::class); - $this->replicas = $arr; - - return $this; - } - - /** - * Output only. The available optional replicas to choose from for - * user-managed configurations. Populated for Google-managed configurations. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaInfo optional_replicas = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getOptionalReplicas() - { - return $this->optional_replicas; - } - - /** - * Output only. The available optional replicas to choose from for - * user-managed configurations. Populated for Google-managed configurations. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.ReplicaInfo optional_replicas = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param array<\Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setOptionalReplicas($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo::class); - $this->optional_replicas = $arr; - - return $this; - } - - /** - * Base configuration name, e.g. projects//instanceConfigs/nam3, - * based on which this configuration is created. Only set for user-managed - * configurations. `base_config` must refer to a configuration of type - * `GOOGLE_MANAGED` in the same project as this configuration. - * - * Generated from protobuf field string base_config = 7 [(.google.api.resource_reference) = { - * @return string - */ - public function getBaseConfig() - { - return $this->base_config; - } - - /** - * Base configuration name, e.g. projects//instanceConfigs/nam3, - * based on which this configuration is created. Only set for user-managed - * configurations. `base_config` must refer to a configuration of type - * `GOOGLE_MANAGED` in the same project as this configuration. - * - * Generated from protobuf field string base_config = 7 [(.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setBaseConfig($var) - { - GPBUtil::checkString($var, True); - $this->base_config = $var; - - return $this; - } - - /** - * Cloud Labels are a flexible and lightweight mechanism for organizing cloud - * resources into groups that reflect a customer's organizational needs and - * deployment strategies. Cloud Labels can be used to filter collections of - * resources. They can be used to control how resource metrics are aggregated. - * And they can be used as arguments to policy management rules (e.g. route, - * firewall, load balancing, etc.). - * * Label keys must be between 1 and 63 characters long and must conform to - * the following regular expression: `[a-z][a-z0-9_-]{0,62}`. - * * Label values must be between 0 and 63 characters long and must conform - * to the regular expression `[a-z0-9_-]{0,63}`. - * * No more than 64 labels can be associated with a given resource. - * See https://goo.gl/xmQnxf for more information on and examples of labels. - * If you plan to use labels in your own code, please note that additional - * characters may be allowed in the future. Therefore, you are advised to use - * an internal label representation, such as JSON, which doesn't rely upon - * specific characters being disallowed. For example, representing labels - * as the string: name + "_" + value would prove problematic if we were to - * allow "_" in a future release. - * - * Generated from protobuf field map labels = 8; - * @return \Google\Protobuf\Internal\MapField - */ - public function getLabels() - { - return $this->labels; - } - - /** - * Cloud Labels are a flexible and lightweight mechanism for organizing cloud - * resources into groups that reflect a customer's organizational needs and - * deployment strategies. Cloud Labels can be used to filter collections of - * resources. They can be used to control how resource metrics are aggregated. - * And they can be used as arguments to policy management rules (e.g. route, - * firewall, load balancing, etc.). - * * Label keys must be between 1 and 63 characters long and must conform to - * the following regular expression: `[a-z][a-z0-9_-]{0,62}`. - * * Label values must be between 0 and 63 characters long and must conform - * to the regular expression `[a-z0-9_-]{0,63}`. - * * No more than 64 labels can be associated with a given resource. - * See https://goo.gl/xmQnxf for more information on and examples of labels. - * If you plan to use labels in your own code, please note that additional - * characters may be allowed in the future. Therefore, you are advised to use - * an internal label representation, such as JSON, which doesn't rely upon - * specific characters being disallowed. For example, representing labels - * as the string: name + "_" + value would prove problematic if we were to - * allow "_" in a future release. - * - * Generated from protobuf field map labels = 8; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setLabels($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->labels = $arr; - - return $this; - } - - /** - * etag is used for optimistic concurrency control as a way - * to help prevent simultaneous updates of a instance configuration from - * overwriting each other. It is strongly suggested that systems make use of - * the etag in the read-modify-write cycle to perform instance configuration - * updates in order to avoid race conditions: An etag is returned in the - * response which contains instance configurations, and systems are expected - * to put that etag in the request to update instance configuration to ensure - * that their change is applied to the same version of the instance - * configuration. If no etag is provided in the call to update the instance - * configuration, then the existing instance configuration is overwritten - * blindly. - * - * Generated from protobuf field string etag = 9; - * @return string - */ - public function getEtag() - { - return $this->etag; - } - - /** - * etag is used for optimistic concurrency control as a way - * to help prevent simultaneous updates of a instance configuration from - * overwriting each other. It is strongly suggested that systems make use of - * the etag in the read-modify-write cycle to perform instance configuration - * updates in order to avoid race conditions: An etag is returned in the - * response which contains instance configurations, and systems are expected - * to put that etag in the request to update instance configuration to ensure - * that their change is applied to the same version of the instance - * configuration. If no etag is provided in the call to update the instance - * configuration, then the existing instance configuration is overwritten - * blindly. - * - * Generated from protobuf field string etag = 9; - * @param string $var - * @return $this - */ - public function setEtag($var) - { - GPBUtil::checkString($var, True); - $this->etag = $var; - - return $this; - } - - /** - * Allowed values of the "default_leader" schema option for databases in - * instances that use this instance configuration. - * - * Generated from protobuf field repeated string leader_options = 4; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getLeaderOptions() - { - return $this->leader_options; - } - - /** - * Allowed values of the "default_leader" schema option for databases in - * instances that use this instance configuration. - * - * Generated from protobuf field repeated string leader_options = 4; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setLeaderOptions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->leader_options = $arr; - - return $this; - } - - /** - * Output only. If true, the instance configuration is being created or - * updated. If false, there are no ongoing operations for the instance - * configuration. - * - * Generated from protobuf field bool reconciling = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return bool - */ - public function getReconciling() - { - return $this->reconciling; - } - - /** - * Output only. If true, the instance configuration is being created or - * updated. If false, there are no ongoing operations for the instance - * configuration. - * - * Generated from protobuf field bool reconciling = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param bool $var - * @return $this - */ - public function setReconciling($var) - { - GPBUtil::checkBool($var); - $this->reconciling = $var; - - return $this; - } - - /** - * Output only. The current instance configuration state. Applicable only for - * `USER_MANAGED` configurations. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.State state = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * Output only. The current instance configuration state. Applicable only for - * `USER_MANAGED` configurations. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.State state = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig\State::class); - $this->state = $var; - - return $this; - } - - /** - * Output only. Describes whether free instances are available to be created - * in this instance configuration. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.FreeInstanceAvailability free_instance_availability = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getFreeInstanceAvailability() - { - return $this->free_instance_availability; - } - - /** - * Output only. Describes whether free instances are available to be created - * in this instance configuration. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.FreeInstanceAvailability free_instance_availability = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setFreeInstanceAvailability($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig\FreeInstanceAvailability::class); - $this->free_instance_availability = $var; - - return $this; - } - - /** - * Output only. The `QuorumType` of the instance configuration. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.QuorumType quorum_type = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getQuorumType() - { - return $this->quorum_type; - } - - /** - * Output only. The `QuorumType` of the instance configuration. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.QuorumType quorum_type = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setQuorumType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig\QuorumType::class); - $this->quorum_type = $var; - - return $this; - } - - /** - * Output only. The storage limit in bytes per processing unit. - * - * Generated from protobuf field int64 storage_limit_per_processing_unit = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int|string - */ - public function getStorageLimitPerProcessingUnit() - { - return $this->storage_limit_per_processing_unit; - } - - /** - * Output only. The storage limit in bytes per processing unit. - * - * Generated from protobuf field int64 storage_limit_per_processing_unit = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int|string $var - * @return $this - */ - public function setStorageLimitPerProcessingUnit($var) - { - GPBUtil::checkInt64($var); - $this->storage_limit_per_processing_unit = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/State.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/State.php deleted file mode 100644 index 99a17baaa4f8..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/State.php +++ /dev/null @@ -1,65 +0,0 @@ -google.spanner.admin.instance.v1.InstanceConfig.State - */ -class State -{ - /** - * Not specified. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * The instance configuration is still being created. - * - * Generated from protobuf enum CREATING = 1; - */ - const CREATING = 1; - /** - * The instance configuration is fully created and ready to be used to - * create instances. - * - * Generated from protobuf enum READY = 2; - */ - const READY = 2; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::CREATING => 'CREATING', - self::READY => 'READY', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(State::class, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig_State::class); - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/Type.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/Type.php deleted file mode 100644 index 08f5079da568..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig/Type.php +++ /dev/null @@ -1,64 +0,0 @@ -google.spanner.admin.instance.v1.InstanceConfig.Type - */ -class Type -{ - /** - * Unspecified. - * - * Generated from protobuf enum TYPE_UNSPECIFIED = 0; - */ - const TYPE_UNSPECIFIED = 0; - /** - * Google-managed configuration. - * - * Generated from protobuf enum GOOGLE_MANAGED = 1; - */ - const GOOGLE_MANAGED = 1; - /** - * User-managed configuration. - * - * Generated from protobuf enum USER_MANAGED = 2; - */ - const USER_MANAGED = 2; - - private static $valueToName = [ - self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', - self::GOOGLE_MANAGED => 'GOOGLE_MANAGED', - self::USER_MANAGED => 'USER_MANAGED', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Type::class, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig_Type::class); - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstancePartition.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstancePartition.php deleted file mode 100644 index b912f776285f..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstancePartition.php +++ /dev/null @@ -1,568 +0,0 @@ -google.spanner.admin.instance.v1.InstancePartition - */ -class InstancePartition extends \Google\Protobuf\Internal\Message -{ - /** - * Required. A unique identifier for the instance partition. Values are of the - * form - * `projects//instances//instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`. - * The final segment of the name must be between 2 and 64 characters in - * length. An instance partition's name cannot be changed after the instance - * partition is created. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $name = ''; - /** - * Required. The name of the instance partition's configuration. Values are of - * the form `projects//instanceConfigs/`. See also - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and - * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. - * - * Generated from protobuf field string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $config = ''; - /** - * Required. The descriptive name for this instance partition as it appears in - * UIs. Must be unique per project and between 4 and 30 characters in length. - * - * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $display_name = ''; - /** - * Output only. The current instance partition state. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $state = 0; - /** - * Output only. The time at which the instance partition was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $create_time = null; - /** - * Output only. The time at which the instance partition was most recently - * updated. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $update_time = null; - /** - * Output only. The names of the databases that reference this - * instance partition. Referencing databases should share the parent instance. - * The existence of any referencing database prevents the instance partition - * from being deleted. - * - * Generated from protobuf field repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $referencing_databases; - /** - * Output only. Deprecated: This field is not populated. - * Output only. The names of the backups that reference this instance - * partition. Referencing backups should share the parent instance. The - * existence of any referencing backup prevents the instance partition from - * being deleted. - * - * Generated from protobuf field repeated string referencing_backups = 11 [deprecated = true, (.google.api.field_behavior) = OUTPUT_ONLY]; - * @deprecated - */ - private $referencing_backups; - /** - * Used for optimistic concurrency control as a way - * to help prevent simultaneous updates of a instance partition from - * overwriting each other. It is strongly suggested that systems make use of - * the etag in the read-modify-write cycle to perform instance partition - * updates in order to avoid race conditions: An etag is returned in the - * response which contains instance partitions, and systems are expected to - * put that etag in the request to update instance partitions to ensure that - * their change will be applied to the same version of the instance partition. - * If no etag is provided in the call to update instance partition, then the - * existing instance partition is overwritten blindly. - * - * Generated from protobuf field string etag = 12; - */ - protected $etag = ''; - protected $compute_capacity; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. A unique identifier for the instance partition. Values are of the - * form - * `projects//instances//instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`. - * The final segment of the name must be between 2 and 64 characters in - * length. An instance partition's name cannot be changed after the instance - * partition is created. - * @type string $config - * Required. The name of the instance partition's configuration. Values are of - * the form `projects//instanceConfigs/`. See also - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and - * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. - * @type string $display_name - * Required. The descriptive name for this instance partition as it appears in - * UIs. Must be unique per project and between 4 and 30 characters in length. - * @type int $node_count - * The number of nodes allocated to this instance partition. - * Users can set the `node_count` field to specify the target number of - * nodes allocated to the instance partition. - * This may be zero in API responses for instance partitions that are not - * yet in state `READY`. - * @type int $processing_units - * The number of processing units allocated to this instance partition. - * Users can set the `processing_units` field to specify the target number - * of processing units allocated to the instance partition. - * This might be zero in API responses for instance partitions that are not - * yet in the `READY` state. - * @type int $state - * Output only. The current instance partition state. - * @type \Google\Protobuf\Timestamp $create_time - * Output only. The time at which the instance partition was created. - * @type \Google\Protobuf\Timestamp $update_time - * Output only. The time at which the instance partition was most recently - * updated. - * @type array|\Google\Protobuf\Internal\RepeatedField $referencing_databases - * Output only. The names of the databases that reference this - * instance partition. Referencing databases should share the parent instance. - * The existence of any referencing database prevents the instance partition - * from being deleted. - * @type array|\Google\Protobuf\Internal\RepeatedField $referencing_backups - * Output only. Deprecated: This field is not populated. - * Output only. The names of the backups that reference this instance - * partition. Referencing backups should share the parent instance. The - * existence of any referencing backup prevents the instance partition from - * being deleted. - * @type string $etag - * Used for optimistic concurrency control as a way - * to help prevent simultaneous updates of a instance partition from - * overwriting each other. It is strongly suggested that systems make use of - * the etag in the read-modify-write cycle to perform instance partition - * updates in order to avoid race conditions: An etag is returned in the - * response which contains instance partitions, and systems are expected to - * put that etag in the request to update instance partitions to ensure that - * their change will be applied to the same version of the instance partition. - * If no etag is provided in the call to update instance partition, then the - * existing instance partition is overwritten blindly. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. A unique identifier for the instance partition. Values are of the - * form - * `projects//instances//instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`. - * The final segment of the name must be between 2 and 64 characters in - * length. An instance partition's name cannot be changed after the instance - * partition is created. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. A unique identifier for the instance partition. Values are of the - * form - * `projects//instances//instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`. - * The final segment of the name must be between 2 and 64 characters in - * length. An instance partition's name cannot be changed after the instance - * partition is created. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Required. The name of the instance partition's configuration. Values are of - * the form `projects//instanceConfigs/`. See also - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and - * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. - * - * Generated from protobuf field string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getConfig() - { - return $this->config; - } - - /** - * Required. The name of the instance partition's configuration. Values are of - * the form `projects//instanceConfigs/`. See also - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and - * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. - * - * Generated from protobuf field string config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setConfig($var) - { - GPBUtil::checkString($var, True); - $this->config = $var; - - return $this; - } - - /** - * Required. The descriptive name for this instance partition as it appears in - * UIs. Must be unique per project and between 4 and 30 characters in length. - * - * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getDisplayName() - { - return $this->display_name; - } - - /** - * Required. The descriptive name for this instance partition as it appears in - * UIs. Must be unique per project and between 4 and 30 characters in length. - * - * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setDisplayName($var) - { - GPBUtil::checkString($var, True); - $this->display_name = $var; - - return $this; - } - - /** - * The number of nodes allocated to this instance partition. - * Users can set the `node_count` field to specify the target number of - * nodes allocated to the instance partition. - * This may be zero in API responses for instance partitions that are not - * yet in state `READY`. - * - * Generated from protobuf field int32 node_count = 5; - * @return int - */ - public function getNodeCount() - { - return $this->readOneof(5); - } - - public function hasNodeCount() - { - return $this->hasOneof(5); - } - - /** - * The number of nodes allocated to this instance partition. - * Users can set the `node_count` field to specify the target number of - * nodes allocated to the instance partition. - * This may be zero in API responses for instance partitions that are not - * yet in state `READY`. - * - * Generated from protobuf field int32 node_count = 5; - * @param int $var - * @return $this - */ - public function setNodeCount($var) - { - GPBUtil::checkInt32($var); - $this->writeOneof(5, $var); - - return $this; - } - - /** - * The number of processing units allocated to this instance partition. - * Users can set the `processing_units` field to specify the target number - * of processing units allocated to the instance partition. - * This might be zero in API responses for instance partitions that are not - * yet in the `READY` state. - * - * Generated from protobuf field int32 processing_units = 6; - * @return int - */ - public function getProcessingUnits() - { - return $this->readOneof(6); - } - - public function hasProcessingUnits() - { - return $this->hasOneof(6); - } - - /** - * The number of processing units allocated to this instance partition. - * Users can set the `processing_units` field to specify the target number - * of processing units allocated to the instance partition. - * This might be zero in API responses for instance partitions that are not - * yet in the `READY` state. - * - * Generated from protobuf field int32 processing_units = 6; - * @param int $var - * @return $this - */ - public function setProcessingUnits($var) - { - GPBUtil::checkInt32($var); - $this->writeOneof(6, $var); - - return $this; - } - - /** - * Output only. The current instance partition state. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * Output only. The current instance partition state. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition\State::class); - $this->state = $var; - - return $this; - } - - /** - * Output only. The time at which the instance partition was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCreateTime() - { - return $this->create_time; - } - - public function hasCreateTime() - { - return isset($this->create_time); - } - - public function clearCreateTime() - { - unset($this->create_time); - } - - /** - * Output only. The time at which the instance partition was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCreateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->create_time = $var; - - return $this; - } - - /** - * Output only. The time at which the instance partition was most recently - * updated. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getUpdateTime() - { - return $this->update_time; - } - - public function hasUpdateTime() - { - return isset($this->update_time); - } - - public function clearUpdateTime() - { - unset($this->update_time); - } - - /** - * Output only. The time at which the instance partition was most recently - * updated. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setUpdateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->update_time = $var; - - return $this; - } - - /** - * Output only. The names of the databases that reference this - * instance partition. Referencing databases should share the parent instance. - * The existence of any referencing database prevents the instance partition - * from being deleted. - * - * Generated from protobuf field repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getReferencingDatabases() - { - return $this->referencing_databases; - } - - /** - * Output only. The names of the databases that reference this - * instance partition. Referencing databases should share the parent instance. - * The existence of any referencing database prevents the instance partition - * from being deleted. - * - * Generated from protobuf field repeated string referencing_databases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setReferencingDatabases($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->referencing_databases = $arr; - - return $this; - } - - /** - * Output only. Deprecated: This field is not populated. - * Output only. The names of the backups that reference this instance - * partition. Referencing backups should share the parent instance. The - * existence of any referencing backup prevents the instance partition from - * being deleted. - * - * Generated from protobuf field repeated string referencing_backups = 11 [deprecated = true, (.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Internal\RepeatedField - * @deprecated - */ - public function getReferencingBackups() - { - @trigger_error('referencing_backups is deprecated.', E_USER_DEPRECATED); - return $this->referencing_backups; - } - - /** - * Output only. Deprecated: This field is not populated. - * Output only. The names of the backups that reference this instance - * partition. Referencing backups should share the parent instance. The - * existence of any referencing backup prevents the instance partition from - * being deleted. - * - * Generated from protobuf field repeated string referencing_backups = 11 [deprecated = true, (.google.api.field_behavior) = OUTPUT_ONLY]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - * @deprecated - */ - public function setReferencingBackups($var) - { - @trigger_error('referencing_backups is deprecated.', E_USER_DEPRECATED); - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->referencing_backups = $arr; - - return $this; - } - - /** - * Used for optimistic concurrency control as a way - * to help prevent simultaneous updates of a instance partition from - * overwriting each other. It is strongly suggested that systems make use of - * the etag in the read-modify-write cycle to perform instance partition - * updates in order to avoid race conditions: An etag is returned in the - * response which contains instance partitions, and systems are expected to - * put that etag in the request to update instance partitions to ensure that - * their change will be applied to the same version of the instance partition. - * If no etag is provided in the call to update instance partition, then the - * existing instance partition is overwritten blindly. - * - * Generated from protobuf field string etag = 12; - * @return string - */ - public function getEtag() - { - return $this->etag; - } - - /** - * Used for optimistic concurrency control as a way - * to help prevent simultaneous updates of a instance partition from - * overwriting each other. It is strongly suggested that systems make use of - * the etag in the read-modify-write cycle to perform instance partition - * updates in order to avoid race conditions: An etag is returned in the - * response which contains instance partitions, and systems are expected to - * put that etag in the request to update instance partitions to ensure that - * their change will be applied to the same version of the instance partition. - * If no etag is provided in the call to update instance partition, then the - * existing instance partition is overwritten blindly. - * - * Generated from protobuf field string etag = 12; - * @param string $var - * @return $this - */ - public function setEtag($var) - { - GPBUtil::checkString($var, True); - $this->etag = $var; - - return $this; - } - - /** - * @return string - */ - public function getComputeCapacity() - { - return $this->whichOneof("compute_capacity"); - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstancePartition/State.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstancePartition/State.php deleted file mode 100644 index 01cf1218b69e..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstancePartition/State.php +++ /dev/null @@ -1,67 +0,0 @@ -google.spanner.admin.instance.v1.InstancePartition.State - */ -class State -{ - /** - * Not specified. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * The instance partition is still being created. Resources may not be - * available yet, and operations such as creating placements using this - * instance partition may not work. - * - * Generated from protobuf enum CREATING = 1; - */ - const CREATING = 1; - /** - * The instance partition is fully created and ready to do work such as - * creating placements and using in databases. - * - * Generated from protobuf enum READY = 2; - */ - const READY = 2; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::CREATING => 'CREATING', - self::READY => 'READY', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(State::class, \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition_State::class); - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigOperationsRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigOperationsRequest.php deleted file mode 100644 index 4f688ae83d94..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigOperationsRequest.php +++ /dev/null @@ -1,349 +0,0 @@ -google.spanner.admin.instance.v1.ListInstanceConfigOperationsRequest - */ -class ListInstanceConfigOperationsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The project of the instance configuration operations. - * Values are of the form `projects/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * An expression that filters the list of returned operations. - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the Operation are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata] - * is - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=` \ - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) - * AND` \ - * `(metadata.instance_config.name:custom-config) AND` \ - * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. - * * The instance configuration name contains "custom-config". - * * The operation started before 2021-03-28T14:50:00Z. - * * The operation resulted in an error. - * - * Generated from protobuf field string filter = 2; - */ - protected $filter = ''; - /** - * Number of operations to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 3; - */ - protected $page_size = 0; - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse.next_page_token] - * from a previous - * [ListInstanceConfigOperationsResponse][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse] - * to the same `parent` and with the same `filter`. - * - * Generated from protobuf field string page_token = 4; - */ - protected $page_token = ''; - - /** - * @param string $parent Required. The project of the instance configuration operations. - * Values are of the form `projects/`. Please see - * {@see InstanceAdminClient::projectName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Instance\V1\ListInstanceConfigOperationsRequest - * - * @experimental - */ - public static function build(string $parent): self - { - return (new self()) - ->setParent($parent); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The project of the instance configuration operations. - * Values are of the form `projects/`. - * @type string $filter - * An expression that filters the list of returned operations. - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the Operation are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata] - * is - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=` \ - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) - * AND` \ - * `(metadata.instance_config.name:custom-config) AND` \ - * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. - * * The instance configuration name contains "custom-config". - * * The operation started before 2021-03-28T14:50:00Z. - * * The operation resulted in an error. - * @type int $page_size - * Number of operations to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * @type string $page_token - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse.next_page_token] - * from a previous - * [ListInstanceConfigOperationsResponse][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse] - * to the same `parent` and with the same `filter`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The project of the instance configuration operations. - * Values are of the form `projects/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The project of the instance configuration operations. - * Values are of the form `projects/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * An expression that filters the list of returned operations. - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the Operation are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata] - * is - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=` \ - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) - * AND` \ - * `(metadata.instance_config.name:custom-config) AND` \ - * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. - * * The instance configuration name contains "custom-config". - * * The operation started before 2021-03-28T14:50:00Z. - * * The operation resulted in an error. - * - * Generated from protobuf field string filter = 2; - * @return string - */ - public function getFilter() - { - return $this->filter; - } - - /** - * An expression that filters the list of returned operations. - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the Operation are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata] - * is - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=` \ - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) - * AND` \ - * `(metadata.instance_config.name:custom-config) AND` \ - * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. - * * The instance configuration name contains "custom-config". - * * The operation started before 2021-03-28T14:50:00Z. - * * The operation resulted in an error. - * - * Generated from protobuf field string filter = 2; - * @param string $var - * @return $this - */ - public function setFilter($var) - { - GPBUtil::checkString($var, True); - $this->filter = $var; - - return $this; - } - - /** - * Number of operations to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 3; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Number of operations to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 3; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse.next_page_token] - * from a previous - * [ListInstanceConfigOperationsResponse][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse] - * to the same `parent` and with the same `filter`. - * - * Generated from protobuf field string page_token = 4; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse.next_page_token] - * from a previous - * [ListInstanceConfigOperationsResponse][google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse] - * to the same `parent` and with the same `filter`. - * - * Generated from protobuf field string page_token = 4; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigOperationsResponse.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigOperationsResponse.php deleted file mode 100644 index b21040c453ec..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigOperationsResponse.php +++ /dev/null @@ -1,126 +0,0 @@ -google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse - */ -class ListInstanceConfigOperationsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The list of matching instance configuration long-running operations. Each - * operation's name will be - * prefixed by the name of the instance configuration. The operation's - * metadata field type - * `metadata.type_url` describes the type of the metadata. - * - * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; - */ - private $operations; - /** - * `next_page_token` can be sent in a subsequent - * [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations] - * call to fetch more of the matching metadata. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\LongRunning\Operation>|\Google\Protobuf\Internal\RepeatedField $operations - * The list of matching instance configuration long-running operations. Each - * operation's name will be - * prefixed by the name of the instance configuration. The operation's - * metadata field type - * `metadata.type_url` describes the type of the metadata. - * @type string $next_page_token - * `next_page_token` can be sent in a subsequent - * [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations] - * call to fetch more of the matching metadata. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * The list of matching instance configuration long-running operations. Each - * operation's name will be - * prefixed by the name of the instance configuration. The operation's - * metadata field type - * `metadata.type_url` describes the type of the metadata. - * - * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getOperations() - { - return $this->operations; - } - - /** - * The list of matching instance configuration long-running operations. Each - * operation's name will be - * prefixed by the name of the instance configuration. The operation's - * metadata field type - * `metadata.type_url` describes the type of the metadata. - * - * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; - * @param array<\Google\LongRunning\Operation>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setOperations($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\LongRunning\Operation::class); - $this->operations = $arr; - - return $this; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations] - * call to fetch more of the matching metadata. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListInstanceConfigOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigOperations] - * call to fetch more of the matching metadata. - * - * Generated from protobuf field string next_page_token = 2; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigsRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigsRequest.php deleted file mode 100644 index 8a0b73a6192b..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigsRequest.php +++ /dev/null @@ -1,176 +0,0 @@ -google.spanner.admin.instance.v1.ListInstanceConfigsRequest - */ -class ListInstanceConfigsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the project for which a list of supported instance - * configurations is requested. Values are of the form - * `projects/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Number of instance configurations to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 2; - */ - protected $page_size = 0; - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigsResponse.next_page_token] - * from a previous - * [ListInstanceConfigsResponse][google.spanner.admin.instance.v1.ListInstanceConfigsResponse]. - * - * Generated from protobuf field string page_token = 3; - */ - protected $page_token = ''; - - /** - * @param string $parent Required. The name of the project for which a list of supported instance - * configurations is requested. Values are of the form - * `projects/`. Please see - * {@see InstanceAdminClient::projectName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Instance\V1\ListInstanceConfigsRequest - * - * @experimental - */ - public static function build(string $parent): self - { - return (new self()) - ->setParent($parent); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The name of the project for which a list of supported instance - * configurations is requested. Values are of the form - * `projects/`. - * @type int $page_size - * Number of instance configurations to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * @type string $page_token - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigsResponse.next_page_token] - * from a previous - * [ListInstanceConfigsResponse][google.spanner.admin.instance.v1.ListInstanceConfigsResponse]. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the project for which a list of supported instance - * configurations is requested. Values are of the form - * `projects/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The name of the project for which a list of supported instance - * configurations is requested. Values are of the form - * `projects/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Number of instance configurations to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 2; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Number of instance configurations to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 2; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigsResponse.next_page_token] - * from a previous - * [ListInstanceConfigsResponse][google.spanner.admin.instance.v1.ListInstanceConfigsResponse]. - * - * Generated from protobuf field string page_token = 3; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.instance.v1.ListInstanceConfigsResponse.next_page_token] - * from a previous - * [ListInstanceConfigsResponse][google.spanner.admin.instance.v1.ListInstanceConfigsResponse]. - * - * Generated from protobuf field string page_token = 3; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigsResponse.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigsResponse.php deleted file mode 100644 index 73241c4da20d..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigsResponse.php +++ /dev/null @@ -1,110 +0,0 @@ -google.spanner.admin.instance.v1.ListInstanceConfigsResponse - */ -class ListInstanceConfigsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The list of requested instance configurations. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.InstanceConfig instance_configs = 1; - */ - private $instance_configs; - /** - * `next_page_token` can be sent in a subsequent - * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs] - * call to fetch more of the matching instance configurations. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig>|\Google\Protobuf\Internal\RepeatedField $instance_configs - * The list of requested instance configurations. - * @type string $next_page_token - * `next_page_token` can be sent in a subsequent - * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs] - * call to fetch more of the matching instance configurations. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * The list of requested instance configurations. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.InstanceConfig instance_configs = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getInstanceConfigs() - { - return $this->instance_configs; - } - - /** - * The list of requested instance configurations. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.InstanceConfig instance_configs = 1; - * @param array<\Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setInstanceConfigs($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig::class); - $this->instance_configs = $arr; - - return $this; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs] - * call to fetch more of the matching instance configurations. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs] - * call to fetch more of the matching instance configurations. - * - * Generated from protobuf field string next_page_token = 2; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionOperationsRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionOperationsRequest.php deleted file mode 100644 index 7df93edd57dc..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionOperationsRequest.php +++ /dev/null @@ -1,413 +0,0 @@ -google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest - */ -class ListInstancePartitionOperationsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The parent instance of the instance partition operations. - * Values are of the form `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Optional. An expression that filters the list of returned operations. - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the Operation are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] - * is - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=` \ - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) - * AND` \ - * `(metadata.instance_partition.name:custom-instance-partition) AND` \ - * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. - * * The instance partition name contains "custom-instance-partition". - * * The operation started before 2021-03-28T14:50:00Z. - * * The operation resulted in an error. - * - * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $filter = ''; - /** - * Optional. Number of operations to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $page_size = 0; - /** - * Optional. If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token] - * from a previous - * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse] - * to the same `parent` and with the same `filter`. - * - * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $page_token = ''; - /** - * Optional. Deadline used while retrieving metadata for instance partition - * operations. Instance partitions whose operation metadata cannot be - * retrieved within this deadline will be added to - * [unreachable_instance_partitions][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions] - * in - * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]. - * - * Generated from protobuf field .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $instance_partition_deadline = null; - - /** - * @param string $parent Required. The parent instance of the instance partition operations. - * Values are of the form `projects//instances/`. Please see - * {@see InstanceAdminClient::instanceName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Instance\V1\ListInstancePartitionOperationsRequest - * - * @experimental - */ - public static function build(string $parent): self - { - return (new self()) - ->setParent($parent); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The parent instance of the instance partition operations. - * Values are of the form `projects//instances/`. - * @type string $filter - * Optional. An expression that filters the list of returned operations. - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the Operation are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] - * is - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=` \ - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) - * AND` \ - * `(metadata.instance_partition.name:custom-instance-partition) AND` \ - * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. - * * The instance partition name contains "custom-instance-partition". - * * The operation started before 2021-03-28T14:50:00Z. - * * The operation resulted in an error. - * @type int $page_size - * Optional. Number of operations to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * @type string $page_token - * Optional. If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token] - * from a previous - * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse] - * to the same `parent` and with the same `filter`. - * @type \Google\Protobuf\Timestamp $instance_partition_deadline - * Optional. Deadline used while retrieving metadata for instance partition - * operations. Instance partitions whose operation metadata cannot be - * retrieved within this deadline will be added to - * [unreachable_instance_partitions][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions] - * in - * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The parent instance of the instance partition operations. - * Values are of the form `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The parent instance of the instance partition operations. - * Values are of the form `projects//instances/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Optional. An expression that filters the list of returned operations. - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the Operation are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] - * is - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=` \ - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) - * AND` \ - * `(metadata.instance_partition.name:custom-instance-partition) AND` \ - * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. - * * The instance partition name contains "custom-instance-partition". - * * The operation started before 2021-03-28T14:50:00Z. - * * The operation resulted in an error. - * - * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getFilter() - { - return $this->filter; - } - - /** - * Optional. An expression that filters the list of returned operations. - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * The following fields in the Operation are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] - * is - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=` \ - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) - * AND` \ - * `(metadata.instance_partition.name:custom-instance-partition) AND` \ - * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. - * * The instance partition name contains "custom-instance-partition". - * * The operation started before 2021-03-28T14:50:00Z. - * * The operation resulted in an error. - * - * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setFilter($var) - { - GPBUtil::checkString($var, True); - $this->filter = $var; - - return $this; - } - - /** - * Optional. Number of operations to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Optional. Number of operations to be returned in the response. If 0 or - * less, defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * Optional. If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token] - * from a previous - * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse] - * to the same `parent` and with the same `filter`. - * - * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * Optional. If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token] - * from a previous - * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse] - * to the same `parent` and with the same `filter`. - * - * Generated from protobuf field string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - - /** - * Optional. Deadline used while retrieving metadata for instance partition - * operations. Instance partitions whose operation metadata cannot be - * retrieved within this deadline will be added to - * [unreachable_instance_partitions][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions] - * in - * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]. - * - * Generated from protobuf field .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getInstancePartitionDeadline() - { - return $this->instance_partition_deadline; - } - - public function hasInstancePartitionDeadline() - { - return isset($this->instance_partition_deadline); - } - - public function clearInstancePartitionDeadline() - { - unset($this->instance_partition_deadline); - } - - /** - * Optional. Deadline used while retrieving metadata for instance partition - * operations. Instance partitions whose operation metadata cannot be - * retrieved within this deadline will be added to - * [unreachable_instance_partitions][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions] - * in - * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]. - * - * Generated from protobuf field .google.protobuf.Timestamp instance_partition_deadline = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setInstancePartitionDeadline($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->instance_partition_deadline = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionOperationsResponse.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionOperationsResponse.php deleted file mode 100644 index 06b112bd09d0..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionOperationsResponse.php +++ /dev/null @@ -1,172 +0,0 @@ -google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse - */ -class ListInstancePartitionOperationsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The list of matching instance partition long-running operations. Each - * operation's name will be - * prefixed by the instance partition's name. The operation's - * metadata field type - * `metadata.type_url` describes the type of the metadata. - * - * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; - */ - private $operations; - /** - * `next_page_token` can be sent in a subsequent - * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations] - * call to fetch more of the matching metadata. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - /** - * The list of unreachable instance partitions. - * It includes the names of instance partitions whose operation metadata could - * not be retrieved within - * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline]. - * - * Generated from protobuf field repeated string unreachable_instance_partitions = 3; - */ - private $unreachable_instance_partitions; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\LongRunning\Operation>|\Google\Protobuf\Internal\RepeatedField $operations - * The list of matching instance partition long-running operations. Each - * operation's name will be - * prefixed by the instance partition's name. The operation's - * metadata field type - * `metadata.type_url` describes the type of the metadata. - * @type string $next_page_token - * `next_page_token` can be sent in a subsequent - * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations] - * call to fetch more of the matching metadata. - * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable_instance_partitions - * The list of unreachable instance partitions. - * It includes the names of instance partitions whose operation metadata could - * not be retrieved within - * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline]. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * The list of matching instance partition long-running operations. Each - * operation's name will be - * prefixed by the instance partition's name. The operation's - * metadata field type - * `metadata.type_url` describes the type of the metadata. - * - * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getOperations() - { - return $this->operations; - } - - /** - * The list of matching instance partition long-running operations. Each - * operation's name will be - * prefixed by the instance partition's name. The operation's - * metadata field type - * `metadata.type_url` describes the type of the metadata. - * - * Generated from protobuf field repeated .google.longrunning.Operation operations = 1; - * @param array<\Google\LongRunning\Operation>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setOperations($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\LongRunning\Operation::class); - $this->operations = $arr; - - return $this; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations] - * call to fetch more of the matching metadata. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListInstancePartitionOperations][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitionOperations] - * call to fetch more of the matching metadata. - * - * Generated from protobuf field string next_page_token = 2; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - - /** - * The list of unreachable instance partitions. - * It includes the names of instance partitions whose operation metadata could - * not be retrieved within - * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline]. - * - * Generated from protobuf field repeated string unreachable_instance_partitions = 3; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getUnreachableInstancePartitions() - { - return $this->unreachable_instance_partitions; - } - - /** - * The list of unreachable instance partitions. - * It includes the names of instance partitions whose operation metadata could - * not be retrieved within - * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.instance_partition_deadline]. - * - * Generated from protobuf field repeated string unreachable_instance_partitions = 3; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setUnreachableInstancePartitions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->unreachable_instance_partitions = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionsRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionsRequest.php deleted file mode 100644 index 73977cce1e50..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionsRequest.php +++ /dev/null @@ -1,245 +0,0 @@ -google.spanner.admin.instance.v1.ListInstancePartitionsRequest - */ -class ListInstancePartitionsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The instance whose instance partitions should be listed. Values - * are of the form `projects//instances/`. Use `{instance} - * = '-'` to list instance partitions for all Instances in a project, e.g., - * `projects/myproject/instances/-`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Number of instance partitions to be returned in the response. If 0 or less, - * defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 2; - */ - protected $page_size = 0; - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token] - * from a previous - * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. - * - * Generated from protobuf field string page_token = 3; - */ - protected $page_token = ''; - /** - * Optional. Deadline used while retrieving metadata for instance partitions. - * Instance partitions whose metadata cannot be retrieved within this deadline - * will be added to - * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable] - * in - * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. - * - * Generated from protobuf field .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $instance_partition_deadline = null; - - /** - * @param string $parent Required. The instance whose instance partitions should be listed. Values - * are of the form `projects//instances/`. Use `{instance} - * = '-'` to list instance partitions for all Instances in a project, e.g., - * `projects/myproject/instances/-`. Please see - * {@see InstanceAdminClient::instanceName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Instance\V1\ListInstancePartitionsRequest - * - * @experimental - */ - public static function build(string $parent): self - { - return (new self()) - ->setParent($parent); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The instance whose instance partitions should be listed. Values - * are of the form `projects//instances/`. Use `{instance} - * = '-'` to list instance partitions for all Instances in a project, e.g., - * `projects/myproject/instances/-`. - * @type int $page_size - * Number of instance partitions to be returned in the response. If 0 or less, - * defaults to the server's maximum allowed page size. - * @type string $page_token - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token] - * from a previous - * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. - * @type \Google\Protobuf\Timestamp $instance_partition_deadline - * Optional. Deadline used while retrieving metadata for instance partitions. - * Instance partitions whose metadata cannot be retrieved within this deadline - * will be added to - * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable] - * in - * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The instance whose instance partitions should be listed. Values - * are of the form `projects//instances/`. Use `{instance} - * = '-'` to list instance partitions for all Instances in a project, e.g., - * `projects/myproject/instances/-`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The instance whose instance partitions should be listed. Values - * are of the form `projects//instances/`. Use `{instance} - * = '-'` to list instance partitions for all Instances in a project, e.g., - * `projects/myproject/instances/-`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Number of instance partitions to be returned in the response. If 0 or less, - * defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 2; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Number of instance partitions to be returned in the response. If 0 or less, - * defaults to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 2; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token] - * from a previous - * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. - * - * Generated from protobuf field string page_token = 3; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token] - * from a previous - * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. - * - * Generated from protobuf field string page_token = 3; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - - /** - * Optional. Deadline used while retrieving metadata for instance partitions. - * Instance partitions whose metadata cannot be retrieved within this deadline - * will be added to - * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable] - * in - * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. - * - * Generated from protobuf field .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getInstancePartitionDeadline() - { - return $this->instance_partition_deadline; - } - - public function hasInstancePartitionDeadline() - { - return isset($this->instance_partition_deadline); - } - - public function clearInstancePartitionDeadline() - { - unset($this->instance_partition_deadline); - } - - /** - * Optional. Deadline used while retrieving metadata for instance partitions. - * Instance partitions whose metadata cannot be retrieved within this deadline - * will be added to - * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable] - * in - * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. - * - * Generated from protobuf field .google.protobuf.Timestamp instance_partition_deadline = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setInstancePartitionDeadline($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->instance_partition_deadline = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionsResponse.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionsResponse.php deleted file mode 100644 index 1aa093dc210b..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionsResponse.php +++ /dev/null @@ -1,156 +0,0 @@ -google.spanner.admin.instance.v1.ListInstancePartitionsResponse - */ -class ListInstancePartitionsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The list of requested instancePartitions. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; - */ - private $instance_partitions; - /** - * `next_page_token` can be sent in a subsequent - * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions] - * call to fetch more of the matching instance partitions. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - /** - * The list of unreachable instances or instance partitions. - * It includes the names of instances or instance partitions whose metadata - * could not be retrieved within - * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline]. - * - * Generated from protobuf field repeated string unreachable = 3; - */ - private $unreachable; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition>|\Google\Protobuf\Internal\RepeatedField $instance_partitions - * The list of requested instancePartitions. - * @type string $next_page_token - * `next_page_token` can be sent in a subsequent - * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions] - * call to fetch more of the matching instance partitions. - * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable - * The list of unreachable instances or instance partitions. - * It includes the names of instances or instance partitions whose metadata - * could not be retrieved within - * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline]. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * The list of requested instancePartitions. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getInstancePartitions() - { - return $this->instance_partitions; - } - - /** - * The list of requested instancePartitions. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.InstancePartition instance_partitions = 1; - * @param array<\Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setInstancePartitions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition::class); - $this->instance_partitions = $arr; - - return $this; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions] - * call to fetch more of the matching instance partitions. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListInstancePartitions][google.spanner.admin.instance.v1.InstanceAdmin.ListInstancePartitions] - * call to fetch more of the matching instance partitions. - * - * Generated from protobuf field string next_page_token = 2; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - - /** - * The list of unreachable instances or instance partitions. - * It includes the names of instances or instance partitions whose metadata - * could not be retrieved within - * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline]. - * - * Generated from protobuf field repeated string unreachable = 3; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getUnreachable() - { - return $this->unreachable; - } - - /** - * The list of unreachable instances or instance partitions. - * It includes the names of instances or instance partitions whose metadata - * could not be retrieved within - * [instance_partition_deadline][google.spanner.admin.instance.v1.ListInstancePartitionsRequest.instance_partition_deadline]. - * - * Generated from protobuf field repeated string unreachable = 3; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setUnreachable($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->unreachable = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancesRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancesRequest.php deleted file mode 100644 index acf67c1d3534..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancesRequest.php +++ /dev/null @@ -1,329 +0,0 @@ -google.spanner.admin.instance.v1.ListInstancesRequest - */ -class ListInstancesRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the project for which a list of instances is - * requested. Values are of the form `projects/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $parent = ''; - /** - * Number of instances to be returned in the response. If 0 or less, defaults - * to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 2; - */ - protected $page_size = 0; - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.instance.v1.ListInstancesResponse.next_page_token] - * from a previous - * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. - * - * Generated from protobuf field string page_token = 3; - */ - protected $page_token = ''; - /** - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * * `name` - * * `display_name` - * * `labels.key` where key is the name of a label - * Some examples of using filters are: - * * `name:*` --> The instance has a name. - * * `name:Howl` --> The instance's name contains the string "howl". - * * `name:HOWL` --> Equivalent to above. - * * `NAME:howl` --> Equivalent to above. - * * `labels.env:*` --> The instance has the label "env". - * * `labels.env:dev` --> The instance has the label "env" and the value of - * the label contains the string "dev". - * * `name:howl labels.env:dev` --> The instance's name contains "howl" and - * it has the label "env" with its value - * containing "dev". - * - * Generated from protobuf field string filter = 4; - */ - protected $filter = ''; - /** - * Deadline used while retrieving metadata for instances. - * Instances whose metadata cannot be retrieved within this deadline will be - * added to - * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable] - * in - * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. - * - * Generated from protobuf field .google.protobuf.Timestamp instance_deadline = 5; - */ - protected $instance_deadline = null; - - /** - * @param string $parent Required. The name of the project for which a list of instances is - * requested. Values are of the form `projects/`. Please see - * {@see InstanceAdminClient::projectName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\Admin\Instance\V1\ListInstancesRequest - * - * @experimental - */ - public static function build(string $parent): self - { - return (new self()) - ->setParent($parent); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. The name of the project for which a list of instances is - * requested. Values are of the form `projects/`. - * @type int $page_size - * Number of instances to be returned in the response. If 0 or less, defaults - * to the server's maximum allowed page size. - * @type string $page_token - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.instance.v1.ListInstancesResponse.next_page_token] - * from a previous - * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. - * @type string $filter - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * * `name` - * * `display_name` - * * `labels.key` where key is the name of a label - * Some examples of using filters are: - * * `name:*` --> The instance has a name. - * * `name:Howl` --> The instance's name contains the string "howl". - * * `name:HOWL` --> Equivalent to above. - * * `NAME:howl` --> Equivalent to above. - * * `labels.env:*` --> The instance has the label "env". - * * `labels.env:dev` --> The instance has the label "env" and the value of - * the label contains the string "dev". - * * `name:howl labels.env:dev` --> The instance's name contains "howl" and - * it has the label "env" with its value - * containing "dev". - * @type \Google\Protobuf\Timestamp $instance_deadline - * Deadline used while retrieving metadata for instances. - * Instances whose metadata cannot be retrieved within this deadline will be - * added to - * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable] - * in - * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the project for which a list of instances is - * requested. Values are of the form `projects/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getParent() - { - return $this->parent; - } - - /** - * Required. The name of the project for which a list of instances is - * requested. Values are of the form `projects/`. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setParent($var) - { - GPBUtil::checkString($var, True); - $this->parent = $var; - - return $this; - } - - /** - * Number of instances to be returned in the response. If 0 or less, defaults - * to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 2; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Number of instances to be returned in the response. If 0 or less, defaults - * to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 2; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.instance.v1.ListInstancesResponse.next_page_token] - * from a previous - * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. - * - * Generated from protobuf field string page_token = 3; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.admin.instance.v1.ListInstancesResponse.next_page_token] - * from a previous - * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. - * - * Generated from protobuf field string page_token = 3; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - - /** - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * * `name` - * * `display_name` - * * `labels.key` where key is the name of a label - * Some examples of using filters are: - * * `name:*` --> The instance has a name. - * * `name:Howl` --> The instance's name contains the string "howl". - * * `name:HOWL` --> Equivalent to above. - * * `NAME:howl` --> Equivalent to above. - * * `labels.env:*` --> The instance has the label "env". - * * `labels.env:dev` --> The instance has the label "env" and the value of - * the label contains the string "dev". - * * `name:howl labels.env:dev` --> The instance's name contains "howl" and - * it has the label "env" with its value - * containing "dev". - * - * Generated from protobuf field string filter = 4; - * @return string - */ - public function getFilter() - { - return $this->filter; - } - - /** - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * * `name` - * * `display_name` - * * `labels.key` where key is the name of a label - * Some examples of using filters are: - * * `name:*` --> The instance has a name. - * * `name:Howl` --> The instance's name contains the string "howl". - * * `name:HOWL` --> Equivalent to above. - * * `NAME:howl` --> Equivalent to above. - * * `labels.env:*` --> The instance has the label "env". - * * `labels.env:dev` --> The instance has the label "env" and the value of - * the label contains the string "dev". - * * `name:howl labels.env:dev` --> The instance's name contains "howl" and - * it has the label "env" with its value - * containing "dev". - * - * Generated from protobuf field string filter = 4; - * @param string $var - * @return $this - */ - public function setFilter($var) - { - GPBUtil::checkString($var, True); - $this->filter = $var; - - return $this; - } - - /** - * Deadline used while retrieving metadata for instances. - * Instances whose metadata cannot be retrieved within this deadline will be - * added to - * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable] - * in - * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. - * - * Generated from protobuf field .google.protobuf.Timestamp instance_deadline = 5; - * @return \Google\Protobuf\Timestamp|null - */ - public function getInstanceDeadline() - { - return $this->instance_deadline; - } - - public function hasInstanceDeadline() - { - return isset($this->instance_deadline); - } - - public function clearInstanceDeadline() - { - unset($this->instance_deadline); - } - - /** - * Deadline used while retrieving metadata for instances. - * Instances whose metadata cannot be retrieved within this deadline will be - * added to - * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable] - * in - * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. - * - * Generated from protobuf field .google.protobuf.Timestamp instance_deadline = 5; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setInstanceDeadline($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->instance_deadline = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancesResponse.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancesResponse.php deleted file mode 100644 index cc134da2aac1..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancesResponse.php +++ /dev/null @@ -1,156 +0,0 @@ -google.spanner.admin.instance.v1.ListInstancesResponse - */ -class ListInstancesResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The list of requested instances. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.Instance instances = 1; - */ - private $instances; - /** - * `next_page_token` can be sent in a subsequent - * [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances] - * call to fetch more of the matching instances. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - /** - * The list of unreachable instances. - * It includes the names of instances whose metadata could not be retrieved - * within - * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline]. - * - * Generated from protobuf field repeated string unreachable = 3; - */ - private $unreachable; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Spanner\Admin\Instance\V1\Instance>|\Google\Protobuf\Internal\RepeatedField $instances - * The list of requested instances. - * @type string $next_page_token - * `next_page_token` can be sent in a subsequent - * [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances] - * call to fetch more of the matching instances. - * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable - * The list of unreachable instances. - * It includes the names of instances whose metadata could not be retrieved - * within - * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline]. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * The list of requested instances. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.Instance instances = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getInstances() - { - return $this->instances; - } - - /** - * The list of requested instances. - * - * Generated from protobuf field repeated .google.spanner.admin.instance.v1.Instance instances = 1; - * @param array<\Google\Cloud\Spanner\Admin\Instance\V1\Instance>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setInstances($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\Admin\Instance\V1\Instance::class); - $this->instances = $arr; - - return $this; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances] - * call to fetch more of the matching instances. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListInstances][google.spanner.admin.instance.v1.InstanceAdmin.ListInstances] - * call to fetch more of the matching instances. - * - * Generated from protobuf field string next_page_token = 2; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - - /** - * The list of unreachable instances. - * It includes the names of instances whose metadata could not be retrieved - * within - * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline]. - * - * Generated from protobuf field repeated string unreachable = 3; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getUnreachable() - { - return $this->unreachable; - } - - /** - * The list of unreachable instances. - * It includes the names of instances whose metadata could not be retrieved - * within - * [instance_deadline][google.spanner.admin.instance.v1.ListInstancesRequest.instance_deadline]. - * - * Generated from protobuf field repeated string unreachable = 3; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setUnreachable($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->unreachable = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceMetadata.php deleted file mode 100644 index e28ddbb7dc57..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceMetadata.php +++ /dev/null @@ -1,176 +0,0 @@ -google.spanner.admin.instance.v1.MoveInstanceMetadata - */ -class MoveInstanceMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The target instance configuration where to move the instance. - * Values are of the form `projects//instanceConfigs/`. - * - * Generated from protobuf field string target_config = 1; - */ - protected $target_config = ''; - /** - * The progress of the - * [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance] - * operation. - * [progress_percent][google.spanner.admin.instance.v1.OperationProgress.progress_percent] - * is reset when cancellation is requested. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.OperationProgress progress = 2; - */ - protected $progress = null; - /** - * The time at which this operation was cancelled. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - */ - protected $cancel_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $target_config - * The target instance configuration where to move the instance. - * Values are of the form `projects//instanceConfigs/`. - * @type \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress $progress - * The progress of the - * [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance] - * operation. - * [progress_percent][google.spanner.admin.instance.v1.OperationProgress.progress_percent] - * is reset when cancellation is requested. - * @type \Google\Protobuf\Timestamp $cancel_time - * The time at which this operation was cancelled. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * The target instance configuration where to move the instance. - * Values are of the form `projects//instanceConfigs/`. - * - * Generated from protobuf field string target_config = 1; - * @return string - */ - public function getTargetConfig() - { - return $this->target_config; - } - - /** - * The target instance configuration where to move the instance. - * Values are of the form `projects//instanceConfigs/`. - * - * Generated from protobuf field string target_config = 1; - * @param string $var - * @return $this - */ - public function setTargetConfig($var) - { - GPBUtil::checkString($var, True); - $this->target_config = $var; - - return $this; - } - - /** - * The progress of the - * [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance] - * operation. - * [progress_percent][google.spanner.admin.instance.v1.OperationProgress.progress_percent] - * is reset when cancellation is requested. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.OperationProgress progress = 2; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress|null - */ - public function getProgress() - { - return $this->progress; - } - - public function hasProgress() - { - return isset($this->progress); - } - - public function clearProgress() - { - unset($this->progress); - } - - /** - * The progress of the - * [MoveInstance][google.spanner.admin.instance.v1.InstanceAdmin.MoveInstance] - * operation. - * [progress_percent][google.spanner.admin.instance.v1.OperationProgress.progress_percent] - * is reset when cancellation is requested. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.OperationProgress progress = 2; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress $var - * @return $this - */ - public function setProgress($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress::class); - $this->progress = $var; - - return $this; - } - - /** - * The time at which this operation was cancelled. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCancelTime() - { - return $this->cancel_time; - } - - public function hasCancelTime() - { - return isset($this->cancel_time); - } - - public function clearCancelTime() - { - unset($this->cancel_time); - } - - /** - * The time at which this operation was cancelled. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCancelTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->cancel_time = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceRequest.php deleted file mode 100644 index eb41cd923ea1..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceRequest.php +++ /dev/null @@ -1,110 +0,0 @@ -google.spanner.admin.instance.v1.MoveInstanceRequest - */ -class MoveInstanceRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The instance to move. - * Values are of the form `projects//instances/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - /** - * Required. The target instance configuration where to move the instance. - * Values are of the form `projects//instanceConfigs/`. - * - * Generated from protobuf field string target_config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $target_config = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The instance to move. - * Values are of the form `projects//instances/`. - * @type string $target_config - * Required. The target instance configuration where to move the instance. - * Values are of the form `projects//instanceConfigs/`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The instance to move. - * Values are of the form `projects//instances/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The instance to move. - * Values are of the form `projects//instances/`. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * Required. The target instance configuration where to move the instance. - * Values are of the form `projects//instanceConfigs/`. - * - * Generated from protobuf field string target_config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getTargetConfig() - { - return $this->target_config; - } - - /** - * Required. The target instance configuration where to move the instance. - * Values are of the form `projects//instanceConfigs/`. - * - * Generated from protobuf field string target_config = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setTargetConfig($var) - { - GPBUtil::checkString($var, True); - $this->target_config = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceResponse.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceResponse.php deleted file mode 100644 index 650c679eb1ba..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/MoveInstanceResponse.php +++ /dev/null @@ -1,34 +0,0 @@ -google.spanner.admin.instance.v1.MoveInstanceResponse - */ -class MoveInstanceResponse extends \Google\Protobuf\Internal\Message -{ - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/OperationProgress.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/OperationProgress.php deleted file mode 100644 index e6b2e6c751d6..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/OperationProgress.php +++ /dev/null @@ -1,164 +0,0 @@ -google.spanner.admin.instance.v1.OperationProgress - */ -class OperationProgress extends \Google\Protobuf\Internal\Message -{ - /** - * Percent completion of the operation. - * Values are between 0 and 100 inclusive. - * - * Generated from protobuf field int32 progress_percent = 1; - */ - protected $progress_percent = 0; - /** - * Time the request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; - */ - protected $start_time = null; - /** - * If set, the time at which this operation failed or was completed - * successfully. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; - */ - protected $end_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $progress_percent - * Percent completion of the operation. - * Values are between 0 and 100 inclusive. - * @type \Google\Protobuf\Timestamp $start_time - * Time the request was received. - * @type \Google\Protobuf\Timestamp $end_time - * If set, the time at which this operation failed or was completed - * successfully. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\Common::initOnce(); - parent::__construct($data); - } - - /** - * Percent completion of the operation. - * Values are between 0 and 100 inclusive. - * - * Generated from protobuf field int32 progress_percent = 1; - * @return int - */ - public function getProgressPercent() - { - return $this->progress_percent; - } - - /** - * Percent completion of the operation. - * Values are between 0 and 100 inclusive. - * - * Generated from protobuf field int32 progress_percent = 1; - * @param int $var - * @return $this - */ - public function setProgressPercent($var) - { - GPBUtil::checkInt32($var); - $this->progress_percent = $var; - - return $this; - } - - /** - * Time the request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; - * @return \Google\Protobuf\Timestamp|null - */ - public function getStartTime() - { - return $this->start_time; - } - - public function hasStartTime() - { - return isset($this->start_time); - } - - public function clearStartTime() - { - unset($this->start_time); - } - - /** - * Time the request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setStartTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->start_time = $var; - - return $this; - } - - /** - * If set, the time at which this operation failed or was completed - * successfully. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; - * @return \Google\Protobuf\Timestamp|null - */ - public function getEndTime() - { - return $this->end_time; - } - - public function hasEndTime() - { - return isset($this->end_time); - } - - public function clearEndTime() - { - unset($this->end_time); - } - - /** - * If set, the time at which this operation failed or was completed - * successfully. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 3; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setEndTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->end_time = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaComputeCapacity.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaComputeCapacity.php deleted file mode 100644 index 551f8e34bf3a..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaComputeCapacity.php +++ /dev/null @@ -1,169 +0,0 @@ -google.spanner.admin.instance.v1.ReplicaComputeCapacity - */ -class ReplicaComputeCapacity extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Identifies replicas by specified properties. - * All replicas in the selection have the same amount of compute capacity. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $replica_selection = null; - protected $compute_capacity; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaSelection $replica_selection - * Required. Identifies replicas by specified properties. - * All replicas in the selection have the same amount of compute capacity. - * @type int $node_count - * The number of nodes allocated to each replica. - * This may be zero in API responses for instances that are not yet in - * state `READY`. - * @type int $processing_units - * The number of processing units allocated to each replica. - * This may be zero in API responses for instances that are not yet in - * state `READY`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. Identifies replicas by specified properties. - * All replicas in the selection have the same amount of compute capacity. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaSelection|null - */ - public function getReplicaSelection() - { - return $this->replica_selection; - } - - public function hasReplicaSelection() - { - return isset($this->replica_selection); - } - - public function clearReplicaSelection() - { - unset($this->replica_selection); - } - - /** - * Required. Identifies replicas by specified properties. - * All replicas in the selection have the same amount of compute capacity. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaSelection $var - * @return $this - */ - public function setReplicaSelection($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaSelection::class); - $this->replica_selection = $var; - - return $this; - } - - /** - * The number of nodes allocated to each replica. - * This may be zero in API responses for instances that are not yet in - * state `READY`. - * - * Generated from protobuf field int32 node_count = 2; - * @return int - */ - public function getNodeCount() - { - return $this->readOneof(2); - } - - public function hasNodeCount() - { - return $this->hasOneof(2); - } - - /** - * The number of nodes allocated to each replica. - * This may be zero in API responses for instances that are not yet in - * state `READY`. - * - * Generated from protobuf field int32 node_count = 2; - * @param int $var - * @return $this - */ - public function setNodeCount($var) - { - GPBUtil::checkInt32($var); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * The number of processing units allocated to each replica. - * This may be zero in API responses for instances that are not yet in - * state `READY`. - * - * Generated from protobuf field int32 processing_units = 3; - * @return int - */ - public function getProcessingUnits() - { - return $this->readOneof(3); - } - - public function hasProcessingUnits() - { - return $this->hasOneof(3); - } - - /** - * The number of processing units allocated to each replica. - * This may be zero in API responses for instances that are not yet in - * state `READY`. - * - * Generated from protobuf field int32 processing_units = 3; - * @param int $var - * @return $this - */ - public function setProcessingUnits($var) - { - GPBUtil::checkInt32($var); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * @return string - */ - public function getComputeCapacity() - { - return $this->whichOneof("compute_capacity"); - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaInfo.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaInfo.php deleted file mode 100644 index c15ef502635c..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaInfo.php +++ /dev/null @@ -1,145 +0,0 @@ -google.spanner.admin.instance.v1.ReplicaInfo - */ -class ReplicaInfo extends \Google\Protobuf\Internal\Message -{ - /** - * The location of the serving resources, e.g., "us-central1". - * - * Generated from protobuf field string location = 1; - */ - protected $location = ''; - /** - * The type of replica. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.ReplicaInfo.ReplicaType type = 2; - */ - protected $type = 0; - /** - * If true, this location is designated as the default leader location where - * leader replicas are placed. See the [region types - * documentation](https://cloud.google.com/spanner/docs/instances#region_types) - * for more details. - * - * Generated from protobuf field bool default_leader_location = 3; - */ - protected $default_leader_location = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $location - * The location of the serving resources, e.g., "us-central1". - * @type int $type - * The type of replica. - * @type bool $default_leader_location - * If true, this location is designated as the default leader location where - * leader replicas are placed. See the [region types - * documentation](https://cloud.google.com/spanner/docs/instances#region_types) - * for more details. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * The location of the serving resources, e.g., "us-central1". - * - * Generated from protobuf field string location = 1; - * @return string - */ - public function getLocation() - { - return $this->location; - } - - /** - * The location of the serving resources, e.g., "us-central1". - * - * Generated from protobuf field string location = 1; - * @param string $var - * @return $this - */ - public function setLocation($var) - { - GPBUtil::checkString($var, True); - $this->location = $var; - - return $this; - } - - /** - * The type of replica. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.ReplicaInfo.ReplicaType type = 2; - * @return int - */ - public function getType() - { - return $this->type; - } - - /** - * The type of replica. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.ReplicaInfo.ReplicaType type = 2; - * @param int $var - * @return $this - */ - public function setType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo\ReplicaType::class); - $this->type = $var; - - return $this; - } - - /** - * If true, this location is designated as the default leader location where - * leader replicas are placed. See the [region types - * documentation](https://cloud.google.com/spanner/docs/instances#region_types) - * for more details. - * - * Generated from protobuf field bool default_leader_location = 3; - * @return bool - */ - public function getDefaultLeaderLocation() - { - return $this->default_leader_location; - } - - /** - * If true, this location is designated as the default leader location where - * leader replicas are placed. See the [region types - * documentation](https://cloud.google.com/spanner/docs/instances#region_types) - * for more details. - * - * Generated from protobuf field bool default_leader_location = 3; - * @param bool $var - * @return $this - */ - public function setDefaultLeaderLocation($var) - { - GPBUtil::checkBool($var); - $this->default_leader_location = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaInfo/ReplicaType.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaInfo/ReplicaType.php deleted file mode 100644 index dbf12281acfc..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaInfo/ReplicaType.php +++ /dev/null @@ -1,87 +0,0 @@ -google.spanner.admin.instance.v1.ReplicaInfo.ReplicaType - */ -class ReplicaType -{ - /** - * Not specified. - * - * Generated from protobuf enum TYPE_UNSPECIFIED = 0; - */ - const TYPE_UNSPECIFIED = 0; - /** - * Read-write replicas support both reads and writes. These replicas: - * * Maintain a full copy of your data. - * * Serve reads. - * * Can vote whether to commit a write. - * * Participate in leadership election. - * * Are eligible to become a leader. - * - * Generated from protobuf enum READ_WRITE = 1; - */ - const READ_WRITE = 1; - /** - * Read-only replicas only support reads (not writes). Read-only replicas: - * * Maintain a full copy of your data. - * * Serve reads. - * * Do not participate in voting to commit writes. - * * Are not eligible to become a leader. - * - * Generated from protobuf enum READ_ONLY = 2; - */ - const READ_ONLY = 2; - /** - * Witness replicas don't support reads but do participate in voting to - * commit writes. Witness replicas: - * * Do not maintain a full copy of data. - * * Do not serve reads. - * * Vote whether to commit writes. - * * Participate in leader election but are not eligible to become leader. - * - * Generated from protobuf enum WITNESS = 3; - */ - const WITNESS = 3; - - private static $valueToName = [ - self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', - self::READ_WRITE => 'READ_WRITE', - self::READ_ONLY => 'READ_ONLY', - self::WITNESS => 'WITNESS', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(ReplicaType::class, \Google\Cloud\Spanner\Admin\Instance\V1\ReplicaInfo_ReplicaType::class); - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaSelection.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaSelection.php deleted file mode 100644 index 3485719a4c58..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ReplicaSelection.php +++ /dev/null @@ -1,67 +0,0 @@ -google.spanner.admin.instance.v1.ReplicaSelection - */ -class ReplicaSelection extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Name of the location of the replicas (e.g., "us-central1"). - * - * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $location = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $location - * Required. Name of the location of the replicas (e.g., "us-central1"). - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\Common::initOnce(); - parent::__construct($data); - } - - /** - * Required. Name of the location of the replicas (e.g., "us-central1"). - * - * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getLocation() - { - return $this->location; - } - - /** - * Required. Name of the location of the replicas (e.g., "us-central1"). - * - * Generated from protobuf field string location = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setLocation($var) - { - GPBUtil::checkString($var, True); - $this->location = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceConfigMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceConfigMetadata.php deleted file mode 100644 index 7f0c794b98c7..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceConfigMetadata.php +++ /dev/null @@ -1,174 +0,0 @@ -google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata - */ -class UpdateInstanceConfigMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The desired instance configuration after updating. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 1; - */ - protected $instance_config = null; - /** - * The progress of the - * [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig] - * operation. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.OperationProgress progress = 2; - */ - protected $progress = null; - /** - * The time at which this operation was cancelled. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - */ - protected $cancel_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $instance_config - * The desired instance configuration after updating. - * @type \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress $progress - * The progress of the - * [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig] - * operation. - * @type \Google\Protobuf\Timestamp $cancel_time - * The time at which this operation was cancelled. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * The desired instance configuration after updating. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 1; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig|null - */ - public function getInstanceConfig() - { - return $this->instance_config; - } - - public function hasInstanceConfig() - { - return isset($this->instance_config); - } - - public function clearInstanceConfig() - { - unset($this->instance_config); - } - - /** - * The desired instance configuration after updating. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 1; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $var - * @return $this - */ - public function setInstanceConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig::class); - $this->instance_config = $var; - - return $this; - } - - /** - * The progress of the - * [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig] - * operation. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.OperationProgress progress = 2; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress|null - */ - public function getProgress() - { - return $this->progress; - } - - public function hasProgress() - { - return isset($this->progress); - } - - public function clearProgress() - { - unset($this->progress); - } - - /** - * The progress of the - * [UpdateInstanceConfig][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstanceConfig] - * operation. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.OperationProgress progress = 2; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress $var - * @return $this - */ - public function setProgress($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\OperationProgress::class); - $this->progress = $var; - - return $this; - } - - /** - * The time at which this operation was cancelled. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCancelTime() - { - return $this->cancel_time; - } - - public function hasCancelTime() - { - return isset($this->cancel_time); - } - - public function clearCancelTime() - { - unset($this->cancel_time); - } - - /** - * The time at which this operation was cancelled. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCancelTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->cancel_time = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceConfigRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceConfigRequest.php deleted file mode 100644 index c4078624f9fc..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceConfigRequest.php +++ /dev/null @@ -1,230 +0,0 @@ -google.spanner.admin.instance.v1.UpdateInstanceConfigRequest - */ -class UpdateInstanceConfigRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The user instance configuration to update, which must always - * include the instance configuration name. Otherwise, only fields mentioned - * in - * [update_mask][google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask] - * need be included. To prevent conflicts of concurrent updates, - * [etag][google.spanner.admin.instance.v1.InstanceConfig.reconciling] can - * be used. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $instance_config = null; - /** - * Required. A mask specifying which fields in - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] should be - * updated. The field mask must always be specified; this prevents any future - * fields in [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] - * from being erased accidentally by clients that do not know about them. Only - * display_name and labels can be updated. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $update_mask = null; - /** - * An option to validate, but not actually execute, a request, - * and provide the same response. - * - * Generated from protobuf field bool validate_only = 3; - */ - protected $validate_only = false; - - /** - * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $instanceConfig Required. The user instance configuration to update, which must always - * include the instance configuration name. Otherwise, only fields mentioned - * in - * [update_mask][google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask] - * need be included. To prevent conflicts of concurrent updates, - * [etag][google.spanner.admin.instance.v1.InstanceConfig.reconciling] can - * be used. - * @param \Google\Protobuf\FieldMask $updateMask Required. A mask specifying which fields in - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] should be - * updated. The field mask must always be specified; this prevents any future - * fields in [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] - * from being erased accidentally by clients that do not know about them. Only - * display_name and labels can be updated. - * - * @return \Google\Cloud\Spanner\Admin\Instance\V1\UpdateInstanceConfigRequest - * - * @experimental - */ - public static function build(\Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $instanceConfig, \Google\Protobuf\FieldMask $updateMask): self - { - return (new self()) - ->setInstanceConfig($instanceConfig) - ->setUpdateMask($updateMask); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $instance_config - * Required. The user instance configuration to update, which must always - * include the instance configuration name. Otherwise, only fields mentioned - * in - * [update_mask][google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask] - * need be included. To prevent conflicts of concurrent updates, - * [etag][google.spanner.admin.instance.v1.InstanceConfig.reconciling] can - * be used. - * @type \Google\Protobuf\FieldMask $update_mask - * Required. A mask specifying which fields in - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] should be - * updated. The field mask must always be specified; this prevents any future - * fields in [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] - * from being erased accidentally by clients that do not know about them. Only - * display_name and labels can be updated. - * @type bool $validate_only - * An option to validate, but not actually execute, a request, - * and provide the same response. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The user instance configuration to update, which must always - * include the instance configuration name. Otherwise, only fields mentioned - * in - * [update_mask][google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask] - * need be included. To prevent conflicts of concurrent updates, - * [etag][google.spanner.admin.instance.v1.InstanceConfig.reconciling] can - * be used. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig|null - */ - public function getInstanceConfig() - { - return $this->instance_config; - } - - public function hasInstanceConfig() - { - return isset($this->instance_config); - } - - public function clearInstanceConfig() - { - unset($this->instance_config); - } - - /** - * Required. The user instance configuration to update, which must always - * include the instance configuration name. Otherwise, only fields mentioned - * in - * [update_mask][google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask] - * need be included. To prevent conflicts of concurrent updates, - * [etag][google.spanner.admin.instance.v1.InstanceConfig.reconciling] can - * be used. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig instance_config = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig $var - * @return $this - */ - public function setInstanceConfig($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig::class); - $this->instance_config = $var; - - return $this; - } - - /** - * Required. A mask specifying which fields in - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] should be - * updated. The field mask must always be specified; this prevents any future - * fields in [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] - * from being erased accidentally by clients that do not know about them. Only - * display_name and labels can be updated. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\FieldMask|null - */ - public function getUpdateMask() - { - return $this->update_mask; - } - - public function hasUpdateMask() - { - return isset($this->update_mask); - } - - public function clearUpdateMask() - { - unset($this->update_mask); - } - - /** - * Required. A mask specifying which fields in - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] should be - * updated. The field mask must always be specified; this prevents any future - * fields in [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] - * from being erased accidentally by clients that do not know about them. Only - * display_name and labels can be updated. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Protobuf\FieldMask $var - * @return $this - */ - public function setUpdateMask($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); - $this->update_mask = $var; - - return $this; - } - - /** - * An option to validate, but not actually execute, a request, - * and provide the same response. - * - * Generated from protobuf field bool validate_only = 3; - * @return bool - */ - public function getValidateOnly() - { - return $this->validate_only; - } - - /** - * An option to validate, but not actually execute, a request, - * and provide the same response. - * - * Generated from protobuf field bool validate_only = 3; - * @param bool $var - * @return $this - */ - public function setValidateOnly($var) - { - GPBUtil::checkBool($var); - $this->validate_only = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceMetadata.php deleted file mode 100644 index 75231230c5bc..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceMetadata.php +++ /dev/null @@ -1,260 +0,0 @@ -google.spanner.admin.instance.v1.UpdateInstanceMetadata - */ -class UpdateInstanceMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The desired end state of the update. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1; - */ - protected $instance = null; - /** - * The time at which - * [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance] - * request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; - */ - protected $start_time = null; - /** - * The time at which this operation was cancelled. If set, this operation is - * in the process of undoing itself (which is guaranteed to succeed) and - * cannot be cancelled again. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - */ - protected $cancel_time = null; - /** - * The time at which this operation failed or was completed successfully. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; - */ - protected $end_time = null; - /** - * The expected fulfillment period of this update operation. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.FulfillmentPeriod expected_fulfillment_period = 5; - */ - protected $expected_fulfillment_period = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\Admin\Instance\V1\Instance $instance - * The desired end state of the update. - * @type \Google\Protobuf\Timestamp $start_time - * The time at which - * [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance] - * request was received. - * @type \Google\Protobuf\Timestamp $cancel_time - * The time at which this operation was cancelled. If set, this operation is - * in the process of undoing itself (which is guaranteed to succeed) and - * cannot be cancelled again. - * @type \Google\Protobuf\Timestamp $end_time - * The time at which this operation failed or was completed successfully. - * @type int $expected_fulfillment_period - * The expected fulfillment period of this update operation. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * The desired end state of the update. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\Instance|null - */ - public function getInstance() - { - return $this->instance; - } - - public function hasInstance() - { - return isset($this->instance); - } - - public function clearInstance() - { - unset($this->instance); - } - - /** - * The desired end state of the update. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\Instance $var - * @return $this - */ - public function setInstance($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\Instance::class); - $this->instance = $var; - - return $this; - } - - /** - * The time at which - * [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance] - * request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; - * @return \Google\Protobuf\Timestamp|null - */ - public function getStartTime() - { - return $this->start_time; - } - - public function hasStartTime() - { - return isset($this->start_time); - } - - public function clearStartTime() - { - unset($this->start_time); - } - - /** - * The time at which - * [UpdateInstance][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstance] - * request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setStartTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->start_time = $var; - - return $this; - } - - /** - * The time at which this operation was cancelled. If set, this operation is - * in the process of undoing itself (which is guaranteed to succeed) and - * cannot be cancelled again. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCancelTime() - { - return $this->cancel_time; - } - - public function hasCancelTime() - { - return isset($this->cancel_time); - } - - public function clearCancelTime() - { - unset($this->cancel_time); - } - - /** - * The time at which this operation was cancelled. If set, this operation is - * in the process of undoing itself (which is guaranteed to succeed) and - * cannot be cancelled again. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCancelTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->cancel_time = $var; - - return $this; - } - - /** - * The time at which this operation failed or was completed successfully. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; - * @return \Google\Protobuf\Timestamp|null - */ - public function getEndTime() - { - return $this->end_time; - } - - public function hasEndTime() - { - return isset($this->end_time); - } - - public function clearEndTime() - { - unset($this->end_time); - } - - /** - * The time at which this operation failed or was completed successfully. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setEndTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->end_time = $var; - - return $this; - } - - /** - * The expected fulfillment period of this update operation. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.FulfillmentPeriod expected_fulfillment_period = 5; - * @return int - */ - public function getExpectedFulfillmentPeriod() - { - return $this->expected_fulfillment_period; - } - - /** - * The expected fulfillment period of this update operation. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.FulfillmentPeriod expected_fulfillment_period = 5; - * @param int $var - * @return $this - */ - public function setExpectedFulfillmentPeriod($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\Admin\Instance\V1\FulfillmentPeriod::class); - $this->expected_fulfillment_period = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstancePartitionMetadata.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstancePartitionMetadata.php deleted file mode 100644 index 7d36e9dc23bd..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstancePartitionMetadata.php +++ /dev/null @@ -1,226 +0,0 @@ -google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata - */ -class UpdateInstancePartitionMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The desired end state of the update. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; - */ - protected $instance_partition = null; - /** - * The time at which - * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition] - * request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; - */ - protected $start_time = null; - /** - * The time at which this operation was cancelled. If set, this operation is - * in the process of undoing itself (which is guaranteed to succeed) and - * cannot be cancelled again. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - */ - protected $cancel_time = null; - /** - * The time at which this operation failed or was completed successfully. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; - */ - protected $end_time = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $instance_partition - * The desired end state of the update. - * @type \Google\Protobuf\Timestamp $start_time - * The time at which - * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition] - * request was received. - * @type \Google\Protobuf\Timestamp $cancel_time - * The time at which this operation was cancelled. If set, this operation is - * in the process of undoing itself (which is guaranteed to succeed) and - * cannot be cancelled again. - * @type \Google\Protobuf\Timestamp $end_time - * The time at which this operation failed or was completed successfully. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * The desired end state of the update. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition|null - */ - public function getInstancePartition() - { - return $this->instance_partition; - } - - public function hasInstancePartition() - { - return isset($this->instance_partition); - } - - public function clearInstancePartition() - { - unset($this->instance_partition); - } - - /** - * The desired end state of the update. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $var - * @return $this - */ - public function setInstancePartition($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition::class); - $this->instance_partition = $var; - - return $this; - } - - /** - * The time at which - * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition] - * request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; - * @return \Google\Protobuf\Timestamp|null - */ - public function getStartTime() - { - return $this->start_time; - } - - public function hasStartTime() - { - return isset($this->start_time); - } - - public function clearStartTime() - { - unset($this->start_time); - } - - /** - * The time at which - * [UpdateInstancePartition][google.spanner.admin.instance.v1.InstanceAdmin.UpdateInstancePartition] - * request was received. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setStartTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->start_time = $var; - - return $this; - } - - /** - * The time at which this operation was cancelled. If set, this operation is - * in the process of undoing itself (which is guaranteed to succeed) and - * cannot be cancelled again. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCancelTime() - { - return $this->cancel_time; - } - - public function hasCancelTime() - { - return isset($this->cancel_time); - } - - public function clearCancelTime() - { - unset($this->cancel_time); - } - - /** - * The time at which this operation was cancelled. If set, this operation is - * in the process of undoing itself (which is guaranteed to succeed) and - * cannot be cancelled again. - * - * Generated from protobuf field .google.protobuf.Timestamp cancel_time = 3; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCancelTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->cancel_time = $var; - - return $this; - } - - /** - * The time at which this operation failed or was completed successfully. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; - * @return \Google\Protobuf\Timestamp|null - */ - public function getEndTime() - { - return $this->end_time; - } - - public function hasEndTime() - { - return isset($this->end_time); - } - - public function clearEndTime() - { - unset($this->end_time); - } - - /** - * The time at which this operation failed or was completed successfully. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 4; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setEndTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->end_time = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstancePartitionRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstancePartitionRequest.php deleted file mode 100644 index 8cab2a4ee3fa..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstancePartitionRequest.php +++ /dev/null @@ -1,177 +0,0 @@ -google.spanner.admin.instance.v1.UpdateInstancePartitionRequest - */ -class UpdateInstancePartitionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The instance partition to update, which must always include the - * instance partition name. Otherwise, only fields mentioned in - * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask] - * need be included. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $instance_partition = null; - /** - * Required. A mask specifying which fields in - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] - * should be updated. The field mask must always be specified; this prevents - * any future fields in - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] - * from being erased accidentally by clients that do not know about them. - * - * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $field_mask = null; - - /** - * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $instancePartition Required. The instance partition to update, which must always include the - * instance partition name. Otherwise, only fields mentioned in - * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask] - * need be included. - * @param \Google\Protobuf\FieldMask $fieldMask Required. A mask specifying which fields in - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] - * should be updated. The field mask must always be specified; this prevents - * any future fields in - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] - * from being erased accidentally by clients that do not know about them. - * - * @return \Google\Cloud\Spanner\Admin\Instance\V1\UpdateInstancePartitionRequest - * - * @experimental - */ - public static function build(\Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $instancePartition, \Google\Protobuf\FieldMask $fieldMask): self - { - return (new self()) - ->setInstancePartition($instancePartition) - ->setFieldMask($fieldMask); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $instance_partition - * Required. The instance partition to update, which must always include the - * instance partition name. Otherwise, only fields mentioned in - * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask] - * need be included. - * @type \Google\Protobuf\FieldMask $field_mask - * Required. A mask specifying which fields in - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] - * should be updated. The field mask must always be specified; this prevents - * any future fields in - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] - * from being erased accidentally by clients that do not know about them. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The instance partition to update, which must always include the - * instance partition name. Otherwise, only fields mentioned in - * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask] - * need be included. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition|null - */ - public function getInstancePartition() - { - return $this->instance_partition; - } - - public function hasInstancePartition() - { - return isset($this->instance_partition); - } - - public function clearInstancePartition() - { - unset($this->instance_partition); - } - - /** - * Required. The instance partition to update, which must always include the - * instance partition name. Otherwise, only fields mentioned in - * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask] - * need be included. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstancePartition instance_partition = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition $var - * @return $this - */ - public function setInstancePartition($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition::class); - $this->instance_partition = $var; - - return $this; - } - - /** - * Required. A mask specifying which fields in - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] - * should be updated. The field mask must always be specified; this prevents - * any future fields in - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] - * from being erased accidentally by clients that do not know about them. - * - * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\FieldMask|null - */ - public function getFieldMask() - { - return $this->field_mask; - } - - public function hasFieldMask() - { - return isset($this->field_mask); - } - - public function clearFieldMask() - { - unset($this->field_mask); - } - - /** - * Required. A mask specifying which fields in - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] - * should be updated. The field mask must always be specified; this prevents - * any future fields in - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] - * from being erased accidentally by clients that do not know about them. - * - * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Protobuf\FieldMask $var - * @return $this - */ - public function setFieldMask($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); - $this->field_mask = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceRequest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceRequest.php deleted file mode 100644 index f787f2e812ec..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceRequest.php +++ /dev/null @@ -1,172 +0,0 @@ -google.spanner.admin.instance.v1.UpdateInstanceRequest - */ -class UpdateInstanceRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The instance to update, which must always include the instance - * name. Otherwise, only fields mentioned in - * [field_mask][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] - * need be included. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $instance = null; - /** - * Required. A mask specifying which fields in - * [Instance][google.spanner.admin.instance.v1.Instance] should be updated. - * The field mask must always be specified; this prevents any future fields in - * [Instance][google.spanner.admin.instance.v1.Instance] from being erased - * accidentally by clients that do not know about them. - * - * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $field_mask = null; - - /** - * @param \Google\Cloud\Spanner\Admin\Instance\V1\Instance $instance Required. The instance to update, which must always include the instance - * name. Otherwise, only fields mentioned in - * [field_mask][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] - * need be included. - * @param \Google\Protobuf\FieldMask $fieldMask Required. A mask specifying which fields in - * [Instance][google.spanner.admin.instance.v1.Instance] should be updated. - * The field mask must always be specified; this prevents any future fields in - * [Instance][google.spanner.admin.instance.v1.Instance] from being erased - * accidentally by clients that do not know about them. - * - * @return \Google\Cloud\Spanner\Admin\Instance\V1\UpdateInstanceRequest - * - * @experimental - */ - public static function build(\Google\Cloud\Spanner\Admin\Instance\V1\Instance $instance, \Google\Protobuf\FieldMask $fieldMask): self - { - return (new self()) - ->setInstance($instance) - ->setFieldMask($fieldMask); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\Admin\Instance\V1\Instance $instance - * Required. The instance to update, which must always include the instance - * name. Otherwise, only fields mentioned in - * [field_mask][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] - * need be included. - * @type \Google\Protobuf\FieldMask $field_mask - * Required. A mask specifying which fields in - * [Instance][google.spanner.admin.instance.v1.Instance] should be updated. - * The field mask must always be specified; this prevents any future fields in - * [Instance][google.spanner.admin.instance.v1.Instance] from being erased - * accidentally by clients that do not know about them. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\Admin\Instance\V1\SpannerInstanceAdmin::initOnce(); - parent::__construct($data); - } - - /** - * Required. The instance to update, which must always include the instance - * name. Otherwise, only fields mentioned in - * [field_mask][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] - * need be included. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\Admin\Instance\V1\Instance|null - */ - public function getInstance() - { - return $this->instance; - } - - public function hasInstance() - { - return isset($this->instance); - } - - public function clearInstance() - { - unset($this->instance); - } - - /** - * Required. The instance to update, which must always include the instance - * name. Otherwise, only fields mentioned in - * [field_mask][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] - * need be included. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.Instance instance = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\Admin\Instance\V1\Instance $var - * @return $this - */ - public function setInstance($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\Admin\Instance\V1\Instance::class); - $this->instance = $var; - - return $this; - } - - /** - * Required. A mask specifying which fields in - * [Instance][google.spanner.admin.instance.v1.Instance] should be updated. - * The field mask must always be specified; this prevents any future fields in - * [Instance][google.spanner.admin.instance.v1.Instance] from being erased - * accidentally by clients that do not know about them. - * - * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\FieldMask|null - */ - public function getFieldMask() - { - return $this->field_mask; - } - - public function hasFieldMask() - { - return isset($this->field_mask); - } - - public function clearFieldMask() - { - unset($this->field_mask); - } - - /** - * Required. A mask specifying which fields in - * [Instance][google.spanner.admin.instance.v1.Instance] should be updated. - * The field mask must always be specified; this prevents any future fields in - * [Instance][google.spanner.admin.instance.v1.Instance] from being erased - * accidentally by clients that do not know about them. - * - * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Protobuf\FieldMask $var - * @return $this - */ - public function setFieldMask($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); - $this->field_mask = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance.php deleted file mode 100644 index c3d315021f0d..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance.php +++ /dev/null @@ -1,155 +0,0 @@ -/operations/` and - * can be used to track creation of the instance. The - * metadata field type is - * [CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata]. - * The response field type is - * [Instance][google.spanner.admin.instance.v1.Instance], if successful. - * - * @param string $formattedParent The name of the project in which to create the instance. Values - * are of the form `projects/`. Please see - * {@see InstanceAdminClient::projectName()} for help formatting this field. - * @param string $instanceId The ID of the instance to create. Valid identifiers are of the - * form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in - * length. - * @param string $instanceName A unique identifier for the instance, which cannot be changed - * after the instance is created. Values are of the form - * `projects//instances/[a-z][-a-z0-9]*[a-z0-9]`. The final - * segment of the name must be between 2 and 64 characters in length. - * @param string $formattedInstanceConfig The name of the instance's configuration. Values are of the form - * `projects//instanceConfigs/`. See - * also [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and - * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. Please see - * {@see InstanceAdminClient::instanceConfigName()} for help formatting this field. - * @param string $instanceDisplayName The descriptive name for this instance as it appears in UIs. - * Must be unique per project and between 4 and 30 characters in length. - */ -function create_instance_sample( - string $formattedParent, - string $instanceId, - string $instanceName, - string $formattedInstanceConfig, - string $instanceDisplayName -): void { - // Create a client. - $instanceAdminClient = new InstanceAdminClient(); - - // Prepare the request message. - $instance = (new Instance()) - ->setName($instanceName) - ->setConfig($formattedInstanceConfig) - ->setDisplayName($instanceDisplayName); - $request = (new CreateInstanceRequest()) - ->setParent($formattedParent) - ->setInstanceId($instanceId) - ->setInstance($instance); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $instanceAdminClient->createInstance($request); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var Instance $result */ - $result = $response->getResult(); - printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); - } else { - /** @var Status $error */ - $error = $response->getError(); - printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = InstanceAdminClient::projectName('[PROJECT]'); - $instanceId = '[INSTANCE_ID]'; - $instanceName = '[NAME]'; - $formattedInstanceConfig = InstanceAdminClient::instanceConfigName( - '[PROJECT]', - '[INSTANCE_CONFIG]' - ); - $instanceDisplayName = '[DISPLAY_NAME]'; - - create_instance_sample( - $formattedParent, - $instanceId, - $instanceName, - $formattedInstanceConfig, - $instanceDisplayName - ); -} -// [END spanner_v1_generated_InstanceAdmin_CreateInstance_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance_config.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance_config.php deleted file mode 100644 index a84bb609082a..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance_config.php +++ /dev/null @@ -1,132 +0,0 @@ -/operations/` and can be used to track - * creation of the instance configuration. The - * metadata field type is - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. - * The response field type is - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if - * successful. - * - * Authorization requires `spanner.instanceConfigs.create` permission on - * the resource - * [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.parent]. - * - * @param string $formattedParent The name of the project in which to create the instance - * configuration. Values are of the form `projects/`. Please see - * {@see InstanceAdminClient::projectName()} for help formatting this field. - * @param string $instanceConfigId The ID of the instance configuration to create. Valid identifiers - * are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 - * characters in length. The `custom-` prefix is required to avoid name - * conflicts with Google-managed configurations. - */ -function create_instance_config_sample(string $formattedParent, string $instanceConfigId): void -{ - // Create a client. - $instanceAdminClient = new InstanceAdminClient(); - - // Prepare the request message. - $instanceConfig = new InstanceConfig(); - $request = (new CreateInstanceConfigRequest()) - ->setParent($formattedParent) - ->setInstanceConfigId($instanceConfigId) - ->setInstanceConfig($instanceConfig); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $instanceAdminClient->createInstanceConfig($request); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var InstanceConfig $result */ - $result = $response->getResult(); - printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); - } else { - /** @var Status $error */ - $error = $response->getError(); - printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = InstanceAdminClient::projectName('[PROJECT]'); - $instanceConfigId = '[INSTANCE_CONFIG_ID]'; - - create_instance_config_sample($formattedParent, $instanceConfigId); -} -// [END spanner_v1_generated_InstanceAdmin_CreateInstanceConfig_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance_partition.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance_partition.php deleted file mode 100644 index 09ac8d5ecbf3..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/create_instance_partition.php +++ /dev/null @@ -1,161 +0,0 @@ -/operations/` and can be used to - * track creation of the instance partition. The - * metadata field type is - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. - * The response field type is - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if - * successful. - * - * @param string $formattedParent The name of the instance in which to create the instance - * partition. Values are of the form - * `projects//instances/`. Please see - * {@see InstanceAdminClient::instanceName()} for help formatting this field. - * @param string $instancePartitionId The ID of the instance partition to create. Valid identifiers are - * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 - * characters in length. - * @param string $instancePartitionName A unique identifier for the instance partition. Values are of the - * form - * `projects//instances//instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`. - * The final segment of the name must be between 2 and 64 characters in - * length. An instance partition's name cannot be changed after the instance - * partition is created. - * @param string $formattedInstancePartitionConfig The name of the instance partition's configuration. Values are of - * the form `projects//instanceConfigs/`. See also - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and - * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. Please see - * {@see InstanceAdminClient::instanceConfigName()} for help formatting this field. - * @param string $instancePartitionDisplayName The descriptive name for this instance partition as it appears in - * UIs. Must be unique per project and between 4 and 30 characters in length. - */ -function create_instance_partition_sample( - string $formattedParent, - string $instancePartitionId, - string $instancePartitionName, - string $formattedInstancePartitionConfig, - string $instancePartitionDisplayName -): void { - // Create a client. - $instanceAdminClient = new InstanceAdminClient(); - - // Prepare the request message. - $instancePartition = (new InstancePartition()) - ->setName($instancePartitionName) - ->setConfig($formattedInstancePartitionConfig) - ->setDisplayName($instancePartitionDisplayName); - $request = (new CreateInstancePartitionRequest()) - ->setParent($formattedParent) - ->setInstancePartitionId($instancePartitionId) - ->setInstancePartition($instancePartition); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $instanceAdminClient->createInstancePartition($request); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var InstancePartition $result */ - $result = $response->getResult(); - printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); - } else { - /** @var Status $error */ - $error = $response->getError(); - printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = InstanceAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); - $instancePartitionId = '[INSTANCE_PARTITION_ID]'; - $instancePartitionName = '[NAME]'; - $formattedInstancePartitionConfig = InstanceAdminClient::instanceConfigName( - '[PROJECT]', - '[INSTANCE_CONFIG]' - ); - $instancePartitionDisplayName = '[DISPLAY_NAME]'; - - create_instance_partition_sample( - $formattedParent, - $instancePartitionId, - $instancePartitionName, - $formattedInstancePartitionConfig, - $instancePartitionDisplayName - ); -} -// [END spanner_v1_generated_InstanceAdmin_CreateInstancePartition_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance.php deleted file mode 100644 index acf410ee2dd3..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance.php +++ /dev/null @@ -1,80 +0,0 @@ -/instances/` - * Please see {@see InstanceAdminClient::instanceName()} for help formatting this field. - */ -function delete_instance_sample(string $formattedName): void -{ - // Create a client. - $instanceAdminClient = new InstanceAdminClient(); - - // Prepare the request message. - $request = (new DeleteInstanceRequest()) - ->setName($formattedName); - - // Call the API and handle any network failures. - try { - $instanceAdminClient->deleteInstance($request); - printf('Call completed successfully.' . PHP_EOL); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = InstanceAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); - - delete_instance_sample($formattedName); -} -// [END spanner_v1_generated_InstanceAdmin_DeleteInstance_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance_config.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance_config.php deleted file mode 100644 index e017057244f2..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance_config.php +++ /dev/null @@ -1,78 +0,0 @@ -/instanceConfigs/` - * Please see {@see InstanceAdminClient::instanceConfigName()} for help formatting this field. - */ -function delete_instance_config_sample(string $formattedName): void -{ - // Create a client. - $instanceAdminClient = new InstanceAdminClient(); - - // Prepare the request message. - $request = (new DeleteInstanceConfigRequest()) - ->setName($formattedName); - - // Call the API and handle any network failures. - try { - $instanceAdminClient->deleteInstanceConfig($request); - printf('Call completed successfully.' . PHP_EOL); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = InstanceAdminClient::instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - - delete_instance_config_sample($formattedName); -} -// [END spanner_v1_generated_InstanceAdmin_DeleteInstanceConfig_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance_partition.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance_partition.php deleted file mode 100644 index fd8162657462..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/delete_instance_partition.php +++ /dev/null @@ -1,81 +0,0 @@ -setName($formattedName); - - // Call the API and handle any network failures. - try { - $instanceAdminClient->deleteInstancePartition($request); - printf('Call completed successfully.' . PHP_EOL); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = InstanceAdminClient::instancePartitionName( - '[PROJECT]', - '[INSTANCE]', - '[INSTANCE_PARTITION]' - ); - - delete_instance_partition_sample($formattedName); -} -// [END spanner_v1_generated_InstanceAdmin_DeleteInstancePartition_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_iam_policy.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_iam_policy.php deleted file mode 100644 index 617ecc2df332..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_iam_policy.php +++ /dev/null @@ -1,75 +0,0 @@ -setResource($resource); - - // Call the API and handle any network failures. - try { - /** @var Policy $response */ - $response = $instanceAdminClient->getIamPolicy($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $resource = '[RESOURCE]'; - - get_iam_policy_sample($resource); -} -// [END spanner_v1_generated_InstanceAdmin_GetIamPolicy_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance.php deleted file mode 100644 index 2ab84c8c825c..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance.php +++ /dev/null @@ -1,72 +0,0 @@ -/instances/`. Please see - * {@see InstanceAdminClient::instanceName()} for help formatting this field. - */ -function get_instance_sample(string $formattedName): void -{ - // Create a client. - $instanceAdminClient = new InstanceAdminClient(); - - // Prepare the request message. - $request = (new GetInstanceRequest()) - ->setName($formattedName); - - // Call the API and handle any network failures. - try { - /** @var Instance $response */ - $response = $instanceAdminClient->getInstance($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = InstanceAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); - - get_instance_sample($formattedName); -} -// [END spanner_v1_generated_InstanceAdmin_GetInstance_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance_config.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance_config.php deleted file mode 100644 index 087415caa6da..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance_config.php +++ /dev/null @@ -1,72 +0,0 @@ -/instanceConfigs/`. Please see - * {@see InstanceAdminClient::instanceConfigName()} for help formatting this field. - */ -function get_instance_config_sample(string $formattedName): void -{ - // Create a client. - $instanceAdminClient = new InstanceAdminClient(); - - // Prepare the request message. - $request = (new GetInstanceConfigRequest()) - ->setName($formattedName); - - // Call the API and handle any network failures. - try { - /** @var InstanceConfig $response */ - $response = $instanceAdminClient->getInstanceConfig($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = InstanceAdminClient::instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - - get_instance_config_sample($formattedName); -} -// [END spanner_v1_generated_InstanceAdmin_GetInstanceConfig_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance_partition.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance_partition.php deleted file mode 100644 index 54ee5059cd63..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/get_instance_partition.php +++ /dev/null @@ -1,77 +0,0 @@ -setName($formattedName); - - // Call the API and handle any network failures. - try { - /** @var InstancePartition $response */ - $response = $instanceAdminClient->getInstancePartition($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = InstanceAdminClient::instancePartitionName( - '[PROJECT]', - '[INSTANCE]', - '[INSTANCE_PARTITION]' - ); - - get_instance_partition_sample($formattedName); -} -// [END spanner_v1_generated_InstanceAdmin_GetInstancePartition_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_config_operations.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_config_operations.php deleted file mode 100644 index cdd490164b0f..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_config_operations.php +++ /dev/null @@ -1,87 +0,0 @@ -/instanceConfigs//operations/`. - * The long-running operation - * metadata field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that have completed/failed/canceled within the last 7 days, - * and pending operations. Operations returned are ordered by - * `operation.metadata.value.start_time` in descending order starting - * from the most recently started operation. - * - * @param string $formattedParent The project of the instance configuration operations. - * Values are of the form `projects/`. Please see - * {@see InstanceAdminClient::projectName()} for help formatting this field. - */ -function list_instance_config_operations_sample(string $formattedParent): void -{ - // Create a client. - $instanceAdminClient = new InstanceAdminClient(); - - // Prepare the request message. - $request = (new ListInstanceConfigOperationsRequest()) - ->setParent($formattedParent); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $instanceAdminClient->listInstanceConfigOperations($request); - - /** @var Operation $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = InstanceAdminClient::projectName('[PROJECT]'); - - list_instance_config_operations_sample($formattedParent); -} -// [END spanner_v1_generated_InstanceAdmin_ListInstanceConfigOperations_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_configs.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_configs.php deleted file mode 100644 index a68208ba7873..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_configs.php +++ /dev/null @@ -1,81 +0,0 @@ -`. Please see - * {@see InstanceAdminClient::projectName()} for help formatting this field. - */ -function list_instance_configs_sample(string $formattedParent): void -{ - // Create a client. - $instanceAdminClient = new InstanceAdminClient(); - - // Prepare the request message. - $request = (new ListInstanceConfigsRequest()) - ->setParent($formattedParent); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $instanceAdminClient->listInstanceConfigs($request); - - /** @var InstanceConfig $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = InstanceAdminClient::projectName('[PROJECT]'); - - list_instance_configs_sample($formattedParent); -} -// [END spanner_v1_generated_InstanceAdmin_ListInstanceConfigs_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_partition_operations.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_partition_operations.php deleted file mode 100644 index 0ef611f61375..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_partition_operations.php +++ /dev/null @@ -1,90 +0,0 @@ -/instances//instancePartitions//operations/`. - * The long-running operation - * metadata field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that have completed/failed/canceled within the last 7 days, - * and pending operations. Operations returned are ordered by - * `operation.metadata.value.start_time` in descending order starting from the - * most recently started operation. - * - * Authorization requires `spanner.instancePartitionOperations.list` - * permission on the resource - * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]. - * - * @param string $formattedParent The parent instance of the instance partition operations. - * Values are of the form `projects//instances/`. Please see - * {@see InstanceAdminClient::instanceName()} for help formatting this field. - */ -function list_instance_partition_operations_sample(string $formattedParent): void -{ - // Create a client. - $instanceAdminClient = new InstanceAdminClient(); - - // Prepare the request message. - $request = (new ListInstancePartitionOperationsRequest()) - ->setParent($formattedParent); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $instanceAdminClient->listInstancePartitionOperations($request); - - /** @var Operation $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = InstanceAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); - - list_instance_partition_operations_sample($formattedParent); -} -// [END spanner_v1_generated_InstanceAdmin_ListInstancePartitionOperations_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_partitions.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_partitions.php deleted file mode 100644 index a8651e105f97..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_partitions.php +++ /dev/null @@ -1,79 +0,0 @@ -/instances/`. Use `{instance} - * = '-'` to list instance partitions for all Instances in a project, e.g., - * `projects/myproject/instances/-`. Please see - * {@see InstanceAdminClient::instanceName()} for help formatting this field. - */ -function list_instance_partitions_sample(string $formattedParent): void -{ - // Create a client. - $instanceAdminClient = new InstanceAdminClient(); - - // Prepare the request message. - $request = (new ListInstancePartitionsRequest()) - ->setParent($formattedParent); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $instanceAdminClient->listInstancePartitions($request); - - /** @var InstancePartition $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = InstanceAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); - - list_instance_partitions_sample($formattedParent); -} -// [END spanner_v1_generated_InstanceAdmin_ListInstancePartitions_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instances.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instances.php deleted file mode 100644 index 4017eba45eef..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instances.php +++ /dev/null @@ -1,77 +0,0 @@ -`. Please see - * {@see InstanceAdminClient::projectName()} for help formatting this field. - */ -function list_instances_sample(string $formattedParent): void -{ - // Create a client. - $instanceAdminClient = new InstanceAdminClient(); - - // Prepare the request message. - $request = (new ListInstancesRequest()) - ->setParent($formattedParent); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $instanceAdminClient->listInstances($request); - - /** @var Instance $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedParent = InstanceAdminClient::projectName('[PROJECT]'); - - list_instances_sample($formattedParent); -} -// [END spanner_v1_generated_InstanceAdmin_ListInstances_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/move_instance.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/move_instance.php deleted file mode 100644 index b8dd949e9572..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/move_instance.php +++ /dev/null @@ -1,149 +0,0 @@ -/operations/` and can be used to track - * the move instance operation. The - * metadata field type is - * [MoveInstanceMetadata][google.spanner.admin.instance.v1.MoveInstanceMetadata]. - * The response field type is - * [Instance][google.spanner.admin.instance.v1.Instance], - * if successful. - * Cancelling the operation sets its metadata's - * [cancel_time][google.spanner.admin.instance.v1.MoveInstanceMetadata.cancel_time]. - * Cancellation is not immediate because it involves moving any data - * previously moved to the target instance configuration back to the original - * instance configuration. You can use this operation to track the progress of - * the cancellation. Upon successful completion of the cancellation, the - * operation terminates with `CANCELLED` status. - * - * If not cancelled, upon completion of the returned operation: - * - * * The instance successfully moves to the target instance - * configuration. - * * You are billed for compute and storage in target instance - * configuration. - * - * Authorization requires the `spanner.instances.update` permission on - * the resource [instance][google.spanner.admin.instance.v1.Instance]. - * - * For more details, see - * [Move an instance](https://cloud.google.com/spanner/docs/move-instance). - * - * @param string $formattedName The instance to move. - * Values are of the form `projects//instances/`. Please see - * {@see InstanceAdminClient::instanceName()} for help formatting this field. - * @param string $formattedTargetConfig The target instance configuration where to move the instance. - * Values are of the form `projects//instanceConfigs/`. Please see - * {@see InstanceAdminClient::instanceConfigName()} for help formatting this field. - */ -function move_instance_sample(string $formattedName, string $formattedTargetConfig): void -{ - // Create a client. - $instanceAdminClient = new InstanceAdminClient(); - - // Prepare the request message. - $request = (new MoveInstanceRequest()) - ->setName($formattedName) - ->setTargetConfig($formattedTargetConfig); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $instanceAdminClient->moveInstance($request); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var MoveInstanceResponse $result */ - $result = $response->getResult(); - printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); - } else { - /** @var Status $error */ - $error = $response->getError(); - printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = InstanceAdminClient::instanceName('[PROJECT]', '[INSTANCE]'); - $formattedTargetConfig = InstanceAdminClient::instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - - move_instance_sample($formattedName, $formattedTargetConfig); -} -// [END spanner_v1_generated_InstanceAdmin_MoveInstance_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/set_iam_policy.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/set_iam_policy.php deleted file mode 100644 index 29f85e9f6741..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/set_iam_policy.php +++ /dev/null @@ -1,77 +0,0 @@ -setResource($resource) - ->setPolicy($policy); - - // Call the API and handle any network failures. - try { - /** @var Policy $response */ - $response = $instanceAdminClient->setIamPolicy($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $resource = '[RESOURCE]'; - - set_iam_policy_sample($resource); -} -// [END spanner_v1_generated_InstanceAdmin_SetIamPolicy_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/test_iam_permissions.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/test_iam_permissions.php deleted file mode 100644 index 583d9f9dc77c..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/test_iam_permissions.php +++ /dev/null @@ -1,83 +0,0 @@ -setResource($resource) - ->setPermissions($permissions); - - // Call the API and handle any network failures. - try { - /** @var TestIamPermissionsResponse $response */ - $response = $instanceAdminClient->testIamPermissions($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $resource = '[RESOURCE]'; - $permissionsElement = '[PERMISSIONS]'; - - test_iam_permissions_sample($resource, $permissionsElement); -} -// [END spanner_v1_generated_InstanceAdmin_TestIamPermissions_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance.php deleted file mode 100644 index f30c0c375cbc..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance.php +++ /dev/null @@ -1,145 +0,0 @@ -/operations/` and - * can be used to track the instance modification. The - * metadata field type is - * [UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. - * The response field type is - * [Instance][google.spanner.admin.instance.v1.Instance], if successful. - * - * Authorization requires `spanner.instances.update` permission on - * the resource [name][google.spanner.admin.instance.v1.Instance.name]. - * - * @param string $instanceName A unique identifier for the instance, which cannot be changed - * after the instance is created. Values are of the form - * `projects//instances/[a-z][-a-z0-9]*[a-z0-9]`. The final - * segment of the name must be between 2 and 64 characters in length. - * @param string $formattedInstanceConfig The name of the instance's configuration. Values are of the form - * `projects//instanceConfigs/`. See - * also [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and - * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. Please see - * {@see InstanceAdminClient::instanceConfigName()} for help formatting this field. - * @param string $instanceDisplayName The descriptive name for this instance as it appears in UIs. - * Must be unique per project and between 4 and 30 characters in length. - */ -function update_instance_sample( - string $instanceName, - string $formattedInstanceConfig, - string $instanceDisplayName -): void { - // Create a client. - $instanceAdminClient = new InstanceAdminClient(); - - // Prepare the request message. - $instance = (new Instance()) - ->setName($instanceName) - ->setConfig($formattedInstanceConfig) - ->setDisplayName($instanceDisplayName); - $fieldMask = new FieldMask(); - $request = (new UpdateInstanceRequest()) - ->setInstance($instance) - ->setFieldMask($fieldMask); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $instanceAdminClient->updateInstance($request); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var Instance $result */ - $result = $response->getResult(); - printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); - } else { - /** @var Status $error */ - $error = $response->getError(); - printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $instanceName = '[NAME]'; - $formattedInstanceConfig = InstanceAdminClient::instanceConfigName( - '[PROJECT]', - '[INSTANCE_CONFIG]' - ); - $instanceDisplayName = '[DISPLAY_NAME]'; - - update_instance_sample($instanceName, $formattedInstanceConfig, $instanceDisplayName); -} -// [END spanner_v1_generated_InstanceAdmin_UpdateInstance_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance_config.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance_config.php deleted file mode 100644 index edf4ddd0b4f9..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance_config.php +++ /dev/null @@ -1,117 +0,0 @@ -/operations/` and can be used to track - * the instance configuration modification. The - * metadata field type is - * [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]. - * The response field type is - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if - * successful. - * - * Authorization requires `spanner.instanceConfigs.update` permission on - * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function update_instance_config_sample(): void -{ - // Create a client. - $instanceAdminClient = new InstanceAdminClient(); - - // Prepare the request message. - $instanceConfig = new InstanceConfig(); - $updateMask = new FieldMask(); - $request = (new UpdateInstanceConfigRequest()) - ->setInstanceConfig($instanceConfig) - ->setUpdateMask($updateMask); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $instanceAdminClient->updateInstanceConfig($request); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var InstanceConfig $result */ - $result = $response->getResult(); - printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); - } else { - /** @var Status $error */ - $error = $response->getError(); - printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} -// [END spanner_v1_generated_InstanceAdmin_UpdateInstanceConfig_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance_partition.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance_partition.php deleted file mode 100644 index 2f61f333c720..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance_partition.php +++ /dev/null @@ -1,155 +0,0 @@ -/operations/` and can be used to - * track the instance partition modification. The - * metadata field type is - * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. - * The response field type is - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if - * successful. - * - * Authorization requires `spanner.instancePartitions.update` permission on - * the resource - * [name][google.spanner.admin.instance.v1.InstancePartition.name]. - * - * @param string $instancePartitionName A unique identifier for the instance partition. Values are of the - * form - * `projects//instances//instancePartitions/[a-z][-a-z0-9]*[a-z0-9]`. - * The final segment of the name must be between 2 and 64 characters in - * length. An instance partition's name cannot be changed after the instance - * partition is created. - * @param string $formattedInstancePartitionConfig The name of the instance partition's configuration. Values are of - * the form `projects//instanceConfigs/`. See also - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and - * [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs]. Please see - * {@see InstanceAdminClient::instanceConfigName()} for help formatting this field. - * @param string $instancePartitionDisplayName The descriptive name for this instance partition as it appears in - * UIs. Must be unique per project and between 4 and 30 characters in length. - */ -function update_instance_partition_sample( - string $instancePartitionName, - string $formattedInstancePartitionConfig, - string $instancePartitionDisplayName -): void { - // Create a client. - $instanceAdminClient = new InstanceAdminClient(); - - // Prepare the request message. - $instancePartition = (new InstancePartition()) - ->setName($instancePartitionName) - ->setConfig($formattedInstancePartitionConfig) - ->setDisplayName($instancePartitionDisplayName); - $fieldMask = new FieldMask(); - $request = (new UpdateInstancePartitionRequest()) - ->setInstancePartition($instancePartition) - ->setFieldMask($fieldMask); - - // Call the API and handle any network failures. - try { - /** @var OperationResponse $response */ - $response = $instanceAdminClient->updateInstancePartition($request); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var InstancePartition $result */ - $result = $response->getResult(); - printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); - } else { - /** @var Status $error */ - $error = $response->getError(); - printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $instancePartitionName = '[NAME]'; - $formattedInstancePartitionConfig = InstanceAdminClient::instanceConfigName( - '[PROJECT]', - '[INSTANCE_CONFIG]' - ); - $instancePartitionDisplayName = '[DISPLAY_NAME]'; - - update_instance_partition_sample( - $instancePartitionName, - $formattedInstancePartitionConfig, - $instancePartitionDisplayName - ); -} -// [END spanner_v1_generated_InstanceAdmin_UpdateInstancePartition_sync] diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/Client/InstanceAdminClient.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/Client/InstanceAdminClient.php deleted file mode 100644 index c1f1fc7a5355..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/Client/InstanceAdminClient.php +++ /dev/null @@ -1,1302 +0,0 @@ - createInstanceAsync(CreateInstanceRequest $request, array $optionalArgs = []) - * @method PromiseInterface createInstanceConfigAsync(CreateInstanceConfigRequest $request, array $optionalArgs = []) - * @method PromiseInterface createInstancePartitionAsync(CreateInstancePartitionRequest $request, array $optionalArgs = []) - * @method PromiseInterface deleteInstanceAsync(DeleteInstanceRequest $request, array $optionalArgs = []) - * @method PromiseInterface deleteInstanceConfigAsync(DeleteInstanceConfigRequest $request, array $optionalArgs = []) - * @method PromiseInterface deleteInstancePartitionAsync(DeleteInstancePartitionRequest $request, array $optionalArgs = []) - * @method PromiseInterface getIamPolicyAsync(GetIamPolicyRequest $request, array $optionalArgs = []) - * @method PromiseInterface getInstanceAsync(GetInstanceRequest $request, array $optionalArgs = []) - * @method PromiseInterface getInstanceConfigAsync(GetInstanceConfigRequest $request, array $optionalArgs = []) - * @method PromiseInterface getInstancePartitionAsync(GetInstancePartitionRequest $request, array $optionalArgs = []) - * @method PromiseInterface listInstanceConfigOperationsAsync(ListInstanceConfigOperationsRequest $request, array $optionalArgs = []) - * @method PromiseInterface listInstanceConfigsAsync(ListInstanceConfigsRequest $request, array $optionalArgs = []) - * @method PromiseInterface listInstancePartitionOperationsAsync(ListInstancePartitionOperationsRequest $request, array $optionalArgs = []) - * @method PromiseInterface listInstancePartitionsAsync(ListInstancePartitionsRequest $request, array $optionalArgs = []) - * @method PromiseInterface listInstancesAsync(ListInstancesRequest $request, array $optionalArgs = []) - * @method PromiseInterface moveInstanceAsync(MoveInstanceRequest $request, array $optionalArgs = []) - * @method PromiseInterface setIamPolicyAsync(SetIamPolicyRequest $request, array $optionalArgs = []) - * @method PromiseInterface testIamPermissionsAsync(TestIamPermissionsRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateInstanceAsync(UpdateInstanceRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateInstanceConfigAsync(UpdateInstanceConfigRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateInstancePartitionAsync(UpdateInstancePartitionRequest $request, array $optionalArgs = []) - */ -final class InstanceAdminClient -{ - use GapicClientTrait; - use ResourceHelperTrait; - - /** The name of the service. */ - private const SERVICE_NAME = 'google.spanner.admin.instance.v1.InstanceAdmin'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - private const SERVICE_ADDRESS = 'spanner.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'spanner.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - private const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - private const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/spanner.admin', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/instance_admin_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/instance_admin_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/instance_admin_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/instance_admin_rest_client_config.php', - ], - ], - ]; - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; - $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); - $operation->reload(); - return $operation; - } - - /** - * Formats a string containing the fully-qualified path to represent a instance - * resource. - * - * @param string $project - * @param string $instance - * - * @return string The formatted instance resource. - */ - public static function instanceName(string $project, string $instance): string - { - return self::getPathTemplate('instance')->render([ - 'project' => $project, - 'instance' => $instance, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * instance_config resource. - * - * @param string $project - * @param string $instanceConfig - * - * @return string The formatted instance_config resource. - */ - public static function instanceConfigName(string $project, string $instanceConfig): string - { - return self::getPathTemplate('instanceConfig')->render([ - 'project' => $project, - 'instance_config' => $instanceConfig, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * instance_partition resource. - * - * @param string $project - * @param string $instance - * @param string $instancePartition - * - * @return string The formatted instance_partition resource. - */ - public static function instancePartitionName(string $project, string $instance, string $instancePartition): string - { - return self::getPathTemplate('instancePartition')->render([ - 'project' => $project, - 'instance' => $instance, - 'instance_partition' => $instancePartition, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a project - * resource. - * - * @param string $project - * - * @return string The formatted project resource. - */ - public static function projectName(string $project): string - { - return self::getPathTemplate('project')->render([ - 'project' => $project, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - instance: projects/{project}/instances/{instance} - * - instanceConfig: projects/{project}/instanceConfigs/{instance_config} - * - instancePartition: projects/{project}/instances/{instance}/instancePartitions/{instance_partition} - * - project: projects/{project} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param ?string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName(string $formattedName, ?string $template = null): array - { - return self::parseFormattedName($formattedName, $template); - } - - /** - * Constructor. - * - * Setting the "SPANNER_EMULATOR_HOST" environment variable will automatically set - * the API Endpoint to the value specified in the variable, as well as ensure that - * empty credentials are used in the transport layer. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'spanner.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * @type false|LoggerInterface $logger - * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the - * 'GOOGLE_SDK_PHP_LOGGING' environment flag - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $options = $this->setDefaultEmulatorConfig($options); - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** Handles execution of the async variants for each documented method. */ - public function __call($method, $args) - { - if (substr($method, -5) !== 'Async') { - trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); - } - - array_unshift($args, substr($method, 0, -5)); - return call_user_func_array([$this, 'startAsyncCall'], $args); - } - - /** - * Creates an instance and begins preparing it to begin serving. The - * returned long-running operation - * can be used to track the progress of preparing the new - * instance. The instance name is assigned by the caller. If the - * named instance already exists, `CreateInstance` returns - * `ALREADY_EXISTS`. - * - * Immediately upon completion of this request: - * - * * The instance is readable via the API, with all requested attributes - * but no allocated resources. Its state is `CREATING`. - * - * Until completion of the returned operation: - * - * * Cancelling the operation renders the instance immediately unreadable - * via the API. - * * The instance can be deleted. - * * All other attempts to modify the instance are rejected. - * - * Upon completion of the returned operation: - * - * * Billing for all successfully-allocated resources begins (some types - * may have lower than the requested levels). - * * Databases can be created in the instance. - * * The instance's allocated resource levels are readable via the API. - * * The instance's state becomes `READY`. - * - * The returned long-running operation will - * have a name of the format `/operations/` and - * can be used to track creation of the instance. The - * metadata field type is - * [CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata]. - * The response field type is - * [Instance][google.spanner.admin.instance.v1.Instance], if successful. - * - * The async variant is {@see InstanceAdminClient::createInstanceAsync()} . - * - * @example samples/V1/InstanceAdminClient/create_instance.php - * - * @param CreateInstanceRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function createInstance(CreateInstanceRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('CreateInstance', $request, $callOptions)->wait(); - } - - /** - * Creates an instance configuration and begins preparing it to be used. The - * returned long-running operation - * can be used to track the progress of preparing the new - * instance configuration. The instance configuration name is assigned by the - * caller. If the named instance configuration already exists, - * `CreateInstanceConfig` returns `ALREADY_EXISTS`. - * - * Immediately after the request returns: - * - * * The instance configuration is readable via the API, with all requested - * attributes. The instance configuration's - * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] - * field is set to true. Its state is `CREATING`. - * - * While the operation is pending: - * - * * Cancelling the operation renders the instance configuration immediately - * unreadable via the API. - * * Except for deleting the creating resource, all other attempts to modify - * the instance configuration are rejected. - * - * Upon completion of the returned operation: - * - * * Instances can be created using the instance configuration. - * * The instance configuration's - * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] - * field becomes false. Its state becomes `READY`. - * - * The returned long-running operation will - * have a name of the format - * `/operations/` and can be used to track - * creation of the instance configuration. The - * metadata field type is - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. - * The response field type is - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if - * successful. - * - * Authorization requires `spanner.instanceConfigs.create` permission on - * the resource - * [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.parent]. - * - * The async variant is {@see InstanceAdminClient::createInstanceConfigAsync()} . - * - * @example samples/V1/InstanceAdminClient/create_instance_config.php - * - * @param CreateInstanceConfigRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function createInstanceConfig(CreateInstanceConfigRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('CreateInstanceConfig', $request, $callOptions)->wait(); - } - - /** - * Creates an instance partition and begins preparing it to be used. The - * returned long-running operation - * can be used to track the progress of preparing the new instance partition. - * The instance partition name is assigned by the caller. If the named - * instance partition already exists, `CreateInstancePartition` returns - * `ALREADY_EXISTS`. - * - * Immediately upon completion of this request: - * - * * The instance partition is readable via the API, with all requested - * attributes but no allocated resources. Its state is `CREATING`. - * - * Until completion of the returned operation: - * - * * Cancelling the operation renders the instance partition immediately - * unreadable via the API. - * * The instance partition can be deleted. - * * All other attempts to modify the instance partition are rejected. - * - * Upon completion of the returned operation: - * - * * Billing for all successfully-allocated resources begins (some types - * may have lower than the requested levels). - * * Databases can start using this instance partition. - * * The instance partition's allocated resource levels are readable via the - * API. - * * The instance partition's state becomes `READY`. - * - * The returned long-running operation will - * have a name of the format - * `/operations/` and can be used to - * track creation of the instance partition. The - * metadata field type is - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. - * The response field type is - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if - * successful. - * - * The async variant is {@see InstanceAdminClient::createInstancePartitionAsync()} - * . - * - * @example samples/V1/InstanceAdminClient/create_instance_partition.php - * - * @param CreateInstancePartitionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function createInstancePartition(CreateInstancePartitionRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('CreateInstancePartition', $request, $callOptions)->wait(); - } - - /** - * Deletes an instance. - * - * Immediately upon completion of the request: - * - * * Billing ceases for all of the instance's reserved resources. - * - * Soon afterward: - * - * * The instance and *all of its databases* immediately and - * irrevocably disappear from the API. All data in the databases - * is permanently deleted. - * - * The async variant is {@see InstanceAdminClient::deleteInstanceAsync()} . - * - * @example samples/V1/InstanceAdminClient/delete_instance.php - * - * @param DeleteInstanceRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteInstance(DeleteInstanceRequest $request, array $callOptions = []): void - { - $this->startApiCall('DeleteInstance', $request, $callOptions)->wait(); - } - - /** - * Deletes the instance configuration. Deletion is only allowed when no - * instances are using the configuration. If any instances are using - * the configuration, returns `FAILED_PRECONDITION`. - * - * Only user-managed configurations can be deleted. - * - * Authorization requires `spanner.instanceConfigs.delete` permission on - * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. - * - * The async variant is {@see InstanceAdminClient::deleteInstanceConfigAsync()} . - * - * @example samples/V1/InstanceAdminClient/delete_instance_config.php - * - * @param DeleteInstanceConfigRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteInstanceConfig(DeleteInstanceConfigRequest $request, array $callOptions = []): void - { - $this->startApiCall('DeleteInstanceConfig', $request, $callOptions)->wait(); - } - - /** - * Deletes an existing instance partition. Requires that the - * instance partition is not used by any database or backup and is not the - * default instance partition of an instance. - * - * Authorization requires `spanner.instancePartitions.delete` permission on - * the resource - * [name][google.spanner.admin.instance.v1.InstancePartition.name]. - * - * The async variant is {@see InstanceAdminClient::deleteInstancePartitionAsync()} - * . - * - * @example samples/V1/InstanceAdminClient/delete_instance_partition.php - * - * @param DeleteInstancePartitionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteInstancePartition(DeleteInstancePartitionRequest $request, array $callOptions = []): void - { - $this->startApiCall('DeleteInstancePartition', $request, $callOptions)->wait(); - } - - /** - * Gets the access control policy for an instance resource. Returns an empty - * policy if an instance exists but does not have a policy set. - * - * Authorization requires `spanner.instances.getIamPolicy` on - * [resource][google.iam.v1.GetIamPolicyRequest.resource]. - * - * The async variant is {@see InstanceAdminClient::getIamPolicyAsync()} . - * - * @example samples/V1/InstanceAdminClient/get_iam_policy.php - * - * @param GetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function getIamPolicy(GetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * Gets information about a particular instance. - * - * The async variant is {@see InstanceAdminClient::getInstanceAsync()} . - * - * @example samples/V1/InstanceAdminClient/get_instance.php - * - * @param GetInstanceRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Instance - * - * @throws ApiException Thrown if the API call fails. - */ - public function getInstance(GetInstanceRequest $request, array $callOptions = []): Instance - { - return $this->startApiCall('GetInstance', $request, $callOptions)->wait(); - } - - /** - * Gets information about a particular instance configuration. - * - * The async variant is {@see InstanceAdminClient::getInstanceConfigAsync()} . - * - * @example samples/V1/InstanceAdminClient/get_instance_config.php - * - * @param GetInstanceConfigRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return InstanceConfig - * - * @throws ApiException Thrown if the API call fails. - */ - public function getInstanceConfig(GetInstanceConfigRequest $request, array $callOptions = []): InstanceConfig - { - return $this->startApiCall('GetInstanceConfig', $request, $callOptions)->wait(); - } - - /** - * Gets information about a particular instance partition. - * - * The async variant is {@see InstanceAdminClient::getInstancePartitionAsync()} . - * - * @example samples/V1/InstanceAdminClient/get_instance_partition.php - * - * @param GetInstancePartitionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return InstancePartition - * - * @throws ApiException Thrown if the API call fails. - */ - public function getInstancePartition(GetInstancePartitionRequest $request, array $callOptions = []): InstancePartition - { - return $this->startApiCall('GetInstancePartition', $request, $callOptions)->wait(); - } - - /** - * Lists the user-managed instance configuration long-running - * operations in the given project. An instance - * configuration operation has a name of the form - * `projects//instanceConfigs//operations/`. - * The long-running operation - * metadata field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that have completed/failed/canceled within the last 7 days, - * and pending operations. Operations returned are ordered by - * `operation.metadata.value.start_time` in descending order starting - * from the most recently started operation. - * - * The async variant is - * {@see InstanceAdminClient::listInstanceConfigOperationsAsync()} . - * - * @example samples/V1/InstanceAdminClient/list_instance_config_operations.php - * - * @param ListInstanceConfigOperationsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listInstanceConfigOperations(ListInstanceConfigOperationsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListInstanceConfigOperations', $request, $callOptions); - } - - /** - * Lists the supported instance configurations for a given project. - * - * Returns both Google-managed configurations and user-managed - * configurations. - * - * The async variant is {@see InstanceAdminClient::listInstanceConfigsAsync()} . - * - * @example samples/V1/InstanceAdminClient/list_instance_configs.php - * - * @param ListInstanceConfigsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listInstanceConfigs(ListInstanceConfigsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListInstanceConfigs', $request, $callOptions); - } - - /** - * Lists instance partition long-running operations in the given instance. - * An instance partition operation has a name of the form - * `projects//instances//instancePartitions//operations/`. - * The long-running operation - * metadata field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that have completed/failed/canceled within the last 7 days, - * and pending operations. Operations returned are ordered by - * `operation.metadata.value.start_time` in descending order starting from the - * most recently started operation. - * - * Authorization requires `spanner.instancePartitionOperations.list` - * permission on the resource - * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]. - * - * The async variant is - * {@see InstanceAdminClient::listInstancePartitionOperationsAsync()} . - * - * @example samples/V1/InstanceAdminClient/list_instance_partition_operations.php - * - * @param ListInstancePartitionOperationsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listInstancePartitionOperations(ListInstancePartitionOperationsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListInstancePartitionOperations', $request, $callOptions); - } - - /** - * Lists all instance partitions for the given instance. - * - * The async variant is {@see InstanceAdminClient::listInstancePartitionsAsync()} . - * - * @example samples/V1/InstanceAdminClient/list_instance_partitions.php - * - * @param ListInstancePartitionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listInstancePartitions(ListInstancePartitionsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListInstancePartitions', $request, $callOptions); - } - - /** - * Lists all instances in the given project. - * - * The async variant is {@see InstanceAdminClient::listInstancesAsync()} . - * - * @example samples/V1/InstanceAdminClient/list_instances.php - * - * @param ListInstancesRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listInstances(ListInstancesRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListInstances', $request, $callOptions); - } - - /** - * Moves an instance to the target instance configuration. You can use the - * returned long-running operation to track - * the progress of moving the instance. - * - * `MoveInstance` returns `FAILED_PRECONDITION` if the instance meets any of - * the following criteria: - * - * * Is undergoing a move to a different instance configuration - * * Has backups - * * Has an ongoing update - * * Contains any CMEK-enabled databases - * * Is a free trial instance - * - * While the operation is pending: - * - * * All other attempts to modify the instance, including changes to its - * compute capacity, are rejected. - * * The following database and backup admin operations are rejected: - * - * * `DatabaseAdmin.CreateDatabase` - * * `DatabaseAdmin.UpdateDatabaseDdl` (disabled if default_leader is - * specified in the request.) - * * `DatabaseAdmin.RestoreDatabase` - * * `DatabaseAdmin.CreateBackup` - * * `DatabaseAdmin.CopyBackup` - * - * * Both the source and target instance configurations are subject to - * hourly compute and storage charges. - * * The instance might experience higher read-write latencies and a higher - * transaction abort rate. However, moving an instance doesn't cause any - * downtime. - * - * The returned long-running operation has - * a name of the format - * `/operations/` and can be used to track - * the move instance operation. The - * metadata field type is - * [MoveInstanceMetadata][google.spanner.admin.instance.v1.MoveInstanceMetadata]. - * The response field type is - * [Instance][google.spanner.admin.instance.v1.Instance], - * if successful. - * Cancelling the operation sets its metadata's - * [cancel_time][google.spanner.admin.instance.v1.MoveInstanceMetadata.cancel_time]. - * Cancellation is not immediate because it involves moving any data - * previously moved to the target instance configuration back to the original - * instance configuration. You can use this operation to track the progress of - * the cancellation. Upon successful completion of the cancellation, the - * operation terminates with `CANCELLED` status. - * - * If not cancelled, upon completion of the returned operation: - * - * * The instance successfully moves to the target instance - * configuration. - * * You are billed for compute and storage in target instance - * configuration. - * - * Authorization requires the `spanner.instances.update` permission on - * the resource [instance][google.spanner.admin.instance.v1.Instance]. - * - * For more details, see - * [Move an instance](https://cloud.google.com/spanner/docs/move-instance). - * - * The async variant is {@see InstanceAdminClient::moveInstanceAsync()} . - * - * @example samples/V1/InstanceAdminClient/move_instance.php - * - * @param MoveInstanceRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function moveInstance(MoveInstanceRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('MoveInstance', $request, $callOptions)->wait(); - } - - /** - * Sets the access control policy on an instance resource. Replaces any - * existing policy. - * - * Authorization requires `spanner.instances.setIamPolicy` on - * [resource][google.iam.v1.SetIamPolicyRequest.resource]. - * - * The async variant is {@see InstanceAdminClient::setIamPolicyAsync()} . - * - * @example samples/V1/InstanceAdminClient/set_iam_policy.php - * - * @param SetIamPolicyRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Policy - * - * @throws ApiException Thrown if the API call fails. - */ - public function setIamPolicy(SetIamPolicyRequest $request, array $callOptions = []): Policy - { - return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); - } - - /** - * Returns permissions that the caller has on the specified instance resource. - * - * Attempting this RPC on a non-existent Cloud Spanner instance resource will - * result in a NOT_FOUND error if the user has `spanner.instances.list` - * permission on the containing Google Cloud Project. Otherwise returns an - * empty set of permissions. - * - * The async variant is {@see InstanceAdminClient::testIamPermissionsAsync()} . - * - * @example samples/V1/InstanceAdminClient/test_iam_permissions.php - * - * @param TestIamPermissionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return TestIamPermissionsResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function testIamPermissions(TestIamPermissionsRequest $request, array $callOptions = []): TestIamPermissionsResponse - { - return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); - } - - /** - * Updates an instance, and begins allocating or releasing resources - * as requested. The returned long-running operation can be used to track the - * progress of updating the instance. If the named instance does not - * exist, returns `NOT_FOUND`. - * - * Immediately upon completion of this request: - * - * * For resource types for which a decrease in the instance's allocation - * has been requested, billing is based on the newly-requested level. - * - * Until completion of the returned operation: - * - * * Cancelling the operation sets its metadata's - * [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time], - * and begins restoring resources to their pre-request values. The - * operation is guaranteed to succeed at undoing all resource changes, - * after which point it terminates with a `CANCELLED` status. - * * All other attempts to modify the instance are rejected. - * * Reading the instance via the API continues to give the pre-request - * resource levels. - * - * Upon completion of the returned operation: - * - * * Billing begins for all successfully-allocated resources (some types - * may have lower than the requested levels). - * * All newly-reserved resources are available for serving the instance's - * tables. - * * The instance's new resource levels are readable via the API. - * - * The returned long-running operation will - * have a name of the format `/operations/` and - * can be used to track the instance modification. The - * metadata field type is - * [UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. - * The response field type is - * [Instance][google.spanner.admin.instance.v1.Instance], if successful. - * - * Authorization requires `spanner.instances.update` permission on - * the resource [name][google.spanner.admin.instance.v1.Instance.name]. - * - * The async variant is {@see InstanceAdminClient::updateInstanceAsync()} . - * - * @example samples/V1/InstanceAdminClient/update_instance.php - * - * @param UpdateInstanceRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateInstance(UpdateInstanceRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('UpdateInstance', $request, $callOptions)->wait(); - } - - /** - * Updates an instance configuration. The returned - * long-running operation can be used to track - * the progress of updating the instance. If the named instance configuration - * does not exist, returns `NOT_FOUND`. - * - * Only user-managed configurations can be updated. - * - * Immediately after the request returns: - * - * * The instance configuration's - * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] - * field is set to true. - * - * While the operation is pending: - * - * * Cancelling the operation sets its metadata's - * [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.cancel_time]. - * The operation is guaranteed to succeed at undoing all changes, after - * which point it terminates with a `CANCELLED` status. - * * All other attempts to modify the instance configuration are rejected. - * * Reading the instance configuration via the API continues to give the - * pre-request values. - * - * Upon completion of the returned operation: - * - * * Creating instances using the instance configuration uses the new - * values. - * * The new values of the instance configuration are readable via the API. - * * The instance configuration's - * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] - * field becomes false. - * - * The returned long-running operation will - * have a name of the format - * `/operations/` and can be used to track - * the instance configuration modification. The - * metadata field type is - * [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]. - * The response field type is - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if - * successful. - * - * Authorization requires `spanner.instanceConfigs.update` permission on - * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. - * - * The async variant is {@see InstanceAdminClient::updateInstanceConfigAsync()} . - * - * @example samples/V1/InstanceAdminClient/update_instance_config.php - * - * @param UpdateInstanceConfigRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateInstanceConfig(UpdateInstanceConfigRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('UpdateInstanceConfig', $request, $callOptions)->wait(); - } - - /** - * Updates an instance partition, and begins allocating or releasing resources - * as requested. The returned long-running operation can be used to track the - * progress of updating the instance partition. If the named instance - * partition does not exist, returns `NOT_FOUND`. - * - * Immediately upon completion of this request: - * - * * For resource types for which a decrease in the instance partition's - * allocation has been requested, billing is based on the newly-requested - * level. - * - * Until completion of the returned operation: - * - * * Cancelling the operation sets its metadata's - * [cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time], - * and begins restoring resources to their pre-request values. The - * operation is guaranteed to succeed at undoing all resource changes, - * after which point it terminates with a `CANCELLED` status. - * * All other attempts to modify the instance partition are rejected. - * * Reading the instance partition via the API continues to give the - * pre-request resource levels. - * - * Upon completion of the returned operation: - * - * * Billing begins for all successfully-allocated resources (some types - * may have lower than the requested levels). - * * All newly-reserved resources are available for serving the instance - * partition's tables. - * * The instance partition's new resource levels are readable via the API. - * - * The returned long-running operation will - * have a name of the format - * `/operations/` and can be used to - * track the instance partition modification. The - * metadata field type is - * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. - * The response field type is - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if - * successful. - * - * Authorization requires `spanner.instancePartitions.update` permission on - * the resource - * [name][google.spanner.admin.instance.v1.InstancePartition.name]. - * - * The async variant is {@see InstanceAdminClient::updateInstancePartitionAsync()} - * . - * - * @example samples/V1/InstanceAdminClient/update_instance_partition.php - * - * @param UpdateInstancePartitionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return OperationResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function updateInstancePartition(UpdateInstancePartitionRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('UpdateInstancePartition', $request, $callOptions)->wait(); - } - - /** Configure the gapic configuration to use a service emulator. */ - private function setDefaultEmulatorConfig(array $options): array - { - $emulatorHost = getenv('SPANNER_EMULATOR_HOST'); - if (empty($emulatorHost)) { - return $options; - } - - if ($scheme = parse_url($emulatorHost, PHP_URL_SCHEME)) { - $search = $scheme . '://'; - $emulatorHost = str_replace($search, '', $emulatorHost); - } - - $options['apiEndpoint'] ??= $emulatorHost; - $options['transportConfig']['grpc']['stubOpts']['credentials'] ??= ChannelCredentials::createInsecure(); - $options['credentials'] ??= new InsecureCredentialsWrapper(); - return $options; - } -} diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/Gapic/InstanceAdminGapicClient.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/Gapic/InstanceAdminGapicClient.php deleted file mode 100644 index 63fccc62ceb7..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/Gapic/InstanceAdminGapicClient.php +++ /dev/null @@ -1,2277 +0,0 @@ -projectName('[PROJECT]'); - * $instanceId = 'instance_id'; - * $instance = new Instance(); - * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'createInstance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\Spanner\Admin\Instance\V1\Client\InstanceAdminClient}. - */ -class InstanceAdminGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.spanner.admin.instance.v1.InstanceAdmin'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'spanner.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'spanner.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/spanner.admin', - ]; - - private static $instanceNameTemplate; - - private static $instanceConfigNameTemplate; - - private static $instancePartitionNameTemplate; - - private static $projectNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/instance_admin_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/instance_admin_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/instance_admin_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/instance_admin_rest_client_config.php', - ], - ], - ]; - } - - private static function getInstanceNameTemplate() - { - if (self::$instanceNameTemplate == null) { - self::$instanceNameTemplate = new PathTemplate('projects/{project}/instances/{instance}'); - } - - return self::$instanceNameTemplate; - } - - private static function getInstanceConfigNameTemplate() - { - if (self::$instanceConfigNameTemplate == null) { - self::$instanceConfigNameTemplate = new PathTemplate('projects/{project}/instanceConfigs/{instance_config}'); - } - - return self::$instanceConfigNameTemplate; - } - - private static function getInstancePartitionNameTemplate() - { - if (self::$instancePartitionNameTemplate == null) { - self::$instancePartitionNameTemplate = new PathTemplate('projects/{project}/instances/{instance}/instancePartitions/{instance_partition}'); - } - - return self::$instancePartitionNameTemplate; - } - - private static function getProjectNameTemplate() - { - if (self::$projectNameTemplate == null) { - self::$projectNameTemplate = new PathTemplate('projects/{project}'); - } - - return self::$projectNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'instance' => self::getInstanceNameTemplate(), - 'instanceConfig' => self::getInstanceConfigNameTemplate(), - 'instancePartition' => self::getInstancePartitionNameTemplate(), - 'project' => self::getProjectNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a instance - * resource. - * - * @param string $project - * @param string $instance - * - * @return string The formatted instance resource. - */ - public static function instanceName($project, $instance) - { - return self::getInstanceNameTemplate()->render([ - 'project' => $project, - 'instance' => $instance, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * instance_config resource. - * - * @param string $project - * @param string $instanceConfig - * - * @return string The formatted instance_config resource. - */ - public static function instanceConfigName($project, $instanceConfig) - { - return self::getInstanceConfigNameTemplate()->render([ - 'project' => $project, - 'instance_config' => $instanceConfig, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * instance_partition resource. - * - * @param string $project - * @param string $instance - * @param string $instancePartition - * - * @return string The formatted instance_partition resource. - */ - public static function instancePartitionName($project, $instance, $instancePartition) - { - return self::getInstancePartitionNameTemplate()->render([ - 'project' => $project, - 'instance' => $instance, - 'instance_partition' => $instancePartition, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a project - * resource. - * - * @param string $project - * - * @return string The formatted project resource. - */ - public static function projectName($project) - { - return self::getProjectNameTemplate()->render([ - 'project' => $project, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - instance: projects/{project}/instances/{instance} - * - instanceConfig: projects/{project}/instanceConfigs/{instance_config} - * - instancePartition: projects/{project}/instances/{instance}/instancePartitions/{instance_partition} - * - project: projects/{project} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException("Template name $template does not exist"); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException("Input did not match any known format. Input: $formattedName"); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; - $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'spanner.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Creates an instance and begins preparing it to begin serving. The - * returned long-running operation - * can be used to track the progress of preparing the new - * instance. The instance name is assigned by the caller. If the - * named instance already exists, `CreateInstance` returns - * `ALREADY_EXISTS`. - * - * Immediately upon completion of this request: - * - * * The instance is readable via the API, with all requested attributes - * but no allocated resources. Its state is `CREATING`. - * - * Until completion of the returned operation: - * - * * Cancelling the operation renders the instance immediately unreadable - * via the API. - * * The instance can be deleted. - * * All other attempts to modify the instance are rejected. - * - * Upon completion of the returned operation: - * - * * Billing for all successfully-allocated resources begins (some types - * may have lower than the requested levels). - * * Databases can be created in the instance. - * * The instance's allocated resource levels are readable via the API. - * * The instance's state becomes `READY`. - * - * The returned long-running operation will - * have a name of the format `/operations/` and - * can be used to track creation of the instance. The - * metadata field type is - * [CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata]. - * The response field type is - * [Instance][google.spanner.admin.instance.v1.Instance], if successful. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedParent = $instanceAdminClient->projectName('[PROJECT]'); - * $instanceId = 'instance_id'; - * $instance = new Instance(); - * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'createInstance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the project in which to create the instance. Values - * are of the form `projects/`. - * @param string $instanceId Required. The ID of the instance to create. Valid identifiers are of the - * form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in - * length. - * @param Instance $instance Required. The instance to create. The name may be omitted, but if - * specified must be `/instances/`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createInstance($parent, $instanceId, $instance, array $optionalArgs = []) - { - $request = new CreateInstanceRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setInstanceId($instanceId); - $request->setInstance($instance); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CreateInstance', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Creates an instance configuration and begins preparing it to be used. The - * returned long-running operation - * can be used to track the progress of preparing the new - * instance configuration. The instance configuration name is assigned by the - * caller. If the named instance configuration already exists, - * `CreateInstanceConfig` returns `ALREADY_EXISTS`. - * - * Immediately after the request returns: - * - * * The instance configuration is readable via the API, with all requested - * attributes. The instance configuration's - * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] - * field is set to true. Its state is `CREATING`. - * - * While the operation is pending: - * - * * Cancelling the operation renders the instance configuration immediately - * unreadable via the API. - * * Except for deleting the creating resource, all other attempts to modify - * the instance configuration are rejected. - * - * Upon completion of the returned operation: - * - * * Instances can be created using the instance configuration. - * * The instance configuration's - * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] - * field becomes false. Its state becomes `READY`. - * - * The returned long-running operation will - * have a name of the format - * `/operations/` and can be used to track - * creation of the instance configuration. The - * metadata field type is - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. - * The response field type is - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if - * successful. - * - * Authorization requires `spanner.instanceConfigs.create` permission on - * the resource - * [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.parent]. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedParent = $instanceAdminClient->projectName('[PROJECT]'); - * $instanceConfigId = 'instance_config_id'; - * $instanceConfig = new InstanceConfig(); - * $operationResponse = $instanceAdminClient->createInstanceConfig($formattedParent, $instanceConfigId, $instanceConfig); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceAdminClient->createInstanceConfig($formattedParent, $instanceConfigId, $instanceConfig); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'createInstanceConfig'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the project in which to create the instance - * configuration. Values are of the form `projects/`. - * @param string $instanceConfigId Required. The ID of the instance configuration to create. Valid identifiers - * are of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 - * characters in length. The `custom-` prefix is required to avoid name - * conflicts with Google-managed configurations. - * @param InstanceConfig $instanceConfig Required. The `InstanceConfig` proto of the configuration to create. - * `instance_config.name` must be - * `/instanceConfigs/`. - * `instance_config.base_config` must be a Google-managed configuration name, - * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * An option to validate, but not actually execute, a request, - * and provide the same response. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createInstanceConfig($parent, $instanceConfigId, $instanceConfig, array $optionalArgs = []) - { - $request = new CreateInstanceConfigRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setInstanceConfigId($instanceConfigId); - $request->setInstanceConfig($instanceConfig); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CreateInstanceConfig', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Creates an instance partition and begins preparing it to be used. The - * returned long-running operation - * can be used to track the progress of preparing the new instance partition. - * The instance partition name is assigned by the caller. If the named - * instance partition already exists, `CreateInstancePartition` returns - * `ALREADY_EXISTS`. - * - * Immediately upon completion of this request: - * - * * The instance partition is readable via the API, with all requested - * attributes but no allocated resources. Its state is `CREATING`. - * - * Until completion of the returned operation: - * - * * Cancelling the operation renders the instance partition immediately - * unreadable via the API. - * * The instance partition can be deleted. - * * All other attempts to modify the instance partition are rejected. - * - * Upon completion of the returned operation: - * - * * Billing for all successfully-allocated resources begins (some types - * may have lower than the requested levels). - * * Databases can start using this instance partition. - * * The instance partition's allocated resource levels are readable via the - * API. - * * The instance partition's state becomes `READY`. - * - * The returned long-running operation will - * have a name of the format - * `/operations/` and can be used to - * track creation of the instance partition. The - * metadata field type is - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. - * The response field type is - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if - * successful. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedParent = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); - * $instancePartitionId = 'instance_partition_id'; - * $instancePartition = new InstancePartition(); - * $operationResponse = $instanceAdminClient->createInstancePartition($formattedParent, $instancePartitionId, $instancePartition); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceAdminClient->createInstancePartition($formattedParent, $instancePartitionId, $instancePartition); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'createInstancePartition'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the instance in which to create the instance - * partition. Values are of the form - * `projects//instances/`. - * @param string $instancePartitionId Required. The ID of the instance partition to create. Valid identifiers are - * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 - * characters in length. - * @param InstancePartition $instancePartition Required. The instance partition to create. The instance_partition.name may - * be omitted, but if specified must be - * `/instancePartitions/`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createInstancePartition($parent, $instancePartitionId, $instancePartition, array $optionalArgs = []) - { - $request = new CreateInstancePartitionRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setInstancePartitionId($instancePartitionId); - $request->setInstancePartition($instancePartition); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CreateInstancePartition', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Deletes an instance. - * - * Immediately upon completion of the request: - * - * * Billing ceases for all of the instance's reserved resources. - * - * Soon afterward: - * - * * The instance and *all of its databases* immediately and - * irrevocably disappear from the API. All data in the databases - * is permanently deleted. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedName = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); - * $instanceAdminClient->deleteInstance($formattedName); - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the instance to be deleted. Values are of the form - * `projects//instances/` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function deleteInstance($name, array $optionalArgs = []) - { - $request = new DeleteInstanceRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DeleteInstance', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Deletes the instance configuration. Deletion is only allowed when no - * instances are using the configuration. If any instances are using - * the configuration, returns `FAILED_PRECONDITION`. - * - * Only user-managed configurations can be deleted. - * - * Authorization requires `spanner.instanceConfigs.delete` permission on - * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedName = $instanceAdminClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - * $instanceAdminClient->deleteInstanceConfig($formattedName); - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the instance configuration to be deleted. - * Values are of the form - * `projects//instanceConfigs/` - * @param array $optionalArgs { - * Optional. - * - * @type string $etag - * Used for optimistic concurrency control as a way to help prevent - * simultaneous deletes of an instance configuration from overwriting each - * other. If not empty, the API - * only deletes the instance configuration when the etag provided matches the - * current status of the requested instance configuration. Otherwise, deletes - * the instance configuration without checking the current status of the - * requested instance configuration. - * @type bool $validateOnly - * An option to validate, but not actually execute, a request, - * and provide the same response. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function deleteInstanceConfig($name, array $optionalArgs = []) - { - $request = new DeleteInstanceConfigRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['etag'])) { - $request->setEtag($optionalArgs['etag']); - } - - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DeleteInstanceConfig', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Deletes an existing instance partition. Requires that the - * instance partition is not used by any database or backup and is not the - * default instance partition of an instance. - * - * Authorization requires `spanner.instancePartitions.delete` permission on - * the resource - * [name][google.spanner.admin.instance.v1.InstancePartition.name]. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedName = $instanceAdminClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]'); - * $instanceAdminClient->deleteInstancePartition($formattedName); - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the instance partition to be deleted. - * Values are of the form - * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}` - * @param array $optionalArgs { - * Optional. - * - * @type string $etag - * Optional. If not empty, the API only deletes the instance partition when - * the etag provided matches the current status of the requested instance - * partition. Otherwise, deletes the instance partition without checking the - * current status of the requested instance partition. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function deleteInstancePartition($name, array $optionalArgs = []) - { - $request = new DeleteInstancePartitionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['etag'])) { - $request->setEtag($optionalArgs['etag']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DeleteInstancePartition', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for an instance resource. Returns an empty - * policy if an instance exists but does not have a policy set. - * - * Authorization requires `spanner.instances.getIamPolicy` on - * [resource][google.iam.v1.GetIamPolicyRequest.resource]. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $resource = 'resource'; - * $response = $instanceAdminClient->getIamPolicy($resource); - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param array $optionalArgs { - * Optional. - * - * @type GetPolicyOptions $options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['options'])) { - $request->setOptions($optionalArgs['options']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetIamPolicy', Policy::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets information about a particular instance. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedName = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); - * $response = $instanceAdminClient->getInstance($formattedName); - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the requested instance. Values are of the form - * `projects//instances/`. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $fieldMask - * If field_mask is present, specifies the subset of - * [Instance][google.spanner.admin.instance.v1.Instance] fields that should be - * returned. If absent, all - * [Instance][google.spanner.admin.instance.v1.Instance] fields are returned. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\Admin\Instance\V1\Instance - * - * @throws ApiException if the remote call fails - */ - public function getInstance($name, array $optionalArgs = []) - { - $request = new GetInstanceRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['fieldMask'])) { - $request->setFieldMask($optionalArgs['fieldMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetInstance', Instance::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets information about a particular instance configuration. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedName = $instanceAdminClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - * $response = $instanceAdminClient->getInstanceConfig($formattedName); - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the requested instance configuration. Values are of - * the form `projects//instanceConfigs/`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig - * - * @throws ApiException if the remote call fails - */ - public function getInstanceConfig($name, array $optionalArgs = []) - { - $request = new GetInstanceConfigRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetInstanceConfig', InstanceConfig::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets information about a particular instance partition. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedName = $instanceAdminClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]'); - * $response = $instanceAdminClient->getInstancePartition($formattedName); - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the requested instance partition. Values are of - * the form - * `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition - * - * @throws ApiException if the remote call fails - */ - public function getInstancePartition($name, array $optionalArgs = []) - { - $request = new GetInstancePartitionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetInstancePartition', InstancePartition::class, $optionalArgs, $request)->wait(); - } - - /** - * Lists the user-managed instance configuration long-running - * operations in the given project. An instance - * configuration operation has a name of the form - * `projects//instanceConfigs//operations/`. - * The long-running operation - * metadata field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that have completed/failed/canceled within the last 7 days, - * and pending operations. Operations returned are ordered by - * `operation.metadata.value.start_time` in descending order starting - * from the most recently started operation. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedParent = $instanceAdminClient->projectName('[PROJECT]'); - * // Iterate over pages of elements - * $pagedResponse = $instanceAdminClient->listInstanceConfigOperations($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceAdminClient->listInstanceConfigOperations($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The project of the instance configuration operations. - * Values are of the form `projects/`. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * An expression that filters the list of returned operations. - * - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * - * The following fields in the Operation are eligible for filtering: - * - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata] - * is - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * - * Here are a few examples: - * - * * `done:true` - The operation is complete. - * * `(metadata.@type=` \ - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) - * AND` \ - * `(metadata.instance_config.name:custom-config) AND` \ - * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. - * * The instance configuration name contains "custom-config". - * * The operation started before 2021-03-28T14:50:00Z. - * * The operation resulted in an error. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listInstanceConfigOperations($parent, array $optionalArgs = []) - { - $request = new ListInstanceConfigOperationsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListInstanceConfigOperations', $optionalArgs, ListInstanceConfigOperationsResponse::class, $request); - } - - /** - * Lists the supported instance configurations for a given project. - * - * Returns both Google-managed configurations and user-managed - * configurations. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedParent = $instanceAdminClient->projectName('[PROJECT]'); - * // Iterate over pages of elements - * $pagedResponse = $instanceAdminClient->listInstanceConfigs($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceAdminClient->listInstanceConfigs($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the project for which a list of supported instance - * configurations is requested. Values are of the form - * `projects/`. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listInstanceConfigs($parent, array $optionalArgs = []) - { - $request = new ListInstanceConfigsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListInstanceConfigs', $optionalArgs, ListInstanceConfigsResponse::class, $request); - } - - /** - * Lists instance partition long-running operations in the given instance. - * An instance partition operation has a name of the form - * `projects//instances//instancePartitions//operations/`. - * The long-running operation - * metadata field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that have completed/failed/canceled within the last 7 days, - * and pending operations. Operations returned are ordered by - * `operation.metadata.value.start_time` in descending order starting from the - * most recently started operation. - * - * Authorization requires `spanner.instancePartitionOperations.list` - * permission on the resource - * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedParent = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); - * // Iterate over pages of elements - * $pagedResponse = $instanceAdminClient->listInstancePartitionOperations($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceAdminClient->listInstancePartitionOperations($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent instance of the instance partition operations. - * Values are of the form `projects//instances/`. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Optional. An expression that filters the list of returned operations. - * - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * - * The following fields in the Operation are eligible for filtering: - * - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] - * is - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * - * Here are a few examples: - * - * * `done:true` - The operation is complete. - * * `(metadata.@type=` \ - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) - * AND` \ - * `(metadata.instance_partition.name:custom-instance-partition) AND` \ - * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. - * * The instance partition name contains "custom-instance-partition". - * * The operation started before 2021-03-28T14:50:00Z. - * * The operation resulted in an error. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type Timestamp $instancePartitionDeadline - * Optional. Deadline used while retrieving metadata for instance partition - * operations. Instance partitions whose operation metadata cannot be - * retrieved within this deadline will be added to - * [unreachable_instance_partitions][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions] - * in - * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listInstancePartitionOperations($parent, array $optionalArgs = []) - { - $request = new ListInstancePartitionOperationsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['instancePartitionDeadline'])) { - $request->setInstancePartitionDeadline($optionalArgs['instancePartitionDeadline']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListInstancePartitionOperations', $optionalArgs, ListInstancePartitionOperationsResponse::class, $request); - } - - /** - * Lists all instance partitions for the given instance. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedParent = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); - * // Iterate over pages of elements - * $pagedResponse = $instanceAdminClient->listInstancePartitions($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceAdminClient->listInstancePartitions($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The instance whose instance partitions should be listed. Values - * are of the form `projects//instances/`. Use `{instance} - * = '-'` to list instance partitions for all Instances in a project, e.g., - * `projects/myproject/instances/-`. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type Timestamp $instancePartitionDeadline - * Optional. Deadline used while retrieving metadata for instance partitions. - * Instance partitions whose metadata cannot be retrieved within this deadline - * will be added to - * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable] - * in - * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listInstancePartitions($parent, array $optionalArgs = []) - { - $request = new ListInstancePartitionsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['instancePartitionDeadline'])) { - $request->setInstancePartitionDeadline($optionalArgs['instancePartitionDeadline']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListInstancePartitions', $optionalArgs, ListInstancePartitionsResponse::class, $request); - } - - /** - * Lists all instances in the given project. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedParent = $instanceAdminClient->projectName('[PROJECT]'); - * // Iterate over pages of elements - * $pagedResponse = $instanceAdminClient->listInstances($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceAdminClient->listInstances($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the project for which a list of instances is - * requested. Values are of the form `projects/`. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $filter - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * - * * `name` - * * `display_name` - * * `labels.key` where key is the name of a label - * - * Some examples of using filters are: - * - * * `name:*` --> The instance has a name. - * * `name:Howl` --> The instance's name contains the string "howl". - * * `name:HOWL` --> Equivalent to above. - * * `NAME:howl` --> Equivalent to above. - * * `labels.env:*` --> The instance has the label "env". - * * `labels.env:dev` --> The instance has the label "env" and the value of - * the label contains the string "dev". - * * `name:howl labels.env:dev` --> The instance's name contains "howl" and - * it has the label "env" with its value - * containing "dev". - * @type Timestamp $instanceDeadline - * Deadline used while retrieving metadata for instances. - * Instances whose metadata cannot be retrieved within this deadline will be - * added to - * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable] - * in - * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listInstances($parent, array $optionalArgs = []) - { - $request = new ListInstancesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['instanceDeadline'])) { - $request->setInstanceDeadline($optionalArgs['instanceDeadline']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListInstances', $optionalArgs, ListInstancesResponse::class, $request); - } - - /** - * Moves an instance to the target instance configuration. You can use the - * returned long-running operation to track - * the progress of moving the instance. - * - * `MoveInstance` returns `FAILED_PRECONDITION` if the instance meets any of - * the following criteria: - * - * * Is undergoing a move to a different instance configuration - * * Has backups - * * Has an ongoing update - * * Contains any CMEK-enabled databases - * * Is a free trial instance - * - * While the operation is pending: - * - * * All other attempts to modify the instance, including changes to its - * compute capacity, are rejected. - * * The following database and backup admin operations are rejected: - * - * * `DatabaseAdmin.CreateDatabase` - * * `DatabaseAdmin.UpdateDatabaseDdl` (disabled if default_leader is - * specified in the request.) - * * `DatabaseAdmin.RestoreDatabase` - * * `DatabaseAdmin.CreateBackup` - * * `DatabaseAdmin.CopyBackup` - * - * * Both the source and target instance configurations are subject to - * hourly compute and storage charges. - * * The instance might experience higher read-write latencies and a higher - * transaction abort rate. However, moving an instance doesn't cause any - * downtime. - * - * The returned long-running operation has - * a name of the format - * `/operations/` and can be used to track - * the move instance operation. The - * metadata field type is - * [MoveInstanceMetadata][google.spanner.admin.instance.v1.MoveInstanceMetadata]. - * The response field type is - * [Instance][google.spanner.admin.instance.v1.Instance], - * if successful. - * Cancelling the operation sets its metadata's - * [cancel_time][google.spanner.admin.instance.v1.MoveInstanceMetadata.cancel_time]. - * Cancellation is not immediate because it involves moving any data - * previously moved to the target instance configuration back to the original - * instance configuration. You can use this operation to track the progress of - * the cancellation. Upon successful completion of the cancellation, the - * operation terminates with `CANCELLED` status. - * - * If not cancelled, upon completion of the returned operation: - * - * * The instance successfully moves to the target instance - * configuration. - * * You are billed for compute and storage in target instance - * configuration. - * - * Authorization requires the `spanner.instances.update` permission on - * the resource [instance][google.spanner.admin.instance.v1.Instance]. - * - * For more details, see - * [Move an instance](https://cloud.google.com/spanner/docs/move-instance). - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedName = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); - * $formattedTargetConfig = $instanceAdminClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - * $operationResponse = $instanceAdminClient->moveInstance($formattedName, $formattedTargetConfig); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceAdminClient->moveInstance($formattedName, $formattedTargetConfig); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'moveInstance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $name Required. The instance to move. - * Values are of the form `projects//instances/`. - * @param string $targetConfig Required. The target instance configuration where to move the instance. - * Values are of the form `projects//instanceConfigs/`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function moveInstance($name, $targetConfig, array $optionalArgs = []) - { - $request = new MoveInstanceRequest(); - $requestParamHeaders = []; - $request->setName($name); - $request->setTargetConfig($targetConfig); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('MoveInstance', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Sets the access control policy on an instance resource. Replaces any - * existing policy. - * - * Authorization requires `spanner.instances.setIamPolicy` on - * [resource][google.iam.v1.SetIamPolicyRequest.resource]. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $instanceAdminClient->setIamPolicy($resource, $policy); - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns permissions that the caller has on the specified instance resource. - * - * Attempting this RPC on a non-existent Cloud Spanner instance resource will - * result in a NOT_FOUND error if the user has `spanner.instances.list` - * permission on the containing Google Cloud Project. Otherwise returns an - * empty set of permissions. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $instanceAdminClient->testIamPermissions($resource, $permissions); - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($resource, $permissions, array $optionalArgs = []) - { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Updates an instance, and begins allocating or releasing resources - * as requested. The returned long-running operation can be used to track the - * progress of updating the instance. If the named instance does not - * exist, returns `NOT_FOUND`. - * - * Immediately upon completion of this request: - * - * * For resource types for which a decrease in the instance's allocation - * has been requested, billing is based on the newly-requested level. - * - * Until completion of the returned operation: - * - * * Cancelling the operation sets its metadata's - * [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time], - * and begins restoring resources to their pre-request values. The - * operation is guaranteed to succeed at undoing all resource changes, - * after which point it terminates with a `CANCELLED` status. - * * All other attempts to modify the instance are rejected. - * * Reading the instance via the API continues to give the pre-request - * resource levels. - * - * Upon completion of the returned operation: - * - * * Billing begins for all successfully-allocated resources (some types - * may have lower than the requested levels). - * * All newly-reserved resources are available for serving the instance's - * tables. - * * The instance's new resource levels are readable via the API. - * - * The returned long-running operation will - * have a name of the format `/operations/` and - * can be used to track the instance modification. The - * metadata field type is - * [UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. - * The response field type is - * [Instance][google.spanner.admin.instance.v1.Instance], if successful. - * - * Authorization requires `spanner.instances.update` permission on - * the resource [name][google.spanner.admin.instance.v1.Instance.name]. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $instance = new Instance(); - * $fieldMask = new FieldMask(); - * $operationResponse = $instanceAdminClient->updateInstance($instance, $fieldMask); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceAdminClient->updateInstance($instance, $fieldMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'updateInstance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param Instance $instance Required. The instance to update, which must always include the instance - * name. Otherwise, only fields mentioned in - * [field_mask][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] - * need be included. - * @param FieldMask $fieldMask Required. A mask specifying which fields in - * [Instance][google.spanner.admin.instance.v1.Instance] should be updated. - * The field mask must always be specified; this prevents any future fields in - * [Instance][google.spanner.admin.instance.v1.Instance] from being erased - * accidentally by clients that do not know about them. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateInstance($instance, $fieldMask, array $optionalArgs = []) - { - $request = new UpdateInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setFieldMask($fieldMask); - $requestParamHeaders['instance.name'] = $instance->getName(); - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('UpdateInstance', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Updates an instance configuration. The returned - * long-running operation can be used to track - * the progress of updating the instance. If the named instance configuration - * does not exist, returns `NOT_FOUND`. - * - * Only user-managed configurations can be updated. - * - * Immediately after the request returns: - * - * * The instance configuration's - * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] - * field is set to true. - * - * While the operation is pending: - * - * * Cancelling the operation sets its metadata's - * [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.cancel_time]. - * The operation is guaranteed to succeed at undoing all changes, after - * which point it terminates with a `CANCELLED` status. - * * All other attempts to modify the instance configuration are rejected. - * * Reading the instance configuration via the API continues to give the - * pre-request values. - * - * Upon completion of the returned operation: - * - * * Creating instances using the instance configuration uses the new - * values. - * * The new values of the instance configuration are readable via the API. - * * The instance configuration's - * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] - * field becomes false. - * - * The returned long-running operation will - * have a name of the format - * `/operations/` and can be used to track - * the instance configuration modification. The - * metadata field type is - * [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]. - * The response field type is - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if - * successful. - * - * Authorization requires `spanner.instanceConfigs.update` permission on - * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $instanceConfig = new InstanceConfig(); - * $updateMask = new FieldMask(); - * $operationResponse = $instanceAdminClient->updateInstanceConfig($instanceConfig, $updateMask); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceAdminClient->updateInstanceConfig($instanceConfig, $updateMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'updateInstanceConfig'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param InstanceConfig $instanceConfig Required. The user instance configuration to update, which must always - * include the instance configuration name. Otherwise, only fields mentioned - * in - * [update_mask][google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask] - * need be included. To prevent conflicts of concurrent updates, - * [etag][google.spanner.admin.instance.v1.InstanceConfig.reconciling] can - * be used. - * @param FieldMask $updateMask Required. A mask specifying which fields in - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] should be - * updated. The field mask must always be specified; this prevents any future - * fields in [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] - * from being erased accidentally by clients that do not know about them. Only - * display_name and labels can be updated. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * An option to validate, but not actually execute, a request, - * and provide the same response. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateInstanceConfig($instanceConfig, $updateMask, array $optionalArgs = []) - { - $request = new UpdateInstanceConfigRequest(); - $requestParamHeaders = []; - $request->setInstanceConfig($instanceConfig); - $request->setUpdateMask($updateMask); - $requestParamHeaders['instance_config.name'] = $instanceConfig->getName(); - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('UpdateInstanceConfig', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Updates an instance partition, and begins allocating or releasing resources - * as requested. The returned long-running operation can be used to track the - * progress of updating the instance partition. If the named instance - * partition does not exist, returns `NOT_FOUND`. - * - * Immediately upon completion of this request: - * - * * For resource types for which a decrease in the instance partition's - * allocation has been requested, billing is based on the newly-requested - * level. - * - * Until completion of the returned operation: - * - * * Cancelling the operation sets its metadata's - * [cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time], - * and begins restoring resources to their pre-request values. The - * operation is guaranteed to succeed at undoing all resource changes, - * after which point it terminates with a `CANCELLED` status. - * * All other attempts to modify the instance partition are rejected. - * * Reading the instance partition via the API continues to give the - * pre-request resource levels. - * - * Upon completion of the returned operation: - * - * * Billing begins for all successfully-allocated resources (some types - * may have lower than the requested levels). - * * All newly-reserved resources are available for serving the instance - * partition's tables. - * * The instance partition's new resource levels are readable via the API. - * - * The returned long-running operation will - * have a name of the format - * `/operations/` and can be used to - * track the instance partition modification. The - * metadata field type is - * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. - * The response field type is - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if - * successful. - * - * Authorization requires `spanner.instancePartitions.update` permission on - * the resource - * [name][google.spanner.admin.instance.v1.InstancePartition.name]. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $instancePartition = new InstancePartition(); - * $fieldMask = new FieldMask(); - * $operationResponse = $instanceAdminClient->updateInstancePartition($instancePartition, $fieldMask); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceAdminClient->updateInstancePartition($instancePartition, $fieldMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'updateInstancePartition'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param InstancePartition $instancePartition Required. The instance partition to update, which must always include the - * instance partition name. Otherwise, only fields mentioned in - * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask] - * need be included. - * @param FieldMask $fieldMask Required. A mask specifying which fields in - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] - * should be updated. The field mask must always be specified; this prevents - * any future fields in - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] - * from being erased accidentally by clients that do not know about them. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateInstancePartition($instancePartition, $fieldMask, array $optionalArgs = []) - { - $request = new UpdateInstancePartitionRequest(); - $requestParamHeaders = []; - $request->setInstancePartition($instancePartition); - $request->setFieldMask($fieldMask); - $requestParamHeaders['instance_partition.name'] = $instancePartition->getName(); - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('UpdateInstancePartition', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } -} diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/InstanceAdminClient.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/InstanceAdminClient.php deleted file mode 100644 index 0c7e3e10d313..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/InstanceAdminClient.php +++ /dev/null @@ -1,34 +0,0 @@ - [ - 'google.spanner.admin.instance.v1.InstanceAdmin' => [ - 'CreateInstance' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\Instance', - 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\CreateInstanceMetadata', - 'initialPollDelayMillis' => '20000', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '45000', - 'totalPollTimeoutMillis' => '86400000', - ], - 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'CreateInstanceConfig' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig', - 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\CreateInstanceConfigMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'CreateInstancePartition' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition', - 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\CreateInstancePartitionMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'MoveInstance' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\MoveInstanceResponse', - 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\MoveInstanceMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'UpdateInstance' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\Instance', - 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\UpdateInstanceMetadata', - 'initialPollDelayMillis' => '20000', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '45000', - 'totalPollTimeoutMillis' => '86400000', - ], - 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, - 'headerParams' => [ - [ - 'keyName' => 'instance.name', - 'fieldAccessors' => [ - 'getInstance', - 'getName', - ], - ], - ], - ], - 'UpdateInstanceConfig' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig', - 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\UpdateInstanceConfigMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, - 'headerParams' => [ - [ - 'keyName' => 'instance_config.name', - 'fieldAccessors' => [ - 'getInstanceConfig', - 'getName', - ], - ], - ], - ], - 'UpdateInstancePartition' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition', - 'metadataReturnType' => '\Google\Cloud\Spanner\Admin\Instance\V1\UpdateInstancePartitionMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, - 'headerParams' => [ - [ - 'keyName' => 'instance_partition.name', - 'fieldAccessors' => [ - 'getInstancePartition', - 'getName', - ], - ], - ], - ], - 'DeleteInstance' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Protobuf\GPBEmpty', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'DeleteInstanceConfig' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Protobuf\GPBEmpty', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'DeleteInstancePartition' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Protobuf\GPBEmpty', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'GetIamPolicy' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\Policy', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - ], - 'GetInstance' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Instance\V1\Instance', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'GetInstanceConfig' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Instance\V1\InstanceConfig', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'GetInstancePartition' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Instance\V1\InstancePartition', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'ListInstanceConfigOperations' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getOperations', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Instance\V1\ListInstanceConfigOperationsResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'ListInstanceConfigs' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getInstanceConfigs', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Instance\V1\ListInstanceConfigsResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'ListInstancePartitionOperations' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getOperations', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Instance\V1\ListInstancePartitionOperationsResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'ListInstancePartitions' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getInstancePartitions', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Instance\V1\ListInstancePartitionsResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'ListInstances' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getInstances', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\Spanner\Admin\Instance\V1\ListInstancesResponse', - 'headerParams' => [ - [ - 'keyName' => 'parent', - 'fieldAccessors' => [ - 'getParent', - ], - ], - ], - ], - 'SetIamPolicy' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\Policy', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - ], - 'TestIamPermissions' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Iam\V1\TestIamPermissionsResponse', - 'headerParams' => [ - [ - 'keyName' => 'resource', - 'fieldAccessors' => [ - 'getResource', - ], - ], - ], - ], - 'templateMap' => [ - 'instance' => 'projects/{project}/instances/{instance}', - 'instanceConfig' => 'projects/{project}/instanceConfigs/{instance_config}', - 'instancePartition' => 'projects/{project}/instances/{instance}/instancePartitions/{instance_partition}', - 'project' => 'projects/{project}', - ], - ], - ], -]; diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/resources/instance_admin_rest_client_config.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/resources/instance_admin_rest_client_config.php deleted file mode 100644 index 1f11b12ff0d9..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/resources/instance_admin_rest_client_config.php +++ /dev/null @@ -1,343 +0,0 @@ - [ - 'google.longrunning.Operations' => [ - 'GetOperation' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations/*}', - 'additionalBindings' => [ - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations/*}', - ], - ], - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListOperations' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations}', - 'additionalBindings' => [ - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations}', - ], - ], - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'CancelOperation' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations/*}:cancel', - 'additionalBindings' => [ - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations/*}:cancel', - ], - ], - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'DeleteOperation' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations/*}', - 'additionalBindings' => [ - [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations/*}', - ], - ], - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - ], - 'google.spanner.admin.instance.v1.InstanceAdmin' => [ - 'CreateInstance' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{parent=projects/*}/instances', - 'body' => '*', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'CreateInstanceConfig' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{parent=projects/*}/instanceConfigs', - 'body' => '*', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'CreateInstancePartition' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/instancePartitions', - 'body' => '*', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'DeleteInstance' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/instances/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'DeleteInstanceConfig' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/instanceConfigs/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'DeleteInstancePartition' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/instancePartitions/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetIamPolicy' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/instances/*}:getIamPolicy', - 'body' => '*', - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'GetInstance' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetInstanceConfig' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instanceConfigs/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetInstancePartition' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/instancePartitions/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListInstanceConfigOperations' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=projects/*}/instanceConfigOperations', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'ListInstanceConfigs' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=projects/*}/instanceConfigs', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'ListInstancePartitionOperations' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/instancePartitionOperations', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'ListInstancePartitions' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/instancePartitions', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'ListInstances' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=projects/*}/instances', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'MoveInstance' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/instances/*}:move', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'SetIamPolicy' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/instances/*}:setIamPolicy', - 'body' => '*', - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'TestIamPermissions' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{resource=projects/*/instances/*}:testIamPermissions', - 'body' => '*', - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'UpdateInstance' => [ - 'method' => 'patch', - 'uriTemplate' => '/v1/{instance.name=projects/*/instances/*}', - 'body' => '*', - 'placeholders' => [ - 'instance.name' => [ - 'getters' => [ - 'getInstance', - 'getName', - ], - ], - ], - ], - 'UpdateInstanceConfig' => [ - 'method' => 'patch', - 'uriTemplate' => '/v1/{instance_config.name=projects/*/instanceConfigs/*}', - 'body' => '*', - 'placeholders' => [ - 'instance_config.name' => [ - 'getters' => [ - 'getInstanceConfig', - 'getName', - ], - ], - ], - ], - 'UpdateInstancePartition' => [ - 'method' => 'patch', - 'uriTemplate' => '/v1/{instance_partition.name=projects/*/instances/*/instancePartitions/*}', - 'body' => '*', - 'placeholders' => [ - 'instance_partition.name' => [ - 'getters' => [ - 'getInstancePartition', - 'getName', - ], - ], - ], - ], - ], - ], - 'numericEnums' => true, -]; diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/tests/Unit/V1/Client/InstanceAdminClientTest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/tests/Unit/V1/Client/InstanceAdminClientTest.php deleted file mode 100644 index 8af298f11c03..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/tests/Unit/V1/Client/InstanceAdminClientTest.php +++ /dev/null @@ -1,2172 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return InstanceAdminClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new InstanceAdminClient($options); - } - - /** @test */ - public function createInstanceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createInstanceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $config = 'config-1354792126'; - $displayName = 'displayName1615086568'; - $nodeCount = 1539922066; - $processingUnits = 329117885; - $expectedResponse = new Instance(); - $expectedResponse->setName($name); - $expectedResponse->setConfig($config); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setNodeCount($nodeCount); - $expectedResponse->setProcessingUnits($processingUnits); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createInstanceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $instanceId = 'instanceId-2101995259'; - $instance = new Instance(); - $instanceName = 'instanceName-737857344'; - $instance->setName($instanceName); - $instanceConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $instance->setConfig($instanceConfig); - $instanceDisplayName = 'instanceDisplayName1824500376'; - $instance->setDisplayName($instanceDisplayName); - $request = (new CreateInstanceRequest()) - ->setParent($formattedParent) - ->setInstanceId($instanceId) - ->setInstance($instance); - $response = $gapicClient->createInstance($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/CreateInstance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceId(); - $this->assertProtobufEquals($instanceId, $actualValue); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createInstanceTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createInstanceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createInstanceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $instanceId = 'instanceId-2101995259'; - $instance = new Instance(); - $instanceName = 'instanceName-737857344'; - $instance->setName($instanceName); - $instanceConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $instance->setConfig($instanceConfig); - $instanceDisplayName = 'instanceDisplayName1824500376'; - $instance->setDisplayName($instanceDisplayName); - $request = (new CreateInstanceRequest()) - ->setParent($formattedParent) - ->setInstanceId($instanceId) - ->setInstance($instance); - $response = $gapicClient->createInstance($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createInstanceTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createInstanceConfigTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createInstanceConfigTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $baseConfig = 'baseConfig1990483056'; - $etag = 'etag3123477'; - $reconciling = false; - $storageLimitPerProcessingUnit = 1769187130; - $expectedResponse = new InstanceConfig(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setBaseConfig($baseConfig); - $expectedResponse->setEtag($etag); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setStorageLimitPerProcessingUnit($storageLimitPerProcessingUnit); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createInstanceConfigTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $instanceConfigId = 'instanceConfigId-1789417458'; - $instanceConfig = new InstanceConfig(); - $request = (new CreateInstanceConfigRequest()) - ->setParent($formattedParent) - ->setInstanceConfigId($instanceConfigId) - ->setInstanceConfig($instanceConfig); - $response = $gapicClient->createInstanceConfig($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/CreateInstanceConfig', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceConfigId(); - $this->assertProtobufEquals($instanceConfigId, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceConfig(); - $this->assertProtobufEquals($instanceConfig, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createInstanceConfigTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createInstanceConfigExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createInstanceConfigTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $instanceConfigId = 'instanceConfigId-1789417458'; - $instanceConfig = new InstanceConfig(); - $request = (new CreateInstanceConfigRequest()) - ->setParent($formattedParent) - ->setInstanceConfigId($instanceConfigId) - ->setInstanceConfig($instanceConfig); - $response = $gapicClient->createInstanceConfig($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createInstanceConfigTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createInstancePartitionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createInstancePartitionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $config = 'config-1354792126'; - $displayName = 'displayName1615086568'; - $nodeCount = 1539922066; - $etag = 'etag3123477'; - $expectedResponse = new InstancePartition(); - $expectedResponse->setName($name); - $expectedResponse->setConfig($config); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setNodeCount($nodeCount); - $expectedResponse->setEtag($etag); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createInstancePartitionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $instancePartitionId = 'instancePartitionId288435706'; - $instancePartition = new InstancePartition(); - $instancePartitionName = 'instancePartitionName1272312320'; - $instancePartition->setName($instancePartitionName); - $instancePartitionConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $instancePartition->setConfig($instancePartitionConfig); - $instancePartitionDisplayName = 'instancePartitionDisplayName1175388504'; - $instancePartition->setDisplayName($instancePartitionDisplayName); - $request = (new CreateInstancePartitionRequest()) - ->setParent($formattedParent) - ->setInstancePartitionId($instancePartitionId) - ->setInstancePartition($instancePartition); - $response = $gapicClient->createInstancePartition($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/CreateInstancePartition', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getInstancePartitionId(); - $this->assertProtobufEquals($instancePartitionId, $actualValue); - $actualValue = $actualApiRequestObject->getInstancePartition(); - $this->assertProtobufEquals($instancePartition, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createInstancePartitionTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createInstancePartitionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createInstancePartitionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $instancePartitionId = 'instancePartitionId288435706'; - $instancePartition = new InstancePartition(); - $instancePartitionName = 'instancePartitionName1272312320'; - $instancePartition->setName($instancePartitionName); - $instancePartitionConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $instancePartition->setConfig($instancePartitionConfig); - $instancePartitionDisplayName = 'instancePartitionDisplayName1175388504'; - $instancePartition->setDisplayName($instancePartitionDisplayName); - $request = (new CreateInstancePartitionRequest()) - ->setParent($formattedParent) - ->setInstancePartitionId($instancePartitionId) - ->setInstancePartition($instancePartition); - $response = $gapicClient->createInstancePartition($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createInstancePartitionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteInstanceTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $request = (new DeleteInstanceRequest()) - ->setName($formattedName); - $gapicClient->deleteInstance($request); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstance', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteInstanceExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $request = (new DeleteInstanceRequest()) - ->setName($formattedName); - try { - $gapicClient->deleteInstance($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteInstanceConfigTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $request = (new DeleteInstanceConfigRequest()) - ->setName($formattedName); - $gapicClient->deleteInstanceConfig($request); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstanceConfig', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteInstanceConfigExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $request = (new DeleteInstanceConfigRequest()) - ->setName($formattedName); - try { - $gapicClient->deleteInstanceConfig($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteInstancePartitionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]'); - $request = (new DeleteInstancePartitionRequest()) - ->setName($formattedName); - $gapicClient->deleteInstancePartition($request); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstancePartition', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteInstancePartitionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]'); - $request = (new DeleteInstancePartitionRequest()) - ->setName($formattedName); - try { - $gapicClient->deleteInstancePartition($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); - $response = $gapicClient->getIamPolicy($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $request = (new GetIamPolicyRequest()) - ->setResource($resource); - try { - $gapicClient->getIamPolicy($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getInstanceTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $config = 'config-1354792126'; - $displayName = 'displayName1615086568'; - $nodeCount = 1539922066; - $processingUnits = 329117885; - $expectedResponse = new Instance(); - $expectedResponse->setName($name2); - $expectedResponse->setConfig($config); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setNodeCount($nodeCount); - $expectedResponse->setProcessingUnits($processingUnits); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $request = (new GetInstanceRequest()) - ->setName($formattedName); - $response = $gapicClient->getInstance($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/GetInstance', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getInstanceExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $request = (new GetInstanceRequest()) - ->setName($formattedName); - try { - $gapicClient->getInstance($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getInstanceConfigTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $baseConfig = 'baseConfig1990483056'; - $etag = 'etag3123477'; - $reconciling = false; - $storageLimitPerProcessingUnit = 1769187130; - $expectedResponse = new InstanceConfig(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setBaseConfig($baseConfig); - $expectedResponse->setEtag($etag); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setStorageLimitPerProcessingUnit($storageLimitPerProcessingUnit); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $request = (new GetInstanceConfigRequest()) - ->setName($formattedName); - $response = $gapicClient->getInstanceConfig($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/GetInstanceConfig', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getInstanceConfigExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $request = (new GetInstanceConfigRequest()) - ->setName($formattedName); - try { - $gapicClient->getInstanceConfig($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getInstancePartitionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $config = 'config-1354792126'; - $displayName = 'displayName1615086568'; - $nodeCount = 1539922066; - $etag = 'etag3123477'; - $expectedResponse = new InstancePartition(); - $expectedResponse->setName($name2); - $expectedResponse->setConfig($config); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setNodeCount($nodeCount); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]'); - $request = (new GetInstancePartitionRequest()) - ->setName($formattedName); - $response = $gapicClient->getInstancePartition($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/GetInstancePartition', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getInstancePartitionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]'); - $request = (new GetInstancePartitionRequest()) - ->setName($formattedName); - try { - $gapicClient->getInstancePartition($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstanceConfigOperationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $operationsElement = new Operation(); - $operations = [ - $operationsElement, - ]; - $expectedResponse = new ListInstanceConfigOperationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setOperations($operations); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ListInstanceConfigOperationsRequest()) - ->setParent($formattedParent); - $response = $gapicClient->listInstanceConfigOperations($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getOperations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstanceConfigOperations', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstanceConfigOperationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ListInstanceConfigOperationsRequest()) - ->setParent($formattedParent); - try { - $gapicClient->listInstanceConfigOperations($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstanceConfigsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $instanceConfigsElement = new InstanceConfig(); - $instanceConfigs = [ - $instanceConfigsElement, - ]; - $expectedResponse = new ListInstanceConfigsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setInstanceConfigs($instanceConfigs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ListInstanceConfigsRequest()) - ->setParent($formattedParent); - $response = $gapicClient->listInstanceConfigs($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getInstanceConfigs()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstanceConfigs', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstanceConfigsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ListInstanceConfigsRequest()) - ->setParent($formattedParent); - try { - $gapicClient->listInstanceConfigs($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstancePartitionOperationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $operationsElement = new Operation(); - $operations = [ - $operationsElement, - ]; - $expectedResponse = new ListInstancePartitionOperationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setOperations($operations); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $request = (new ListInstancePartitionOperationsRequest()) - ->setParent($formattedParent); - $response = $gapicClient->listInstancePartitionOperations($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getOperations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstancePartitionOperations', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstancePartitionOperationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $request = (new ListInstancePartitionOperationsRequest()) - ->setParent($formattedParent); - try { - $gapicClient->listInstancePartitionOperations($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstancePartitionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $instancePartitionsElement = new InstancePartition(); - $instancePartitions = [ - $instancePartitionsElement, - ]; - $expectedResponse = new ListInstancePartitionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setInstancePartitions($instancePartitions); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $request = (new ListInstancePartitionsRequest()) - ->setParent($formattedParent); - $response = $gapicClient->listInstancePartitions($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getInstancePartitions()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstancePartitions', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstancePartitionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $request = (new ListInstancePartitionsRequest()) - ->setParent($formattedParent); - try { - $gapicClient->listInstancePartitions($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstancesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $instancesElement = new Instance(); - $instances = [ - $instancesElement, - ]; - $expectedResponse = new ListInstancesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setInstances($instances); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ListInstancesRequest()) - ->setParent($formattedParent); - $response = $gapicClient->listInstances($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getInstances()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstances', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstancesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $request = (new ListInstancesRequest()) - ->setParent($formattedParent); - try { - $gapicClient->listInstances($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function moveInstanceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/moveInstanceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new MoveInstanceResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/moveInstanceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $formattedTargetConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $request = (new MoveInstanceRequest()) - ->setName($formattedName) - ->setTargetConfig($formattedTargetConfig); - $response = $gapicClient->moveInstance($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/MoveInstance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualApiRequestObject->getTargetConfig(); - $this->assertProtobufEquals($formattedTargetConfig, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/moveInstanceTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function moveInstanceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/moveInstanceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $formattedTargetConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $request = (new MoveInstanceRequest()) - ->setName($formattedName) - ->setTargetConfig($formattedTargetConfig); - $response = $gapicClient->moveInstance($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/moveInstanceTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); - $response = $gapicClient->setIamPolicy($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $request = (new SetIamPolicyRequest()) - ->setResource($resource) - ->setPolicy($policy); - try { - $gapicClient->setIamPolicy($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); - $response = $gapicClient->testIamPermissions($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $request = (new TestIamPermissionsRequest()) - ->setResource($resource) - ->setPermissions($permissions); - try { - $gapicClient->testIamPermissions($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateInstanceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateInstanceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $config = 'config-1354792126'; - $displayName = 'displayName1615086568'; - $nodeCount = 1539922066; - $processingUnits = 329117885; - $expectedResponse = new Instance(); - $expectedResponse->setName($name); - $expectedResponse->setConfig($config); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setNodeCount($nodeCount); - $expectedResponse->setProcessingUnits($processingUnits); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateInstanceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = new Instance(); - $instanceName = 'instanceName-737857344'; - $instance->setName($instanceName); - $instanceConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $instance->setConfig($instanceConfig); - $instanceDisplayName = 'instanceDisplayName1824500376'; - $instance->setDisplayName($instanceDisplayName); - $fieldMask = new FieldMask(); - $request = (new UpdateInstanceRequest()) - ->setInstance($instance) - ->setFieldMask($fieldMask); - $response = $gapicClient->updateInstance($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getFieldMask(); - $this->assertProtobufEquals($fieldMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateInstanceTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateInstanceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateInstanceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $instance = new Instance(); - $instanceName = 'instanceName-737857344'; - $instance->setName($instanceName); - $instanceConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $instance->setConfig($instanceConfig); - $instanceDisplayName = 'instanceDisplayName1824500376'; - $instance->setDisplayName($instanceDisplayName); - $fieldMask = new FieldMask(); - $request = (new UpdateInstanceRequest()) - ->setInstance($instance) - ->setFieldMask($fieldMask); - $response = $gapicClient->updateInstance($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateInstanceTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateInstanceConfigTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateInstanceConfigTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $baseConfig = 'baseConfig1990483056'; - $etag = 'etag3123477'; - $reconciling = false; - $storageLimitPerProcessingUnit = 1769187130; - $expectedResponse = new InstanceConfig(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setBaseConfig($baseConfig); - $expectedResponse->setEtag($etag); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setStorageLimitPerProcessingUnit($storageLimitPerProcessingUnit); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateInstanceConfigTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceConfig = new InstanceConfig(); - $updateMask = new FieldMask(); - $request = (new UpdateInstanceConfigRequest()) - ->setInstanceConfig($instanceConfig) - ->setUpdateMask($updateMask); - $response = $gapicClient->updateInstanceConfig($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstanceConfig', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceConfig(); - $this->assertProtobufEquals($instanceConfig, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateInstanceConfigTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateInstanceConfigExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateInstanceConfigTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $instanceConfig = new InstanceConfig(); - $updateMask = new FieldMask(); - $request = (new UpdateInstanceConfigRequest()) - ->setInstanceConfig($instanceConfig) - ->setUpdateMask($updateMask); - $response = $gapicClient->updateInstanceConfig($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateInstanceConfigTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateInstancePartitionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateInstancePartitionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $config = 'config-1354792126'; - $displayName = 'displayName1615086568'; - $nodeCount = 1539922066; - $etag = 'etag3123477'; - $expectedResponse = new InstancePartition(); - $expectedResponse->setName($name); - $expectedResponse->setConfig($config); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setNodeCount($nodeCount); - $expectedResponse->setEtag($etag); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateInstancePartitionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instancePartition = new InstancePartition(); - $instancePartitionName = 'instancePartitionName1272312320'; - $instancePartition->setName($instancePartitionName); - $instancePartitionConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $instancePartition->setConfig($instancePartitionConfig); - $instancePartitionDisplayName = 'instancePartitionDisplayName1175388504'; - $instancePartition->setDisplayName($instancePartitionDisplayName); - $fieldMask = new FieldMask(); - $request = (new UpdateInstancePartitionRequest()) - ->setInstancePartition($instancePartition) - ->setFieldMask($fieldMask); - $response = $gapicClient->updateInstancePartition($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstancePartition', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstancePartition(); - $this->assertProtobufEquals($instancePartition, $actualValue); - $actualValue = $actualApiRequestObject->getFieldMask(); - $this->assertProtobufEquals($fieldMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateInstancePartitionTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateInstancePartitionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateInstancePartitionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $instancePartition = new InstancePartition(); - $instancePartitionName = 'instancePartitionName1272312320'; - $instancePartition->setName($instancePartitionName); - $instancePartitionConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $instancePartition->setConfig($instancePartitionConfig); - $instancePartitionDisplayName = 'instancePartitionDisplayName1175388504'; - $instancePartition->setDisplayName($instancePartitionDisplayName); - $fieldMask = new FieldMask(); - $request = (new UpdateInstancePartitionRequest()) - ->setInstancePartition($instancePartition) - ->setFieldMask($fieldMask); - $response = $gapicClient->updateInstancePartition($request); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateInstancePartitionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createInstanceAsyncTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createInstanceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $config = 'config-1354792126'; - $displayName = 'displayName1615086568'; - $nodeCount = 1539922066; - $processingUnits = 329117885; - $expectedResponse = new Instance(); - $expectedResponse->setName($name); - $expectedResponse->setConfig($config); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setNodeCount($nodeCount); - $expectedResponse->setProcessingUnits($processingUnits); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createInstanceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $instanceId = 'instanceId-2101995259'; - $instance = new Instance(); - $instanceName = 'instanceName-737857344'; - $instance->setName($instanceName); - $instanceConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $instance->setConfig($instanceConfig); - $instanceDisplayName = 'instanceDisplayName1824500376'; - $instance->setDisplayName($instanceDisplayName); - $request = (new CreateInstanceRequest()) - ->setParent($formattedParent) - ->setInstanceId($instanceId) - ->setInstance($instance); - $response = $gapicClient->createInstanceAsync($request)->wait(); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/CreateInstance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceId(); - $this->assertProtobufEquals($instanceId, $actualValue); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createInstanceTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } -} diff --git a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/tests/Unit/V1/InstanceAdminClientTest.php b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/tests/Unit/V1/InstanceAdminClientTest.php deleted file mode 100644 index dbe048dd5628..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/tests/Unit/V1/InstanceAdminClientTest.php +++ /dev/null @@ -1,1955 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return InstanceAdminClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new InstanceAdminClient($options); - } - - /** @test */ - public function createInstanceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createInstanceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $config = 'config-1354792126'; - $displayName = 'displayName1615086568'; - $nodeCount = 1539922066; - $processingUnits = 329117885; - $expectedResponse = new Instance(); - $expectedResponse->setName($name); - $expectedResponse->setConfig($config); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setNodeCount($nodeCount); - $expectedResponse->setProcessingUnits($processingUnits); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createInstanceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $instanceId = 'instanceId-2101995259'; - $instance = new Instance(); - $instanceName = 'instanceName-737857344'; - $instance->setName($instanceName); - $instanceConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $instance->setConfig($instanceConfig); - $instanceDisplayName = 'instanceDisplayName1824500376'; - $instance->setDisplayName($instanceDisplayName); - $response = $gapicClient->createInstance($formattedParent, $instanceId, $instance); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/CreateInstance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceId(); - $this->assertProtobufEquals($instanceId, $actualValue); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createInstanceTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createInstanceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createInstanceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $instanceId = 'instanceId-2101995259'; - $instance = new Instance(); - $instanceName = 'instanceName-737857344'; - $instance->setName($instanceName); - $instanceConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $instance->setConfig($instanceConfig); - $instanceDisplayName = 'instanceDisplayName1824500376'; - $instance->setDisplayName($instanceDisplayName); - $response = $gapicClient->createInstance($formattedParent, $instanceId, $instance); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createInstanceTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createInstanceConfigTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createInstanceConfigTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $baseConfig = 'baseConfig1990483056'; - $etag = 'etag3123477'; - $reconciling = false; - $storageLimitPerProcessingUnit = 1769187130; - $expectedResponse = new InstanceConfig(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setBaseConfig($baseConfig); - $expectedResponse->setEtag($etag); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setStorageLimitPerProcessingUnit($storageLimitPerProcessingUnit); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createInstanceConfigTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $instanceConfigId = 'instanceConfigId-1789417458'; - $instanceConfig = new InstanceConfig(); - $response = $gapicClient->createInstanceConfig($formattedParent, $instanceConfigId, $instanceConfig); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/CreateInstanceConfig', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceConfigId(); - $this->assertProtobufEquals($instanceConfigId, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceConfig(); - $this->assertProtobufEquals($instanceConfig, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createInstanceConfigTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createInstanceConfigExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createInstanceConfigTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $instanceConfigId = 'instanceConfigId-1789417458'; - $instanceConfig = new InstanceConfig(); - $response = $gapicClient->createInstanceConfig($formattedParent, $instanceConfigId, $instanceConfig); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createInstanceConfigTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createInstancePartitionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createInstancePartitionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $config = 'config-1354792126'; - $displayName = 'displayName1615086568'; - $nodeCount = 1539922066; - $etag = 'etag3123477'; - $expectedResponse = new InstancePartition(); - $expectedResponse->setName($name); - $expectedResponse->setConfig($config); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setNodeCount($nodeCount); - $expectedResponse->setEtag($etag); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createInstancePartitionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $instancePartitionId = 'instancePartitionId288435706'; - $instancePartition = new InstancePartition(); - $instancePartitionName = 'instancePartitionName1272312320'; - $instancePartition->setName($instancePartitionName); - $instancePartitionConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $instancePartition->setConfig($instancePartitionConfig); - $instancePartitionDisplayName = 'instancePartitionDisplayName1175388504'; - $instancePartition->setDisplayName($instancePartitionDisplayName); - $response = $gapicClient->createInstancePartition($formattedParent, $instancePartitionId, $instancePartition); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/CreateInstancePartition', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getInstancePartitionId(); - $this->assertProtobufEquals($instancePartitionId, $actualValue); - $actualValue = $actualApiRequestObject->getInstancePartition(); - $this->assertProtobufEquals($instancePartition, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createInstancePartitionTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createInstancePartitionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createInstancePartitionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $instancePartitionId = 'instancePartitionId288435706'; - $instancePartition = new InstancePartition(); - $instancePartitionName = 'instancePartitionName1272312320'; - $instancePartition->setName($instancePartitionName); - $instancePartitionConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $instancePartition->setConfig($instancePartitionConfig); - $instancePartitionDisplayName = 'instancePartitionDisplayName1175388504'; - $instancePartition->setDisplayName($instancePartitionDisplayName); - $response = $gapicClient->createInstancePartition($formattedParent, $instancePartitionId, $instancePartition); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createInstancePartitionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteInstanceTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $gapicClient->deleteInstance($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstance', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteInstanceExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - try { - $gapicClient->deleteInstance($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteInstanceConfigTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $gapicClient->deleteInstanceConfig($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstanceConfig', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteInstanceConfigExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - try { - $gapicClient->deleteInstanceConfig($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteInstancePartitionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]'); - $gapicClient->deleteInstancePartition($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/DeleteInstancePartition', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteInstancePartitionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]'); - try { - $gapicClient->deleteInstancePartition($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($resource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($resource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getInstanceTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $config = 'config-1354792126'; - $displayName = 'displayName1615086568'; - $nodeCount = 1539922066; - $processingUnits = 329117885; - $expectedResponse = new Instance(); - $expectedResponse->setName($name2); - $expectedResponse->setConfig($config); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setNodeCount($nodeCount); - $expectedResponse->setProcessingUnits($processingUnits); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $response = $gapicClient->getInstance($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/GetInstance', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getInstanceExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - try { - $gapicClient->getInstance($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getInstanceConfigTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $displayName = 'displayName1615086568'; - $baseConfig = 'baseConfig1990483056'; - $etag = 'etag3123477'; - $reconciling = false; - $storageLimitPerProcessingUnit = 1769187130; - $expectedResponse = new InstanceConfig(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setBaseConfig($baseConfig); - $expectedResponse->setEtag($etag); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setStorageLimitPerProcessingUnit($storageLimitPerProcessingUnit); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $response = $gapicClient->getInstanceConfig($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/GetInstanceConfig', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getInstanceConfigExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - try { - $gapicClient->getInstanceConfig($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getInstancePartitionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $config = 'config-1354792126'; - $displayName = 'displayName1615086568'; - $nodeCount = 1539922066; - $etag = 'etag3123477'; - $expectedResponse = new InstancePartition(); - $expectedResponse->setName($name2); - $expectedResponse->setConfig($config); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setNodeCount($nodeCount); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]'); - $response = $gapicClient->getInstancePartition($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/GetInstancePartition', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getInstancePartitionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->instancePartitionName('[PROJECT]', '[INSTANCE]', '[INSTANCE_PARTITION]'); - try { - $gapicClient->getInstancePartition($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstanceConfigOperationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $operationsElement = new Operation(); - $operations = [ - $operationsElement, - ]; - $expectedResponse = new ListInstanceConfigOperationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setOperations($operations); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $response = $gapicClient->listInstanceConfigOperations($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getOperations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstanceConfigOperations', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstanceConfigOperationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - try { - $gapicClient->listInstanceConfigOperations($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstanceConfigsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $instanceConfigsElement = new InstanceConfig(); - $instanceConfigs = [ - $instanceConfigsElement, - ]; - $expectedResponse = new ListInstanceConfigsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setInstanceConfigs($instanceConfigs); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $response = $gapicClient->listInstanceConfigs($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getInstanceConfigs()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstanceConfigs', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstanceConfigsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - try { - $gapicClient->listInstanceConfigs($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstancePartitionOperationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $operationsElement = new Operation(); - $operations = [ - $operationsElement, - ]; - $expectedResponse = new ListInstancePartitionOperationsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setOperations($operations); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $response = $gapicClient->listInstancePartitionOperations($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getOperations()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstancePartitionOperations', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstancePartitionOperationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - try { - $gapicClient->listInstancePartitionOperations($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstancePartitionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $instancePartitionsElement = new InstancePartition(); - $instancePartitions = [ - $instancePartitionsElement, - ]; - $expectedResponse = new ListInstancePartitionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setInstancePartitions($instancePartitions); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $response = $gapicClient->listInstancePartitions($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getInstancePartitions()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstancePartitions', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstancePartitionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - try { - $gapicClient->listInstancePartitions($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstancesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $instancesElement = new Instance(); - $instances = [ - $instancesElement, - ]; - $expectedResponse = new ListInstancesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setInstances($instances); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - $response = $gapicClient->listInstances($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getInstances()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/ListInstances', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstancesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedParent = $gapicClient->projectName('[PROJECT]'); - try { - $gapicClient->listInstances($formattedParent); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function moveInstanceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/moveInstanceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new MoveInstanceResponse(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/moveInstanceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $formattedTargetConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $response = $gapicClient->moveInstance($formattedName, $formattedTargetConfig); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/MoveInstance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $actualValue = $actualApiRequestObject->getTargetConfig(); - $this->assertProtobufEquals($formattedTargetConfig, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/moveInstanceTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function moveInstanceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/moveInstanceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->instanceName('[PROJECT]', '[INSTANCE]'); - $formattedTargetConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $response = $gapicClient->moveInstance($formattedName, $formattedTargetConfig); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/moveInstanceTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setIamPolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $version = 351608024; - $etag = '21'; - $expectedResponse = new Policy(); - $expectedResponse->setVersion($version); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - $response = $gapicClient->setIamPolicy($resource, $policy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPolicy(); - $this->assertProtobufEquals($policy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setIamPolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $policy = new Policy(); - try { - $gapicClient->setIamPolicy($resource, $policy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestIamPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - $response = $gapicClient->testIamPermissions($resource, $permissions); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getPermissions(); - $this->assertProtobufEquals($permissions, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function testIamPermissionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $resource = 'resource-341064690'; - $permissions = []; - try { - $gapicClient->testIamPermissions($resource, $permissions); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateInstanceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateInstanceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $config = 'config-1354792126'; - $displayName = 'displayName1615086568'; - $nodeCount = 1539922066; - $processingUnits = 329117885; - $expectedResponse = new Instance(); - $expectedResponse->setName($name); - $expectedResponse->setConfig($config); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setNodeCount($nodeCount); - $expectedResponse->setProcessingUnits($processingUnits); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateInstanceTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = new Instance(); - $instanceName = 'instanceName-737857344'; - $instance->setName($instanceName); - $instanceConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $instance->setConfig($instanceConfig); - $instanceDisplayName = 'instanceDisplayName1824500376'; - $instance->setDisplayName($instanceDisplayName); - $fieldMask = new FieldMask(); - $response = $gapicClient->updateInstance($instance, $fieldMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getFieldMask(); - $this->assertProtobufEquals($fieldMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateInstanceTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateInstanceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateInstanceTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $instance = new Instance(); - $instanceName = 'instanceName-737857344'; - $instance->setName($instanceName); - $instanceConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $instance->setConfig($instanceConfig); - $instanceDisplayName = 'instanceDisplayName1824500376'; - $instance->setDisplayName($instanceDisplayName); - $fieldMask = new FieldMask(); - $response = $gapicClient->updateInstance($instance, $fieldMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateInstanceTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateInstanceConfigTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateInstanceConfigTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $displayName = 'displayName1615086568'; - $baseConfig = 'baseConfig1990483056'; - $etag = 'etag3123477'; - $reconciling = false; - $storageLimitPerProcessingUnit = 1769187130; - $expectedResponse = new InstanceConfig(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setBaseConfig($baseConfig); - $expectedResponse->setEtag($etag); - $expectedResponse->setReconciling($reconciling); - $expectedResponse->setStorageLimitPerProcessingUnit($storageLimitPerProcessingUnit); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateInstanceConfigTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceConfig = new InstanceConfig(); - $updateMask = new FieldMask(); - $response = $gapicClient->updateInstanceConfig($instanceConfig, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstanceConfig', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceConfig(); - $this->assertProtobufEquals($instanceConfig, $actualValue); - $actualValue = $actualApiRequestObject->getUpdateMask(); - $this->assertProtobufEquals($updateMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateInstanceConfigTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateInstanceConfigExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateInstanceConfigTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $instanceConfig = new InstanceConfig(); - $updateMask = new FieldMask(); - $response = $gapicClient->updateInstanceConfig($instanceConfig, $updateMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateInstanceConfigTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateInstancePartitionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateInstancePartitionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $config = 'config-1354792126'; - $displayName = 'displayName1615086568'; - $nodeCount = 1539922066; - $etag = 'etag3123477'; - $expectedResponse = new InstancePartition(); - $expectedResponse->setName($name); - $expectedResponse->setConfig($config); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setNodeCount($nodeCount); - $expectedResponse->setEtag($etag); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateInstancePartitionTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instancePartition = new InstancePartition(); - $instancePartitionName = 'instancePartitionName1272312320'; - $instancePartition->setName($instancePartitionName); - $instancePartitionConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $instancePartition->setConfig($instancePartitionConfig); - $instancePartitionDisplayName = 'instancePartitionDisplayName1175388504'; - $instancePartition->setDisplayName($instancePartitionDisplayName); - $fieldMask = new FieldMask(); - $response = $gapicClient->updateInstancePartition($instancePartition, $fieldMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.admin.instance.v1.InstanceAdmin/UpdateInstancePartition', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstancePartition(); - $this->assertProtobufEquals($instancePartition, $actualValue); - $actualValue = $actualApiRequestObject->getFieldMask(); - $this->assertProtobufEquals($fieldMask, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateInstancePartitionTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateInstancePartitionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateInstancePartitionTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $operationsTransport->addResponse(null, $status); - // Mock request - $instancePartition = new InstancePartition(); - $instancePartitionName = 'instancePartitionName1272312320'; - $instancePartition->setName($instancePartitionName); - $instancePartitionConfig = $gapicClient->instanceConfigName('[PROJECT]', '[INSTANCE_CONFIG]'); - $instancePartition->setConfig($instancePartitionConfig); - $instancePartitionDisplayName = 'instancePartitionDisplayName1175388504'; - $instancePartition->setDisplayName($instancePartitionDisplayName); - $fieldMask = new FieldMask(); - $response = $gapicClient->updateInstancePartition($instancePartition, $fieldMask); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateInstancePartitionTest'); - try { - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - // If the pollUntilComplete() method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stubs are exhausted - $transport->popReceivedCalls(); - $operationsTransport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } -} diff --git a/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/CommitResponse.php b/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/CommitResponse.php deleted file mode 100644 index b5451ada8ff4d3bfe0d4b58d7492dfdfb04719dd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1251 zcma)5%We}f6eXcz;i3XT(2|v*MM)((Q7CL&3L-6pF4{&-)CC$Ta%OH)i-~R7o{EC{ zDf|E*zz4A8Q}_yO&m)bJ1=(a~e9yV(9-sT>oxG4}6L*1wq6T6-y29oHuvEf`NF;ca zj>n*IB&L!jpaP5!Pw~m=0Dm|<8a%a7Em9Q$!4n}S3AD7N+;X)p+bxTkGBZ@5rQjL@ z&xsJHQ~QNRfV;iUF&G+CL&L6zhy4s5p11c9iV~_dKJYYWIScxZu>Hw&l&}bELyi60 zVtU9pGmIwen;l{wk7=U8QY_YvQyv*6ICg+j9zk;(XPmBfOA0&mJ}&h1oDbH6@Q52w zoF?HR=twbXgzDK+LMC8J_uQA}cHY*}u`zCD8VOktxsQ!X;bwP?6_`}F!S?bLURMgW25#>5l$?QhwUdYj2`Si28-u0^+9C&y?Tj1cl{iiqyLw^*O x%Wb#&Z?&Gm2=Rx6-`q$_hp?^+`p@IMa diff --git a/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Keys.php b/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Keys.php deleted file mode 100644 index 07acede2f29a224b40d712f6ca728e0236ac999d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1173 zcma)5+iuf95XEg3g>6+qBt%tsSW2b30vuAr%a(!&g-~%xM5;VgmZFV4Nmp!lt=)B{ zfcis-FG1o*c;*8b+p$|I(2|$fo;hdc%*=WAA~{aTecAy9hC7JqXiD8N(8Oq`BQ5DD z9go4#NS`D^f(aXaIAsZqOm-xBBhM_3_>7zp@&|(xcQpV2 diff --git a/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Mutation.php b/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Mutation.php deleted file mode 100644 index cf7179a94320969ece0420a975c63f2b9062aced..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1480 zcmb7EU2hUW6fIz>9b!}xBN88`wMnVbCA9jo6-^QQ5v?VmL1Q){!*Zb$hn>mHEJ-ze z^Vj&~@9^DspZyii&VJAY)XEcZ@45G$d(WI_FT|NZ5AXp5Ac=+{9-L!+23Sb0xz8CM zgrgBi?DL7B45Wi``vku|ImNHqN2hBBs(2`UaPgS)F@w4iBrvt=(?)#~YN9C*99s;b zfK0%IeZU8u)-h-@B${{!7Uy+ioY!mYBIGlo6h2Py=rh9RBfC$P68ilTR5&6ZG1kH$b%@Dr6I&gLy?=_sO#X!5p$Iof9w7ual+tI#JPAy{< zaoj{-is+w`Dc_Do9Pf_|BYVTW*#n8-=k$qwOmHanhY4&<*c>}Klk$Gn`p&2LO2POVPB}N zmLHMPL6V(+D;W~XFna_EjRsCh{1MtVW3{Z8(~Q=jp0m}VMKeath@B7z#hBptb)%=cR>rW3zI4jqhp1^K8h=jLbOMuY5IzxvmYmZUS`OUSm+STiV&o9>$~C94>ju PAAQ7T#;^SXT_E%ueDK(w diff --git a/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/QueryPlan.php b/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/QueryPlan.php deleted file mode 100644 index 4b17b952279ce8da5d1245e2651647ab7a8470e7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1535 zcmah}T~E_c7;+*K49mPZP7EW_&S6YQ0dZ`DEZ{a7a$%Y*U3<2jP)_UV>B2Pp zA>)ny41bEhz)R0*yAB0$H*0&|=Xt-L^X%-o0~em4LrgImpR-q9UFE1 zUJo;5Iu|anF;fw$Hc_K_ifYyR>0<%)9G{t3Lw(2T+qmet1{GYzVX64h$86MbZG)-- z9RM{hum~_QI&AH~#oVwAZs>;rQg4Sy{j9VNVA_V~p?8v@B?#a%An|kku1!qjaf6G$ zHR5#$C7c*G`6No;MLomzut498?fKN?#Gyz6n$*OF4HR<9*frM?t?r_6DJ|K(=v=Q; zju|yuV+VyVeT`!9n>ue zuHq;CmO;hUwFQ&OHEq(+@WI6d$=bm}gqaz}(Pa#OT`5q;lUAuzXwDg3O8pESs0hNh@st&+p1hO0Xv= zId~&HFHl{1URW3mrv`>M)^3CPylAymGW`o3XhYD1&@5EMTxJ0;JG%>fk9Y1|Z zu7=*GRswiCbU5{_^kaOY>%oy8yPvSXpUGSZ)3o4F(;}dzot3&XfzV#A#~1inXeihG Q=bzpaM1~%51y=yS0Ze(|tpET3 diff --git a/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/ResultSet.php b/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/ResultSet.php deleted file mode 100644 index f702c5d7c9b996b7be3244ba42e87fc6bc90906b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2130 zcmbtVL2naB6z(Q~!h{xBk>W~f;Dc`9yX*^+>{gvh{0A4XeDdB`<#qe?`~&i z18J3?z`x+sbET?(p}(T%9((GsZ)SF9EyZf9;EOHK_q}=F_ujns@SEbWAh+l)WFVM= zgpQA?Is{sXT;*||(s4PNfS_?cEqDqdpmb-CKHD48?{*#!Zz5IZrHCP<2YG&wLPr)X z!&sf8ZbyJDQ#F#H0uzpqj7!;A)&8SQsB35ioCC4FHc3_y{e z2*poPj#C~}shGmAbuLFdAp10SQf9H@c}6v1FN>jlm)e*byI$ld zb&J-i^tF0a9zD(!h>WGt4#-&WLgk{5&@emzwC`5e>TrBQ+cw8AJeA}YRicF1 z+bI>GN|9}vymf#R_bZxX)ONw6M;y|m2Z!v4=OPRnRZWn2R3~hJNyO^^6Pw~h&r1-; z{gh>AVh;t&Br~-*8~?a~`9xF1`(N{_WZOyND)b0jx9vRD4&Nbf30eE^p7pOYSiIXvancT2^6hoxWH#zEq(4n(Ai#q7;g^r)z(CE*YiQ$36Mmq9{&RA<5P*YY%GF5auOMrkH{6Xm+^0Axc#*;zNCqG!zSMrr9cpTC z@sDk9?cD;o(q}@yc&Fve+HaE!M_O8~{^L3=r`{@GAs@zvW%de^k--}Wmi%kvlECpa zg-Y8w)OM+{$x1z&O-t`-)2|-6>iluF?vN#{^+@+n)gzzQif4*w2g49S{svi|=}PPo z-B+K@;mo{g{~=i^vjlK{3pA`?0!Kd1(7JE_{mQl9Jo1st+_upJLYnteC4OU05^gN{ z_sFtk*oL)vU#}^yx>l+G3AwCoiSsg3BY1&-;1d z`mR}*!M7&Dz%I>Tzx#WA5=G`HatjqV>Yod%mKKKQFbpeV818q+7mOzxcie=$XLr=h UO4C;Ic+NUANV{}S$O$3;0RBb0i2wiq diff --git a/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Spanner.php b/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Spanner.php deleted file mode 100644 index bd5f04d2a43bfda996ec17610cdaeae0bde9a0ac..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12024 zcmdT~O>7&-6%IvNA|Lfbt!0~*4TssdvEtffthk9w+et`?mS{^NP0@CovRy36m9#Or zOYbgiDS=R+1=>T=L(oG}^cbK(i?(Qi0=)$VdTDbgiuPvokV8*N&pq_iH-F0|HL@wm zMG;?2?aaJ+|L=Pqc_1 zlv^=8y`g)0b&)QsuCZm+yO*v4)SJ5NCiy4$5R&+>-KjOrdeZfD5C1!Bx|(U3o~bv@ z50LBY$#uQy8n|}%-1UxC_e|SLk_APpZp^-#WHia#vuzutyq*+{l!)LcbhTi4hGXf? z>Vo0c9kcD(P6?-GG8=~HtBZV@eU)!Z$eHWOS;k`~vx~{=NzdsR!QGQd$M8Cib(Qi> z2<-U3s!vr@b>42ZOs|Y8wJq1kWV+IIiOEQ0+h#RuSvFB5uH4_k`KD=D-u~9yFpXv- zXKd<^OxxMtQk0H)*TB;G=3D5XKcj$yZ|E;Yz2{qPZ~FjC*U-TAedx#EvtnX!czUZn z_@?D{y}E{0?Cisa-7u@(GPV!4aHYdsXK+pfyP`!qO>fQEhmHcPD~@itI*sN7?Oxe# z?-4094P1Q7RyVo^WD5K?vlu>uHh{J8mCct{PG-9-uq&QAsIjai8NeRL*o@J&KKv zrMZU3=e)doj@Nacy&3V)N7$(P-4IOAI|kOpHN$l=nUsx(9Sl?D>kuKutERg~B9six zMswA3pJj*slYI$Z6y|2zqsiP97SHqopRc?Iqb{SC7{aBoxtSE38gP^p-!B(Ns_M@} zFq6~0`eqL=?(<;gGQ>GEnumsOqNva2N|}Liv8rx&EH4p8L5?tHZ^9`ludGZdU+qdC zN`{{eQ+l zaahWHzzV{fQ+`S&f`yeFoYdPmxMj9bOBzBHPwTh_qcPlT$-QVy!x-J!b~MLs8i^ys zca#LgTIjoGyJ>70jl>9kjF3G;GZ!HiWIP683=^gTWgLz?(wiM-uV`lIN+{!fo_z>s z_HaO<$RaZLzEStw^oRV{PTI6EJP{e;H}P{PEj%1Qik~}aZg>2~f97dxAuui!Kk+y??%k-GTOw65^gh%h9REe)pjzY{~xlZ%+4XU;%5hjp9=>Q4*sQN94 z_$w1IT`Cufd538RK!_fuPL8mnuWkYWW8Osnit$MT5Ff_+#V|$>xG&o{&Z%Aa7P)HTn@-kn& z^n!vkjjcYKEKd(gGtZWHY0msA1abc78XBGA7gR^2Y1b)6@ohDq_E+MbxZHlPUo zgi{3Ms8?Z_{I5(yymG&k?=!^&KsldX(C(p`@@R;0h|<4{tIPM}Lo?qC!DOFilr>Ns zrX{SgTn3_T5&>@>kX7Xj9M?OZt*z^3(|%+)TElepS`(8XQF&x$9VYv<`9I+!2N2=H zx#|x`VJg36)H@iP51XRMz8S1r=<~S&Q<`!WVu7Hca>*-I0NXMru^sf0u=}vdG88SZ zO7$F!v~@>sxinA3=1vIR`!$F4AW8vZbfQLl%EeMcEOlAT7DeLGrPMBAQzfziaUYiz zOe|XjUbV2;(Tqtd)EE{-Ks4lRYc0EBBu4Su#9V41`nSol6gE~`Ejtm#Kf}rrjI+ILmfjM8pJQ{E2H#HPj0{YQ%qD2XD6N+yw0hH{l80jro`x{t z=nYL!n4}bB_(PI(5I!lSplUVSMhszC%;V!oBchyw35qNTTsB(RYbU12cLoQFFh*4; zWH|{_go74VHb=woArO`4lCyBSJ4A?KRW<7_7NYtCtcEP3&)mcW+-K_^jPXhkV+4FH z;621m2>4L%L9}aEfRWW=c_q7yc|QWfrRD4@rkNOwmdeE&h2=cvdCWog3Y8^ot&*** z#lz?dN9o^Wu9jV0-~+?zC&O@@`zS@03$4RPB3?&YTuxc`ILfMfl*EokCCQ}<%N7%%k_8O z!4d4OSF+{%+O7P3L}bTc%3rfu)adW{5K@hZZIqL6Y`HjpOIs?eR{GjVY%aS)YfITO z_W2%$X(L z#j5lG5bF&X6Q|M|IhA8afTtw8iwhHGvA>34T-@DZPlKn)2ktEsFyVENv^A5p&0~0q zu?WXq)57~$c0}2oM3Z-HZZIVwp%g@gl%(S%DEDb1V*hfK-DqkY`w*l=ssV|XD-b7m zgpV|groK(HLZB@8U97mjV}T+u6f4RD7)k=gSV57&^?{&RZoDV)s~a#`wwuiw_Ev}X zXKVmvHl_Zm{$&WJXb*G`&-IK$?q$d#Latbd(f1i0z*fvbS?fg6DH-IM=J z=)Ce7p3_sk_3+{<7bWaU<_V@{r$y4~%r5HtPqN3wRm25;3Xj5PIKc)@hFIP4czQr~_iSBtJWAsa zGSv4d*A=x$J@b%U2Y5vGUkfRJz&iyl01a_G#Zz7twhbh$zBxkSvdgPoQ@QuvrGk{y zThBod!7H)BM2vRZ^HUp07Yio{z<|QWU3FKd)0iBo#d{2f%gSel-ug^VMM9* zwJk*TUxZ+U0eK}Uabz|m_?F>RF@wA9PeV_#Nx^$B2D~7kmir_-E2hW+es?OBdr{3D zMs9{^h_t^6K}3LDMU}`a28G0XCGJfu;zER8DJjDRb>T1!wnpF|Wg7)~ zEj07^Q*=}Qa$cOn@T}=# zAA)Uj9}U4V47=Tqnj2eV{FKO3zEbGDuhDJ9L|l{Ju*IY6G&0nEg59oN<$JVizZg2P zNZ(wi<_VW6PBeA*(x+miTBSo(|5Y|V%l>?5hAqov=wK$p7iKaznAM*B@a>x4WgOt) nQR#)+2t|OepYxw$USQ9u1Fx^iVS`zhyu79}*}Lc+*a7%2OM#)p diff --git a/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Transaction.php b/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Transaction.php deleted file mode 100644 index d7fd2b4b2856ca6c6f997e98272764124bdcd02f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2283 zcmbVNU2hvj6s_GRq&Fr>7gY_GXos{YserYT22^btP#inKBB`y~q*ArgYP>skM%|rV zc4k8g$}j0F4~SR(1rPiNo)JHSyR#oQb!a2}Vz2j}bMHO(%-knmN2d|oCx=Y1m@4Lx z;VYs}8HwUhg>LARVKN%An7CmOai7H|A+0WX+8vN~t26i*p)yQjmsw;ShGU;KWJCpW zHO@90DyBkGSMgAonh!wGfMJBo$YHN}%oO#gqV}PN+Wib_pKR^`xIUGV3?>xt6A=7F z$+vsW9$gsAY|rDrHOm*?5?zP3icEY-BZB)=ZJRM8yf4&Q3_o zR1%9FU3W@wQU0i{TKsS(#ieMedz?DmkG19_2lXmXkoNO zM@Vvv9L8h#G)R2KBcGk4Mv_U1YB^EN(ASA{rfw03d%Edb^ZK8Am9;L^(&9>{yHJ1D z-fKBW-TiN!<8G_%eD}29YwvdsI_=iVHDehTd+mO|bKL0^TF`);j_BRoSf!~GL*<*4u_6S-E8 z3auvhfq6V}Qa>|NufPsc=-ST}_+YBKKJ%H2H@bmWx8wpBn3Krjz<+W{f+=i%SKwf3 zy2bQ3*6`^|m>aS&FUq_sOA}y0=H;v%0eM#|#+_MVGL@I%J;}azL=tFu=bFD&;5G_4 z+fH+3svo@=dX*PnxPF*;MKIzTYYQq#?5^V?`O;0JlXuc zcw^i8m0d1+-1L7{>lw_l^h?XiftGc$Ih@yL=h1q(Fh0vR=hUM8&n2rPvsHKj7XbeN D?#1Va diff --git a/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Type.php b/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/Type.php deleted file mode 100644 index e58489a57e215b43fddd20e26082183cfd926510..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1525 zcma)6+iuf95G9vhGNtX-QfVn5EwokB3S6ZD9^4CZ5+^chVk>bX6FoIc96bF*}8Q0Nb^q2pg0Op8?ZfFzmUGjicC#>EDJE zbsf)%9m{n-QN4$FV7U>Y#JkwR(6eL5_b?-9o=x)GcodUiHv*s5cZjc5=&WQ~uBm!4 z2|dd-D1ar-55W?eXbC`mU}-2~x9y*hHnCCL4LqPR-umrruAj9c(+2A=+F zaKh5)R2+|0yePc*lY%T8k03(U_WNWtg;V*3y(i)wsK{Vt3MplN$!Vbof)$3=WtX_* zoOp4UU69o@WzX%c+`|_3U@oG)v&ZNRM?af@ZgCVBb_9zobeG;lpWPbYTg`Hfn-h49 zAtyklR(J#p{MvGX-N8q1b&Aq+FTMcW%2I^s0UJm}8<3$TtWOAj0~h)5)(&8bFNBAX zWp9EvFDGn5_CK1j^D_mrOfOgY7?zC_UFnv!iqdU2TDnqJtEy5#4}@9BmNe}crGy+z zsSV@pYm^q|V5WMk$!wEJHpM-(D9l67Q0q#|kn1|iGIm8a6f`9OOt*}t+Nhyv7O8Y% zC@nO@mU6QxpP<<>qFpvnj>T-W>q=8CBVa+^x3mVDV`#mp85){r9~BBg3$*-Ms!M5h zmT-hN?9tRlNY9*Sgmd(kutvGZiITF|CE}G@2z_ z`ksPi>S%WdR?4yL+zIs5hc~wC5Bt|BO4vR16N9q?hkD%jT?D=TWc4+@GV(RC%;{ry z6FY?;*C(dQkIcmRsP+9$uZ?Ju#1AEDOq8Tfp*PJhWN|Bbzb{9Qa?613H6M-~S;Q4w G0sIBIAHoCx diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchCreateSessionsRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchCreateSessionsRequest.php deleted file mode 100644 index f76a48fe2104..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchCreateSessionsRequest.php +++ /dev/null @@ -1,187 +0,0 @@ -google.spanner.v1.BatchCreateSessionsRequest - */ -class BatchCreateSessionsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The database in which the new sessions are created. - * - * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $database = ''; - /** - * Parameters to be applied to each created session. - * - * Generated from protobuf field .google.spanner.v1.Session session_template = 2; - */ - protected $session_template = null; - /** - * Required. The number of sessions to be created in this batch call. - * The API may return fewer than the requested number of sessions. If a - * specific number of sessions are desired, the client can make additional - * calls to BatchCreateSessions (adjusting - * [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count] - * as necessary). - * - * Generated from protobuf field int32 session_count = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $session_count = 0; - - /** - * @param string $database Required. The database in which the new sessions are created. Please see - * {@see SpannerClient::databaseName()} for help formatting this field. - * @param int $sessionCount Required. The number of sessions to be created in this batch call. - * The API may return fewer than the requested number of sessions. If a - * specific number of sessions are desired, the client can make additional - * calls to BatchCreateSessions (adjusting - * [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count] - * as necessary). - * - * @return \Google\Cloud\Spanner\V1\BatchCreateSessionsRequest - * - * @experimental - */ - public static function build(string $database, int $sessionCount): self - { - return (new self()) - ->setDatabase($database) - ->setSessionCount($sessionCount); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $database - * Required. The database in which the new sessions are created. - * @type \Google\Cloud\Spanner\V1\Session $session_template - * Parameters to be applied to each created session. - * @type int $session_count - * Required. The number of sessions to be created in this batch call. - * The API may return fewer than the requested number of sessions. If a - * specific number of sessions are desired, the client can make additional - * calls to BatchCreateSessions (adjusting - * [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count] - * as necessary). - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * Required. The database in which the new sessions are created. - * - * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getDatabase() - { - return $this->database; - } - - /** - * Required. The database in which the new sessions are created. - * - * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setDatabase($var) - { - GPBUtil::checkString($var, True); - $this->database = $var; - - return $this; - } - - /** - * Parameters to be applied to each created session. - * - * Generated from protobuf field .google.spanner.v1.Session session_template = 2; - * @return \Google\Cloud\Spanner\V1\Session|null - */ - public function getSessionTemplate() - { - return $this->session_template; - } - - public function hasSessionTemplate() - { - return isset($this->session_template); - } - - public function clearSessionTemplate() - { - unset($this->session_template); - } - - /** - * Parameters to be applied to each created session. - * - * Generated from protobuf field .google.spanner.v1.Session session_template = 2; - * @param \Google\Cloud\Spanner\V1\Session $var - * @return $this - */ - public function setSessionTemplate($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Session::class); - $this->session_template = $var; - - return $this; - } - - /** - * Required. The number of sessions to be created in this batch call. - * The API may return fewer than the requested number of sessions. If a - * specific number of sessions are desired, the client can make additional - * calls to BatchCreateSessions (adjusting - * [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count] - * as necessary). - * - * Generated from protobuf field int32 session_count = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return int - */ - public function getSessionCount() - { - return $this->session_count; - } - - /** - * Required. The number of sessions to be created in this batch call. - * The API may return fewer than the requested number of sessions. If a - * specific number of sessions are desired, the client can make additional - * calls to BatchCreateSessions (adjusting - * [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count] - * as necessary). - * - * Generated from protobuf field int32 session_count = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param int $var - * @return $this - */ - public function setSessionCount($var) - { - GPBUtil::checkInt32($var); - $this->session_count = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchCreateSessionsResponse.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchCreateSessionsResponse.php deleted file mode 100644 index ff411489ae3b..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchCreateSessionsResponse.php +++ /dev/null @@ -1,68 +0,0 @@ -google.spanner.v1.BatchCreateSessionsResponse - */ -class BatchCreateSessionsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The freshly created sessions. - * - * Generated from protobuf field repeated .google.spanner.v1.Session session = 1; - */ - private $session; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Spanner\V1\Session>|\Google\Protobuf\Internal\RepeatedField $session - * The freshly created sessions. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * The freshly created sessions. - * - * Generated from protobuf field repeated .google.spanner.v1.Session session = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getSession() - { - return $this->session; - } - - /** - * The freshly created sessions. - * - * Generated from protobuf field repeated .google.spanner.v1.Session session = 1; - * @param array<\Google\Cloud\Spanner\V1\Session>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setSession($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Session::class); - $this->session = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteRequest.php deleted file mode 100644 index d5467dbbe1e9..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteRequest.php +++ /dev/null @@ -1,235 +0,0 @@ -google.spanner.v1.BatchWriteRequest - */ -class BatchWriteRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The session in which the batch request is to be run. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $session = ''; - /** - * Common options for this request. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 3; - */ - protected $request_options = null; - /** - * Required. The groups of mutations to be applied. - * - * Generated from protobuf field repeated .google.spanner.v1.BatchWriteRequest.MutationGroup mutation_groups = 4 [(.google.api.field_behavior) = REQUIRED]; - */ - private $mutation_groups; - /** - * Optional. When `exclude_txn_from_change_streams` is set to `true`: - * * Mutations from all transactions in this batch write operation will not - * be recorded in change streams with DDL option `allow_txn_exclusion=true` - * that are tracking columns modified by these transactions. - * * Mutations from all transactions in this batch write operation will be - * recorded in change streams with DDL option `allow_txn_exclusion=false or - * not set` that are tracking columns modified by these transactions. - * When `exclude_txn_from_change_streams` is set to `false` or not set, - * mutations from all transactions in this batch write operation will be - * recorded in all change streams that are tracking columns modified by these - * transactions. - * - * Generated from protobuf field bool exclude_txn_from_change_streams = 5 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $exclude_txn_from_change_streams = false; - - /** - * @param string $session Required. The session in which the batch request is to be run. Please see - * {@see SpannerClient::sessionName()} for help formatting this field. - * @param \Google\Cloud\Spanner\V1\BatchWriteRequest\MutationGroup[] $mutationGroups Required. The groups of mutations to be applied. - * - * @return \Google\Cloud\Spanner\V1\BatchWriteRequest - * - * @experimental - */ - public static function build(string $session, array $mutationGroups): self - { - return (new self()) - ->setSession($session) - ->setMutationGroups($mutationGroups); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $session - * Required. The session in which the batch request is to be run. - * @type \Google\Cloud\Spanner\V1\RequestOptions $request_options - * Common options for this request. - * @type array<\Google\Cloud\Spanner\V1\BatchWriteRequest\MutationGroup>|\Google\Protobuf\Internal\RepeatedField $mutation_groups - * Required. The groups of mutations to be applied. - * @type bool $exclude_txn_from_change_streams - * Optional. When `exclude_txn_from_change_streams` is set to `true`: - * * Mutations from all transactions in this batch write operation will not - * be recorded in change streams with DDL option `allow_txn_exclusion=true` - * that are tracking columns modified by these transactions. - * * Mutations from all transactions in this batch write operation will be - * recorded in change streams with DDL option `allow_txn_exclusion=false or - * not set` that are tracking columns modified by these transactions. - * When `exclude_txn_from_change_streams` is set to `false` or not set, - * mutations from all transactions in this batch write operation will be - * recorded in all change streams that are tracking columns modified by these - * transactions. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * Required. The session in which the batch request is to be run. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSession() - { - return $this->session; - } - - /** - * Required. The session in which the batch request is to be run. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSession($var) - { - GPBUtil::checkString($var, True); - $this->session = $var; - - return $this; - } - - /** - * Common options for this request. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 3; - * @return \Google\Cloud\Spanner\V1\RequestOptions|null - */ - public function getRequestOptions() - { - return $this->request_options; - } - - public function hasRequestOptions() - { - return isset($this->request_options); - } - - public function clearRequestOptions() - { - unset($this->request_options); - } - - /** - * Common options for this request. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 3; - * @param \Google\Cloud\Spanner\V1\RequestOptions $var - * @return $this - */ - public function setRequestOptions($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\RequestOptions::class); - $this->request_options = $var; - - return $this; - } - - /** - * Required. The groups of mutations to be applied. - * - * Generated from protobuf field repeated .google.spanner.v1.BatchWriteRequest.MutationGroup mutation_groups = 4 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getMutationGroups() - { - return $this->mutation_groups; - } - - /** - * Required. The groups of mutations to be applied. - * - * Generated from protobuf field repeated .google.spanner.v1.BatchWriteRequest.MutationGroup mutation_groups = 4 [(.google.api.field_behavior) = REQUIRED]; - * @param array<\Google\Cloud\Spanner\V1\BatchWriteRequest\MutationGroup>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setMutationGroups($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\BatchWriteRequest\MutationGroup::class); - $this->mutation_groups = $arr; - - return $this; - } - - /** - * Optional. When `exclude_txn_from_change_streams` is set to `true`: - * * Mutations from all transactions in this batch write operation will not - * be recorded in change streams with DDL option `allow_txn_exclusion=true` - * that are tracking columns modified by these transactions. - * * Mutations from all transactions in this batch write operation will be - * recorded in change streams with DDL option `allow_txn_exclusion=false or - * not set` that are tracking columns modified by these transactions. - * When `exclude_txn_from_change_streams` is set to `false` or not set, - * mutations from all transactions in this batch write operation will be - * recorded in all change streams that are tracking columns modified by these - * transactions. - * - * Generated from protobuf field bool exclude_txn_from_change_streams = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getExcludeTxnFromChangeStreams() - { - return $this->exclude_txn_from_change_streams; - } - - /** - * Optional. When `exclude_txn_from_change_streams` is set to `true`: - * * Mutations from all transactions in this batch write operation will not - * be recorded in change streams with DDL option `allow_txn_exclusion=true` - * that are tracking columns modified by these transactions. - * * Mutations from all transactions in this batch write operation will be - * recorded in change streams with DDL option `allow_txn_exclusion=false or - * not set` that are tracking columns modified by these transactions. - * When `exclude_txn_from_change_streams` is set to `false` or not set, - * mutations from all transactions in this batch write operation will be - * recorded in all change streams that are tracking columns modified by these - * transactions. - * - * Generated from protobuf field bool exclude_txn_from_change_streams = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setExcludeTxnFromChangeStreams($var) - { - GPBUtil::checkBool($var); - $this->exclude_txn_from_change_streams = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteRequest/MutationGroup.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteRequest/MutationGroup.php deleted file mode 100644 index 22d04c7f4b91..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteRequest/MutationGroup.php +++ /dev/null @@ -1,72 +0,0 @@ -google.spanner.v1.BatchWriteRequest.MutationGroup - */ -class MutationGroup extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The mutations in this group. - * - * Generated from protobuf field repeated .google.spanner.v1.Mutation mutations = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - private $mutations; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Spanner\V1\Mutation>|\Google\Protobuf\Internal\RepeatedField $mutations - * Required. The mutations in this group. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * Required. The mutations in this group. - * - * Generated from protobuf field repeated .google.spanner.v1.Mutation mutations = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getMutations() - { - return $this->mutations; - } - - /** - * Required. The mutations in this group. - * - * Generated from protobuf field repeated .google.spanner.v1.Mutation mutations = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param array<\Google\Cloud\Spanner\V1\Mutation>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setMutations($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Mutation::class); - $this->mutations = $arr; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(MutationGroup::class, \Google\Cloud\Spanner\V1\BatchWriteRequest_MutationGroup::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteResponse.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteResponse.php deleted file mode 100644 index efcb9bc2ddb9..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BatchWriteResponse.php +++ /dev/null @@ -1,163 +0,0 @@ -google.spanner.v1.BatchWriteResponse - */ -class BatchWriteResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The mutation groups applied in this batch. The values index into the - * `mutation_groups` field in the corresponding `BatchWriteRequest`. - * - * Generated from protobuf field repeated int32 indexes = 1; - */ - private $indexes; - /** - * An `OK` status indicates success. Any other status indicates a failure. - * - * Generated from protobuf field .google.rpc.Status status = 2; - */ - protected $status = null; - /** - * The commit timestamp of the transaction that applied this batch. - * Present if `status` is `OK`, absent otherwise. - * - * Generated from protobuf field .google.protobuf.Timestamp commit_timestamp = 3; - */ - protected $commit_timestamp = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array|\Google\Protobuf\Internal\RepeatedField $indexes - * The mutation groups applied in this batch. The values index into the - * `mutation_groups` field in the corresponding `BatchWriteRequest`. - * @type \Google\Rpc\Status $status - * An `OK` status indicates success. Any other status indicates a failure. - * @type \Google\Protobuf\Timestamp $commit_timestamp - * The commit timestamp of the transaction that applied this batch. - * Present if `status` is `OK`, absent otherwise. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * The mutation groups applied in this batch. The values index into the - * `mutation_groups` field in the corresponding `BatchWriteRequest`. - * - * Generated from protobuf field repeated int32 indexes = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getIndexes() - { - return $this->indexes; - } - - /** - * The mutation groups applied in this batch. The values index into the - * `mutation_groups` field in the corresponding `BatchWriteRequest`. - * - * Generated from protobuf field repeated int32 indexes = 1; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setIndexes($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); - $this->indexes = $arr; - - return $this; - } - - /** - * An `OK` status indicates success. Any other status indicates a failure. - * - * Generated from protobuf field .google.rpc.Status status = 2; - * @return \Google\Rpc\Status|null - */ - public function getStatus() - { - return $this->status; - } - - public function hasStatus() - { - return isset($this->status); - } - - public function clearStatus() - { - unset($this->status); - } - - /** - * An `OK` status indicates success. Any other status indicates a failure. - * - * Generated from protobuf field .google.rpc.Status status = 2; - * @param \Google\Rpc\Status $var - * @return $this - */ - public function setStatus($var) - { - GPBUtil::checkMessage($var, \Google\Rpc\Status::class); - $this->status = $var; - - return $this; - } - - /** - * The commit timestamp of the transaction that applied this batch. - * Present if `status` is `OK`, absent otherwise. - * - * Generated from protobuf field .google.protobuf.Timestamp commit_timestamp = 3; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCommitTimestamp() - { - return $this->commit_timestamp; - } - - public function hasCommitTimestamp() - { - return isset($this->commit_timestamp); - } - - public function clearCommitTimestamp() - { - unset($this->commit_timestamp); - } - - /** - * The commit timestamp of the transaction that applied this batch. - * Present if `status` is `OK`, absent otherwise. - * - * Generated from protobuf field .google.protobuf.Timestamp commit_timestamp = 3; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCommitTimestamp($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->commit_timestamp = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BeginTransactionRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BeginTransactionRequest.php deleted file mode 100644 index 835d6d602d59..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BeginTransactionRequest.php +++ /dev/null @@ -1,252 +0,0 @@ -google.spanner.v1.BeginTransactionRequest - */ -class BeginTransactionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The session in which the transaction runs. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $session = ''; - /** - * Required. Options for the new transaction. - * - * Generated from protobuf field .google.spanner.v1.TransactionOptions options = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $options = null; - /** - * Common options for this request. - * Priority is ignored for this request. Setting the priority in this - * request_options struct will not do anything. To set the priority for a - * transaction, set it on the reads and writes that are part of this - * transaction instead. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 3; - */ - protected $request_options = null; - /** - * Optional. Required for read-write transactions on a multiplexed session - * that commit mutations but do not perform any reads or queries. Clients - * should randomly select one of the mutations from the mutation set and send - * it as a part of this request. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $mutation_key = null; - - /** - * @param string $session Required. The session in which the transaction runs. Please see - * {@see SpannerClient::sessionName()} for help formatting this field. - * @param \Google\Cloud\Spanner\V1\TransactionOptions $options Required. Options for the new transaction. - * - * @return \Google\Cloud\Spanner\V1\BeginTransactionRequest - * - * @experimental - */ - public static function build(string $session, \Google\Cloud\Spanner\V1\TransactionOptions $options): self - { - return (new self()) - ->setSession($session) - ->setOptions($options); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $session - * Required. The session in which the transaction runs. - * @type \Google\Cloud\Spanner\V1\TransactionOptions $options - * Required. Options for the new transaction. - * @type \Google\Cloud\Spanner\V1\RequestOptions $request_options - * Common options for this request. - * Priority is ignored for this request. Setting the priority in this - * request_options struct will not do anything. To set the priority for a - * transaction, set it on the reads and writes that are part of this - * transaction instead. - * @type \Google\Cloud\Spanner\V1\Mutation $mutation_key - * Optional. Required for read-write transactions on a multiplexed session - * that commit mutations but do not perform any reads or queries. Clients - * should randomly select one of the mutations from the mutation set and send - * it as a part of this request. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * Required. The session in which the transaction runs. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSession() - { - return $this->session; - } - - /** - * Required. The session in which the transaction runs. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSession($var) - { - GPBUtil::checkString($var, True); - $this->session = $var; - - return $this; - } - - /** - * Required. Options for the new transaction. - * - * Generated from protobuf field .google.spanner.v1.TransactionOptions options = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\V1\TransactionOptions|null - */ - public function getOptions() - { - return $this->options; - } - - public function hasOptions() - { - return isset($this->options); - } - - public function clearOptions() - { - unset($this->options); - } - - /** - * Required. Options for the new transaction. - * - * Generated from protobuf field .google.spanner.v1.TransactionOptions options = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\V1\TransactionOptions $var - * @return $this - */ - public function setOptions($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionOptions::class); - $this->options = $var; - - return $this; - } - - /** - * Common options for this request. - * Priority is ignored for this request. Setting the priority in this - * request_options struct will not do anything. To set the priority for a - * transaction, set it on the reads and writes that are part of this - * transaction instead. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 3; - * @return \Google\Cloud\Spanner\V1\RequestOptions|null - */ - public function getRequestOptions() - { - return $this->request_options; - } - - public function hasRequestOptions() - { - return isset($this->request_options); - } - - public function clearRequestOptions() - { - unset($this->request_options); - } - - /** - * Common options for this request. - * Priority is ignored for this request. Setting the priority in this - * request_options struct will not do anything. To set the priority for a - * transaction, set it on the reads and writes that are part of this - * transaction instead. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 3; - * @param \Google\Cloud\Spanner\V1\RequestOptions $var - * @return $this - */ - public function setRequestOptions($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\RequestOptions::class); - $this->request_options = $var; - - return $this; - } - - /** - * Optional. Required for read-write transactions on a multiplexed session - * that commit mutations but do not perform any reads or queries. Clients - * should randomly select one of the mutations from the mutation set and send - * it as a part of this request. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\Spanner\V1\Mutation|null - */ - public function getMutationKey() - { - return $this->mutation_key; - } - - public function hasMutationKey() - { - return isset($this->mutation_key); - } - - public function clearMutationKey() - { - unset($this->mutation_key); - } - - /** - * Optional. Required for read-write transactions on a multiplexed session - * that commit mutations but do not perform any reads or queries. Clients - * should randomly select one of the mutations from the mutation set and send - * it as a part of this request. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\Spanner\V1\Mutation $var - * @return $this - */ - public function setMutationKey($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Mutation::class); - $this->mutation_key = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitRequest.php deleted file mode 100644 index 1c5bec6a1abc..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitRequest.php +++ /dev/null @@ -1,466 +0,0 @@ -google.spanner.v1.CommitRequest - */ -class CommitRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The session in which the transaction to be committed is running. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $session = ''; - /** - * The mutations to be executed when this transaction commits. All - * mutations are applied atomically, in the order they appear in - * this list. - * - * Generated from protobuf field repeated .google.spanner.v1.Mutation mutations = 4; - */ - private $mutations; - /** - * If `true`, then statistics related to the transaction will be included in - * the [CommitResponse][google.spanner.v1.CommitResponse.commit_stats]. - * Default value is `false`. - * - * Generated from protobuf field bool return_commit_stats = 5; - */ - protected $return_commit_stats = false; - /** - * Optional. The amount of latency this request is willing to incur in order - * to improve throughput. If this field is not set, Spanner assumes requests - * are relatively latency sensitive and automatically determines an - * appropriate delay time. You can specify a batching delay value between 0 - * and 500 ms. - * - * Generated from protobuf field .google.protobuf.Duration max_commit_delay = 8 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $max_commit_delay = null; - /** - * Common options for this request. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 6; - */ - protected $request_options = null; - /** - * Optional. If the read-write transaction was executed on a multiplexed - * session, the precommit token with the highest sequence number received in - * this transaction attempt, should be included here. Failing to do so will - * result in a FailedPrecondition error. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $precommit_token = null; - protected $transaction; - - /** - * @param string $session Required. The session in which the transaction to be committed is running. Please see - * {@see SpannerClient::sessionName()} for help formatting this field. - * @param string $transactionId Commit a previously-started transaction. - * @param \Google\Cloud\Spanner\V1\Mutation[] $mutations The mutations to be executed when this transaction commits. All - * mutations are applied atomically, in the order they appear in - * this list. - * - * @return \Google\Cloud\Spanner\V1\CommitRequest - * - * @experimental - */ - public static function build(string $session, string $transactionId, array $mutations): self - { - return (new self()) - ->setSession($session) - ->setTransactionId($transactionId) - ->setMutations($mutations); - } - - /** - * @param string $session Required. The session in which the transaction to be committed is running. Please see - * {@see SpannerClient::sessionName()} for help formatting this field. - * @param \Google\Cloud\Spanner\V1\TransactionOptions $singleUseTransaction Execute mutations in a temporary transaction. Note that unlike - * commit of a previously-started transaction, commit with a - * temporary transaction is non-idempotent. That is, if the - * `CommitRequest` is sent to Cloud Spanner more than once (for - * instance, due to retries in the application, or in the - * transport library), it is possible that the mutations are - * executed more than once. If this is undesirable, use - * [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction] and - * [Commit][google.spanner.v1.Spanner.Commit] instead. - * @param \Google\Cloud\Spanner\V1\Mutation[] $mutations The mutations to be executed when this transaction commits. All - * mutations are applied atomically, in the order they appear in - * this list. - * - * @return \Google\Cloud\Spanner\V1\CommitRequest - * - * @experimental - */ - public static function buildFromSessionSingleUseTransactionMutations(string $session, \Google\Cloud\Spanner\V1\TransactionOptions $singleUseTransaction, array $mutations): self - { - return (new self()) - ->setSession($session) - ->setSingleUseTransaction($singleUseTransaction) - ->setMutations($mutations); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $session - * Required. The session in which the transaction to be committed is running. - * @type string $transaction_id - * Commit a previously-started transaction. - * @type \Google\Cloud\Spanner\V1\TransactionOptions $single_use_transaction - * Execute mutations in a temporary transaction. Note that unlike - * commit of a previously-started transaction, commit with a - * temporary transaction is non-idempotent. That is, if the - * `CommitRequest` is sent to Cloud Spanner more than once (for - * instance, due to retries in the application, or in the - * transport library), it is possible that the mutations are - * executed more than once. If this is undesirable, use - * [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction] and - * [Commit][google.spanner.v1.Spanner.Commit] instead. - * @type array<\Google\Cloud\Spanner\V1\Mutation>|\Google\Protobuf\Internal\RepeatedField $mutations - * The mutations to be executed when this transaction commits. All - * mutations are applied atomically, in the order they appear in - * this list. - * @type bool $return_commit_stats - * If `true`, then statistics related to the transaction will be included in - * the [CommitResponse][google.spanner.v1.CommitResponse.commit_stats]. - * Default value is `false`. - * @type \Google\Protobuf\Duration $max_commit_delay - * Optional. The amount of latency this request is willing to incur in order - * to improve throughput. If this field is not set, Spanner assumes requests - * are relatively latency sensitive and automatically determines an - * appropriate delay time. You can specify a batching delay value between 0 - * and 500 ms. - * @type \Google\Cloud\Spanner\V1\RequestOptions $request_options - * Common options for this request. - * @type \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $precommit_token - * Optional. If the read-write transaction was executed on a multiplexed - * session, the precommit token with the highest sequence number received in - * this transaction attempt, should be included here. Failing to do so will - * result in a FailedPrecondition error. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * Required. The session in which the transaction to be committed is running. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSession() - { - return $this->session; - } - - /** - * Required. The session in which the transaction to be committed is running. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSession($var) - { - GPBUtil::checkString($var, True); - $this->session = $var; - - return $this; - } - - /** - * Commit a previously-started transaction. - * - * Generated from protobuf field bytes transaction_id = 2; - * @return string - */ - public function getTransactionId() - { - return $this->readOneof(2); - } - - public function hasTransactionId() - { - return $this->hasOneof(2); - } - - /** - * Commit a previously-started transaction. - * - * Generated from protobuf field bytes transaction_id = 2; - * @param string $var - * @return $this - */ - public function setTransactionId($var) - { - GPBUtil::checkString($var, False); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * Execute mutations in a temporary transaction. Note that unlike - * commit of a previously-started transaction, commit with a - * temporary transaction is non-idempotent. That is, if the - * `CommitRequest` is sent to Cloud Spanner more than once (for - * instance, due to retries in the application, or in the - * transport library), it is possible that the mutations are - * executed more than once. If this is undesirable, use - * [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction] and - * [Commit][google.spanner.v1.Spanner.Commit] instead. - * - * Generated from protobuf field .google.spanner.v1.TransactionOptions single_use_transaction = 3; - * @return \Google\Cloud\Spanner\V1\TransactionOptions|null - */ - public function getSingleUseTransaction() - { - return $this->readOneof(3); - } - - public function hasSingleUseTransaction() - { - return $this->hasOneof(3); - } - - /** - * Execute mutations in a temporary transaction. Note that unlike - * commit of a previously-started transaction, commit with a - * temporary transaction is non-idempotent. That is, if the - * `CommitRequest` is sent to Cloud Spanner more than once (for - * instance, due to retries in the application, or in the - * transport library), it is possible that the mutations are - * executed more than once. If this is undesirable, use - * [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction] and - * [Commit][google.spanner.v1.Spanner.Commit] instead. - * - * Generated from protobuf field .google.spanner.v1.TransactionOptions single_use_transaction = 3; - * @param \Google\Cloud\Spanner\V1\TransactionOptions $var - * @return $this - */ - public function setSingleUseTransaction($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionOptions::class); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * The mutations to be executed when this transaction commits. All - * mutations are applied atomically, in the order they appear in - * this list. - * - * Generated from protobuf field repeated .google.spanner.v1.Mutation mutations = 4; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getMutations() - { - return $this->mutations; - } - - /** - * The mutations to be executed when this transaction commits. All - * mutations are applied atomically, in the order they appear in - * this list. - * - * Generated from protobuf field repeated .google.spanner.v1.Mutation mutations = 4; - * @param array<\Google\Cloud\Spanner\V1\Mutation>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setMutations($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Mutation::class); - $this->mutations = $arr; - - return $this; - } - - /** - * If `true`, then statistics related to the transaction will be included in - * the [CommitResponse][google.spanner.v1.CommitResponse.commit_stats]. - * Default value is `false`. - * - * Generated from protobuf field bool return_commit_stats = 5; - * @return bool - */ - public function getReturnCommitStats() - { - return $this->return_commit_stats; - } - - /** - * If `true`, then statistics related to the transaction will be included in - * the [CommitResponse][google.spanner.v1.CommitResponse.commit_stats]. - * Default value is `false`. - * - * Generated from protobuf field bool return_commit_stats = 5; - * @param bool $var - * @return $this - */ - public function setReturnCommitStats($var) - { - GPBUtil::checkBool($var); - $this->return_commit_stats = $var; - - return $this; - } - - /** - * Optional. The amount of latency this request is willing to incur in order - * to improve throughput. If this field is not set, Spanner assumes requests - * are relatively latency sensitive and automatically determines an - * appropriate delay time. You can specify a batching delay value between 0 - * and 500 ms. - * - * Generated from protobuf field .google.protobuf.Duration max_commit_delay = 8 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Protobuf\Duration|null - */ - public function getMaxCommitDelay() - { - return $this->max_commit_delay; - } - - public function hasMaxCommitDelay() - { - return isset($this->max_commit_delay); - } - - public function clearMaxCommitDelay() - { - unset($this->max_commit_delay); - } - - /** - * Optional. The amount of latency this request is willing to incur in order - * to improve throughput. If this field is not set, Spanner assumes requests - * are relatively latency sensitive and automatically determines an - * appropriate delay time. You can specify a batching delay value between 0 - * and 500 ms. - * - * Generated from protobuf field .google.protobuf.Duration max_commit_delay = 8 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Protobuf\Duration $var - * @return $this - */ - public function setMaxCommitDelay($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); - $this->max_commit_delay = $var; - - return $this; - } - - /** - * Common options for this request. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 6; - * @return \Google\Cloud\Spanner\V1\RequestOptions|null - */ - public function getRequestOptions() - { - return $this->request_options; - } - - public function hasRequestOptions() - { - return isset($this->request_options); - } - - public function clearRequestOptions() - { - unset($this->request_options); - } - - /** - * Common options for this request. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 6; - * @param \Google\Cloud\Spanner\V1\RequestOptions $var - * @return $this - */ - public function setRequestOptions($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\RequestOptions::class); - $this->request_options = $var; - - return $this; - } - - /** - * Optional. If the read-write transaction was executed on a multiplexed - * session, the precommit token with the highest sequence number received in - * this transaction attempt, should be included here. Failing to do so will - * result in a FailedPrecondition error. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken|null - */ - public function getPrecommitToken() - { - return $this->precommit_token; - } - - public function hasPrecommitToken() - { - return isset($this->precommit_token); - } - - public function clearPrecommitToken() - { - unset($this->precommit_token); - } - - /** - * Optional. If the read-write transaction was executed on a multiplexed - * session, the precommit token with the highest sequence number received in - * this transaction attempt, should be included here. Failing to do so will - * result in a FailedPrecondition error. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $var - * @return $this - */ - public function setPrecommitToken($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken::class); - $this->precommit_token = $var; - - return $this; - } - - /** - * @return string - */ - public function getTransaction() - { - return $this->whichOneof("transaction"); - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitResponse.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitResponse.php deleted file mode 100644 index 2259fc08d33c..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitResponse.php +++ /dev/null @@ -1,174 +0,0 @@ -google.spanner.v1.CommitResponse - */ -class CommitResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The Cloud Spanner timestamp at which the transaction committed. - * - * Generated from protobuf field .google.protobuf.Timestamp commit_timestamp = 1; - */ - protected $commit_timestamp = null; - /** - * The statistics about this Commit. Not returned by default. - * For more information, see - * [CommitRequest.return_commit_stats][google.spanner.v1.CommitRequest.return_commit_stats]. - * - * Generated from protobuf field .google.spanner.v1.CommitResponse.CommitStats commit_stats = 2; - */ - protected $commit_stats = null; - protected $MultiplexedSessionRetry; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Protobuf\Timestamp $commit_timestamp - * The Cloud Spanner timestamp at which the transaction committed. - * @type \Google\Cloud\Spanner\V1\CommitResponse\CommitStats $commit_stats - * The statistics about this Commit. Not returned by default. - * For more information, see - * [CommitRequest.return_commit_stats][google.spanner.v1.CommitRequest.return_commit_stats]. - * @type \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $precommit_token - * If specified, transaction has not committed yet. - * Clients must retry the commit with the new precommit token. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\CommitResponse::initOnce(); - parent::__construct($data); - } - - /** - * The Cloud Spanner timestamp at which the transaction committed. - * - * Generated from protobuf field .google.protobuf.Timestamp commit_timestamp = 1; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCommitTimestamp() - { - return $this->commit_timestamp; - } - - public function hasCommitTimestamp() - { - return isset($this->commit_timestamp); - } - - public function clearCommitTimestamp() - { - unset($this->commit_timestamp); - } - - /** - * The Cloud Spanner timestamp at which the transaction committed. - * - * Generated from protobuf field .google.protobuf.Timestamp commit_timestamp = 1; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCommitTimestamp($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->commit_timestamp = $var; - - return $this; - } - - /** - * The statistics about this Commit. Not returned by default. - * For more information, see - * [CommitRequest.return_commit_stats][google.spanner.v1.CommitRequest.return_commit_stats]. - * - * Generated from protobuf field .google.spanner.v1.CommitResponse.CommitStats commit_stats = 2; - * @return \Google\Cloud\Spanner\V1\CommitResponse\CommitStats|null - */ - public function getCommitStats() - { - return $this->commit_stats; - } - - public function hasCommitStats() - { - return isset($this->commit_stats); - } - - public function clearCommitStats() - { - unset($this->commit_stats); - } - - /** - * The statistics about this Commit. Not returned by default. - * For more information, see - * [CommitRequest.return_commit_stats][google.spanner.v1.CommitRequest.return_commit_stats]. - * - * Generated from protobuf field .google.spanner.v1.CommitResponse.CommitStats commit_stats = 2; - * @param \Google\Cloud\Spanner\V1\CommitResponse\CommitStats $var - * @return $this - */ - public function setCommitStats($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\CommitResponse\CommitStats::class); - $this->commit_stats = $var; - - return $this; - } - - /** - * If specified, transaction has not committed yet. - * Clients must retry the commit with the new precommit token. - * - * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; - * @return \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken|null - */ - public function getPrecommitToken() - { - return $this->readOneof(4); - } - - public function hasPrecommitToken() - { - return $this->hasOneof(4); - } - - /** - * If specified, transaction has not committed yet. - * Clients must retry the commit with the new precommit token. - * - * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; - * @param \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $var - * @return $this - */ - public function setPrecommitToken($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken::class); - $this->writeOneof(4, $var); - - return $this; - } - - /** - * @return string - */ - public function getMultiplexedSessionRetry() - { - return $this->whichOneof("MultiplexedSessionRetry"); - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitResponse/CommitStats.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitResponse/CommitStats.php deleted file mode 100644 index 0f853f3c78fa..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitResponse/CommitStats.php +++ /dev/null @@ -1,94 +0,0 @@ -google.spanner.v1.CommitResponse.CommitStats - */ -class CommitStats extends \Google\Protobuf\Internal\Message -{ - /** - * The total number of mutations for the transaction. Knowing the - * `mutation_count` value can help you maximize the number of mutations - * in a transaction and minimize the number of API round trips. You can - * also monitor this value to prevent transactions from exceeding the system - * [limit](https://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data). - * If the number of mutations exceeds the limit, the server returns - * [INVALID_ARGUMENT](https://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT). - * - * Generated from protobuf field int64 mutation_count = 1; - */ - protected $mutation_count = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int|string $mutation_count - * The total number of mutations for the transaction. Knowing the - * `mutation_count` value can help you maximize the number of mutations - * in a transaction and minimize the number of API round trips. You can - * also monitor this value to prevent transactions from exceeding the system - * [limit](https://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data). - * If the number of mutations exceeds the limit, the server returns - * [INVALID_ARGUMENT](https://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT). - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\CommitResponse::initOnce(); - parent::__construct($data); - } - - /** - * The total number of mutations for the transaction. Knowing the - * `mutation_count` value can help you maximize the number of mutations - * in a transaction and minimize the number of API round trips. You can - * also monitor this value to prevent transactions from exceeding the system - * [limit](https://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data). - * If the number of mutations exceeds the limit, the server returns - * [INVALID_ARGUMENT](https://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT). - * - * Generated from protobuf field int64 mutation_count = 1; - * @return int|string - */ - public function getMutationCount() - { - return $this->mutation_count; - } - - /** - * The total number of mutations for the transaction. Knowing the - * `mutation_count` value can help you maximize the number of mutations - * in a transaction and minimize the number of API round trips. You can - * also monitor this value to prevent transactions from exceeding the system - * [limit](https://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data). - * If the number of mutations exceeds the limit, the server returns - * [INVALID_ARGUMENT](https://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT). - * - * Generated from protobuf field int64 mutation_count = 1; - * @param int|string $var - * @return $this - */ - public function setMutationCount($var) - { - GPBUtil::checkInt64($var); - $this->mutation_count = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(CommitStats::class, \Google\Cloud\Spanner\V1\CommitResponse_CommitStats::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CreateSessionRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CreateSessionRequest.php deleted file mode 100644 index f76760ba06a8..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CreateSessionRequest.php +++ /dev/null @@ -1,125 +0,0 @@ -google.spanner.v1.CreateSessionRequest - */ -class CreateSessionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The database in which the new session is created. - * - * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $database = ''; - /** - * Required. The session to create. - * - * Generated from protobuf field .google.spanner.v1.Session session = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $session = null; - - /** - * @param string $database Required. The database in which the new session is created. Please see - * {@see SpannerClient::databaseName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\V1\CreateSessionRequest - * - * @experimental - */ - public static function build(string $database): self - { - return (new self()) - ->setDatabase($database); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $database - * Required. The database in which the new session is created. - * @type \Google\Cloud\Spanner\V1\Session $session - * Required. The session to create. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * Required. The database in which the new session is created. - * - * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getDatabase() - { - return $this->database; - } - - /** - * Required. The database in which the new session is created. - * - * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setDatabase($var) - { - GPBUtil::checkString($var, True); - $this->database = $var; - - return $this; - } - - /** - * Required. The session to create. - * - * Generated from protobuf field .google.spanner.v1.Session session = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\V1\Session|null - */ - public function getSession() - { - return $this->session; - } - - public function hasSession() - { - return isset($this->session); - } - - public function clearSession() - { - unset($this->session); - } - - /** - * Required. The session to create. - * - * Generated from protobuf field .google.spanner.v1.Session session = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\V1\Session $var - * @return $this - */ - public function setSession($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Session::class); - $this->session = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DeleteSessionRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DeleteSessionRequest.php deleted file mode 100644 index 0bf9497d1ccc..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DeleteSessionRequest.php +++ /dev/null @@ -1,81 +0,0 @@ -google.spanner.v1.DeleteSessionRequest - */ -class DeleteSessionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the session to delete. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - - /** - * @param string $name Required. The name of the session to delete. Please see - * {@see SpannerClient::sessionName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\V1\DeleteSessionRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the session to delete. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the session to delete. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The name of the session to delete. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions.php deleted file mode 100644 index c6983461e086..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions.php +++ /dev/null @@ -1,129 +0,0 @@ -google.spanner.v1.DirectedReadOptions - */ -class DirectedReadOptions extends \Google\Protobuf\Internal\Message -{ - protected $replicas; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\V1\DirectedReadOptions\IncludeReplicas $include_replicas - * Include_replicas indicates the order of replicas (as they appear in - * this list) to process the request. If auto_failover_disabled is set to - * true and all replicas are exhausted without finding a healthy replica, - * Spanner will wait for a replica in the list to become available, requests - * may fail due to `DEADLINE_EXCEEDED` errors. - * @type \Google\Cloud\Spanner\V1\DirectedReadOptions\ExcludeReplicas $exclude_replicas - * Exclude_replicas indicates that specified replicas should be excluded - * from serving requests. Spanner will not route requests to the replicas - * in this list. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * Include_replicas indicates the order of replicas (as they appear in - * this list) to process the request. If auto_failover_disabled is set to - * true and all replicas are exhausted without finding a healthy replica, - * Spanner will wait for a replica in the list to become available, requests - * may fail due to `DEADLINE_EXCEEDED` errors. - * - * Generated from protobuf field .google.spanner.v1.DirectedReadOptions.IncludeReplicas include_replicas = 1; - * @return \Google\Cloud\Spanner\V1\DirectedReadOptions\IncludeReplicas|null - */ - public function getIncludeReplicas() - { - return $this->readOneof(1); - } - - public function hasIncludeReplicas() - { - return $this->hasOneof(1); - } - - /** - * Include_replicas indicates the order of replicas (as they appear in - * this list) to process the request. If auto_failover_disabled is set to - * true and all replicas are exhausted without finding a healthy replica, - * Spanner will wait for a replica in the list to become available, requests - * may fail due to `DEADLINE_EXCEEDED` errors. - * - * Generated from protobuf field .google.spanner.v1.DirectedReadOptions.IncludeReplicas include_replicas = 1; - * @param \Google\Cloud\Spanner\V1\DirectedReadOptions\IncludeReplicas $var - * @return $this - */ - public function setIncludeReplicas($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\DirectedReadOptions\IncludeReplicas::class); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * Exclude_replicas indicates that specified replicas should be excluded - * from serving requests. Spanner will not route requests to the replicas - * in this list. - * - * Generated from protobuf field .google.spanner.v1.DirectedReadOptions.ExcludeReplicas exclude_replicas = 2; - * @return \Google\Cloud\Spanner\V1\DirectedReadOptions\ExcludeReplicas|null - */ - public function getExcludeReplicas() - { - return $this->readOneof(2); - } - - public function hasExcludeReplicas() - { - return $this->hasOneof(2); - } - - /** - * Exclude_replicas indicates that specified replicas should be excluded - * from serving requests. Spanner will not route requests to the replicas - * in this list. - * - * Generated from protobuf field .google.spanner.v1.DirectedReadOptions.ExcludeReplicas exclude_replicas = 2; - * @param \Google\Cloud\Spanner\V1\DirectedReadOptions\ExcludeReplicas $var - * @return $this - */ - public function setExcludeReplicas($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\DirectedReadOptions\ExcludeReplicas::class); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * @return string - */ - public function getReplicas() - { - return $this->whichOneof("replicas"); - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ExcludeReplicas.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ExcludeReplicas.php deleted file mode 100644 index 913c6fba2724..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ExcludeReplicas.php +++ /dev/null @@ -1,71 +0,0 @@ -google.spanner.v1.DirectedReadOptions.ExcludeReplicas - */ -class ExcludeReplicas extends \Google\Protobuf\Internal\Message -{ - /** - * The directed read replica selector. - * - * Generated from protobuf field repeated .google.spanner.v1.DirectedReadOptions.ReplicaSelection replica_selections = 1; - */ - private $replica_selections; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Spanner\V1\DirectedReadOptions\ReplicaSelection>|\Google\Protobuf\Internal\RepeatedField $replica_selections - * The directed read replica selector. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * The directed read replica selector. - * - * Generated from protobuf field repeated .google.spanner.v1.DirectedReadOptions.ReplicaSelection replica_selections = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getReplicaSelections() - { - return $this->replica_selections; - } - - /** - * The directed read replica selector. - * - * Generated from protobuf field repeated .google.spanner.v1.DirectedReadOptions.ReplicaSelection replica_selections = 1; - * @param array<\Google\Cloud\Spanner\V1\DirectedReadOptions\ReplicaSelection>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setReplicaSelections($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\DirectedReadOptions\ReplicaSelection::class); - $this->replica_selections = $arr; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(ExcludeReplicas::class, \Google\Cloud\Spanner\V1\DirectedReadOptions_ExcludeReplicas::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/IncludeReplicas.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/IncludeReplicas.php deleted file mode 100644 index 82047d57919f..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/IncludeReplicas.php +++ /dev/null @@ -1,113 +0,0 @@ -google.spanner.v1.DirectedReadOptions.IncludeReplicas - */ -class IncludeReplicas extends \Google\Protobuf\Internal\Message -{ - /** - * The directed read replica selector. - * - * Generated from protobuf field repeated .google.spanner.v1.DirectedReadOptions.ReplicaSelection replica_selections = 1; - */ - private $replica_selections; - /** - * If true, Spanner will not route requests to a replica outside the - * include_replicas list when all of the specified replicas are unavailable - * or unhealthy. Default value is `false`. - * - * Generated from protobuf field bool auto_failover_disabled = 2; - */ - protected $auto_failover_disabled = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Spanner\V1\DirectedReadOptions\ReplicaSelection>|\Google\Protobuf\Internal\RepeatedField $replica_selections - * The directed read replica selector. - * @type bool $auto_failover_disabled - * If true, Spanner will not route requests to a replica outside the - * include_replicas list when all of the specified replicas are unavailable - * or unhealthy. Default value is `false`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * The directed read replica selector. - * - * Generated from protobuf field repeated .google.spanner.v1.DirectedReadOptions.ReplicaSelection replica_selections = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getReplicaSelections() - { - return $this->replica_selections; - } - - /** - * The directed read replica selector. - * - * Generated from protobuf field repeated .google.spanner.v1.DirectedReadOptions.ReplicaSelection replica_selections = 1; - * @param array<\Google\Cloud\Spanner\V1\DirectedReadOptions\ReplicaSelection>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setReplicaSelections($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\DirectedReadOptions\ReplicaSelection::class); - $this->replica_selections = $arr; - - return $this; - } - - /** - * If true, Spanner will not route requests to a replica outside the - * include_replicas list when all of the specified replicas are unavailable - * or unhealthy. Default value is `false`. - * - * Generated from protobuf field bool auto_failover_disabled = 2; - * @return bool - */ - public function getAutoFailoverDisabled() - { - return $this->auto_failover_disabled; - } - - /** - * If true, Spanner will not route requests to a replica outside the - * include_replicas list when all of the specified replicas are unavailable - * or unhealthy. Default value is `false`. - * - * Generated from protobuf field bool auto_failover_disabled = 2; - * @param bool $var - * @return $this - */ - public function setAutoFailoverDisabled($var) - { - GPBUtil::checkBool($var); - $this->auto_failover_disabled = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(IncludeReplicas::class, \Google\Cloud\Spanner\V1\DirectedReadOptions_IncludeReplicas::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ReplicaSelection.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ReplicaSelection.php deleted file mode 100644 index 634c7345e1a1..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ReplicaSelection.php +++ /dev/null @@ -1,118 +0,0 @@ - The "us-east1" replica(s) of any available type - * will be used to process the request. - * * `type:READ_ONLY` --> The "READ_ONLY" type replica(s) in nearest - * available location will be used to process the - * request. - * * `location:us-east1 type:READ_ONLY` --> The "READ_ONLY" type replica(s) - * in location "us-east1" will be used to process - * the request. - * - * Generated from protobuf message google.spanner.v1.DirectedReadOptions.ReplicaSelection - */ -class ReplicaSelection extends \Google\Protobuf\Internal\Message -{ - /** - * The location or region of the serving requests, e.g. "us-east1". - * - * Generated from protobuf field string location = 1; - */ - protected $location = ''; - /** - * The type of replica. - * - * Generated from protobuf field .google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type type = 2; - */ - protected $type = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $location - * The location or region of the serving requests, e.g. "us-east1". - * @type int $type - * The type of replica. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * The location or region of the serving requests, e.g. "us-east1". - * - * Generated from protobuf field string location = 1; - * @return string - */ - public function getLocation() - { - return $this->location; - } - - /** - * The location or region of the serving requests, e.g. "us-east1". - * - * Generated from protobuf field string location = 1; - * @param string $var - * @return $this - */ - public function setLocation($var) - { - GPBUtil::checkString($var, True); - $this->location = $var; - - return $this; - } - - /** - * The type of replica. - * - * Generated from protobuf field .google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type type = 2; - * @return int - */ - public function getType() - { - return $this->type; - } - - /** - * The type of replica. - * - * Generated from protobuf field .google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type type = 2; - * @param int $var - * @return $this - */ - public function setType($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\V1\DirectedReadOptions\ReplicaSelection\Type::class); - $this->type = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(ReplicaSelection::class, \Google\Cloud\Spanner\V1\DirectedReadOptions_ReplicaSelection::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ReplicaSelection/Type.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ReplicaSelection/Type.php deleted file mode 100644 index 94b7d304ad1b..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/DirectedReadOptions/ReplicaSelection/Type.php +++ /dev/null @@ -1,64 +0,0 @@ -google.spanner.v1.DirectedReadOptions.ReplicaSelection.Type - */ -class Type -{ - /** - * Not specified. - * - * Generated from protobuf enum TYPE_UNSPECIFIED = 0; - */ - const TYPE_UNSPECIFIED = 0; - /** - * Read-write replicas support both reads and writes. - * - * Generated from protobuf enum READ_WRITE = 1; - */ - const READ_WRITE = 1; - /** - * Read-only replicas only support reads (not writes). - * - * Generated from protobuf enum READ_ONLY = 2; - */ - const READ_ONLY = 2; - - private static $valueToName = [ - self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', - self::READ_WRITE => 'READ_WRITE', - self::READ_ONLY => 'READ_ONLY', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Type::class, \Google\Cloud\Spanner\V1\DirectedReadOptions_ReplicaSelection_Type::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlRequest.php deleted file mode 100644 index 37c878c7e14a..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlRequest.php +++ /dev/null @@ -1,337 +0,0 @@ -google.spanner.v1.ExecuteBatchDmlRequest - */ -class ExecuteBatchDmlRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The session in which the DML statements should be performed. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $session = ''; - /** - * Required. The transaction to use. Must be a read-write transaction. - * To protect against replays, single-use transactions are not supported. The - * caller must either supply an existing transaction ID or begin a new - * transaction. - * - * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $transaction = null; - /** - * Required. The list of statements to execute in this batch. Statements are - * executed serially, such that the effects of statement `i` are visible to - * statement `i+1`. Each statement must be a DML statement. Execution stops at - * the first failed statement; the remaining statements are not executed. - * Callers must provide at least one statement. - * - * Generated from protobuf field repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - private $statements; - /** - * Required. A per-transaction sequence number used to identify this request. - * This field makes each request idempotent such that if the request is - * received multiple times, at most one will succeed. - * The sequence number must be monotonically increasing within the - * transaction. If a request arrives for the first time with an out-of-order - * sequence number, the transaction may be aborted. Replays of previously - * handled requests will yield the same response as the first execution. - * - * Generated from protobuf field int64 seqno = 4 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $seqno = 0; - /** - * Common options for this request. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 5; - */ - protected $request_options = null; - /** - * Optional. If set to true, this request marks the end of the transaction. - * The transaction should be committed or aborted after these statements - * execute, and attempts to execute any other requests against this - * transaction (including reads and queries) will be rejected. - * Setting this option may cause some error reporting to be deferred until - * commit time (e.g. validation of unique constraints). Given this, successful - * execution of statements should not be assumed until a subsequent Commit - * call completes successfully. - * - * Generated from protobuf field bool last_statements = 6 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $last_statements = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $session - * Required. The session in which the DML statements should be performed. - * @type \Google\Cloud\Spanner\V1\TransactionSelector $transaction - * Required. The transaction to use. Must be a read-write transaction. - * To protect against replays, single-use transactions are not supported. The - * caller must either supply an existing transaction ID or begin a new - * transaction. - * @type array<\Google\Cloud\Spanner\V1\ExecuteBatchDmlRequest\Statement>|\Google\Protobuf\Internal\RepeatedField $statements - * Required. The list of statements to execute in this batch. Statements are - * executed serially, such that the effects of statement `i` are visible to - * statement `i+1`. Each statement must be a DML statement. Execution stops at - * the first failed statement; the remaining statements are not executed. - * Callers must provide at least one statement. - * @type int|string $seqno - * Required. A per-transaction sequence number used to identify this request. - * This field makes each request idempotent such that if the request is - * received multiple times, at most one will succeed. - * The sequence number must be monotonically increasing within the - * transaction. If a request arrives for the first time with an out-of-order - * sequence number, the transaction may be aborted. Replays of previously - * handled requests will yield the same response as the first execution. - * @type \Google\Cloud\Spanner\V1\RequestOptions $request_options - * Common options for this request. - * @type bool $last_statements - * Optional. If set to true, this request marks the end of the transaction. - * The transaction should be committed or aborted after these statements - * execute, and attempts to execute any other requests against this - * transaction (including reads and queries) will be rejected. - * Setting this option may cause some error reporting to be deferred until - * commit time (e.g. validation of unique constraints). Given this, successful - * execution of statements should not be assumed until a subsequent Commit - * call completes successfully. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * Required. The session in which the DML statements should be performed. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSession() - { - return $this->session; - } - - /** - * Required. The session in which the DML statements should be performed. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSession($var) - { - GPBUtil::checkString($var, True); - $this->session = $var; - - return $this; - } - - /** - * Required. The transaction to use. Must be a read-write transaction. - * To protect against replays, single-use transactions are not supported. The - * caller must either supply an existing transaction ID or begin a new - * transaction. - * - * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\V1\TransactionSelector|null - */ - public function getTransaction() - { - return $this->transaction; - } - - public function hasTransaction() - { - return isset($this->transaction); - } - - public function clearTransaction() - { - unset($this->transaction); - } - - /** - * Required. The transaction to use. Must be a read-write transaction. - * To protect against replays, single-use transactions are not supported. The - * caller must either supply an existing transaction ID or begin a new - * transaction. - * - * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\V1\TransactionSelector $var - * @return $this - */ - public function setTransaction($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionSelector::class); - $this->transaction = $var; - - return $this; - } - - /** - * Required. The list of statements to execute in this batch. Statements are - * executed serially, such that the effects of statement `i` are visible to - * statement `i+1`. Each statement must be a DML statement. Execution stops at - * the first failed statement; the remaining statements are not executed. - * Callers must provide at least one statement. - * - * Generated from protobuf field repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getStatements() - { - return $this->statements; - } - - /** - * Required. The list of statements to execute in this batch. Statements are - * executed serially, such that the effects of statement `i` are visible to - * statement `i+1`. Each statement must be a DML statement. Execution stops at - * the first failed statement; the remaining statements are not executed. - * Callers must provide at least one statement. - * - * Generated from protobuf field repeated .google.spanner.v1.ExecuteBatchDmlRequest.Statement statements = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param array<\Google\Cloud\Spanner\V1\ExecuteBatchDmlRequest\Statement>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setStatements($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\ExecuteBatchDmlRequest\Statement::class); - $this->statements = $arr; - - return $this; - } - - /** - * Required. A per-transaction sequence number used to identify this request. - * This field makes each request idempotent such that if the request is - * received multiple times, at most one will succeed. - * The sequence number must be monotonically increasing within the - * transaction. If a request arrives for the first time with an out-of-order - * sequence number, the transaction may be aborted. Replays of previously - * handled requests will yield the same response as the first execution. - * - * Generated from protobuf field int64 seqno = 4 [(.google.api.field_behavior) = REQUIRED]; - * @return int|string - */ - public function getSeqno() - { - return $this->seqno; - } - - /** - * Required. A per-transaction sequence number used to identify this request. - * This field makes each request idempotent such that if the request is - * received multiple times, at most one will succeed. - * The sequence number must be monotonically increasing within the - * transaction. If a request arrives for the first time with an out-of-order - * sequence number, the transaction may be aborted. Replays of previously - * handled requests will yield the same response as the first execution. - * - * Generated from protobuf field int64 seqno = 4 [(.google.api.field_behavior) = REQUIRED]; - * @param int|string $var - * @return $this - */ - public function setSeqno($var) - { - GPBUtil::checkInt64($var); - $this->seqno = $var; - - return $this; - } - - /** - * Common options for this request. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 5; - * @return \Google\Cloud\Spanner\V1\RequestOptions|null - */ - public function getRequestOptions() - { - return $this->request_options; - } - - public function hasRequestOptions() - { - return isset($this->request_options); - } - - public function clearRequestOptions() - { - unset($this->request_options); - } - - /** - * Common options for this request. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 5; - * @param \Google\Cloud\Spanner\V1\RequestOptions $var - * @return $this - */ - public function setRequestOptions($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\RequestOptions::class); - $this->request_options = $var; - - return $this; - } - - /** - * Optional. If set to true, this request marks the end of the transaction. - * The transaction should be committed or aborted after these statements - * execute, and attempts to execute any other requests against this - * transaction (including reads and queries) will be rejected. - * Setting this option may cause some error reporting to be deferred until - * commit time (e.g. validation of unique constraints). Given this, successful - * execution of statements should not be assumed until a subsequent Commit - * call completes successfully. - * - * Generated from protobuf field bool last_statements = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getLastStatements() - { - return $this->last_statements; - } - - /** - * Optional. If set to true, this request marks the end of the transaction. - * The transaction should be committed or aborted after these statements - * execute, and attempts to execute any other requests against this - * transaction (including reads and queries) will be rejected. - * Setting this option may cause some error reporting to be deferred until - * commit time (e.g. validation of unique constraints). Given this, successful - * execution of statements should not be assumed until a subsequent Commit - * call completes successfully. - * - * Generated from protobuf field bool last_statements = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setLastStatements($var) - { - GPBUtil::checkBool($var); - $this->last_statements = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlRequest/Statement.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlRequest/Statement.php deleted file mode 100644 index aba8c0bd42cd..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlRequest/Statement.php +++ /dev/null @@ -1,208 +0,0 @@ -google.spanner.v1.ExecuteBatchDmlRequest.Statement - */ -class Statement extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The DML string. - * - * Generated from protobuf field string sql = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $sql = ''; - /** - * Parameter names and values that bind to placeholders in the DML string. - * A parameter placeholder consists of the `@` character followed by the - * parameter name (for example, `@firstName`). Parameter names can contain - * letters, numbers, and underscores. - * Parameters can appear anywhere that a literal value is expected. The - * same parameter name can be used more than once, for example: - * `"WHERE id > @msg_id AND id < @msg_id + 100"` - * It is an error to execute a SQL statement with unbound parameters. - * - * Generated from protobuf field .google.protobuf.Struct params = 2; - */ - protected $params = null; - /** - * It is not always possible for Cloud Spanner to infer the right SQL type - * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in - * [params][google.spanner.v1.ExecuteBatchDmlRequest.Statement.params] as - * JSON strings. - * In these cases, `param_types` can be used to specify the exact - * SQL type for some or all of the SQL statement parameters. See the - * definition of [Type][google.spanner.v1.Type] for more information - * about SQL types. - * - * Generated from protobuf field map param_types = 3; - */ - private $param_types; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $sql - * Required. The DML string. - * @type \Google\Protobuf\Struct $params - * Parameter names and values that bind to placeholders in the DML string. - * A parameter placeholder consists of the `@` character followed by the - * parameter name (for example, `@firstName`). Parameter names can contain - * letters, numbers, and underscores. - * Parameters can appear anywhere that a literal value is expected. The - * same parameter name can be used more than once, for example: - * `"WHERE id > @msg_id AND id < @msg_id + 100"` - * It is an error to execute a SQL statement with unbound parameters. - * @type array|\Google\Protobuf\Internal\MapField $param_types - * It is not always possible for Cloud Spanner to infer the right SQL type - * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in - * [params][google.spanner.v1.ExecuteBatchDmlRequest.Statement.params] as - * JSON strings. - * In these cases, `param_types` can be used to specify the exact - * SQL type for some or all of the SQL statement parameters. See the - * definition of [Type][google.spanner.v1.Type] for more information - * about SQL types. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * Required. The DML string. - * - * Generated from protobuf field string sql = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getSql() - { - return $this->sql; - } - - /** - * Required. The DML string. - * - * Generated from protobuf field string sql = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setSql($var) - { - GPBUtil::checkString($var, True); - $this->sql = $var; - - return $this; - } - - /** - * Parameter names and values that bind to placeholders in the DML string. - * A parameter placeholder consists of the `@` character followed by the - * parameter name (for example, `@firstName`). Parameter names can contain - * letters, numbers, and underscores. - * Parameters can appear anywhere that a literal value is expected. The - * same parameter name can be used more than once, for example: - * `"WHERE id > @msg_id AND id < @msg_id + 100"` - * It is an error to execute a SQL statement with unbound parameters. - * - * Generated from protobuf field .google.protobuf.Struct params = 2; - * @return \Google\Protobuf\Struct|null - */ - public function getParams() - { - return $this->params; - } - - public function hasParams() - { - return isset($this->params); - } - - public function clearParams() - { - unset($this->params); - } - - /** - * Parameter names and values that bind to placeholders in the DML string. - * A parameter placeholder consists of the `@` character followed by the - * parameter name (for example, `@firstName`). Parameter names can contain - * letters, numbers, and underscores. - * Parameters can appear anywhere that a literal value is expected. The - * same parameter name can be used more than once, for example: - * `"WHERE id > @msg_id AND id < @msg_id + 100"` - * It is an error to execute a SQL statement with unbound parameters. - * - * Generated from protobuf field .google.protobuf.Struct params = 2; - * @param \Google\Protobuf\Struct $var - * @return $this - */ - public function setParams($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); - $this->params = $var; - - return $this; - } - - /** - * It is not always possible for Cloud Spanner to infer the right SQL type - * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in - * [params][google.spanner.v1.ExecuteBatchDmlRequest.Statement.params] as - * JSON strings. - * In these cases, `param_types` can be used to specify the exact - * SQL type for some or all of the SQL statement parameters. See the - * definition of [Type][google.spanner.v1.Type] for more information - * about SQL types. - * - * Generated from protobuf field map param_types = 3; - * @return \Google\Protobuf\Internal\MapField - */ - public function getParamTypes() - { - return $this->param_types; - } - - /** - * It is not always possible for Cloud Spanner to infer the right SQL type - * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in - * [params][google.spanner.v1.ExecuteBatchDmlRequest.Statement.params] as - * JSON strings. - * In these cases, `param_types` can be used to specify the exact - * SQL type for some or all of the SQL statement parameters. See the - * definition of [Type][google.spanner.v1.Type] for more information - * about SQL types. - * - * Generated from protobuf field map param_types = 3; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setParamTypes($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Type::class); - $this->param_types = $arr; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Statement::class, \Google\Cloud\Spanner\V1\ExecuteBatchDmlRequest_Statement::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlResponse.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlResponse.php deleted file mode 100644 index af904f7019f8..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlResponse.php +++ /dev/null @@ -1,235 +0,0 @@ -google.spanner.v1.ExecuteBatchDmlResponse - */ -class ExecuteBatchDmlResponse extends \Google\Protobuf\Internal\Message -{ - /** - * One [ResultSet][google.spanner.v1.ResultSet] for each statement in the - * request that ran successfully, in the same order as the statements in the - * request. Each [ResultSet][google.spanner.v1.ResultSet] does not contain any - * rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each - * [ResultSet][google.spanner.v1.ResultSet] contain the number of rows - * modified by the statement. - * Only the first [ResultSet][google.spanner.v1.ResultSet] in the response - * contains valid [ResultSetMetadata][google.spanner.v1.ResultSetMetadata]. - * - * Generated from protobuf field repeated .google.spanner.v1.ResultSet result_sets = 1; - */ - private $result_sets; - /** - * If all DML statements are executed successfully, the status is `OK`. - * Otherwise, the error status of the first failed statement. - * - * Generated from protobuf field .google.rpc.Status status = 2; - */ - protected $status = null; - /** - * Optional. A precommit token will be included if the read-write transaction - * is on a multiplexed session. - * The precommit token with the highest sequence number from this transaction - * attempt should be passed to the - * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $precommit_token = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Spanner\V1\ResultSet>|\Google\Protobuf\Internal\RepeatedField $result_sets - * One [ResultSet][google.spanner.v1.ResultSet] for each statement in the - * request that ran successfully, in the same order as the statements in the - * request. Each [ResultSet][google.spanner.v1.ResultSet] does not contain any - * rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each - * [ResultSet][google.spanner.v1.ResultSet] contain the number of rows - * modified by the statement. - * Only the first [ResultSet][google.spanner.v1.ResultSet] in the response - * contains valid [ResultSetMetadata][google.spanner.v1.ResultSetMetadata]. - * @type \Google\Rpc\Status $status - * If all DML statements are executed successfully, the status is `OK`. - * Otherwise, the error status of the first failed statement. - * @type \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $precommit_token - * Optional. A precommit token will be included if the read-write transaction - * is on a multiplexed session. - * The precommit token with the highest sequence number from this transaction - * attempt should be passed to the - * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * One [ResultSet][google.spanner.v1.ResultSet] for each statement in the - * request that ran successfully, in the same order as the statements in the - * request. Each [ResultSet][google.spanner.v1.ResultSet] does not contain any - * rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each - * [ResultSet][google.spanner.v1.ResultSet] contain the number of rows - * modified by the statement. - * Only the first [ResultSet][google.spanner.v1.ResultSet] in the response - * contains valid [ResultSetMetadata][google.spanner.v1.ResultSetMetadata]. - * - * Generated from protobuf field repeated .google.spanner.v1.ResultSet result_sets = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getResultSets() - { - return $this->result_sets; - } - - /** - * One [ResultSet][google.spanner.v1.ResultSet] for each statement in the - * request that ran successfully, in the same order as the statements in the - * request. Each [ResultSet][google.spanner.v1.ResultSet] does not contain any - * rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each - * [ResultSet][google.spanner.v1.ResultSet] contain the number of rows - * modified by the statement. - * Only the first [ResultSet][google.spanner.v1.ResultSet] in the response - * contains valid [ResultSetMetadata][google.spanner.v1.ResultSetMetadata]. - * - * Generated from protobuf field repeated .google.spanner.v1.ResultSet result_sets = 1; - * @param array<\Google\Cloud\Spanner\V1\ResultSet>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setResultSets($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\ResultSet::class); - $this->result_sets = $arr; - - return $this; - } - - /** - * If all DML statements are executed successfully, the status is `OK`. - * Otherwise, the error status of the first failed statement. - * - * Generated from protobuf field .google.rpc.Status status = 2; - * @return \Google\Rpc\Status|null - */ - public function getStatus() - { - return $this->status; - } - - public function hasStatus() - { - return isset($this->status); - } - - public function clearStatus() - { - unset($this->status); - } - - /** - * If all DML statements are executed successfully, the status is `OK`. - * Otherwise, the error status of the first failed statement. - * - * Generated from protobuf field .google.rpc.Status status = 2; - * @param \Google\Rpc\Status $var - * @return $this - */ - public function setStatus($var) - { - GPBUtil::checkMessage($var, \Google\Rpc\Status::class); - $this->status = $var; - - return $this; - } - - /** - * Optional. A precommit token will be included if the read-write transaction - * is on a multiplexed session. - * The precommit token with the highest sequence number from this transaction - * attempt should be passed to the - * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken|null - */ - public function getPrecommitToken() - { - return $this->precommit_token; - } - - public function hasPrecommitToken() - { - return isset($this->precommit_token); - } - - public function clearPrecommitToken() - { - unset($this->precommit_token); - } - - /** - * Optional. A precommit token will be included if the read-write transaction - * is on a multiplexed session. - * The precommit token with the highest sequence number from this transaction - * attempt should be passed to the - * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $var - * @return $this - */ - public function setPrecommitToken($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken::class); - $this->precommit_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest.php deleted file mode 100644 index 6733a35ca0b9..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest.php +++ /dev/null @@ -1,764 +0,0 @@ -google.spanner.v1.ExecuteSqlRequest - */ -class ExecuteSqlRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The session in which the SQL query should be performed. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $session = ''; - /** - * The transaction to use. - * For queries, if none is provided, the default is a temporary read-only - * transaction with strong concurrency. - * Standard DML statements require a read-write transaction. To protect - * against replays, single-use transactions are not supported. The caller - * must either supply an existing transaction ID or begin a new transaction. - * Partitioned DML requires an existing Partitioned DML transaction ID. - * - * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; - */ - protected $transaction = null; - /** - * Required. The SQL string. - * - * Generated from protobuf field string sql = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $sql = ''; - /** - * Parameter names and values that bind to placeholders in the SQL string. - * A parameter placeholder consists of the `@` character followed by the - * parameter name (for example, `@firstName`). Parameter names must conform - * to the naming requirements of identifiers as specified at - * https://cloud.google.com/spanner/docs/lexical#identifiers. - * Parameters can appear anywhere that a literal value is expected. The same - * parameter name can be used more than once, for example: - * `"WHERE id > @msg_id AND id < @msg_id + 100"` - * It is an error to execute a SQL statement with unbound parameters. - * - * Generated from protobuf field .google.protobuf.Struct params = 4; - */ - protected $params = null; - /** - * It is not always possible for Cloud Spanner to infer the right SQL type - * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in - * [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings. - * In these cases, `param_types` can be used to specify the exact - * SQL type for some or all of the SQL statement parameters. See the - * definition of [Type][google.spanner.v1.Type] for more information - * about SQL types. - * - * Generated from protobuf field map param_types = 5; - */ - private $param_types; - /** - * If this request is resuming a previously interrupted SQL statement - * execution, `resume_token` should be copied from the last - * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the - * interruption. Doing this enables the new SQL statement execution to resume - * where the last one left off. The rest of the request parameters must - * exactly match the request that yielded this token. - * - * Generated from protobuf field bytes resume_token = 6; - */ - protected $resume_token = ''; - /** - * Used to control the amount of debugging information returned in - * [ResultSetStats][google.spanner.v1.ResultSetStats]. If - * [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is - * set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only - * be set to - * [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL]. - * - * Generated from protobuf field .google.spanner.v1.ExecuteSqlRequest.QueryMode query_mode = 7; - */ - protected $query_mode = 0; - /** - * If present, results will be restricted to the specified partition - * previously created using PartitionQuery(). There must be an exact - * match for the values of fields common to this message and the - * PartitionQueryRequest message used to create this partition_token. - * - * Generated from protobuf field bytes partition_token = 8; - */ - protected $partition_token = ''; - /** - * A per-transaction sequence number used to identify this request. This field - * makes each request idempotent such that if the request is received multiple - * times, at most one will succeed. - * The sequence number must be monotonically increasing within the - * transaction. If a request arrives for the first time with an out-of-order - * sequence number, the transaction may be aborted. Replays of previously - * handled requests will yield the same response as the first execution. - * Required for DML statements. Ignored for queries. - * - * Generated from protobuf field int64 seqno = 9; - */ - protected $seqno = 0; - /** - * Query optimizer configuration to use for the given query. - * - * Generated from protobuf field .google.spanner.v1.ExecuteSqlRequest.QueryOptions query_options = 10; - */ - protected $query_options = null; - /** - * Common options for this request. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 11; - */ - protected $request_options = null; - /** - * Directed read options for this request. - * - * Generated from protobuf field .google.spanner.v1.DirectedReadOptions directed_read_options = 15; - */ - protected $directed_read_options = null; - /** - * If this is for a partitioned query and this field is set to `true`, the - * request is executed with Spanner Data Boost independent compute resources. - * If the field is set to `true` but the request does not set - * `partition_token`, the API returns an `INVALID_ARGUMENT` error. - * - * Generated from protobuf field bool data_boost_enabled = 16; - */ - protected $data_boost_enabled = false; - /** - * Optional. If set to true, this statement marks the end of the transaction. - * The transaction should be committed or aborted after this statement - * executes, and attempts to execute any other requests against this - * transaction (including reads and queries) will be rejected. - * For DML statements, setting this option may cause some error reporting to - * be deferred until commit time (e.g. validation of unique constraints). - * Given this, successful execution of a DML statement should not be assumed - * until a subsequent Commit call completes successfully. - * - * Generated from protobuf field bool last_statement = 17 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $last_statement = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $session - * Required. The session in which the SQL query should be performed. - * @type \Google\Cloud\Spanner\V1\TransactionSelector $transaction - * The transaction to use. - * For queries, if none is provided, the default is a temporary read-only - * transaction with strong concurrency. - * Standard DML statements require a read-write transaction. To protect - * against replays, single-use transactions are not supported. The caller - * must either supply an existing transaction ID or begin a new transaction. - * Partitioned DML requires an existing Partitioned DML transaction ID. - * @type string $sql - * Required. The SQL string. - * @type \Google\Protobuf\Struct $params - * Parameter names and values that bind to placeholders in the SQL string. - * A parameter placeholder consists of the `@` character followed by the - * parameter name (for example, `@firstName`). Parameter names must conform - * to the naming requirements of identifiers as specified at - * https://cloud.google.com/spanner/docs/lexical#identifiers. - * Parameters can appear anywhere that a literal value is expected. The same - * parameter name can be used more than once, for example: - * `"WHERE id > @msg_id AND id < @msg_id + 100"` - * It is an error to execute a SQL statement with unbound parameters. - * @type array|\Google\Protobuf\Internal\MapField $param_types - * It is not always possible for Cloud Spanner to infer the right SQL type - * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in - * [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings. - * In these cases, `param_types` can be used to specify the exact - * SQL type for some or all of the SQL statement parameters. See the - * definition of [Type][google.spanner.v1.Type] for more information - * about SQL types. - * @type string $resume_token - * If this request is resuming a previously interrupted SQL statement - * execution, `resume_token` should be copied from the last - * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the - * interruption. Doing this enables the new SQL statement execution to resume - * where the last one left off. The rest of the request parameters must - * exactly match the request that yielded this token. - * @type int $query_mode - * Used to control the amount of debugging information returned in - * [ResultSetStats][google.spanner.v1.ResultSetStats]. If - * [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is - * set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only - * be set to - * [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL]. - * @type string $partition_token - * If present, results will be restricted to the specified partition - * previously created using PartitionQuery(). There must be an exact - * match for the values of fields common to this message and the - * PartitionQueryRequest message used to create this partition_token. - * @type int|string $seqno - * A per-transaction sequence number used to identify this request. This field - * makes each request idempotent such that if the request is received multiple - * times, at most one will succeed. - * The sequence number must be monotonically increasing within the - * transaction. If a request arrives for the first time with an out-of-order - * sequence number, the transaction may be aborted. Replays of previously - * handled requests will yield the same response as the first execution. - * Required for DML statements. Ignored for queries. - * @type \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryOptions $query_options - * Query optimizer configuration to use for the given query. - * @type \Google\Cloud\Spanner\V1\RequestOptions $request_options - * Common options for this request. - * @type \Google\Cloud\Spanner\V1\DirectedReadOptions $directed_read_options - * Directed read options for this request. - * @type bool $data_boost_enabled - * If this is for a partitioned query and this field is set to `true`, the - * request is executed with Spanner Data Boost independent compute resources. - * If the field is set to `true` but the request does not set - * `partition_token`, the API returns an `INVALID_ARGUMENT` error. - * @type bool $last_statement - * Optional. If set to true, this statement marks the end of the transaction. - * The transaction should be committed or aborted after this statement - * executes, and attempts to execute any other requests against this - * transaction (including reads and queries) will be rejected. - * For DML statements, setting this option may cause some error reporting to - * be deferred until commit time (e.g. validation of unique constraints). - * Given this, successful execution of a DML statement should not be assumed - * until a subsequent Commit call completes successfully. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * Required. The session in which the SQL query should be performed. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSession() - { - return $this->session; - } - - /** - * Required. The session in which the SQL query should be performed. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSession($var) - { - GPBUtil::checkString($var, True); - $this->session = $var; - - return $this; - } - - /** - * The transaction to use. - * For queries, if none is provided, the default is a temporary read-only - * transaction with strong concurrency. - * Standard DML statements require a read-write transaction. To protect - * against replays, single-use transactions are not supported. The caller - * must either supply an existing transaction ID or begin a new transaction. - * Partitioned DML requires an existing Partitioned DML transaction ID. - * - * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; - * @return \Google\Cloud\Spanner\V1\TransactionSelector|null - */ - public function getTransaction() - { - return $this->transaction; - } - - public function hasTransaction() - { - return isset($this->transaction); - } - - public function clearTransaction() - { - unset($this->transaction); - } - - /** - * The transaction to use. - * For queries, if none is provided, the default is a temporary read-only - * transaction with strong concurrency. - * Standard DML statements require a read-write transaction. To protect - * against replays, single-use transactions are not supported. The caller - * must either supply an existing transaction ID or begin a new transaction. - * Partitioned DML requires an existing Partitioned DML transaction ID. - * - * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; - * @param \Google\Cloud\Spanner\V1\TransactionSelector $var - * @return $this - */ - public function setTransaction($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionSelector::class); - $this->transaction = $var; - - return $this; - } - - /** - * Required. The SQL string. - * - * Generated from protobuf field string sql = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getSql() - { - return $this->sql; - } - - /** - * Required. The SQL string. - * - * Generated from protobuf field string sql = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setSql($var) - { - GPBUtil::checkString($var, True); - $this->sql = $var; - - return $this; - } - - /** - * Parameter names and values that bind to placeholders in the SQL string. - * A parameter placeholder consists of the `@` character followed by the - * parameter name (for example, `@firstName`). Parameter names must conform - * to the naming requirements of identifiers as specified at - * https://cloud.google.com/spanner/docs/lexical#identifiers. - * Parameters can appear anywhere that a literal value is expected. The same - * parameter name can be used more than once, for example: - * `"WHERE id > @msg_id AND id < @msg_id + 100"` - * It is an error to execute a SQL statement with unbound parameters. - * - * Generated from protobuf field .google.protobuf.Struct params = 4; - * @return \Google\Protobuf\Struct|null - */ - public function getParams() - { - return $this->params; - } - - public function hasParams() - { - return isset($this->params); - } - - public function clearParams() - { - unset($this->params); - } - - /** - * Parameter names and values that bind to placeholders in the SQL string. - * A parameter placeholder consists of the `@` character followed by the - * parameter name (for example, `@firstName`). Parameter names must conform - * to the naming requirements of identifiers as specified at - * https://cloud.google.com/spanner/docs/lexical#identifiers. - * Parameters can appear anywhere that a literal value is expected. The same - * parameter name can be used more than once, for example: - * `"WHERE id > @msg_id AND id < @msg_id + 100"` - * It is an error to execute a SQL statement with unbound parameters. - * - * Generated from protobuf field .google.protobuf.Struct params = 4; - * @param \Google\Protobuf\Struct $var - * @return $this - */ - public function setParams($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); - $this->params = $var; - - return $this; - } - - /** - * It is not always possible for Cloud Spanner to infer the right SQL type - * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in - * [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings. - * In these cases, `param_types` can be used to specify the exact - * SQL type for some or all of the SQL statement parameters. See the - * definition of [Type][google.spanner.v1.Type] for more information - * about SQL types. - * - * Generated from protobuf field map param_types = 5; - * @return \Google\Protobuf\Internal\MapField - */ - public function getParamTypes() - { - return $this->param_types; - } - - /** - * It is not always possible for Cloud Spanner to infer the right SQL type - * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in - * [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings. - * In these cases, `param_types` can be used to specify the exact - * SQL type for some or all of the SQL statement parameters. See the - * definition of [Type][google.spanner.v1.Type] for more information - * about SQL types. - * - * Generated from protobuf field map param_types = 5; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setParamTypes($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Type::class); - $this->param_types = $arr; - - return $this; - } - - /** - * If this request is resuming a previously interrupted SQL statement - * execution, `resume_token` should be copied from the last - * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the - * interruption. Doing this enables the new SQL statement execution to resume - * where the last one left off. The rest of the request parameters must - * exactly match the request that yielded this token. - * - * Generated from protobuf field bytes resume_token = 6; - * @return string - */ - public function getResumeToken() - { - return $this->resume_token; - } - - /** - * If this request is resuming a previously interrupted SQL statement - * execution, `resume_token` should be copied from the last - * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the - * interruption. Doing this enables the new SQL statement execution to resume - * where the last one left off. The rest of the request parameters must - * exactly match the request that yielded this token. - * - * Generated from protobuf field bytes resume_token = 6; - * @param string $var - * @return $this - */ - public function setResumeToken($var) - { - GPBUtil::checkString($var, False); - $this->resume_token = $var; - - return $this; - } - - /** - * Used to control the amount of debugging information returned in - * [ResultSetStats][google.spanner.v1.ResultSetStats]. If - * [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is - * set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only - * be set to - * [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL]. - * - * Generated from protobuf field .google.spanner.v1.ExecuteSqlRequest.QueryMode query_mode = 7; - * @return int - */ - public function getQueryMode() - { - return $this->query_mode; - } - - /** - * Used to control the amount of debugging information returned in - * [ResultSetStats][google.spanner.v1.ResultSetStats]. If - * [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is - * set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only - * be set to - * [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL]. - * - * Generated from protobuf field .google.spanner.v1.ExecuteSqlRequest.QueryMode query_mode = 7; - * @param int $var - * @return $this - */ - public function setQueryMode($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryMode::class); - $this->query_mode = $var; - - return $this; - } - - /** - * If present, results will be restricted to the specified partition - * previously created using PartitionQuery(). There must be an exact - * match for the values of fields common to this message and the - * PartitionQueryRequest message used to create this partition_token. - * - * Generated from protobuf field bytes partition_token = 8; - * @return string - */ - public function getPartitionToken() - { - return $this->partition_token; - } - - /** - * If present, results will be restricted to the specified partition - * previously created using PartitionQuery(). There must be an exact - * match for the values of fields common to this message and the - * PartitionQueryRequest message used to create this partition_token. - * - * Generated from protobuf field bytes partition_token = 8; - * @param string $var - * @return $this - */ - public function setPartitionToken($var) - { - GPBUtil::checkString($var, False); - $this->partition_token = $var; - - return $this; - } - - /** - * A per-transaction sequence number used to identify this request. This field - * makes each request idempotent such that if the request is received multiple - * times, at most one will succeed. - * The sequence number must be monotonically increasing within the - * transaction. If a request arrives for the first time with an out-of-order - * sequence number, the transaction may be aborted. Replays of previously - * handled requests will yield the same response as the first execution. - * Required for DML statements. Ignored for queries. - * - * Generated from protobuf field int64 seqno = 9; - * @return int|string - */ - public function getSeqno() - { - return $this->seqno; - } - - /** - * A per-transaction sequence number used to identify this request. This field - * makes each request idempotent such that if the request is received multiple - * times, at most one will succeed. - * The sequence number must be monotonically increasing within the - * transaction. If a request arrives for the first time with an out-of-order - * sequence number, the transaction may be aborted. Replays of previously - * handled requests will yield the same response as the first execution. - * Required for DML statements. Ignored for queries. - * - * Generated from protobuf field int64 seqno = 9; - * @param int|string $var - * @return $this - */ - public function setSeqno($var) - { - GPBUtil::checkInt64($var); - $this->seqno = $var; - - return $this; - } - - /** - * Query optimizer configuration to use for the given query. - * - * Generated from protobuf field .google.spanner.v1.ExecuteSqlRequest.QueryOptions query_options = 10; - * @return \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryOptions|null - */ - public function getQueryOptions() - { - return $this->query_options; - } - - public function hasQueryOptions() - { - return isset($this->query_options); - } - - public function clearQueryOptions() - { - unset($this->query_options); - } - - /** - * Query optimizer configuration to use for the given query. - * - * Generated from protobuf field .google.spanner.v1.ExecuteSqlRequest.QueryOptions query_options = 10; - * @param \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryOptions $var - * @return $this - */ - public function setQueryOptions($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryOptions::class); - $this->query_options = $var; - - return $this; - } - - /** - * Common options for this request. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 11; - * @return \Google\Cloud\Spanner\V1\RequestOptions|null - */ - public function getRequestOptions() - { - return $this->request_options; - } - - public function hasRequestOptions() - { - return isset($this->request_options); - } - - public function clearRequestOptions() - { - unset($this->request_options); - } - - /** - * Common options for this request. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 11; - * @param \Google\Cloud\Spanner\V1\RequestOptions $var - * @return $this - */ - public function setRequestOptions($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\RequestOptions::class); - $this->request_options = $var; - - return $this; - } - - /** - * Directed read options for this request. - * - * Generated from protobuf field .google.spanner.v1.DirectedReadOptions directed_read_options = 15; - * @return \Google\Cloud\Spanner\V1\DirectedReadOptions|null - */ - public function getDirectedReadOptions() - { - return $this->directed_read_options; - } - - public function hasDirectedReadOptions() - { - return isset($this->directed_read_options); - } - - public function clearDirectedReadOptions() - { - unset($this->directed_read_options); - } - - /** - * Directed read options for this request. - * - * Generated from protobuf field .google.spanner.v1.DirectedReadOptions directed_read_options = 15; - * @param \Google\Cloud\Spanner\V1\DirectedReadOptions $var - * @return $this - */ - public function setDirectedReadOptions($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\DirectedReadOptions::class); - $this->directed_read_options = $var; - - return $this; - } - - /** - * If this is for a partitioned query and this field is set to `true`, the - * request is executed with Spanner Data Boost independent compute resources. - * If the field is set to `true` but the request does not set - * `partition_token`, the API returns an `INVALID_ARGUMENT` error. - * - * Generated from protobuf field bool data_boost_enabled = 16; - * @return bool - */ - public function getDataBoostEnabled() - { - return $this->data_boost_enabled; - } - - /** - * If this is for a partitioned query and this field is set to `true`, the - * request is executed with Spanner Data Boost independent compute resources. - * If the field is set to `true` but the request does not set - * `partition_token`, the API returns an `INVALID_ARGUMENT` error. - * - * Generated from protobuf field bool data_boost_enabled = 16; - * @param bool $var - * @return $this - */ - public function setDataBoostEnabled($var) - { - GPBUtil::checkBool($var); - $this->data_boost_enabled = $var; - - return $this; - } - - /** - * Optional. If set to true, this statement marks the end of the transaction. - * The transaction should be committed or aborted after this statement - * executes, and attempts to execute any other requests against this - * transaction (including reads and queries) will be rejected. - * For DML statements, setting this option may cause some error reporting to - * be deferred until commit time (e.g. validation of unique constraints). - * Given this, successful execution of a DML statement should not be assumed - * until a subsequent Commit call completes successfully. - * - * Generated from protobuf field bool last_statement = 17 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getLastStatement() - { - return $this->last_statement; - } - - /** - * Optional. If set to true, this statement marks the end of the transaction. - * The transaction should be committed or aborted after this statement - * executes, and attempts to execute any other requests against this - * transaction (including reads and queries) will be rejected. - * For DML statements, setting this option may cause some error reporting to - * be deferred until commit time (e.g. validation of unique constraints). - * Given this, successful execution of a DML statement should not be assumed - * until a subsequent Commit call completes successfully. - * - * Generated from protobuf field bool last_statement = 17 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setLastStatement($var) - { - GPBUtil::checkBool($var); - $this->last_statement = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest/QueryMode.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest/QueryMode.php deleted file mode 100644 index 43c3ed48f97b..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest/QueryMode.php +++ /dev/null @@ -1,84 +0,0 @@ -google.spanner.v1.ExecuteSqlRequest.QueryMode - */ -class QueryMode -{ - /** - * The default mode. Only the statement results are returned. - * - * Generated from protobuf enum NORMAL = 0; - */ - const NORMAL = 0; - /** - * This mode returns only the query plan, without any results or - * execution statistics information. - * - * Generated from protobuf enum PLAN = 1; - */ - const PLAN = 1; - /** - * This mode returns the query plan, overall execution statistics, - * operator level execution statistics along with the results. This has a - * performance overhead compared to the other modes. It is not recommended - * to use this mode for production traffic. - * - * Generated from protobuf enum PROFILE = 2; - */ - const PROFILE = 2; - /** - * This mode returns the overall (but not operator-level) execution - * statistics along with the results. - * - * Generated from protobuf enum WITH_STATS = 3; - */ - const WITH_STATS = 3; - /** - * This mode returns the query plan, overall (but not operator-level) - * execution statistics along with the results. - * - * Generated from protobuf enum WITH_PLAN_AND_STATS = 4; - */ - const WITH_PLAN_AND_STATS = 4; - - private static $valueToName = [ - self::NORMAL => 'NORMAL', - self::PLAN => 'PLAN', - self::PROFILE => 'PROFILE', - self::WITH_STATS => 'WITH_STATS', - self::WITH_PLAN_AND_STATS => 'WITH_PLAN_AND_STATS', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(QueryMode::class, \Google\Cloud\Spanner\V1\ExecuteSqlRequest_QueryMode::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest/QueryOptions.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest/QueryOptions.php deleted file mode 100644 index d821f6f3bbef..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest/QueryOptions.php +++ /dev/null @@ -1,232 +0,0 @@ -google.spanner.v1.ExecuteSqlRequest.QueryOptions - */ -class QueryOptions extends \Google\Protobuf\Internal\Message -{ - /** - * An option to control the selection of optimizer version. - * This parameter allows individual queries to pick different query - * optimizer versions. - * Specifying `latest` as a value instructs Cloud Spanner to use the - * latest supported query optimizer version. If not specified, Cloud Spanner - * uses the optimizer version set at the database level options. Any other - * positive integer (from the list of supported optimizer versions) - * overrides the default optimizer version for query execution. - * The list of supported optimizer versions can be queried from - * SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS. - * Executing a SQL statement with an invalid optimizer version fails with - * an `INVALID_ARGUMENT` error. - * See - * https://cloud.google.com/spanner/docs/query-optimizer/manage-query-optimizer - * for more information on managing the query optimizer. - * The `optimizer_version` statement hint has precedence over this setting. - * - * Generated from protobuf field string optimizer_version = 1; - */ - protected $optimizer_version = ''; - /** - * An option to control the selection of optimizer statistics package. - * This parameter allows individual queries to use a different query - * optimizer statistics package. - * Specifying `latest` as a value instructs Cloud Spanner to use the latest - * generated statistics package. If not specified, Cloud Spanner uses - * the statistics package set at the database level options, or the latest - * package if the database option is not set. - * The statistics package requested by the query has to be exempt from - * garbage collection. This can be achieved with the following DDL - * statement: - * ``` - * ALTER STATISTICS SET OPTIONS (allow_gc=false) - * ``` - * The list of available statistics packages can be queried from - * `INFORMATION_SCHEMA.SPANNER_STATISTICS`. - * Executing a SQL statement with an invalid optimizer statistics package - * or with a statistics package that allows garbage collection fails with - * an `INVALID_ARGUMENT` error. - * - * Generated from protobuf field string optimizer_statistics_package = 2; - */ - protected $optimizer_statistics_package = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $optimizer_version - * An option to control the selection of optimizer version. - * This parameter allows individual queries to pick different query - * optimizer versions. - * Specifying `latest` as a value instructs Cloud Spanner to use the - * latest supported query optimizer version. If not specified, Cloud Spanner - * uses the optimizer version set at the database level options. Any other - * positive integer (from the list of supported optimizer versions) - * overrides the default optimizer version for query execution. - * The list of supported optimizer versions can be queried from - * SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS. - * Executing a SQL statement with an invalid optimizer version fails with - * an `INVALID_ARGUMENT` error. - * See - * https://cloud.google.com/spanner/docs/query-optimizer/manage-query-optimizer - * for more information on managing the query optimizer. - * The `optimizer_version` statement hint has precedence over this setting. - * @type string $optimizer_statistics_package - * An option to control the selection of optimizer statistics package. - * This parameter allows individual queries to use a different query - * optimizer statistics package. - * Specifying `latest` as a value instructs Cloud Spanner to use the latest - * generated statistics package. If not specified, Cloud Spanner uses - * the statistics package set at the database level options, or the latest - * package if the database option is not set. - * The statistics package requested by the query has to be exempt from - * garbage collection. This can be achieved with the following DDL - * statement: - * ``` - * ALTER STATISTICS SET OPTIONS (allow_gc=false) - * ``` - * The list of available statistics packages can be queried from - * `INFORMATION_SCHEMA.SPANNER_STATISTICS`. - * Executing a SQL statement with an invalid optimizer statistics package - * or with a statistics package that allows garbage collection fails with - * an `INVALID_ARGUMENT` error. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * An option to control the selection of optimizer version. - * This parameter allows individual queries to pick different query - * optimizer versions. - * Specifying `latest` as a value instructs Cloud Spanner to use the - * latest supported query optimizer version. If not specified, Cloud Spanner - * uses the optimizer version set at the database level options. Any other - * positive integer (from the list of supported optimizer versions) - * overrides the default optimizer version for query execution. - * The list of supported optimizer versions can be queried from - * SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS. - * Executing a SQL statement with an invalid optimizer version fails with - * an `INVALID_ARGUMENT` error. - * See - * https://cloud.google.com/spanner/docs/query-optimizer/manage-query-optimizer - * for more information on managing the query optimizer. - * The `optimizer_version` statement hint has precedence over this setting. - * - * Generated from protobuf field string optimizer_version = 1; - * @return string - */ - public function getOptimizerVersion() - { - return $this->optimizer_version; - } - - /** - * An option to control the selection of optimizer version. - * This parameter allows individual queries to pick different query - * optimizer versions. - * Specifying `latest` as a value instructs Cloud Spanner to use the - * latest supported query optimizer version. If not specified, Cloud Spanner - * uses the optimizer version set at the database level options. Any other - * positive integer (from the list of supported optimizer versions) - * overrides the default optimizer version for query execution. - * The list of supported optimizer versions can be queried from - * SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS. - * Executing a SQL statement with an invalid optimizer version fails with - * an `INVALID_ARGUMENT` error. - * See - * https://cloud.google.com/spanner/docs/query-optimizer/manage-query-optimizer - * for more information on managing the query optimizer. - * The `optimizer_version` statement hint has precedence over this setting. - * - * Generated from protobuf field string optimizer_version = 1; - * @param string $var - * @return $this - */ - public function setOptimizerVersion($var) - { - GPBUtil::checkString($var, True); - $this->optimizer_version = $var; - - return $this; - } - - /** - * An option to control the selection of optimizer statistics package. - * This parameter allows individual queries to use a different query - * optimizer statistics package. - * Specifying `latest` as a value instructs Cloud Spanner to use the latest - * generated statistics package. If not specified, Cloud Spanner uses - * the statistics package set at the database level options, or the latest - * package if the database option is not set. - * The statistics package requested by the query has to be exempt from - * garbage collection. This can be achieved with the following DDL - * statement: - * ``` - * ALTER STATISTICS SET OPTIONS (allow_gc=false) - * ``` - * The list of available statistics packages can be queried from - * `INFORMATION_SCHEMA.SPANNER_STATISTICS`. - * Executing a SQL statement with an invalid optimizer statistics package - * or with a statistics package that allows garbage collection fails with - * an `INVALID_ARGUMENT` error. - * - * Generated from protobuf field string optimizer_statistics_package = 2; - * @return string - */ - public function getOptimizerStatisticsPackage() - { - return $this->optimizer_statistics_package; - } - - /** - * An option to control the selection of optimizer statistics package. - * This parameter allows individual queries to use a different query - * optimizer statistics package. - * Specifying `latest` as a value instructs Cloud Spanner to use the latest - * generated statistics package. If not specified, Cloud Spanner uses - * the statistics package set at the database level options, or the latest - * package if the database option is not set. - * The statistics package requested by the query has to be exempt from - * garbage collection. This can be achieved with the following DDL - * statement: - * ``` - * ALTER STATISTICS SET OPTIONS (allow_gc=false) - * ``` - * The list of available statistics packages can be queried from - * `INFORMATION_SCHEMA.SPANNER_STATISTICS`. - * Executing a SQL statement with an invalid optimizer statistics package - * or with a statistics package that allows garbage collection fails with - * an `INVALID_ARGUMENT` error. - * - * Generated from protobuf field string optimizer_statistics_package = 2; - * @param string $var - * @return $this - */ - public function setOptimizerStatisticsPackage($var) - { - GPBUtil::checkString($var, True); - $this->optimizer_statistics_package = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(QueryOptions::class, \Google\Cloud\Spanner\V1\ExecuteSqlRequest_QueryOptions::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/GetSessionRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/GetSessionRequest.php deleted file mode 100644 index 3e1ca94c5883..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/GetSessionRequest.php +++ /dev/null @@ -1,81 +0,0 @@ -google.spanner.v1.GetSessionRequest - */ -class GetSessionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The name of the session to retrieve. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $name = ''; - - /** - * @param string $name Required. The name of the session to retrieve. Please see - * {@see SpannerClient::sessionName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\V1\GetSessionRequest - * - * @experimental - */ - public static function build(string $name): self - { - return (new self()) - ->setName($name); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. The name of the session to retrieve. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * Required. The name of the session to retrieve. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Required. The name of the session to retrieve. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/KeyRange.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/KeyRange.php deleted file mode 100644 index 4b65e7b846ef..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/KeyRange.php +++ /dev/null @@ -1,255 +0,0 @@ -google.spanner.v1.KeyRange - */ -class KeyRange extends \Google\Protobuf\Internal\Message -{ - protected $start_key_type; - protected $end_key_type; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Protobuf\ListValue $start_closed - * If the start is closed, then the range includes all rows whose - * first `len(start_closed)` key columns exactly match `start_closed`. - * @type \Google\Protobuf\ListValue $start_open - * If the start is open, then the range excludes rows whose first - * `len(start_open)` key columns exactly match `start_open`. - * @type \Google\Protobuf\ListValue $end_closed - * If the end is closed, then the range includes all rows whose - * first `len(end_closed)` key columns exactly match `end_closed`. - * @type \Google\Protobuf\ListValue $end_open - * If the end is open, then the range excludes rows whose first - * `len(end_open)` key columns exactly match `end_open`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Keys::initOnce(); - parent::__construct($data); - } - - /** - * If the start is closed, then the range includes all rows whose - * first `len(start_closed)` key columns exactly match `start_closed`. - * - * Generated from protobuf field .google.protobuf.ListValue start_closed = 1; - * @return \Google\Protobuf\ListValue|null - */ - public function getStartClosed() - { - return $this->readOneof(1); - } - - public function hasStartClosed() - { - return $this->hasOneof(1); - } - - /** - * If the start is closed, then the range includes all rows whose - * first `len(start_closed)` key columns exactly match `start_closed`. - * - * Generated from protobuf field .google.protobuf.ListValue start_closed = 1; - * @param \Google\Protobuf\ListValue $var - * @return $this - */ - public function setStartClosed($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\ListValue::class); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * If the start is open, then the range excludes rows whose first - * `len(start_open)` key columns exactly match `start_open`. - * - * Generated from protobuf field .google.protobuf.ListValue start_open = 2; - * @return \Google\Protobuf\ListValue|null - */ - public function getStartOpen() - { - return $this->readOneof(2); - } - - public function hasStartOpen() - { - return $this->hasOneof(2); - } - - /** - * If the start is open, then the range excludes rows whose first - * `len(start_open)` key columns exactly match `start_open`. - * - * Generated from protobuf field .google.protobuf.ListValue start_open = 2; - * @param \Google\Protobuf\ListValue $var - * @return $this - */ - public function setStartOpen($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\ListValue::class); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * If the end is closed, then the range includes all rows whose - * first `len(end_closed)` key columns exactly match `end_closed`. - * - * Generated from protobuf field .google.protobuf.ListValue end_closed = 3; - * @return \Google\Protobuf\ListValue|null - */ - public function getEndClosed() - { - return $this->readOneof(3); - } - - public function hasEndClosed() - { - return $this->hasOneof(3); - } - - /** - * If the end is closed, then the range includes all rows whose - * first `len(end_closed)` key columns exactly match `end_closed`. - * - * Generated from protobuf field .google.protobuf.ListValue end_closed = 3; - * @param \Google\Protobuf\ListValue $var - * @return $this - */ - public function setEndClosed($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\ListValue::class); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * If the end is open, then the range excludes rows whose first - * `len(end_open)` key columns exactly match `end_open`. - * - * Generated from protobuf field .google.protobuf.ListValue end_open = 4; - * @return \Google\Protobuf\ListValue|null - */ - public function getEndOpen() - { - return $this->readOneof(4); - } - - public function hasEndOpen() - { - return $this->hasOneof(4); - } - - /** - * If the end is open, then the range excludes rows whose first - * `len(end_open)` key columns exactly match `end_open`. - * - * Generated from protobuf field .google.protobuf.ListValue end_open = 4; - * @param \Google\Protobuf\ListValue $var - * @return $this - */ - public function setEndOpen($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\ListValue::class); - $this->writeOneof(4, $var); - - return $this; - } - - /** - * @return string - */ - public function getStartKeyType() - { - return $this->whichOneof("start_key_type"); - } - - /** - * @return string - */ - public function getEndKeyType() - { - return $this->whichOneof("end_key_type"); - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/KeySet.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/KeySet.php deleted file mode 100644 index 29121208ba59..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/KeySet.php +++ /dev/null @@ -1,164 +0,0 @@ -google.spanner.v1.KeySet - */ -class KeySet extends \Google\Protobuf\Internal\Message -{ - /** - * A list of specific keys. Entries in `keys` should have exactly as - * many elements as there are columns in the primary or index key - * with which this `KeySet` is used. Individual key values are - * encoded as described [here][google.spanner.v1.TypeCode]. - * - * Generated from protobuf field repeated .google.protobuf.ListValue keys = 1; - */ - private $keys; - /** - * A list of key ranges. See [KeyRange][google.spanner.v1.KeyRange] for more information about - * key range specifications. - * - * Generated from protobuf field repeated .google.spanner.v1.KeyRange ranges = 2; - */ - private $ranges; - /** - * For convenience `all` can be set to `true` to indicate that this - * `KeySet` matches all keys in the table or index. Note that any keys - * specified in `keys` or `ranges` are only yielded once. - * - * Generated from protobuf field bool all = 3; - */ - protected $all = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Protobuf\ListValue>|\Google\Protobuf\Internal\RepeatedField $keys - * A list of specific keys. Entries in `keys` should have exactly as - * many elements as there are columns in the primary or index key - * with which this `KeySet` is used. Individual key values are - * encoded as described [here][google.spanner.v1.TypeCode]. - * @type array<\Google\Cloud\Spanner\V1\KeyRange>|\Google\Protobuf\Internal\RepeatedField $ranges - * A list of key ranges. See [KeyRange][google.spanner.v1.KeyRange] for more information about - * key range specifications. - * @type bool $all - * For convenience `all` can be set to `true` to indicate that this - * `KeySet` matches all keys in the table or index. Note that any keys - * specified in `keys` or `ranges` are only yielded once. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Keys::initOnce(); - parent::__construct($data); - } - - /** - * A list of specific keys. Entries in `keys` should have exactly as - * many elements as there are columns in the primary or index key - * with which this `KeySet` is used. Individual key values are - * encoded as described [here][google.spanner.v1.TypeCode]. - * - * Generated from protobuf field repeated .google.protobuf.ListValue keys = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getKeys() - { - return $this->keys; - } - - /** - * A list of specific keys. Entries in `keys` should have exactly as - * many elements as there are columns in the primary or index key - * with which this `KeySet` is used. Individual key values are - * encoded as described [here][google.spanner.v1.TypeCode]. - * - * Generated from protobuf field repeated .google.protobuf.ListValue keys = 1; - * @param array<\Google\Protobuf\ListValue>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setKeys($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\ListValue::class); - $this->keys = $arr; - - return $this; - } - - /** - * A list of key ranges. See [KeyRange][google.spanner.v1.KeyRange] for more information about - * key range specifications. - * - * Generated from protobuf field repeated .google.spanner.v1.KeyRange ranges = 2; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getRanges() - { - return $this->ranges; - } - - /** - * A list of key ranges. See [KeyRange][google.spanner.v1.KeyRange] for more information about - * key range specifications. - * - * Generated from protobuf field repeated .google.spanner.v1.KeyRange ranges = 2; - * @param array<\Google\Cloud\Spanner\V1\KeyRange>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setRanges($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\KeyRange::class); - $this->ranges = $arr; - - return $this; - } - - /** - * For convenience `all` can be set to `true` to indicate that this - * `KeySet` matches all keys in the table or index. Note that any keys - * specified in `keys` or `ranges` are only yielded once. - * - * Generated from protobuf field bool all = 3; - * @return bool - */ - public function getAll() - { - return $this->all; - } - - /** - * For convenience `all` can be set to `true` to indicate that this - * `KeySet` matches all keys in the table or index. Note that any keys - * specified in `keys` or `ranges` are only yielded once. - * - * Generated from protobuf field bool all = 3; - * @param bool $var - * @return $this - */ - public function setAll($var) - { - GPBUtil::checkBool($var); - $this->all = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ListSessionsRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ListSessionsRequest.php deleted file mode 100644 index d3fd205fce8d..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ListSessionsRequest.php +++ /dev/null @@ -1,223 +0,0 @@ -google.spanner.v1.ListSessionsRequest - */ -class ListSessionsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The database in which to list sessions. - * - * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $database = ''; - /** - * Number of sessions to be returned in the response. If 0 or less, defaults - * to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 2; - */ - protected $page_size = 0; - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.v1.ListSessionsResponse.next_page_token] - * from a previous - * [ListSessionsResponse][google.spanner.v1.ListSessionsResponse]. - * - * Generated from protobuf field string page_token = 3; - */ - protected $page_token = ''; - /** - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * * `labels.key` where key is the name of a label - * Some examples of using filters are: - * * `labels.env:*` --> The session has the label "env". - * * `labels.env:dev` --> The session has the label "env" and the value of - * the label contains the string "dev". - * - * Generated from protobuf field string filter = 4; - */ - protected $filter = ''; - - /** - * @param string $database Required. The database in which to list sessions. Please see - * {@see SpannerClient::databaseName()} for help formatting this field. - * - * @return \Google\Cloud\Spanner\V1\ListSessionsRequest - * - * @experimental - */ - public static function build(string $database): self - { - return (new self()) - ->setDatabase($database); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $database - * Required. The database in which to list sessions. - * @type int $page_size - * Number of sessions to be returned in the response. If 0 or less, defaults - * to the server's maximum allowed page size. - * @type string $page_token - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.v1.ListSessionsResponse.next_page_token] - * from a previous - * [ListSessionsResponse][google.spanner.v1.ListSessionsResponse]. - * @type string $filter - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * * `labels.key` where key is the name of a label - * Some examples of using filters are: - * * `labels.env:*` --> The session has the label "env". - * * `labels.env:dev` --> The session has the label "env" and the value of - * the label contains the string "dev". - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * Required. The database in which to list sessions. - * - * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getDatabase() - { - return $this->database; - } - - /** - * Required. The database in which to list sessions. - * - * Generated from protobuf field string database = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setDatabase($var) - { - GPBUtil::checkString($var, True); - $this->database = $var; - - return $this; - } - - /** - * Number of sessions to be returned in the response. If 0 or less, defaults - * to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 2; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Number of sessions to be returned in the response. If 0 or less, defaults - * to the server's maximum allowed page size. - * - * Generated from protobuf field int32 page_size = 2; - * @param int $var - * @return $this - */ - public function setPageSize($var) - { - GPBUtil::checkInt32($var); - $this->page_size = $var; - - return $this; - } - - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.v1.ListSessionsResponse.next_page_token] - * from a previous - * [ListSessionsResponse][google.spanner.v1.ListSessionsResponse]. - * - * Generated from protobuf field string page_token = 3; - * @return string - */ - public function getPageToken() - { - return $this->page_token; - } - - /** - * If non-empty, `page_token` should contain a - * [next_page_token][google.spanner.v1.ListSessionsResponse.next_page_token] - * from a previous - * [ListSessionsResponse][google.spanner.v1.ListSessionsResponse]. - * - * Generated from protobuf field string page_token = 3; - * @param string $var - * @return $this - */ - public function setPageToken($var) - { - GPBUtil::checkString($var, True); - $this->page_token = $var; - - return $this; - } - - /** - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * * `labels.key` where key is the name of a label - * Some examples of using filters are: - * * `labels.env:*` --> The session has the label "env". - * * `labels.env:dev` --> The session has the label "env" and the value of - * the label contains the string "dev". - * - * Generated from protobuf field string filter = 4; - * @return string - */ - public function getFilter() - { - return $this->filter; - } - - /** - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * * `labels.key` where key is the name of a label - * Some examples of using filters are: - * * `labels.env:*` --> The session has the label "env". - * * `labels.env:dev` --> The session has the label "env" and the value of - * the label contains the string "dev". - * - * Generated from protobuf field string filter = 4; - * @param string $var - * @return $this - */ - public function setFilter($var) - { - GPBUtil::checkString($var, True); - $this->filter = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ListSessionsResponse.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ListSessionsResponse.php deleted file mode 100644 index 0d8cff32a984..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ListSessionsResponse.php +++ /dev/null @@ -1,109 +0,0 @@ -google.spanner.v1.ListSessionsResponse - */ -class ListSessionsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The list of requested sessions. - * - * Generated from protobuf field repeated .google.spanner.v1.Session sessions = 1; - */ - private $sessions; - /** - * `next_page_token` can be sent in a subsequent - * [ListSessions][google.spanner.v1.Spanner.ListSessions] call to fetch more - * of the matching sessions. - * - * Generated from protobuf field string next_page_token = 2; - */ - protected $next_page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Spanner\V1\Session>|\Google\Protobuf\Internal\RepeatedField $sessions - * The list of requested sessions. - * @type string $next_page_token - * `next_page_token` can be sent in a subsequent - * [ListSessions][google.spanner.v1.Spanner.ListSessions] call to fetch more - * of the matching sessions. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * The list of requested sessions. - * - * Generated from protobuf field repeated .google.spanner.v1.Session sessions = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getSessions() - { - return $this->sessions; - } - - /** - * The list of requested sessions. - * - * Generated from protobuf field repeated .google.spanner.v1.Session sessions = 1; - * @param array<\Google\Cloud\Spanner\V1\Session>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setSessions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Session::class); - $this->sessions = $arr; - - return $this; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListSessions][google.spanner.v1.Spanner.ListSessions] call to fetch more - * of the matching sessions. - * - * Generated from protobuf field string next_page_token = 2; - * @return string - */ - public function getNextPageToken() - { - return $this->next_page_token; - } - - /** - * `next_page_token` can be sent in a subsequent - * [ListSessions][google.spanner.v1.Spanner.ListSessions] call to fetch more - * of the matching sessions. - * - * Generated from protobuf field string next_page_token = 2; - * @param string $var - * @return $this - */ - public function setNextPageToken($var) - { - GPBUtil::checkString($var, True); - $this->next_page_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/MultiplexedSessionPrecommitToken.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/MultiplexedSessionPrecommitToken.php deleted file mode 100644 index 85495ac60b56..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/MultiplexedSessionPrecommitToken.php +++ /dev/null @@ -1,112 +0,0 @@ -google.spanner.v1.MultiplexedSessionPrecommitToken - */ -class MultiplexedSessionPrecommitToken extends \Google\Protobuf\Internal\Message -{ - /** - * Opaque precommit token. - * - * Generated from protobuf field bytes precommit_token = 1; - */ - protected $precommit_token = ''; - /** - * An incrementing seq number is generated on every precommit token - * that is returned. Clients should remember the precommit token with the - * highest sequence number from the current transaction attempt. - * - * Generated from protobuf field int32 seq_num = 2; - */ - protected $seq_num = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $precommit_token - * Opaque precommit token. - * @type int $seq_num - * An incrementing seq number is generated on every precommit token - * that is returned. Clients should remember the precommit token with the - * highest sequence number from the current transaction attempt. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Transaction::initOnce(); - parent::__construct($data); - } - - /** - * Opaque precommit token. - * - * Generated from protobuf field bytes precommit_token = 1; - * @return string - */ - public function getPrecommitToken() - { - return $this->precommit_token; - } - - /** - * Opaque precommit token. - * - * Generated from protobuf field bytes precommit_token = 1; - * @param string $var - * @return $this - */ - public function setPrecommitToken($var) - { - GPBUtil::checkString($var, False); - $this->precommit_token = $var; - - return $this; - } - - /** - * An incrementing seq number is generated on every precommit token - * that is returned. Clients should remember the precommit token with the - * highest sequence number from the current transaction attempt. - * - * Generated from protobuf field int32 seq_num = 2; - * @return int - */ - public function getSeqNum() - { - return $this->seq_num; - } - - /** - * An incrementing seq number is generated on every precommit token - * that is returned. Clients should remember the precommit token with the - * highest sequence number from the current transaction attempt. - * - * Generated from protobuf field int32 seq_num = 2; - * @param int $var - * @return $this - */ - public function setSeqNum($var) - { - GPBUtil::checkInt32($var); - $this->seq_num = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation.php deleted file mode 100644 index 82cb3686bb9a..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation.php +++ /dev/null @@ -1,254 +0,0 @@ -google.spanner.v1.Mutation - */ -class Mutation extends \Google\Protobuf\Internal\Message -{ - protected $operation; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\V1\Mutation\Write $insert - * Insert new rows in a table. If any of the rows already exist, - * the write or transaction fails with error `ALREADY_EXISTS`. - * @type \Google\Cloud\Spanner\V1\Mutation\Write $update - * Update existing rows in a table. If any of the rows does not - * already exist, the transaction fails with error `NOT_FOUND`. - * @type \Google\Cloud\Spanner\V1\Mutation\Write $insert_or_update - * Like [insert][google.spanner.v1.Mutation.insert], except that if the row already exists, then - * its column values are overwritten with the ones provided. Any - * column values not explicitly written are preserved. - * When using [insert_or_update][google.spanner.v1.Mutation.insert_or_update], just as when using [insert][google.spanner.v1.Mutation.insert], all `NOT - * NULL` columns in the table must be given a value. This holds true - * even when the row already exists and will therefore actually be updated. - * @type \Google\Cloud\Spanner\V1\Mutation\Write $replace - * Like [insert][google.spanner.v1.Mutation.insert], except that if the row already exists, it is - * deleted, and the column values provided are inserted - * instead. Unlike [insert_or_update][google.spanner.v1.Mutation.insert_or_update], this means any values not - * explicitly written become `NULL`. - * In an interleaved table, if you create the child table with the - * `ON DELETE CASCADE` annotation, then replacing a parent row - * also deletes the child rows. Otherwise, you must delete the - * child rows before you replace the parent row. - * @type \Google\Cloud\Spanner\V1\Mutation\Delete $delete - * Delete rows from a table. Succeeds whether or not the named - * rows were present. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Mutation::initOnce(); - parent::__construct($data); - } - - /** - * Insert new rows in a table. If any of the rows already exist, - * the write or transaction fails with error `ALREADY_EXISTS`. - * - * Generated from protobuf field .google.spanner.v1.Mutation.Write insert = 1; - * @return \Google\Cloud\Spanner\V1\Mutation\Write|null - */ - public function getInsert() - { - return $this->readOneof(1); - } - - public function hasInsert() - { - return $this->hasOneof(1); - } - - /** - * Insert new rows in a table. If any of the rows already exist, - * the write or transaction fails with error `ALREADY_EXISTS`. - * - * Generated from protobuf field .google.spanner.v1.Mutation.Write insert = 1; - * @param \Google\Cloud\Spanner\V1\Mutation\Write $var - * @return $this - */ - public function setInsert($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Mutation\Write::class); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * Update existing rows in a table. If any of the rows does not - * already exist, the transaction fails with error `NOT_FOUND`. - * - * Generated from protobuf field .google.spanner.v1.Mutation.Write update = 2; - * @return \Google\Cloud\Spanner\V1\Mutation\Write|null - */ - public function getUpdate() - { - return $this->readOneof(2); - } - - public function hasUpdate() - { - return $this->hasOneof(2); - } - - /** - * Update existing rows in a table. If any of the rows does not - * already exist, the transaction fails with error `NOT_FOUND`. - * - * Generated from protobuf field .google.spanner.v1.Mutation.Write update = 2; - * @param \Google\Cloud\Spanner\V1\Mutation\Write $var - * @return $this - */ - public function setUpdate($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Mutation\Write::class); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * Like [insert][google.spanner.v1.Mutation.insert], except that if the row already exists, then - * its column values are overwritten with the ones provided. Any - * column values not explicitly written are preserved. - * When using [insert_or_update][google.spanner.v1.Mutation.insert_or_update], just as when using [insert][google.spanner.v1.Mutation.insert], all `NOT - * NULL` columns in the table must be given a value. This holds true - * even when the row already exists and will therefore actually be updated. - * - * Generated from protobuf field .google.spanner.v1.Mutation.Write insert_or_update = 3; - * @return \Google\Cloud\Spanner\V1\Mutation\Write|null - */ - public function getInsertOrUpdate() - { - return $this->readOneof(3); - } - - public function hasInsertOrUpdate() - { - return $this->hasOneof(3); - } - - /** - * Like [insert][google.spanner.v1.Mutation.insert], except that if the row already exists, then - * its column values are overwritten with the ones provided. Any - * column values not explicitly written are preserved. - * When using [insert_or_update][google.spanner.v1.Mutation.insert_or_update], just as when using [insert][google.spanner.v1.Mutation.insert], all `NOT - * NULL` columns in the table must be given a value. This holds true - * even when the row already exists and will therefore actually be updated. - * - * Generated from protobuf field .google.spanner.v1.Mutation.Write insert_or_update = 3; - * @param \Google\Cloud\Spanner\V1\Mutation\Write $var - * @return $this - */ - public function setInsertOrUpdate($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Mutation\Write::class); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * Like [insert][google.spanner.v1.Mutation.insert], except that if the row already exists, it is - * deleted, and the column values provided are inserted - * instead. Unlike [insert_or_update][google.spanner.v1.Mutation.insert_or_update], this means any values not - * explicitly written become `NULL`. - * In an interleaved table, if you create the child table with the - * `ON DELETE CASCADE` annotation, then replacing a parent row - * also deletes the child rows. Otherwise, you must delete the - * child rows before you replace the parent row. - * - * Generated from protobuf field .google.spanner.v1.Mutation.Write replace = 4; - * @return \Google\Cloud\Spanner\V1\Mutation\Write|null - */ - public function getReplace() - { - return $this->readOneof(4); - } - - public function hasReplace() - { - return $this->hasOneof(4); - } - - /** - * Like [insert][google.spanner.v1.Mutation.insert], except that if the row already exists, it is - * deleted, and the column values provided are inserted - * instead. Unlike [insert_or_update][google.spanner.v1.Mutation.insert_or_update], this means any values not - * explicitly written become `NULL`. - * In an interleaved table, if you create the child table with the - * `ON DELETE CASCADE` annotation, then replacing a parent row - * also deletes the child rows. Otherwise, you must delete the - * child rows before you replace the parent row. - * - * Generated from protobuf field .google.spanner.v1.Mutation.Write replace = 4; - * @param \Google\Cloud\Spanner\V1\Mutation\Write $var - * @return $this - */ - public function setReplace($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Mutation\Write::class); - $this->writeOneof(4, $var); - - return $this; - } - - /** - * Delete rows from a table. Succeeds whether or not the named - * rows were present. - * - * Generated from protobuf field .google.spanner.v1.Mutation.Delete delete = 5; - * @return \Google\Cloud\Spanner\V1\Mutation\Delete|null - */ - public function getDelete() - { - return $this->readOneof(5); - } - - public function hasDelete() - { - return $this->hasOneof(5); - } - - /** - * Delete rows from a table. Succeeds whether or not the named - * rows were present. - * - * Generated from protobuf field .google.spanner.v1.Mutation.Delete delete = 5; - * @param \Google\Cloud\Spanner\V1\Mutation\Delete $var - * @return $this - */ - public function setDelete($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Mutation\Delete::class); - $this->writeOneof(5, $var); - - return $this; - } - - /** - * @return string - */ - public function getOperation() - { - return $this->whichOneof("operation"); - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation/Delete.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation/Delete.php deleted file mode 100644 index db49cf9dc249..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation/Delete.php +++ /dev/null @@ -1,134 +0,0 @@ -google.spanner.v1.Mutation.Delete - */ -class Delete extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The table whose rows will be deleted. - * - * Generated from protobuf field string table = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $table = ''; - /** - * Required. The primary keys of the rows within [table][google.spanner.v1.Mutation.Delete.table] to delete. The - * primary keys must be specified in the order in which they appear in the - * `PRIMARY KEY()` clause of the table's equivalent DDL statement (the DDL - * statement used to create the table). - * Delete is idempotent. The transaction will succeed even if some or all - * rows do not exist. - * - * Generated from protobuf field .google.spanner.v1.KeySet key_set = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $key_set = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $table - * Required. The table whose rows will be deleted. - * @type \Google\Cloud\Spanner\V1\KeySet $key_set - * Required. The primary keys of the rows within [table][google.spanner.v1.Mutation.Delete.table] to delete. The - * primary keys must be specified in the order in which they appear in the - * `PRIMARY KEY()` clause of the table's equivalent DDL statement (the DDL - * statement used to create the table). - * Delete is idempotent. The transaction will succeed even if some or all - * rows do not exist. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Mutation::initOnce(); - parent::__construct($data); - } - - /** - * Required. The table whose rows will be deleted. - * - * Generated from protobuf field string table = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getTable() - { - return $this->table; - } - - /** - * Required. The table whose rows will be deleted. - * - * Generated from protobuf field string table = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setTable($var) - { - GPBUtil::checkString($var, True); - $this->table = $var; - - return $this; - } - - /** - * Required. The primary keys of the rows within [table][google.spanner.v1.Mutation.Delete.table] to delete. The - * primary keys must be specified in the order in which they appear in the - * `PRIMARY KEY()` clause of the table's equivalent DDL statement (the DDL - * statement used to create the table). - * Delete is idempotent. The transaction will succeed even if some or all - * rows do not exist. - * - * Generated from protobuf field .google.spanner.v1.KeySet key_set = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\V1\KeySet|null - */ - public function getKeySet() - { - return $this->key_set; - } - - public function hasKeySet() - { - return isset($this->key_set); - } - - public function clearKeySet() - { - unset($this->key_set); - } - - /** - * Required. The primary keys of the rows within [table][google.spanner.v1.Mutation.Delete.table] to delete. The - * primary keys must be specified in the order in which they appear in the - * `PRIMARY KEY()` clause of the table's equivalent DDL statement (the DDL - * statement used to create the table). - * Delete is idempotent. The transaction will succeed even if some or all - * rows do not exist. - * - * Generated from protobuf field .google.spanner.v1.KeySet key_set = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\V1\KeySet $var - * @return $this - */ - public function setKeySet($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\KeySet::class); - $this->key_set = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Delete::class, \Google\Cloud\Spanner\V1\Mutation_Delete::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation/Write.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation/Write.php deleted file mode 100644 index 8e08ca69d213..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Mutation/Write.php +++ /dev/null @@ -1,179 +0,0 @@ -google.spanner.v1.Mutation.Write - */ -class Write extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The table whose rows will be written. - * - * Generated from protobuf field string table = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $table = ''; - /** - * The names of the columns in [table][google.spanner.v1.Mutation.Write.table] to be written. - * The list of columns must contain enough columns to allow - * Cloud Spanner to derive values for all primary key columns in the - * row(s) to be modified. - * - * Generated from protobuf field repeated string columns = 2; - */ - private $columns; - /** - * The values to be written. `values` can contain more than one - * list of values. If it does, then multiple rows are written, one - * for each entry in `values`. Each list in `values` must have - * exactly as many entries as there are entries in [columns][google.spanner.v1.Mutation.Write.columns] - * above. Sending multiple lists is equivalent to sending multiple - * `Mutation`s, each containing one `values` entry and repeating - * [table][google.spanner.v1.Mutation.Write.table] and [columns][google.spanner.v1.Mutation.Write.columns]. Individual values in each list are - * encoded as described [here][google.spanner.v1.TypeCode]. - * - * Generated from protobuf field repeated .google.protobuf.ListValue values = 3; - */ - private $values; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $table - * Required. The table whose rows will be written. - * @type array|\Google\Protobuf\Internal\RepeatedField $columns - * The names of the columns in [table][google.spanner.v1.Mutation.Write.table] to be written. - * The list of columns must contain enough columns to allow - * Cloud Spanner to derive values for all primary key columns in the - * row(s) to be modified. - * @type array<\Google\Protobuf\ListValue>|\Google\Protobuf\Internal\RepeatedField $values - * The values to be written. `values` can contain more than one - * list of values. If it does, then multiple rows are written, one - * for each entry in `values`. Each list in `values` must have - * exactly as many entries as there are entries in [columns][google.spanner.v1.Mutation.Write.columns] - * above. Sending multiple lists is equivalent to sending multiple - * `Mutation`s, each containing one `values` entry and repeating - * [table][google.spanner.v1.Mutation.Write.table] and [columns][google.spanner.v1.Mutation.Write.columns]. Individual values in each list are - * encoded as described [here][google.spanner.v1.TypeCode]. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Mutation::initOnce(); - parent::__construct($data); - } - - /** - * Required. The table whose rows will be written. - * - * Generated from protobuf field string table = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getTable() - { - return $this->table; - } - - /** - * Required. The table whose rows will be written. - * - * Generated from protobuf field string table = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setTable($var) - { - GPBUtil::checkString($var, True); - $this->table = $var; - - return $this; - } - - /** - * The names of the columns in [table][google.spanner.v1.Mutation.Write.table] to be written. - * The list of columns must contain enough columns to allow - * Cloud Spanner to derive values for all primary key columns in the - * row(s) to be modified. - * - * Generated from protobuf field repeated string columns = 2; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getColumns() - { - return $this->columns; - } - - /** - * The names of the columns in [table][google.spanner.v1.Mutation.Write.table] to be written. - * The list of columns must contain enough columns to allow - * Cloud Spanner to derive values for all primary key columns in the - * row(s) to be modified. - * - * Generated from protobuf field repeated string columns = 2; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setColumns($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->columns = $arr; - - return $this; - } - - /** - * The values to be written. `values` can contain more than one - * list of values. If it does, then multiple rows are written, one - * for each entry in `values`. Each list in `values` must have - * exactly as many entries as there are entries in [columns][google.spanner.v1.Mutation.Write.columns] - * above. Sending multiple lists is equivalent to sending multiple - * `Mutation`s, each containing one `values` entry and repeating - * [table][google.spanner.v1.Mutation.Write.table] and [columns][google.spanner.v1.Mutation.Write.columns]. Individual values in each list are - * encoded as described [here][google.spanner.v1.TypeCode]. - * - * Generated from protobuf field repeated .google.protobuf.ListValue values = 3; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getValues() - { - return $this->values; - } - - /** - * The values to be written. `values` can contain more than one - * list of values. If it does, then multiple rows are written, one - * for each entry in `values`. Each list in `values` must have - * exactly as many entries as there are entries in [columns][google.spanner.v1.Mutation.Write.columns] - * above. Sending multiple lists is equivalent to sending multiple - * `Mutation`s, each containing one `values` entry and repeating - * [table][google.spanner.v1.Mutation.Write.table] and [columns][google.spanner.v1.Mutation.Write.columns]. Individual values in each list are - * encoded as described [here][google.spanner.v1.TypeCode]. - * - * Generated from protobuf field repeated .google.protobuf.ListValue values = 3; - * @param array<\Google\Protobuf\ListValue>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setValues($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\ListValue::class); - $this->values = $arr; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Write::class, \Google\Cloud\Spanner\V1\Mutation_Write::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartialResultSet.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartialResultSet.php deleted file mode 100644 index dd0f33180421..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartialResultSet.php +++ /dev/null @@ -1,573 +0,0 @@ -google.spanner.v1.PartialResultSet - */ -class PartialResultSet extends \Google\Protobuf\Internal\Message -{ - /** - * Metadata about the result set, such as row type information. - * Only present in the first response. - * - * Generated from protobuf field .google.spanner.v1.ResultSetMetadata metadata = 1; - */ - protected $metadata = null; - /** - * A streamed result set consists of a stream of values, which might - * be split into many `PartialResultSet` messages to accommodate - * large rows and/or large values. Every N complete values defines a - * row, where N is equal to the number of entries in - * [metadata.row_type.fields][google.spanner.v1.StructType.fields]. - * Most values are encoded based on type as described - * [here][google.spanner.v1.TypeCode]. - * It is possible that the last value in values is "chunked", - * meaning that the rest of the value is sent in subsequent - * `PartialResultSet`(s). This is denoted by the [chunked_value][google.spanner.v1.PartialResultSet.chunked_value] - * field. Two or more chunked values can be merged to form a - * complete value as follows: - * * `bool/number/null`: cannot be chunked - * * `string`: concatenate the strings - * * `list`: concatenate the lists. If the last element in a list is a - * `string`, `list`, or `object`, merge it with the first element in - * the next list by applying these rules recursively. - * * `object`: concatenate the (field name, field value) pairs. If a - * field name is duplicated, then apply these rules recursively - * to merge the field values. - * Some examples of merging: - * # Strings are concatenated. - * "foo", "bar" => "foobar" - * # Lists of non-strings are concatenated. - * [2, 3], [4] => [2, 3, 4] - * # Lists are concatenated, but the last and first elements are merged - * # because they are strings. - * ["a", "b"], ["c", "d"] => ["a", "bc", "d"] - * # Lists are concatenated, but the last and first elements are merged - * # because they are lists. Recursively, the last and first elements - * # of the inner lists are merged because they are strings. - * ["a", ["b", "c"]], [["d"], "e"] => ["a", ["b", "cd"], "e"] - * # Non-overlapping object fields are combined. - * {"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"} - * # Overlapping object fields are merged. - * {"a": "1"}, {"a": "2"} => {"a": "12"} - * # Examples of merging objects containing lists of strings. - * {"a": ["1"]}, {"a": ["2"]} => {"a": ["12"]} - * For a more complete example, suppose a streaming SQL query is - * yielding a result set whose rows contain a single string - * field. The following `PartialResultSet`s might be yielded: - * { - * "metadata": { ... } - * "values": ["Hello", "W"] - * "chunked_value": true - * "resume_token": "Af65..." - * } - * { - * "values": ["orl"] - * "chunked_value": true - * "resume_token": "Bqp2..." - * } - * { - * "values": ["d"] - * "resume_token": "Zx1B..." - * } - * This sequence of `PartialResultSet`s encodes two rows, one - * containing the field value `"Hello"`, and a second containing the - * field value `"World" = "W" + "orl" + "d"`. - * - * Generated from protobuf field repeated .google.protobuf.Value values = 2; - */ - private $values; - /** - * If true, then the final value in [values][google.spanner.v1.PartialResultSet.values] is chunked, and must - * be combined with more values from subsequent `PartialResultSet`s - * to obtain a complete field value. - * - * Generated from protobuf field bool chunked_value = 3; - */ - protected $chunked_value = false; - /** - * Streaming calls might be interrupted for a variety of reasons, such - * as TCP connection loss. If this occurs, the stream of results can - * be resumed by re-sending the original request and including - * `resume_token`. Note that executing any other transaction in the - * same session invalidates the token. - * - * Generated from protobuf field bytes resume_token = 4; - */ - protected $resume_token = ''; - /** - * Query plan and execution statistics for the statement that produced this - * streaming result set. These can be requested by setting - * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] and are sent - * only once with the last response in the stream. - * This field will also be present in the last response for DML - * statements. - * - * Generated from protobuf field .google.spanner.v1.ResultSetStats stats = 5; - */ - protected $stats = null; - /** - * Optional. A precommit token will be included if the read-write transaction - * is on a multiplexed session. - * The precommit token with the highest sequence number from this transaction - * attempt should be passed to the - * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $precommit_token = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\V1\ResultSetMetadata $metadata - * Metadata about the result set, such as row type information. - * Only present in the first response. - * @type array<\Google\Protobuf\Value>|\Google\Protobuf\Internal\RepeatedField $values - * A streamed result set consists of a stream of values, which might - * be split into many `PartialResultSet` messages to accommodate - * large rows and/or large values. Every N complete values defines a - * row, where N is equal to the number of entries in - * [metadata.row_type.fields][google.spanner.v1.StructType.fields]. - * Most values are encoded based on type as described - * [here][google.spanner.v1.TypeCode]. - * It is possible that the last value in values is "chunked", - * meaning that the rest of the value is sent in subsequent - * `PartialResultSet`(s). This is denoted by the [chunked_value][google.spanner.v1.PartialResultSet.chunked_value] - * field. Two or more chunked values can be merged to form a - * complete value as follows: - * * `bool/number/null`: cannot be chunked - * * `string`: concatenate the strings - * * `list`: concatenate the lists. If the last element in a list is a - * `string`, `list`, or `object`, merge it with the first element in - * the next list by applying these rules recursively. - * * `object`: concatenate the (field name, field value) pairs. If a - * field name is duplicated, then apply these rules recursively - * to merge the field values. - * Some examples of merging: - * # Strings are concatenated. - * "foo", "bar" => "foobar" - * # Lists of non-strings are concatenated. - * [2, 3], [4] => [2, 3, 4] - * # Lists are concatenated, but the last and first elements are merged - * # because they are strings. - * ["a", "b"], ["c", "d"] => ["a", "bc", "d"] - * # Lists are concatenated, but the last and first elements are merged - * # because they are lists. Recursively, the last and first elements - * # of the inner lists are merged because they are strings. - * ["a", ["b", "c"]], [["d"], "e"] => ["a", ["b", "cd"], "e"] - * # Non-overlapping object fields are combined. - * {"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"} - * # Overlapping object fields are merged. - * {"a": "1"}, {"a": "2"} => {"a": "12"} - * # Examples of merging objects containing lists of strings. - * {"a": ["1"]}, {"a": ["2"]} => {"a": ["12"]} - * For a more complete example, suppose a streaming SQL query is - * yielding a result set whose rows contain a single string - * field. The following `PartialResultSet`s might be yielded: - * { - * "metadata": { ... } - * "values": ["Hello", "W"] - * "chunked_value": true - * "resume_token": "Af65..." - * } - * { - * "values": ["orl"] - * "chunked_value": true - * "resume_token": "Bqp2..." - * } - * { - * "values": ["d"] - * "resume_token": "Zx1B..." - * } - * This sequence of `PartialResultSet`s encodes two rows, one - * containing the field value `"Hello"`, and a second containing the - * field value `"World" = "W" + "orl" + "d"`. - * @type bool $chunked_value - * If true, then the final value in [values][google.spanner.v1.PartialResultSet.values] is chunked, and must - * be combined with more values from subsequent `PartialResultSet`s - * to obtain a complete field value. - * @type string $resume_token - * Streaming calls might be interrupted for a variety of reasons, such - * as TCP connection loss. If this occurs, the stream of results can - * be resumed by re-sending the original request and including - * `resume_token`. Note that executing any other transaction in the - * same session invalidates the token. - * @type \Google\Cloud\Spanner\V1\ResultSetStats $stats - * Query plan and execution statistics for the statement that produced this - * streaming result set. These can be requested by setting - * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] and are sent - * only once with the last response in the stream. - * This field will also be present in the last response for DML - * statements. - * @type \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $precommit_token - * Optional. A precommit token will be included if the read-write transaction - * is on a multiplexed session. - * The precommit token with the highest sequence number from this transaction - * attempt should be passed to the - * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\ResultSet::initOnce(); - parent::__construct($data); - } - - /** - * Metadata about the result set, such as row type information. - * Only present in the first response. - * - * Generated from protobuf field .google.spanner.v1.ResultSetMetadata metadata = 1; - * @return \Google\Cloud\Spanner\V1\ResultSetMetadata|null - */ - public function getMetadata() - { - return $this->metadata; - } - - public function hasMetadata() - { - return isset($this->metadata); - } - - public function clearMetadata() - { - unset($this->metadata); - } - - /** - * Metadata about the result set, such as row type information. - * Only present in the first response. - * - * Generated from protobuf field .google.spanner.v1.ResultSetMetadata metadata = 1; - * @param \Google\Cloud\Spanner\V1\ResultSetMetadata $var - * @return $this - */ - public function setMetadata($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\ResultSetMetadata::class); - $this->metadata = $var; - - return $this; - } - - /** - * A streamed result set consists of a stream of values, which might - * be split into many `PartialResultSet` messages to accommodate - * large rows and/or large values. Every N complete values defines a - * row, where N is equal to the number of entries in - * [metadata.row_type.fields][google.spanner.v1.StructType.fields]. - * Most values are encoded based on type as described - * [here][google.spanner.v1.TypeCode]. - * It is possible that the last value in values is "chunked", - * meaning that the rest of the value is sent in subsequent - * `PartialResultSet`(s). This is denoted by the [chunked_value][google.spanner.v1.PartialResultSet.chunked_value] - * field. Two or more chunked values can be merged to form a - * complete value as follows: - * * `bool/number/null`: cannot be chunked - * * `string`: concatenate the strings - * * `list`: concatenate the lists. If the last element in a list is a - * `string`, `list`, or `object`, merge it with the first element in - * the next list by applying these rules recursively. - * * `object`: concatenate the (field name, field value) pairs. If a - * field name is duplicated, then apply these rules recursively - * to merge the field values. - * Some examples of merging: - * # Strings are concatenated. - * "foo", "bar" => "foobar" - * # Lists of non-strings are concatenated. - * [2, 3], [4] => [2, 3, 4] - * # Lists are concatenated, but the last and first elements are merged - * # because they are strings. - * ["a", "b"], ["c", "d"] => ["a", "bc", "d"] - * # Lists are concatenated, but the last and first elements are merged - * # because they are lists. Recursively, the last and first elements - * # of the inner lists are merged because they are strings. - * ["a", ["b", "c"]], [["d"], "e"] => ["a", ["b", "cd"], "e"] - * # Non-overlapping object fields are combined. - * {"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"} - * # Overlapping object fields are merged. - * {"a": "1"}, {"a": "2"} => {"a": "12"} - * # Examples of merging objects containing lists of strings. - * {"a": ["1"]}, {"a": ["2"]} => {"a": ["12"]} - * For a more complete example, suppose a streaming SQL query is - * yielding a result set whose rows contain a single string - * field. The following `PartialResultSet`s might be yielded: - * { - * "metadata": { ... } - * "values": ["Hello", "W"] - * "chunked_value": true - * "resume_token": "Af65..." - * } - * { - * "values": ["orl"] - * "chunked_value": true - * "resume_token": "Bqp2..." - * } - * { - * "values": ["d"] - * "resume_token": "Zx1B..." - * } - * This sequence of `PartialResultSet`s encodes two rows, one - * containing the field value `"Hello"`, and a second containing the - * field value `"World" = "W" + "orl" + "d"`. - * - * Generated from protobuf field repeated .google.protobuf.Value values = 2; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getValues() - { - return $this->values; - } - - /** - * A streamed result set consists of a stream of values, which might - * be split into many `PartialResultSet` messages to accommodate - * large rows and/or large values. Every N complete values defines a - * row, where N is equal to the number of entries in - * [metadata.row_type.fields][google.spanner.v1.StructType.fields]. - * Most values are encoded based on type as described - * [here][google.spanner.v1.TypeCode]. - * It is possible that the last value in values is "chunked", - * meaning that the rest of the value is sent in subsequent - * `PartialResultSet`(s). This is denoted by the [chunked_value][google.spanner.v1.PartialResultSet.chunked_value] - * field. Two or more chunked values can be merged to form a - * complete value as follows: - * * `bool/number/null`: cannot be chunked - * * `string`: concatenate the strings - * * `list`: concatenate the lists. If the last element in a list is a - * `string`, `list`, or `object`, merge it with the first element in - * the next list by applying these rules recursively. - * * `object`: concatenate the (field name, field value) pairs. If a - * field name is duplicated, then apply these rules recursively - * to merge the field values. - * Some examples of merging: - * # Strings are concatenated. - * "foo", "bar" => "foobar" - * # Lists of non-strings are concatenated. - * [2, 3], [4] => [2, 3, 4] - * # Lists are concatenated, but the last and first elements are merged - * # because they are strings. - * ["a", "b"], ["c", "d"] => ["a", "bc", "d"] - * # Lists are concatenated, but the last and first elements are merged - * # because they are lists. Recursively, the last and first elements - * # of the inner lists are merged because they are strings. - * ["a", ["b", "c"]], [["d"], "e"] => ["a", ["b", "cd"], "e"] - * # Non-overlapping object fields are combined. - * {"a": "1"}, {"b": "2"} => {"a": "1", "b": 2"} - * # Overlapping object fields are merged. - * {"a": "1"}, {"a": "2"} => {"a": "12"} - * # Examples of merging objects containing lists of strings. - * {"a": ["1"]}, {"a": ["2"]} => {"a": ["12"]} - * For a more complete example, suppose a streaming SQL query is - * yielding a result set whose rows contain a single string - * field. The following `PartialResultSet`s might be yielded: - * { - * "metadata": { ... } - * "values": ["Hello", "W"] - * "chunked_value": true - * "resume_token": "Af65..." - * } - * { - * "values": ["orl"] - * "chunked_value": true - * "resume_token": "Bqp2..." - * } - * { - * "values": ["d"] - * "resume_token": "Zx1B..." - * } - * This sequence of `PartialResultSet`s encodes two rows, one - * containing the field value `"Hello"`, and a second containing the - * field value `"World" = "W" + "orl" + "d"`. - * - * Generated from protobuf field repeated .google.protobuf.Value values = 2; - * @param array<\Google\Protobuf\Value>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setValues($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Value::class); - $this->values = $arr; - - return $this; - } - - /** - * If true, then the final value in [values][google.spanner.v1.PartialResultSet.values] is chunked, and must - * be combined with more values from subsequent `PartialResultSet`s - * to obtain a complete field value. - * - * Generated from protobuf field bool chunked_value = 3; - * @return bool - */ - public function getChunkedValue() - { - return $this->chunked_value; - } - - /** - * If true, then the final value in [values][google.spanner.v1.PartialResultSet.values] is chunked, and must - * be combined with more values from subsequent `PartialResultSet`s - * to obtain a complete field value. - * - * Generated from protobuf field bool chunked_value = 3; - * @param bool $var - * @return $this - */ - public function setChunkedValue($var) - { - GPBUtil::checkBool($var); - $this->chunked_value = $var; - - return $this; - } - - /** - * Streaming calls might be interrupted for a variety of reasons, such - * as TCP connection loss. If this occurs, the stream of results can - * be resumed by re-sending the original request and including - * `resume_token`. Note that executing any other transaction in the - * same session invalidates the token. - * - * Generated from protobuf field bytes resume_token = 4; - * @return string - */ - public function getResumeToken() - { - return $this->resume_token; - } - - /** - * Streaming calls might be interrupted for a variety of reasons, such - * as TCP connection loss. If this occurs, the stream of results can - * be resumed by re-sending the original request and including - * `resume_token`. Note that executing any other transaction in the - * same session invalidates the token. - * - * Generated from protobuf field bytes resume_token = 4; - * @param string $var - * @return $this - */ - public function setResumeToken($var) - { - GPBUtil::checkString($var, False); - $this->resume_token = $var; - - return $this; - } - - /** - * Query plan and execution statistics for the statement that produced this - * streaming result set. These can be requested by setting - * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] and are sent - * only once with the last response in the stream. - * This field will also be present in the last response for DML - * statements. - * - * Generated from protobuf field .google.spanner.v1.ResultSetStats stats = 5; - * @return \Google\Cloud\Spanner\V1\ResultSetStats|null - */ - public function getStats() - { - return $this->stats; - } - - public function hasStats() - { - return isset($this->stats); - } - - public function clearStats() - { - unset($this->stats); - } - - /** - * Query plan and execution statistics for the statement that produced this - * streaming result set. These can be requested by setting - * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] and are sent - * only once with the last response in the stream. - * This field will also be present in the last response for DML - * statements. - * - * Generated from protobuf field .google.spanner.v1.ResultSetStats stats = 5; - * @param \Google\Cloud\Spanner\V1\ResultSetStats $var - * @return $this - */ - public function setStats($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\ResultSetStats::class); - $this->stats = $var; - - return $this; - } - - /** - * Optional. A precommit token will be included if the read-write transaction - * is on a multiplexed session. - * The precommit token with the highest sequence number from this transaction - * attempt should be passed to the - * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken|null - */ - public function getPrecommitToken() - { - return $this->precommit_token; - } - - public function hasPrecommitToken() - { - return isset($this->precommit_token); - } - - public function clearPrecommitToken() - { - unset($this->precommit_token); - } - - /** - * Optional. A precommit token will be included if the read-write transaction - * is on a multiplexed session. - * The precommit token with the highest sequence number from this transaction - * attempt should be passed to the - * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $var - * @return $this - */ - public function setPrecommitToken($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken::class); - $this->precommit_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Partition.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Partition.php deleted file mode 100644 index 02b7e70d0762..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Partition.php +++ /dev/null @@ -1,76 +0,0 @@ -google.spanner.v1.Partition - */ -class Partition extends \Google\Protobuf\Internal\Message -{ - /** - * This token can be passed to Read, StreamingRead, ExecuteSql, or - * ExecuteStreamingSql requests to restrict the results to those identified by - * this partition token. - * - * Generated from protobuf field bytes partition_token = 1; - */ - protected $partition_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $partition_token - * This token can be passed to Read, StreamingRead, ExecuteSql, or - * ExecuteStreamingSql requests to restrict the results to those identified by - * this partition token. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * This token can be passed to Read, StreamingRead, ExecuteSql, or - * ExecuteStreamingSql requests to restrict the results to those identified by - * this partition token. - * - * Generated from protobuf field bytes partition_token = 1; - * @return string - */ - public function getPartitionToken() - { - return $this->partition_token; - } - - /** - * This token can be passed to Read, StreamingRead, ExecuteSql, or - * ExecuteStreamingSql requests to restrict the results to those identified by - * this partition token. - * - * Generated from protobuf field bytes partition_token = 1; - * @param string $var - * @return $this - */ - public function setPartitionToken($var) - { - GPBUtil::checkString($var, False); - $this->partition_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionOptions.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionOptions.php deleted file mode 100644 index fa726b5f9161..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionOptions.php +++ /dev/null @@ -1,142 +0,0 @@ -google.spanner.v1.PartitionOptions - */ -class PartitionOptions extends \Google\Protobuf\Internal\Message -{ - /** - * **Note:** This hint is currently ignored by PartitionQuery and - * PartitionRead requests. - * The desired data size for each partition generated. The default for this - * option is currently 1 GiB. This is only a hint. The actual size of each - * partition may be smaller or larger than this size request. - * - * Generated from protobuf field int64 partition_size_bytes = 1; - */ - protected $partition_size_bytes = 0; - /** - * **Note:** This hint is currently ignored by PartitionQuery and - * PartitionRead requests. - * The desired maximum number of partitions to return. For example, this may - * be set to the number of workers available. The default for this option - * is currently 10,000. The maximum value is currently 200,000. This is only - * a hint. The actual number of partitions returned may be smaller or larger - * than this maximum count request. - * - * Generated from protobuf field int64 max_partitions = 2; - */ - protected $max_partitions = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int|string $partition_size_bytes - * **Note:** This hint is currently ignored by PartitionQuery and - * PartitionRead requests. - * The desired data size for each partition generated. The default for this - * option is currently 1 GiB. This is only a hint. The actual size of each - * partition may be smaller or larger than this size request. - * @type int|string $max_partitions - * **Note:** This hint is currently ignored by PartitionQuery and - * PartitionRead requests. - * The desired maximum number of partitions to return. For example, this may - * be set to the number of workers available. The default for this option - * is currently 10,000. The maximum value is currently 200,000. This is only - * a hint. The actual number of partitions returned may be smaller or larger - * than this maximum count request. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * **Note:** This hint is currently ignored by PartitionQuery and - * PartitionRead requests. - * The desired data size for each partition generated. The default for this - * option is currently 1 GiB. This is only a hint. The actual size of each - * partition may be smaller or larger than this size request. - * - * Generated from protobuf field int64 partition_size_bytes = 1; - * @return int|string - */ - public function getPartitionSizeBytes() - { - return $this->partition_size_bytes; - } - - /** - * **Note:** This hint is currently ignored by PartitionQuery and - * PartitionRead requests. - * The desired data size for each partition generated. The default for this - * option is currently 1 GiB. This is only a hint. The actual size of each - * partition may be smaller or larger than this size request. - * - * Generated from protobuf field int64 partition_size_bytes = 1; - * @param int|string $var - * @return $this - */ - public function setPartitionSizeBytes($var) - { - GPBUtil::checkInt64($var); - $this->partition_size_bytes = $var; - - return $this; - } - - /** - * **Note:** This hint is currently ignored by PartitionQuery and - * PartitionRead requests. - * The desired maximum number of partitions to return. For example, this may - * be set to the number of workers available. The default for this option - * is currently 10,000. The maximum value is currently 200,000. This is only - * a hint. The actual number of partitions returned may be smaller or larger - * than this maximum count request. - * - * Generated from protobuf field int64 max_partitions = 2; - * @return int|string - */ - public function getMaxPartitions() - { - return $this->max_partitions; - } - - /** - * **Note:** This hint is currently ignored by PartitionQuery and - * PartitionRead requests. - * The desired maximum number of partitions to return. For example, this may - * be set to the number of workers available. The default for this option - * is currently 10,000. The maximum value is currently 200,000. This is only - * a hint. The actual number of partitions returned may be smaller or larger - * than this maximum count request. - * - * Generated from protobuf field int64 max_partitions = 2; - * @param int|string $var - * @return $this - */ - public function setMaxPartitions($var) - { - GPBUtil::checkInt64($var); - $this->max_partitions = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionQueryRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionQueryRequest.php deleted file mode 100644 index 98df014e6b07..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionQueryRequest.php +++ /dev/null @@ -1,367 +0,0 @@ -google.spanner.v1.PartitionQueryRequest - */ -class PartitionQueryRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The session used to create the partitions. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $session = ''; - /** - * Read only snapshot transactions are supported, read/write and single use - * transactions are not. - * - * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; - */ - protected $transaction = null; - /** - * Required. The query request to generate partitions for. The request will - * fail if the query is not root partitionable. For a query to be root - * partitionable, it needs to satisfy a few conditions. For example, if the - * query execution plan contains a distributed union operator, then it must be - * the first operator in the plan. For more information about other - * conditions, see [Read data in - * parallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel). - * The query request must not contain DML commands, such as INSERT, UPDATE, or - * DELETE. Use - * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] with a - * PartitionedDml transaction for large, partition-friendly DML operations. - * - * Generated from protobuf field string sql = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $sql = ''; - /** - * Parameter names and values that bind to placeholders in the SQL string. - * A parameter placeholder consists of the `@` character followed by the - * parameter name (for example, `@firstName`). Parameter names can contain - * letters, numbers, and underscores. - * Parameters can appear anywhere that a literal value is expected. The same - * parameter name can be used more than once, for example: - * `"WHERE id > @msg_id AND id < @msg_id + 100"` - * It is an error to execute a SQL statement with unbound parameters. - * - * Generated from protobuf field .google.protobuf.Struct params = 4; - */ - protected $params = null; - /** - * It is not always possible for Cloud Spanner to infer the right SQL type - * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in - * [params][google.spanner.v1.PartitionQueryRequest.params] as JSON strings. - * In these cases, `param_types` can be used to specify the exact - * SQL type for some or all of the SQL query parameters. See the - * definition of [Type][google.spanner.v1.Type] for more information - * about SQL types. - * - * Generated from protobuf field map param_types = 5; - */ - private $param_types; - /** - * Additional options that affect how many partitions are created. - * - * Generated from protobuf field .google.spanner.v1.PartitionOptions partition_options = 6; - */ - protected $partition_options = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $session - * Required. The session used to create the partitions. - * @type \Google\Cloud\Spanner\V1\TransactionSelector $transaction - * Read only snapshot transactions are supported, read/write and single use - * transactions are not. - * @type string $sql - * Required. The query request to generate partitions for. The request will - * fail if the query is not root partitionable. For a query to be root - * partitionable, it needs to satisfy a few conditions. For example, if the - * query execution plan contains a distributed union operator, then it must be - * the first operator in the plan. For more information about other - * conditions, see [Read data in - * parallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel). - * The query request must not contain DML commands, such as INSERT, UPDATE, or - * DELETE. Use - * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] with a - * PartitionedDml transaction for large, partition-friendly DML operations. - * @type \Google\Protobuf\Struct $params - * Parameter names and values that bind to placeholders in the SQL string. - * A parameter placeholder consists of the `@` character followed by the - * parameter name (for example, `@firstName`). Parameter names can contain - * letters, numbers, and underscores. - * Parameters can appear anywhere that a literal value is expected. The same - * parameter name can be used more than once, for example: - * `"WHERE id > @msg_id AND id < @msg_id + 100"` - * It is an error to execute a SQL statement with unbound parameters. - * @type array|\Google\Protobuf\Internal\MapField $param_types - * It is not always possible for Cloud Spanner to infer the right SQL type - * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in - * [params][google.spanner.v1.PartitionQueryRequest.params] as JSON strings. - * In these cases, `param_types` can be used to specify the exact - * SQL type for some or all of the SQL query parameters. See the - * definition of [Type][google.spanner.v1.Type] for more information - * about SQL types. - * @type \Google\Cloud\Spanner\V1\PartitionOptions $partition_options - * Additional options that affect how many partitions are created. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * Required. The session used to create the partitions. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSession() - { - return $this->session; - } - - /** - * Required. The session used to create the partitions. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSession($var) - { - GPBUtil::checkString($var, True); - $this->session = $var; - - return $this; - } - - /** - * Read only snapshot transactions are supported, read/write and single use - * transactions are not. - * - * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; - * @return \Google\Cloud\Spanner\V1\TransactionSelector|null - */ - public function getTransaction() - { - return $this->transaction; - } - - public function hasTransaction() - { - return isset($this->transaction); - } - - public function clearTransaction() - { - unset($this->transaction); - } - - /** - * Read only snapshot transactions are supported, read/write and single use - * transactions are not. - * - * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; - * @param \Google\Cloud\Spanner\V1\TransactionSelector $var - * @return $this - */ - public function setTransaction($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionSelector::class); - $this->transaction = $var; - - return $this; - } - - /** - * Required. The query request to generate partitions for. The request will - * fail if the query is not root partitionable. For a query to be root - * partitionable, it needs to satisfy a few conditions. For example, if the - * query execution plan contains a distributed union operator, then it must be - * the first operator in the plan. For more information about other - * conditions, see [Read data in - * parallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel). - * The query request must not contain DML commands, such as INSERT, UPDATE, or - * DELETE. Use - * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] with a - * PartitionedDml transaction for large, partition-friendly DML operations. - * - * Generated from protobuf field string sql = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getSql() - { - return $this->sql; - } - - /** - * Required. The query request to generate partitions for. The request will - * fail if the query is not root partitionable. For a query to be root - * partitionable, it needs to satisfy a few conditions. For example, if the - * query execution plan contains a distributed union operator, then it must be - * the first operator in the plan. For more information about other - * conditions, see [Read data in - * parallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel). - * The query request must not contain DML commands, such as INSERT, UPDATE, or - * DELETE. Use - * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] with a - * PartitionedDml transaction for large, partition-friendly DML operations. - * - * Generated from protobuf field string sql = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setSql($var) - { - GPBUtil::checkString($var, True); - $this->sql = $var; - - return $this; - } - - /** - * Parameter names and values that bind to placeholders in the SQL string. - * A parameter placeholder consists of the `@` character followed by the - * parameter name (for example, `@firstName`). Parameter names can contain - * letters, numbers, and underscores. - * Parameters can appear anywhere that a literal value is expected. The same - * parameter name can be used more than once, for example: - * `"WHERE id > @msg_id AND id < @msg_id + 100"` - * It is an error to execute a SQL statement with unbound parameters. - * - * Generated from protobuf field .google.protobuf.Struct params = 4; - * @return \Google\Protobuf\Struct|null - */ - public function getParams() - { - return $this->params; - } - - public function hasParams() - { - return isset($this->params); - } - - public function clearParams() - { - unset($this->params); - } - - /** - * Parameter names and values that bind to placeholders in the SQL string. - * A parameter placeholder consists of the `@` character followed by the - * parameter name (for example, `@firstName`). Parameter names can contain - * letters, numbers, and underscores. - * Parameters can appear anywhere that a literal value is expected. The same - * parameter name can be used more than once, for example: - * `"WHERE id > @msg_id AND id < @msg_id + 100"` - * It is an error to execute a SQL statement with unbound parameters. - * - * Generated from protobuf field .google.protobuf.Struct params = 4; - * @param \Google\Protobuf\Struct $var - * @return $this - */ - public function setParams($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); - $this->params = $var; - - return $this; - } - - /** - * It is not always possible for Cloud Spanner to infer the right SQL type - * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in - * [params][google.spanner.v1.PartitionQueryRequest.params] as JSON strings. - * In these cases, `param_types` can be used to specify the exact - * SQL type for some or all of the SQL query parameters. See the - * definition of [Type][google.spanner.v1.Type] for more information - * about SQL types. - * - * Generated from protobuf field map param_types = 5; - * @return \Google\Protobuf\Internal\MapField - */ - public function getParamTypes() - { - return $this->param_types; - } - - /** - * It is not always possible for Cloud Spanner to infer the right SQL type - * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in - * [params][google.spanner.v1.PartitionQueryRequest.params] as JSON strings. - * In these cases, `param_types` can be used to specify the exact - * SQL type for some or all of the SQL query parameters. See the - * definition of [Type][google.spanner.v1.Type] for more information - * about SQL types. - * - * Generated from protobuf field map param_types = 5; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setParamTypes($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Type::class); - $this->param_types = $arr; - - return $this; - } - - /** - * Additional options that affect how many partitions are created. - * - * Generated from protobuf field .google.spanner.v1.PartitionOptions partition_options = 6; - * @return \Google\Cloud\Spanner\V1\PartitionOptions|null - */ - public function getPartitionOptions() - { - return $this->partition_options; - } - - public function hasPartitionOptions() - { - return isset($this->partition_options); - } - - public function clearPartitionOptions() - { - unset($this->partition_options); - } - - /** - * Additional options that affect how many partitions are created. - * - * Generated from protobuf field .google.spanner.v1.PartitionOptions partition_options = 6; - * @param \Google\Cloud\Spanner\V1\PartitionOptions $var - * @return $this - */ - public function setPartitionOptions($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\PartitionOptions::class); - $this->partition_options = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionReadRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionReadRequest.php deleted file mode 100644 index abf0b47074e2..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionReadRequest.php +++ /dev/null @@ -1,361 +0,0 @@ -google.spanner.v1.PartitionReadRequest - */ -class PartitionReadRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The session used to create the partitions. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $session = ''; - /** - * Read only snapshot transactions are supported, read/write and single use - * transactions are not. - * - * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; - */ - protected $transaction = null; - /** - * Required. The name of the table in the database to be read. - * - * Generated from protobuf field string table = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $table = ''; - /** - * If non-empty, the name of an index on - * [table][google.spanner.v1.PartitionReadRequest.table]. This index is used - * instead of the table primary key when interpreting - * [key_set][google.spanner.v1.PartitionReadRequest.key_set] and sorting - * result rows. See [key_set][google.spanner.v1.PartitionReadRequest.key_set] - * for further information. - * - * Generated from protobuf field string index = 4; - */ - protected $index = ''; - /** - * The columns of [table][google.spanner.v1.PartitionReadRequest.table] to be - * returned for each row matching this request. - * - * Generated from protobuf field repeated string columns = 5; - */ - private $columns; - /** - * Required. `key_set` identifies the rows to be yielded. `key_set` names the - * primary keys of the rows in - * [table][google.spanner.v1.PartitionReadRequest.table] to be yielded, unless - * [index][google.spanner.v1.PartitionReadRequest.index] is present. If - * [index][google.spanner.v1.PartitionReadRequest.index] is present, then - * [key_set][google.spanner.v1.PartitionReadRequest.key_set] instead names - * index keys in [index][google.spanner.v1.PartitionReadRequest.index]. - * It is not an error for the `key_set` to name rows that do not - * exist in the database. Read yields nothing for nonexistent rows. - * - * Generated from protobuf field .google.spanner.v1.KeySet key_set = 6 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $key_set = null; - /** - * Additional options that affect how many partitions are created. - * - * Generated from protobuf field .google.spanner.v1.PartitionOptions partition_options = 9; - */ - protected $partition_options = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $session - * Required. The session used to create the partitions. - * @type \Google\Cloud\Spanner\V1\TransactionSelector $transaction - * Read only snapshot transactions are supported, read/write and single use - * transactions are not. - * @type string $table - * Required. The name of the table in the database to be read. - * @type string $index - * If non-empty, the name of an index on - * [table][google.spanner.v1.PartitionReadRequest.table]. This index is used - * instead of the table primary key when interpreting - * [key_set][google.spanner.v1.PartitionReadRequest.key_set] and sorting - * result rows. See [key_set][google.spanner.v1.PartitionReadRequest.key_set] - * for further information. - * @type array|\Google\Protobuf\Internal\RepeatedField $columns - * The columns of [table][google.spanner.v1.PartitionReadRequest.table] to be - * returned for each row matching this request. - * @type \Google\Cloud\Spanner\V1\KeySet $key_set - * Required. `key_set` identifies the rows to be yielded. `key_set` names the - * primary keys of the rows in - * [table][google.spanner.v1.PartitionReadRequest.table] to be yielded, unless - * [index][google.spanner.v1.PartitionReadRequest.index] is present. If - * [index][google.spanner.v1.PartitionReadRequest.index] is present, then - * [key_set][google.spanner.v1.PartitionReadRequest.key_set] instead names - * index keys in [index][google.spanner.v1.PartitionReadRequest.index]. - * It is not an error for the `key_set` to name rows that do not - * exist in the database. Read yields nothing for nonexistent rows. - * @type \Google\Cloud\Spanner\V1\PartitionOptions $partition_options - * Additional options that affect how many partitions are created. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * Required. The session used to create the partitions. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSession() - { - return $this->session; - } - - /** - * Required. The session used to create the partitions. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSession($var) - { - GPBUtil::checkString($var, True); - $this->session = $var; - - return $this; - } - - /** - * Read only snapshot transactions are supported, read/write and single use - * transactions are not. - * - * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; - * @return \Google\Cloud\Spanner\V1\TransactionSelector|null - */ - public function getTransaction() - { - return $this->transaction; - } - - public function hasTransaction() - { - return isset($this->transaction); - } - - public function clearTransaction() - { - unset($this->transaction); - } - - /** - * Read only snapshot transactions are supported, read/write and single use - * transactions are not. - * - * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; - * @param \Google\Cloud\Spanner\V1\TransactionSelector $var - * @return $this - */ - public function setTransaction($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionSelector::class); - $this->transaction = $var; - - return $this; - } - - /** - * Required. The name of the table in the database to be read. - * - * Generated from protobuf field string table = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getTable() - { - return $this->table; - } - - /** - * Required. The name of the table in the database to be read. - * - * Generated from protobuf field string table = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setTable($var) - { - GPBUtil::checkString($var, True); - $this->table = $var; - - return $this; - } - - /** - * If non-empty, the name of an index on - * [table][google.spanner.v1.PartitionReadRequest.table]. This index is used - * instead of the table primary key when interpreting - * [key_set][google.spanner.v1.PartitionReadRequest.key_set] and sorting - * result rows. See [key_set][google.spanner.v1.PartitionReadRequest.key_set] - * for further information. - * - * Generated from protobuf field string index = 4; - * @return string - */ - public function getIndex() - { - return $this->index; - } - - /** - * If non-empty, the name of an index on - * [table][google.spanner.v1.PartitionReadRequest.table]. This index is used - * instead of the table primary key when interpreting - * [key_set][google.spanner.v1.PartitionReadRequest.key_set] and sorting - * result rows. See [key_set][google.spanner.v1.PartitionReadRequest.key_set] - * for further information. - * - * Generated from protobuf field string index = 4; - * @param string $var - * @return $this - */ - public function setIndex($var) - { - GPBUtil::checkString($var, True); - $this->index = $var; - - return $this; - } - - /** - * The columns of [table][google.spanner.v1.PartitionReadRequest.table] to be - * returned for each row matching this request. - * - * Generated from protobuf field repeated string columns = 5; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getColumns() - { - return $this->columns; - } - - /** - * The columns of [table][google.spanner.v1.PartitionReadRequest.table] to be - * returned for each row matching this request. - * - * Generated from protobuf field repeated string columns = 5; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setColumns($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->columns = $arr; - - return $this; - } - - /** - * Required. `key_set` identifies the rows to be yielded. `key_set` names the - * primary keys of the rows in - * [table][google.spanner.v1.PartitionReadRequest.table] to be yielded, unless - * [index][google.spanner.v1.PartitionReadRequest.index] is present. If - * [index][google.spanner.v1.PartitionReadRequest.index] is present, then - * [key_set][google.spanner.v1.PartitionReadRequest.key_set] instead names - * index keys in [index][google.spanner.v1.PartitionReadRequest.index]. - * It is not an error for the `key_set` to name rows that do not - * exist in the database. Read yields nothing for nonexistent rows. - * - * Generated from protobuf field .google.spanner.v1.KeySet key_set = 6 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\V1\KeySet|null - */ - public function getKeySet() - { - return $this->key_set; - } - - public function hasKeySet() - { - return isset($this->key_set); - } - - public function clearKeySet() - { - unset($this->key_set); - } - - /** - * Required. `key_set` identifies the rows to be yielded. `key_set` names the - * primary keys of the rows in - * [table][google.spanner.v1.PartitionReadRequest.table] to be yielded, unless - * [index][google.spanner.v1.PartitionReadRequest.index] is present. If - * [index][google.spanner.v1.PartitionReadRequest.index] is present, then - * [key_set][google.spanner.v1.PartitionReadRequest.key_set] instead names - * index keys in [index][google.spanner.v1.PartitionReadRequest.index]. - * It is not an error for the `key_set` to name rows that do not - * exist in the database. Read yields nothing for nonexistent rows. - * - * Generated from protobuf field .google.spanner.v1.KeySet key_set = 6 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\V1\KeySet $var - * @return $this - */ - public function setKeySet($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\KeySet::class); - $this->key_set = $var; - - return $this; - } - - /** - * Additional options that affect how many partitions are created. - * - * Generated from protobuf field .google.spanner.v1.PartitionOptions partition_options = 9; - * @return \Google\Cloud\Spanner\V1\PartitionOptions|null - */ - public function getPartitionOptions() - { - return $this->partition_options; - } - - public function hasPartitionOptions() - { - return isset($this->partition_options); - } - - public function clearPartitionOptions() - { - unset($this->partition_options); - } - - /** - * Additional options that affect how many partitions are created. - * - * Generated from protobuf field .google.spanner.v1.PartitionOptions partition_options = 9; - * @param \Google\Cloud\Spanner\V1\PartitionOptions $var - * @return $this - */ - public function setPartitionOptions($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\PartitionOptions::class); - $this->partition_options = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionResponse.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionResponse.php deleted file mode 100644 index f73e1179d2df..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartitionResponse.php +++ /dev/null @@ -1,112 +0,0 @@ -google.spanner.v1.PartitionResponse - */ -class PartitionResponse extends \Google\Protobuf\Internal\Message -{ - /** - * Partitions created by this request. - * - * Generated from protobuf field repeated .google.spanner.v1.Partition partitions = 1; - */ - private $partitions; - /** - * Transaction created by this request. - * - * Generated from protobuf field .google.spanner.v1.Transaction transaction = 2; - */ - protected $transaction = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Spanner\V1\Partition>|\Google\Protobuf\Internal\RepeatedField $partitions - * Partitions created by this request. - * @type \Google\Cloud\Spanner\V1\Transaction $transaction - * Transaction created by this request. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * Partitions created by this request. - * - * Generated from protobuf field repeated .google.spanner.v1.Partition partitions = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getPartitions() - { - return $this->partitions; - } - - /** - * Partitions created by this request. - * - * Generated from protobuf field repeated .google.spanner.v1.Partition partitions = 1; - * @param array<\Google\Cloud\Spanner\V1\Partition>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setPartitions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\Partition::class); - $this->partitions = $arr; - - return $this; - } - - /** - * Transaction created by this request. - * - * Generated from protobuf field .google.spanner.v1.Transaction transaction = 2; - * @return \Google\Cloud\Spanner\V1\Transaction|null - */ - public function getTransaction() - { - return $this->transaction; - } - - public function hasTransaction() - { - return isset($this->transaction); - } - - public function clearTransaction() - { - unset($this->transaction); - } - - /** - * Transaction created by this request. - * - * Generated from protobuf field .google.spanner.v1.Transaction transaction = 2; - * @param \Google\Cloud\Spanner\V1\Transaction $var - * @return $this - */ - public function setTransaction($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Transaction::class); - $this->transaction = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode.php deleted file mode 100644 index 9137384574bb..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode.php +++ /dev/null @@ -1,353 +0,0 @@ -google.spanner.v1.PlanNode - */ -class PlanNode extends \Google\Protobuf\Internal\Message -{ - /** - * The `PlanNode`'s index in [node list][google.spanner.v1.QueryPlan.plan_nodes]. - * - * Generated from protobuf field int32 index = 1; - */ - protected $index = 0; - /** - * Used to determine the type of node. May be needed for visualizing - * different kinds of nodes differently. For example, If the node is a - * [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] node, it will have a condensed representation - * which can be used to directly embed a description of the node in its - * parent. - * - * Generated from protobuf field .google.spanner.v1.PlanNode.Kind kind = 2; - */ - protected $kind = 0; - /** - * The display name for the node. - * - * Generated from protobuf field string display_name = 3; - */ - protected $display_name = ''; - /** - * List of child node `index`es and their relationship to this parent. - * - * Generated from protobuf field repeated .google.spanner.v1.PlanNode.ChildLink child_links = 4; - */ - private $child_links; - /** - * Condensed representation for [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] nodes. - * - * Generated from protobuf field .google.spanner.v1.PlanNode.ShortRepresentation short_representation = 5; - */ - protected $short_representation = null; - /** - * Attributes relevant to the node contained in a group of key-value pairs. - * For example, a Parameter Reference node could have the following - * information in its metadata: - * { - * "parameter_reference": "param1", - * "parameter_type": "array" - * } - * - * Generated from protobuf field .google.protobuf.Struct metadata = 6; - */ - protected $metadata = null; - /** - * The execution statistics associated with the node, contained in a group of - * key-value pairs. Only present if the plan was returned as a result of a - * profile query. For example, number of executions, number of rows/time per - * execution etc. - * - * Generated from protobuf field .google.protobuf.Struct execution_stats = 7; - */ - protected $execution_stats = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $index - * The `PlanNode`'s index in [node list][google.spanner.v1.QueryPlan.plan_nodes]. - * @type int $kind - * Used to determine the type of node. May be needed for visualizing - * different kinds of nodes differently. For example, If the node is a - * [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] node, it will have a condensed representation - * which can be used to directly embed a description of the node in its - * parent. - * @type string $display_name - * The display name for the node. - * @type array<\Google\Cloud\Spanner\V1\PlanNode\ChildLink>|\Google\Protobuf\Internal\RepeatedField $child_links - * List of child node `index`es and their relationship to this parent. - * @type \Google\Cloud\Spanner\V1\PlanNode\ShortRepresentation $short_representation - * Condensed representation for [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] nodes. - * @type \Google\Protobuf\Struct $metadata - * Attributes relevant to the node contained in a group of key-value pairs. - * For example, a Parameter Reference node could have the following - * information in its metadata: - * { - * "parameter_reference": "param1", - * "parameter_type": "array" - * } - * @type \Google\Protobuf\Struct $execution_stats - * The execution statistics associated with the node, contained in a group of - * key-value pairs. Only present if the plan was returned as a result of a - * profile query. For example, number of executions, number of rows/time per - * execution etc. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\QueryPlan::initOnce(); - parent::__construct($data); - } - - /** - * The `PlanNode`'s index in [node list][google.spanner.v1.QueryPlan.plan_nodes]. - * - * Generated from protobuf field int32 index = 1; - * @return int - */ - public function getIndex() - { - return $this->index; - } - - /** - * The `PlanNode`'s index in [node list][google.spanner.v1.QueryPlan.plan_nodes]. - * - * Generated from protobuf field int32 index = 1; - * @param int $var - * @return $this - */ - public function setIndex($var) - { - GPBUtil::checkInt32($var); - $this->index = $var; - - return $this; - } - - /** - * Used to determine the type of node. May be needed for visualizing - * different kinds of nodes differently. For example, If the node is a - * [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] node, it will have a condensed representation - * which can be used to directly embed a description of the node in its - * parent. - * - * Generated from protobuf field .google.spanner.v1.PlanNode.Kind kind = 2; - * @return int - */ - public function getKind() - { - return $this->kind; - } - - /** - * Used to determine the type of node. May be needed for visualizing - * different kinds of nodes differently. For example, If the node is a - * [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] node, it will have a condensed representation - * which can be used to directly embed a description of the node in its - * parent. - * - * Generated from protobuf field .google.spanner.v1.PlanNode.Kind kind = 2; - * @param int $var - * @return $this - */ - public function setKind($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\V1\PlanNode\Kind::class); - $this->kind = $var; - - return $this; - } - - /** - * The display name for the node. - * - * Generated from protobuf field string display_name = 3; - * @return string - */ - public function getDisplayName() - { - return $this->display_name; - } - - /** - * The display name for the node. - * - * Generated from protobuf field string display_name = 3; - * @param string $var - * @return $this - */ - public function setDisplayName($var) - { - GPBUtil::checkString($var, True); - $this->display_name = $var; - - return $this; - } - - /** - * List of child node `index`es and their relationship to this parent. - * - * Generated from protobuf field repeated .google.spanner.v1.PlanNode.ChildLink child_links = 4; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getChildLinks() - { - return $this->child_links; - } - - /** - * List of child node `index`es and their relationship to this parent. - * - * Generated from protobuf field repeated .google.spanner.v1.PlanNode.ChildLink child_links = 4; - * @param array<\Google\Cloud\Spanner\V1\PlanNode\ChildLink>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setChildLinks($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\PlanNode\ChildLink::class); - $this->child_links = $arr; - - return $this; - } - - /** - * Condensed representation for [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] nodes. - * - * Generated from protobuf field .google.spanner.v1.PlanNode.ShortRepresentation short_representation = 5; - * @return \Google\Cloud\Spanner\V1\PlanNode\ShortRepresentation|null - */ - public function getShortRepresentation() - { - return $this->short_representation; - } - - public function hasShortRepresentation() - { - return isset($this->short_representation); - } - - public function clearShortRepresentation() - { - unset($this->short_representation); - } - - /** - * Condensed representation for [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] nodes. - * - * Generated from protobuf field .google.spanner.v1.PlanNode.ShortRepresentation short_representation = 5; - * @param \Google\Cloud\Spanner\V1\PlanNode\ShortRepresentation $var - * @return $this - */ - public function setShortRepresentation($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\PlanNode\ShortRepresentation::class); - $this->short_representation = $var; - - return $this; - } - - /** - * Attributes relevant to the node contained in a group of key-value pairs. - * For example, a Parameter Reference node could have the following - * information in its metadata: - * { - * "parameter_reference": "param1", - * "parameter_type": "array" - * } - * - * Generated from protobuf field .google.protobuf.Struct metadata = 6; - * @return \Google\Protobuf\Struct|null - */ - public function getMetadata() - { - return $this->metadata; - } - - public function hasMetadata() - { - return isset($this->metadata); - } - - public function clearMetadata() - { - unset($this->metadata); - } - - /** - * Attributes relevant to the node contained in a group of key-value pairs. - * For example, a Parameter Reference node could have the following - * information in its metadata: - * { - * "parameter_reference": "param1", - * "parameter_type": "array" - * } - * - * Generated from protobuf field .google.protobuf.Struct metadata = 6; - * @param \Google\Protobuf\Struct $var - * @return $this - */ - public function setMetadata($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); - $this->metadata = $var; - - return $this; - } - - /** - * The execution statistics associated with the node, contained in a group of - * key-value pairs. Only present if the plan was returned as a result of a - * profile query. For example, number of executions, number of rows/time per - * execution etc. - * - * Generated from protobuf field .google.protobuf.Struct execution_stats = 7; - * @return \Google\Protobuf\Struct|null - */ - public function getExecutionStats() - { - return $this->execution_stats; - } - - public function hasExecutionStats() - { - return isset($this->execution_stats); - } - - public function clearExecutionStats() - { - unset($this->execution_stats); - } - - /** - * The execution statistics associated with the node, contained in a group of - * key-value pairs. Only present if the plan was returned as a result of a - * profile query. For example, number of executions, number of rows/time per - * execution etc. - * - * Generated from protobuf field .google.protobuf.Struct execution_stats = 7; - * @param \Google\Protobuf\Struct $var - * @return $this - */ - public function setExecutionStats($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); - $this->execution_stats = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/ChildLink.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/ChildLink.php deleted file mode 100644 index 1afd40ab8fdb..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/ChildLink.php +++ /dev/null @@ -1,179 +0,0 @@ -google.spanner.v1.PlanNode.ChildLink - */ -class ChildLink extends \Google\Protobuf\Internal\Message -{ - /** - * The node to which the link points. - * - * Generated from protobuf field int32 child_index = 1; - */ - protected $child_index = 0; - /** - * The type of the link. For example, in Hash Joins this could be used to - * distinguish between the build child and the probe child, or in the case - * of the child being an output variable, to represent the tag associated - * with the output variable. - * - * Generated from protobuf field string type = 2; - */ - protected $type = ''; - /** - * Only present if the child node is [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] and corresponds - * to an output variable of the parent node. The field carries the name of - * the output variable. - * For example, a `TableScan` operator that reads rows from a table will - * have child links to the `SCALAR` nodes representing the output variables - * created for each column that is read by the operator. The corresponding - * `variable` fields will be set to the variable names assigned to the - * columns. - * - * Generated from protobuf field string variable = 3; - */ - protected $variable = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $child_index - * The node to which the link points. - * @type string $type - * The type of the link. For example, in Hash Joins this could be used to - * distinguish between the build child and the probe child, or in the case - * of the child being an output variable, to represent the tag associated - * with the output variable. - * @type string $variable - * Only present if the child node is [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] and corresponds - * to an output variable of the parent node. The field carries the name of - * the output variable. - * For example, a `TableScan` operator that reads rows from a table will - * have child links to the `SCALAR` nodes representing the output variables - * created for each column that is read by the operator. The corresponding - * `variable` fields will be set to the variable names assigned to the - * columns. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\QueryPlan::initOnce(); - parent::__construct($data); - } - - /** - * The node to which the link points. - * - * Generated from protobuf field int32 child_index = 1; - * @return int - */ - public function getChildIndex() - { - return $this->child_index; - } - - /** - * The node to which the link points. - * - * Generated from protobuf field int32 child_index = 1; - * @param int $var - * @return $this - */ - public function setChildIndex($var) - { - GPBUtil::checkInt32($var); - $this->child_index = $var; - - return $this; - } - - /** - * The type of the link. For example, in Hash Joins this could be used to - * distinguish between the build child and the probe child, or in the case - * of the child being an output variable, to represent the tag associated - * with the output variable. - * - * Generated from protobuf field string type = 2; - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * The type of the link. For example, in Hash Joins this could be used to - * distinguish between the build child and the probe child, or in the case - * of the child being an output variable, to represent the tag associated - * with the output variable. - * - * Generated from protobuf field string type = 2; - * @param string $var - * @return $this - */ - public function setType($var) - { - GPBUtil::checkString($var, True); - $this->type = $var; - - return $this; - } - - /** - * Only present if the child node is [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] and corresponds - * to an output variable of the parent node. The field carries the name of - * the output variable. - * For example, a `TableScan` operator that reads rows from a table will - * have child links to the `SCALAR` nodes representing the output variables - * created for each column that is read by the operator. The corresponding - * `variable` fields will be set to the variable names assigned to the - * columns. - * - * Generated from protobuf field string variable = 3; - * @return string - */ - public function getVariable() - { - return $this->variable; - } - - /** - * Only present if the child node is [SCALAR][google.spanner.v1.PlanNode.Kind.SCALAR] and corresponds - * to an output variable of the parent node. The field carries the name of - * the output variable. - * For example, a `TableScan` operator that reads rows from a table will - * have child links to the `SCALAR` nodes representing the output variables - * created for each column that is read by the operator. The corresponding - * `variable` fields will be set to the variable names assigned to the - * columns. - * - * Generated from protobuf field string variable = 3; - * @param string $var - * @return $this - */ - public function setVariable($var) - { - GPBUtil::checkString($var, True); - $this->variable = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(ChildLink::class, \Google\Cloud\Spanner\V1\PlanNode_ChildLink::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/Kind.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/Kind.php deleted file mode 100644 index 78081c797e03..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/Kind.php +++ /dev/null @@ -1,70 +0,0 @@ -google.spanner.v1.PlanNode.Kind - */ -class Kind -{ - /** - * Not specified. - * - * Generated from protobuf enum KIND_UNSPECIFIED = 0; - */ - const KIND_UNSPECIFIED = 0; - /** - * Denotes a Relational operator node in the expression tree. Relational - * operators represent iterative processing of rows during query execution. - * For example, a `TableScan` operation that reads rows from a table. - * - * Generated from protobuf enum RELATIONAL = 1; - */ - const RELATIONAL = 1; - /** - * Denotes a Scalar node in the expression tree. Scalar nodes represent - * non-iterable entities in the query plan. For example, constants or - * arithmetic operators appearing inside predicate expressions or references - * to column names. - * - * Generated from protobuf enum SCALAR = 2; - */ - const SCALAR = 2; - - private static $valueToName = [ - self::KIND_UNSPECIFIED => 'KIND_UNSPECIFIED', - self::RELATIONAL => 'RELATIONAL', - self::SCALAR => 'SCALAR', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Kind::class, \Google\Cloud\Spanner\V1\PlanNode_Kind::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/ShortRepresentation.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/ShortRepresentation.php deleted file mode 100644 index 4de00c304229..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PlanNode/ShortRepresentation.php +++ /dev/null @@ -1,121 +0,0 @@ -google.spanner.v1.PlanNode.ShortRepresentation - */ -class ShortRepresentation extends \Google\Protobuf\Internal\Message -{ - /** - * A string representation of the expression subtree rooted at this node. - * - * Generated from protobuf field string description = 1; - */ - protected $description = ''; - /** - * A mapping of (subquery variable name) -> (subquery node id) for cases - * where the `description` string of this node references a `SCALAR` - * subquery contained in the expression subtree rooted at this node. The - * referenced `SCALAR` subquery may not necessarily be a direct child of - * this node. - * - * Generated from protobuf field map subqueries = 2; - */ - private $subqueries; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $description - * A string representation of the expression subtree rooted at this node. - * @type array|\Google\Protobuf\Internal\MapField $subqueries - * A mapping of (subquery variable name) -> (subquery node id) for cases - * where the `description` string of this node references a `SCALAR` - * subquery contained in the expression subtree rooted at this node. The - * referenced `SCALAR` subquery may not necessarily be a direct child of - * this node. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\QueryPlan::initOnce(); - parent::__construct($data); - } - - /** - * A string representation of the expression subtree rooted at this node. - * - * Generated from protobuf field string description = 1; - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * A string representation of the expression subtree rooted at this node. - * - * Generated from protobuf field string description = 1; - * @param string $var - * @return $this - */ - public function setDescription($var) - { - GPBUtil::checkString($var, True); - $this->description = $var; - - return $this; - } - - /** - * A mapping of (subquery variable name) -> (subquery node id) for cases - * where the `description` string of this node references a `SCALAR` - * subquery contained in the expression subtree rooted at this node. The - * referenced `SCALAR` subquery may not necessarily be a direct child of - * this node. - * - * Generated from protobuf field map subqueries = 2; - * @return \Google\Protobuf\Internal\MapField - */ - public function getSubqueries() - { - return $this->subqueries; - } - - /** - * A mapping of (subquery variable name) -> (subquery node id) for cases - * where the `description` string of this node references a `SCALAR` - * subquery contained in the expression subtree rooted at this node. The - * referenced `SCALAR` subquery may not necessarily be a direct child of - * this node. - * - * Generated from protobuf field map subqueries = 2; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setSubqueries($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT32); - $this->subqueries = $arr; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(ShortRepresentation::class, \Google\Cloud\Spanner\V1\PlanNode_ShortRepresentation::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/QueryPlan.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/QueryPlan.php deleted file mode 100644 index b09ddcab41ba..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/QueryPlan.php +++ /dev/null @@ -1,75 +0,0 @@ -google.spanner.v1.QueryPlan - */ -class QueryPlan extends \Google\Protobuf\Internal\Message -{ - /** - * The nodes in the query plan. Plan nodes are returned in pre-order starting - * with the plan root. Each [PlanNode][google.spanner.v1.PlanNode]'s `id` corresponds to its index in - * `plan_nodes`. - * - * Generated from protobuf field repeated .google.spanner.v1.PlanNode plan_nodes = 1; - */ - private $plan_nodes; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Spanner\V1\PlanNode>|\Google\Protobuf\Internal\RepeatedField $plan_nodes - * The nodes in the query plan. Plan nodes are returned in pre-order starting - * with the plan root. Each [PlanNode][google.spanner.v1.PlanNode]'s `id` corresponds to its index in - * `plan_nodes`. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\QueryPlan::initOnce(); - parent::__construct($data); - } - - /** - * The nodes in the query plan. Plan nodes are returned in pre-order starting - * with the plan root. Each [PlanNode][google.spanner.v1.PlanNode]'s `id` corresponds to its index in - * `plan_nodes`. - * - * Generated from protobuf field repeated .google.spanner.v1.PlanNode plan_nodes = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getPlanNodes() - { - return $this->plan_nodes; - } - - /** - * The nodes in the query plan. Plan nodes are returned in pre-order starting - * with the plan root. Each [PlanNode][google.spanner.v1.PlanNode]'s `id` corresponds to its index in - * `plan_nodes`. - * - * Generated from protobuf field repeated .google.spanner.v1.PlanNode plan_nodes = 1; - * @param array<\Google\Cloud\Spanner\V1\PlanNode>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setPlanNodes($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\PlanNode::class); - $this->plan_nodes = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest.php deleted file mode 100644 index 6f97b44a5e6f..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest.php +++ /dev/null @@ -1,706 +0,0 @@ -google.spanner.v1.ReadRequest - */ -class ReadRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The session in which the read should be performed. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $session = ''; - /** - * The transaction to use. If none is provided, the default is a - * temporary read-only transaction with strong concurrency. - * - * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; - */ - protected $transaction = null; - /** - * Required. The name of the table in the database to be read. - * - * Generated from protobuf field string table = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $table = ''; - /** - * If non-empty, the name of an index on - * [table][google.spanner.v1.ReadRequest.table]. This index is used instead of - * the table primary key when interpreting - * [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows. - * See [key_set][google.spanner.v1.ReadRequest.key_set] for further - * information. - * - * Generated from protobuf field string index = 4; - */ - protected $index = ''; - /** - * Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be - * returned for each row matching this request. - * - * Generated from protobuf field repeated string columns = 5 [(.google.api.field_behavior) = REQUIRED]; - */ - private $columns; - /** - * Required. `key_set` identifies the rows to be yielded. `key_set` names the - * primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to - * be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present. - * If [index][google.spanner.v1.ReadRequest.index] is present, then - * [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys - * in [index][google.spanner.v1.ReadRequest.index]. - * If the [partition_token][google.spanner.v1.ReadRequest.partition_token] - * field is empty, rows are yielded in table primary key order (if - * [index][google.spanner.v1.ReadRequest.index] is empty) or index key order - * (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the - * [partition_token][google.spanner.v1.ReadRequest.partition_token] field is - * not empty, rows will be yielded in an unspecified order. - * It is not an error for the `key_set` to name rows that do not - * exist in the database. Read yields nothing for nonexistent rows. - * - * Generated from protobuf field .google.spanner.v1.KeySet key_set = 6 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $key_set = null; - /** - * If greater than zero, only the first `limit` rows are yielded. If `limit` - * is zero, the default is no limit. A limit cannot be specified if - * `partition_token` is set. - * - * Generated from protobuf field int64 limit = 8; - */ - protected $limit = 0; - /** - * If this request is resuming a previously interrupted read, - * `resume_token` should be copied from the last - * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the - * interruption. Doing this enables the new read to resume where the last read - * left off. The rest of the request parameters must exactly match the request - * that yielded this token. - * - * Generated from protobuf field bytes resume_token = 9; - */ - protected $resume_token = ''; - /** - * If present, results will be restricted to the specified partition - * previously created using PartitionRead(). There must be an exact - * match for the values of fields common to this message and the - * PartitionReadRequest message used to create this partition_token. - * - * Generated from protobuf field bytes partition_token = 10; - */ - protected $partition_token = ''; - /** - * Common options for this request. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 11; - */ - protected $request_options = null; - /** - * Directed read options for this request. - * - * Generated from protobuf field .google.spanner.v1.DirectedReadOptions directed_read_options = 14; - */ - protected $directed_read_options = null; - /** - * If this is for a partitioned read and this field is set to `true`, the - * request is executed with Spanner Data Boost independent compute resources. - * If the field is set to `true` but the request does not set - * `partition_token`, the API returns an `INVALID_ARGUMENT` error. - * - * Generated from protobuf field bool data_boost_enabled = 15; - */ - protected $data_boost_enabled = false; - /** - * Optional. Order for the returned rows. - * By default, Spanner will return result rows in primary key order except for - * PartitionRead requests. For applications that do not require rows to be - * returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting - * `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval, - * resulting in lower latencies in certain cases (e.g. bulk point lookups). - * - * Generated from protobuf field .google.spanner.v1.ReadRequest.OrderBy order_by = 16 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $order_by = 0; - /** - * Optional. Lock Hint for the request, it can only be used with read-write - * transactions. - * - * Generated from protobuf field .google.spanner.v1.ReadRequest.LockHint lock_hint = 17 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $lock_hint = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $session - * Required. The session in which the read should be performed. - * @type \Google\Cloud\Spanner\V1\TransactionSelector $transaction - * The transaction to use. If none is provided, the default is a - * temporary read-only transaction with strong concurrency. - * @type string $table - * Required. The name of the table in the database to be read. - * @type string $index - * If non-empty, the name of an index on - * [table][google.spanner.v1.ReadRequest.table]. This index is used instead of - * the table primary key when interpreting - * [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows. - * See [key_set][google.spanner.v1.ReadRequest.key_set] for further - * information. - * @type array|\Google\Protobuf\Internal\RepeatedField $columns - * Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be - * returned for each row matching this request. - * @type \Google\Cloud\Spanner\V1\KeySet $key_set - * Required. `key_set` identifies the rows to be yielded. `key_set` names the - * primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to - * be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present. - * If [index][google.spanner.v1.ReadRequest.index] is present, then - * [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys - * in [index][google.spanner.v1.ReadRequest.index]. - * If the [partition_token][google.spanner.v1.ReadRequest.partition_token] - * field is empty, rows are yielded in table primary key order (if - * [index][google.spanner.v1.ReadRequest.index] is empty) or index key order - * (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the - * [partition_token][google.spanner.v1.ReadRequest.partition_token] field is - * not empty, rows will be yielded in an unspecified order. - * It is not an error for the `key_set` to name rows that do not - * exist in the database. Read yields nothing for nonexistent rows. - * @type int|string $limit - * If greater than zero, only the first `limit` rows are yielded. If `limit` - * is zero, the default is no limit. A limit cannot be specified if - * `partition_token` is set. - * @type string $resume_token - * If this request is resuming a previously interrupted read, - * `resume_token` should be copied from the last - * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the - * interruption. Doing this enables the new read to resume where the last read - * left off. The rest of the request parameters must exactly match the request - * that yielded this token. - * @type string $partition_token - * If present, results will be restricted to the specified partition - * previously created using PartitionRead(). There must be an exact - * match for the values of fields common to this message and the - * PartitionReadRequest message used to create this partition_token. - * @type \Google\Cloud\Spanner\V1\RequestOptions $request_options - * Common options for this request. - * @type \Google\Cloud\Spanner\V1\DirectedReadOptions $directed_read_options - * Directed read options for this request. - * @type bool $data_boost_enabled - * If this is for a partitioned read and this field is set to `true`, the - * request is executed with Spanner Data Boost independent compute resources. - * If the field is set to `true` but the request does not set - * `partition_token`, the API returns an `INVALID_ARGUMENT` error. - * @type int $order_by - * Optional. Order for the returned rows. - * By default, Spanner will return result rows in primary key order except for - * PartitionRead requests. For applications that do not require rows to be - * returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting - * `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval, - * resulting in lower latencies in certain cases (e.g. bulk point lookups). - * @type int $lock_hint - * Optional. Lock Hint for the request, it can only be used with read-write - * transactions. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * Required. The session in which the read should be performed. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSession() - { - return $this->session; - } - - /** - * Required. The session in which the read should be performed. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSession($var) - { - GPBUtil::checkString($var, True); - $this->session = $var; - - return $this; - } - - /** - * The transaction to use. If none is provided, the default is a - * temporary read-only transaction with strong concurrency. - * - * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; - * @return \Google\Cloud\Spanner\V1\TransactionSelector|null - */ - public function getTransaction() - { - return $this->transaction; - } - - public function hasTransaction() - { - return isset($this->transaction); - } - - public function clearTransaction() - { - unset($this->transaction); - } - - /** - * The transaction to use. If none is provided, the default is a - * temporary read-only transaction with strong concurrency. - * - * Generated from protobuf field .google.spanner.v1.TransactionSelector transaction = 2; - * @param \Google\Cloud\Spanner\V1\TransactionSelector $var - * @return $this - */ - public function setTransaction($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionSelector::class); - $this->transaction = $var; - - return $this; - } - - /** - * Required. The name of the table in the database to be read. - * - * Generated from protobuf field string table = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getTable() - { - return $this->table; - } - - /** - * Required. The name of the table in the database to be read. - * - * Generated from protobuf field string table = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setTable($var) - { - GPBUtil::checkString($var, True); - $this->table = $var; - - return $this; - } - - /** - * If non-empty, the name of an index on - * [table][google.spanner.v1.ReadRequest.table]. This index is used instead of - * the table primary key when interpreting - * [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows. - * See [key_set][google.spanner.v1.ReadRequest.key_set] for further - * information. - * - * Generated from protobuf field string index = 4; - * @return string - */ - public function getIndex() - { - return $this->index; - } - - /** - * If non-empty, the name of an index on - * [table][google.spanner.v1.ReadRequest.table]. This index is used instead of - * the table primary key when interpreting - * [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows. - * See [key_set][google.spanner.v1.ReadRequest.key_set] for further - * information. - * - * Generated from protobuf field string index = 4; - * @param string $var - * @return $this - */ - public function setIndex($var) - { - GPBUtil::checkString($var, True); - $this->index = $var; - - return $this; - } - - /** - * Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be - * returned for each row matching this request. - * - * Generated from protobuf field repeated string columns = 5 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getColumns() - { - return $this->columns; - } - - /** - * Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be - * returned for each row matching this request. - * - * Generated from protobuf field repeated string columns = 5 [(.google.api.field_behavior) = REQUIRED]; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setColumns($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->columns = $arr; - - return $this; - } - - /** - * Required. `key_set` identifies the rows to be yielded. `key_set` names the - * primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to - * be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present. - * If [index][google.spanner.v1.ReadRequest.index] is present, then - * [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys - * in [index][google.spanner.v1.ReadRequest.index]. - * If the [partition_token][google.spanner.v1.ReadRequest.partition_token] - * field is empty, rows are yielded in table primary key order (if - * [index][google.spanner.v1.ReadRequest.index] is empty) or index key order - * (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the - * [partition_token][google.spanner.v1.ReadRequest.partition_token] field is - * not empty, rows will be yielded in an unspecified order. - * It is not an error for the `key_set` to name rows that do not - * exist in the database. Read yields nothing for nonexistent rows. - * - * Generated from protobuf field .google.spanner.v1.KeySet key_set = 6 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Spanner\V1\KeySet|null - */ - public function getKeySet() - { - return $this->key_set; - } - - public function hasKeySet() - { - return isset($this->key_set); - } - - public function clearKeySet() - { - unset($this->key_set); - } - - /** - * Required. `key_set` identifies the rows to be yielded. `key_set` names the - * primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to - * be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present. - * If [index][google.spanner.v1.ReadRequest.index] is present, then - * [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys - * in [index][google.spanner.v1.ReadRequest.index]. - * If the [partition_token][google.spanner.v1.ReadRequest.partition_token] - * field is empty, rows are yielded in table primary key order (if - * [index][google.spanner.v1.ReadRequest.index] is empty) or index key order - * (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the - * [partition_token][google.spanner.v1.ReadRequest.partition_token] field is - * not empty, rows will be yielded in an unspecified order. - * It is not an error for the `key_set` to name rows that do not - * exist in the database. Read yields nothing for nonexistent rows. - * - * Generated from protobuf field .google.spanner.v1.KeySet key_set = 6 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Spanner\V1\KeySet $var - * @return $this - */ - public function setKeySet($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\KeySet::class); - $this->key_set = $var; - - return $this; - } - - /** - * If greater than zero, only the first `limit` rows are yielded. If `limit` - * is zero, the default is no limit. A limit cannot be specified if - * `partition_token` is set. - * - * Generated from protobuf field int64 limit = 8; - * @return int|string - */ - public function getLimit() - { - return $this->limit; - } - - /** - * If greater than zero, only the first `limit` rows are yielded. If `limit` - * is zero, the default is no limit. A limit cannot be specified if - * `partition_token` is set. - * - * Generated from protobuf field int64 limit = 8; - * @param int|string $var - * @return $this - */ - public function setLimit($var) - { - GPBUtil::checkInt64($var); - $this->limit = $var; - - return $this; - } - - /** - * If this request is resuming a previously interrupted read, - * `resume_token` should be copied from the last - * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the - * interruption. Doing this enables the new read to resume where the last read - * left off. The rest of the request parameters must exactly match the request - * that yielded this token. - * - * Generated from protobuf field bytes resume_token = 9; - * @return string - */ - public function getResumeToken() - { - return $this->resume_token; - } - - /** - * If this request is resuming a previously interrupted read, - * `resume_token` should be copied from the last - * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the - * interruption. Doing this enables the new read to resume where the last read - * left off. The rest of the request parameters must exactly match the request - * that yielded this token. - * - * Generated from protobuf field bytes resume_token = 9; - * @param string $var - * @return $this - */ - public function setResumeToken($var) - { - GPBUtil::checkString($var, False); - $this->resume_token = $var; - - return $this; - } - - /** - * If present, results will be restricted to the specified partition - * previously created using PartitionRead(). There must be an exact - * match for the values of fields common to this message and the - * PartitionReadRequest message used to create this partition_token. - * - * Generated from protobuf field bytes partition_token = 10; - * @return string - */ - public function getPartitionToken() - { - return $this->partition_token; - } - - /** - * If present, results will be restricted to the specified partition - * previously created using PartitionRead(). There must be an exact - * match for the values of fields common to this message and the - * PartitionReadRequest message used to create this partition_token. - * - * Generated from protobuf field bytes partition_token = 10; - * @param string $var - * @return $this - */ - public function setPartitionToken($var) - { - GPBUtil::checkString($var, False); - $this->partition_token = $var; - - return $this; - } - - /** - * Common options for this request. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 11; - * @return \Google\Cloud\Spanner\V1\RequestOptions|null - */ - public function getRequestOptions() - { - return $this->request_options; - } - - public function hasRequestOptions() - { - return isset($this->request_options); - } - - public function clearRequestOptions() - { - unset($this->request_options); - } - - /** - * Common options for this request. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions request_options = 11; - * @param \Google\Cloud\Spanner\V1\RequestOptions $var - * @return $this - */ - public function setRequestOptions($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\RequestOptions::class); - $this->request_options = $var; - - return $this; - } - - /** - * Directed read options for this request. - * - * Generated from protobuf field .google.spanner.v1.DirectedReadOptions directed_read_options = 14; - * @return \Google\Cloud\Spanner\V1\DirectedReadOptions|null - */ - public function getDirectedReadOptions() - { - return $this->directed_read_options; - } - - public function hasDirectedReadOptions() - { - return isset($this->directed_read_options); - } - - public function clearDirectedReadOptions() - { - unset($this->directed_read_options); - } - - /** - * Directed read options for this request. - * - * Generated from protobuf field .google.spanner.v1.DirectedReadOptions directed_read_options = 14; - * @param \Google\Cloud\Spanner\V1\DirectedReadOptions $var - * @return $this - */ - public function setDirectedReadOptions($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\DirectedReadOptions::class); - $this->directed_read_options = $var; - - return $this; - } - - /** - * If this is for a partitioned read and this field is set to `true`, the - * request is executed with Spanner Data Boost independent compute resources. - * If the field is set to `true` but the request does not set - * `partition_token`, the API returns an `INVALID_ARGUMENT` error. - * - * Generated from protobuf field bool data_boost_enabled = 15; - * @return bool - */ - public function getDataBoostEnabled() - { - return $this->data_boost_enabled; - } - - /** - * If this is for a partitioned read and this field is set to `true`, the - * request is executed with Spanner Data Boost independent compute resources. - * If the field is set to `true` but the request does not set - * `partition_token`, the API returns an `INVALID_ARGUMENT` error. - * - * Generated from protobuf field bool data_boost_enabled = 15; - * @param bool $var - * @return $this - */ - public function setDataBoostEnabled($var) - { - GPBUtil::checkBool($var); - $this->data_boost_enabled = $var; - - return $this; - } - - /** - * Optional. Order for the returned rows. - * By default, Spanner will return result rows in primary key order except for - * PartitionRead requests. For applications that do not require rows to be - * returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting - * `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval, - * resulting in lower latencies in certain cases (e.g. bulk point lookups). - * - * Generated from protobuf field .google.spanner.v1.ReadRequest.OrderBy order_by = 16 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getOrderBy() - { - return $this->order_by; - } - - /** - * Optional. Order for the returned rows. - * By default, Spanner will return result rows in primary key order except for - * PartitionRead requests. For applications that do not require rows to be - * returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting - * `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval, - * resulting in lower latencies in certain cases (e.g. bulk point lookups). - * - * Generated from protobuf field .google.spanner.v1.ReadRequest.OrderBy order_by = 16 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setOrderBy($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\V1\ReadRequest\OrderBy::class); - $this->order_by = $var; - - return $this; - } - - /** - * Optional. Lock Hint for the request, it can only be used with read-write - * transactions. - * - * Generated from protobuf field .google.spanner.v1.ReadRequest.LockHint lock_hint = 17 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getLockHint() - { - return $this->lock_hint; - } - - /** - * Optional. Lock Hint for the request, it can only be used with read-write - * transactions. - * - * Generated from protobuf field .google.spanner.v1.ReadRequest.LockHint lock_hint = 17 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setLockHint($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\V1\ReadRequest\LockHint::class); - $this->lock_hint = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest/LockHint.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest/LockHint.php deleted file mode 100644 index c0e38b196dbf..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest/LockHint.php +++ /dev/null @@ -1,95 +0,0 @@ -google.spanner.v1.ReadRequest.LockHint - */ -class LockHint -{ - /** - * Default value. - * LOCK_HINT_UNSPECIFIED is equivalent to LOCK_HINT_SHARED. - * - * Generated from protobuf enum LOCK_HINT_UNSPECIFIED = 0; - */ - const LOCK_HINT_UNSPECIFIED = 0; - /** - * Acquire shared locks. - * By default when you perform a read as part of a read-write transaction, - * Spanner acquires shared read locks, which allows other reads to still - * access the data until your transaction is ready to commit. When your - * transaction is committing and writes are being applied, the transaction - * attempts to upgrade to an exclusive lock for any data you are writing. - * For more information about locks, see [Lock - * modes](https://cloud.google.com/spanner/docs/introspection/lock-statistics#explain-lock-modes). - * - * Generated from protobuf enum LOCK_HINT_SHARED = 1; - */ - const LOCK_HINT_SHARED = 1; - /** - * Acquire exclusive locks. - * Requesting exclusive locks is beneficial if you observe high write - * contention, which means you notice that multiple transactions are - * concurrently trying to read and write to the same data, resulting in a - * large number of aborts. This problem occurs when two transactions - * initially acquire shared locks and then both try to upgrade to exclusive - * locks at the same time. In this situation both transactions are waiting - * for the other to give up their lock, resulting in a deadlocked situation. - * Spanner is able to detect this occurring and force one of the - * transactions to abort. However, this is a slow and expensive operation - * and results in lower performance. In this case it makes sense to acquire - * exclusive locks at the start of the transaction because then when - * multiple transactions try to act on the same data, they automatically get - * serialized. Each transaction waits its turn to acquire the lock and - * avoids getting into deadlock situations. - * Because the exclusive lock hint is just a hint, it should not be - * considered equivalent to a mutex. In other words, you should not use - * Spanner exclusive locks as a mutual exclusion mechanism for the execution - * of code outside of Spanner. - * **Note:** Request exclusive locks judiciously because they block others - * from reading that data for the entire transaction, rather than just when - * the writes are being performed. Unless you observe high write contention, - * you should use the default of shared read locks so you don't prematurely - * block other clients from reading the data that you're writing to. - * - * Generated from protobuf enum LOCK_HINT_EXCLUSIVE = 2; - */ - const LOCK_HINT_EXCLUSIVE = 2; - - private static $valueToName = [ - self::LOCK_HINT_UNSPECIFIED => 'LOCK_HINT_UNSPECIFIED', - self::LOCK_HINT_SHARED => 'LOCK_HINT_SHARED', - self::LOCK_HINT_EXCLUSIVE => 'LOCK_HINT_EXCLUSIVE', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(LockHint::class, \Google\Cloud\Spanner\V1\ReadRequest_LockHint::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest/OrderBy.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest/OrderBy.php deleted file mode 100644 index 4a229a9738f2..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest/OrderBy.php +++ /dev/null @@ -1,67 +0,0 @@ -google.spanner.v1.ReadRequest.OrderBy - */ -class OrderBy -{ - /** - * Default value. - * ORDER_BY_UNSPECIFIED is equivalent to ORDER_BY_PRIMARY_KEY. - * - * Generated from protobuf enum ORDER_BY_UNSPECIFIED = 0; - */ - const ORDER_BY_UNSPECIFIED = 0; - /** - * Read rows are returned in primary key order. - * In the event that this option is used in conjunction with the - * `partition_token` field, the API will return an `INVALID_ARGUMENT` error. - * - * Generated from protobuf enum ORDER_BY_PRIMARY_KEY = 1; - */ - const ORDER_BY_PRIMARY_KEY = 1; - /** - * Read rows are returned in any order. - * - * Generated from protobuf enum ORDER_BY_NO_ORDER = 2; - */ - const ORDER_BY_NO_ORDER = 2; - - private static $valueToName = [ - self::ORDER_BY_UNSPECIFIED => 'ORDER_BY_UNSPECIFIED', - self::ORDER_BY_PRIMARY_KEY => 'ORDER_BY_PRIMARY_KEY', - self::ORDER_BY_NO_ORDER => 'ORDER_BY_NO_ORDER', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(OrderBy::class, \Google\Cloud\Spanner\V1\ReadRequest_OrderBy::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RequestOptions.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RequestOptions.php deleted file mode 100644 index 1b2cd281d004..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RequestOptions.php +++ /dev/null @@ -1,211 +0,0 @@ -google.spanner.v1.RequestOptions - */ -class RequestOptions extends \Google\Protobuf\Internal\Message -{ - /** - * Priority for the request. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions.Priority priority = 1; - */ - protected $priority = 0; - /** - * A per-request tag which can be applied to queries or reads, used for - * statistics collection. - * Both request_tag and transaction_tag can be specified for a read or query - * that belongs to a transaction. - * This field is ignored for requests where it's not applicable (e.g. - * CommitRequest). - * Legal characters for `request_tag` values are all printable characters - * (ASCII 32 - 126) and the length of a request_tag is limited to 50 - * characters. Values that exceed this limit are truncated. - * Any leading underscore (_) characters will be removed from the string. - * - * Generated from protobuf field string request_tag = 2; - */ - protected $request_tag = ''; - /** - * A tag used for statistics collection about this transaction. - * Both request_tag and transaction_tag can be specified for a read or query - * that belongs to a transaction. - * The value of transaction_tag should be the same for all requests belonging - * to the same transaction. - * If this request doesn't belong to any transaction, transaction_tag will be - * ignored. - * Legal characters for `transaction_tag` values are all printable characters - * (ASCII 32 - 126) and the length of a transaction_tag is limited to 50 - * characters. Values that exceed this limit are truncated. - * Any leading underscore (_) characters will be removed from the string. - * - * Generated from protobuf field string transaction_tag = 3; - */ - protected $transaction_tag = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $priority - * Priority for the request. - * @type string $request_tag - * A per-request tag which can be applied to queries or reads, used for - * statistics collection. - * Both request_tag and transaction_tag can be specified for a read or query - * that belongs to a transaction. - * This field is ignored for requests where it's not applicable (e.g. - * CommitRequest). - * Legal characters for `request_tag` values are all printable characters - * (ASCII 32 - 126) and the length of a request_tag is limited to 50 - * characters. Values that exceed this limit are truncated. - * Any leading underscore (_) characters will be removed from the string. - * @type string $transaction_tag - * A tag used for statistics collection about this transaction. - * Both request_tag and transaction_tag can be specified for a read or query - * that belongs to a transaction. - * The value of transaction_tag should be the same for all requests belonging - * to the same transaction. - * If this request doesn't belong to any transaction, transaction_tag will be - * ignored. - * Legal characters for `transaction_tag` values are all printable characters - * (ASCII 32 - 126) and the length of a transaction_tag is limited to 50 - * characters. Values that exceed this limit are truncated. - * Any leading underscore (_) characters will be removed from the string. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * Priority for the request. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions.Priority priority = 1; - * @return int - */ - public function getPriority() - { - return $this->priority; - } - - /** - * Priority for the request. - * - * Generated from protobuf field .google.spanner.v1.RequestOptions.Priority priority = 1; - * @param int $var - * @return $this - */ - public function setPriority($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\V1\RequestOptions\Priority::class); - $this->priority = $var; - - return $this; - } - - /** - * A per-request tag which can be applied to queries or reads, used for - * statistics collection. - * Both request_tag and transaction_tag can be specified for a read or query - * that belongs to a transaction. - * This field is ignored for requests where it's not applicable (e.g. - * CommitRequest). - * Legal characters for `request_tag` values are all printable characters - * (ASCII 32 - 126) and the length of a request_tag is limited to 50 - * characters. Values that exceed this limit are truncated. - * Any leading underscore (_) characters will be removed from the string. - * - * Generated from protobuf field string request_tag = 2; - * @return string - */ - public function getRequestTag() - { - return $this->request_tag; - } - - /** - * A per-request tag which can be applied to queries or reads, used for - * statistics collection. - * Both request_tag and transaction_tag can be specified for a read or query - * that belongs to a transaction. - * This field is ignored for requests where it's not applicable (e.g. - * CommitRequest). - * Legal characters for `request_tag` values are all printable characters - * (ASCII 32 - 126) and the length of a request_tag is limited to 50 - * characters. Values that exceed this limit are truncated. - * Any leading underscore (_) characters will be removed from the string. - * - * Generated from protobuf field string request_tag = 2; - * @param string $var - * @return $this - */ - public function setRequestTag($var) - { - GPBUtil::checkString($var, True); - $this->request_tag = $var; - - return $this; - } - - /** - * A tag used for statistics collection about this transaction. - * Both request_tag and transaction_tag can be specified for a read or query - * that belongs to a transaction. - * The value of transaction_tag should be the same for all requests belonging - * to the same transaction. - * If this request doesn't belong to any transaction, transaction_tag will be - * ignored. - * Legal characters for `transaction_tag` values are all printable characters - * (ASCII 32 - 126) and the length of a transaction_tag is limited to 50 - * characters. Values that exceed this limit are truncated. - * Any leading underscore (_) characters will be removed from the string. - * - * Generated from protobuf field string transaction_tag = 3; - * @return string - */ - public function getTransactionTag() - { - return $this->transaction_tag; - } - - /** - * A tag used for statistics collection about this transaction. - * Both request_tag and transaction_tag can be specified for a read or query - * that belongs to a transaction. - * The value of transaction_tag should be the same for all requests belonging - * to the same transaction. - * If this request doesn't belong to any transaction, transaction_tag will be - * ignored. - * Legal characters for `transaction_tag` values are all printable characters - * (ASCII 32 - 126) and the length of a transaction_tag is limited to 50 - * characters. Values that exceed this limit are truncated. - * Any leading underscore (_) characters will be removed from the string. - * - * Generated from protobuf field string transaction_tag = 3; - * @param string $var - * @return $this - */ - public function setTransactionTag($var) - { - GPBUtil::checkString($var, True); - $this->transaction_tag = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RequestOptions/Priority.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RequestOptions/Priority.php deleted file mode 100644 index b8d614f98da5..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RequestOptions/Priority.php +++ /dev/null @@ -1,84 +0,0 @@ -google.spanner.v1.RequestOptions.Priority - */ -class Priority -{ - /** - * `PRIORITY_UNSPECIFIED` is equivalent to `PRIORITY_HIGH`. - * - * Generated from protobuf enum PRIORITY_UNSPECIFIED = 0; - */ - const PRIORITY_UNSPECIFIED = 0; - /** - * This specifies that the request is low priority. - * - * Generated from protobuf enum PRIORITY_LOW = 1; - */ - const PRIORITY_LOW = 1; - /** - * This specifies that the request is medium priority. - * - * Generated from protobuf enum PRIORITY_MEDIUM = 2; - */ - const PRIORITY_MEDIUM = 2; - /** - * This specifies that the request is high priority. - * - * Generated from protobuf enum PRIORITY_HIGH = 3; - */ - const PRIORITY_HIGH = 3; - - private static $valueToName = [ - self::PRIORITY_UNSPECIFIED => 'PRIORITY_UNSPECIFIED', - self::PRIORITY_LOW => 'PRIORITY_LOW', - self::PRIORITY_MEDIUM => 'PRIORITY_MEDIUM', - self::PRIORITY_HIGH => 'PRIORITY_HIGH', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Priority::class, \Google\Cloud\Spanner\V1\RequestOptions_Priority::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSet.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSet.php deleted file mode 100644 index af4bbe1996f0..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSet.php +++ /dev/null @@ -1,272 +0,0 @@ -google.spanner.v1.ResultSet - */ -class ResultSet extends \Google\Protobuf\Internal\Message -{ - /** - * Metadata about the result set, such as row type information. - * - * Generated from protobuf field .google.spanner.v1.ResultSetMetadata metadata = 1; - */ - protected $metadata = null; - /** - * Each element in `rows` is a row whose format is defined by - * [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. The ith element - * in each row matches the ith field in - * [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. Elements are - * encoded based on type as described - * [here][google.spanner.v1.TypeCode]. - * - * Generated from protobuf field repeated .google.protobuf.ListValue rows = 2; - */ - private $rows; - /** - * Query plan and execution statistics for the SQL statement that - * produced this result set. These can be requested by setting - * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. - * DML statements always produce stats containing the number of rows - * modified, unless executed using the - * [ExecuteSqlRequest.QueryMode.PLAN][google.spanner.v1.ExecuteSqlRequest.QueryMode.PLAN] [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. - * Other fields may or may not be populated, based on the - * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. - * - * Generated from protobuf field .google.spanner.v1.ResultSetStats stats = 3; - */ - protected $stats = null; - /** - * Optional. A precommit token will be included if the read-write transaction - * is on a multiplexed session. - * The precommit token with the highest sequence number from this transaction - * attempt should be passed to the - * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $precommit_token = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\V1\ResultSetMetadata $metadata - * Metadata about the result set, such as row type information. - * @type array<\Google\Protobuf\ListValue>|\Google\Protobuf\Internal\RepeatedField $rows - * Each element in `rows` is a row whose format is defined by - * [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. The ith element - * in each row matches the ith field in - * [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. Elements are - * encoded based on type as described - * [here][google.spanner.v1.TypeCode]. - * @type \Google\Cloud\Spanner\V1\ResultSetStats $stats - * Query plan and execution statistics for the SQL statement that - * produced this result set. These can be requested by setting - * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. - * DML statements always produce stats containing the number of rows - * modified, unless executed using the - * [ExecuteSqlRequest.QueryMode.PLAN][google.spanner.v1.ExecuteSqlRequest.QueryMode.PLAN] [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. - * Other fields may or may not be populated, based on the - * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. - * @type \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $precommit_token - * Optional. A precommit token will be included if the read-write transaction - * is on a multiplexed session. - * The precommit token with the highest sequence number from this transaction - * attempt should be passed to the - * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\ResultSet::initOnce(); - parent::__construct($data); - } - - /** - * Metadata about the result set, such as row type information. - * - * Generated from protobuf field .google.spanner.v1.ResultSetMetadata metadata = 1; - * @return \Google\Cloud\Spanner\V1\ResultSetMetadata|null - */ - public function getMetadata() - { - return $this->metadata; - } - - public function hasMetadata() - { - return isset($this->metadata); - } - - public function clearMetadata() - { - unset($this->metadata); - } - - /** - * Metadata about the result set, such as row type information. - * - * Generated from protobuf field .google.spanner.v1.ResultSetMetadata metadata = 1; - * @param \Google\Cloud\Spanner\V1\ResultSetMetadata $var - * @return $this - */ - public function setMetadata($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\ResultSetMetadata::class); - $this->metadata = $var; - - return $this; - } - - /** - * Each element in `rows` is a row whose format is defined by - * [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. The ith element - * in each row matches the ith field in - * [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. Elements are - * encoded based on type as described - * [here][google.spanner.v1.TypeCode]. - * - * Generated from protobuf field repeated .google.protobuf.ListValue rows = 2; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getRows() - { - return $this->rows; - } - - /** - * Each element in `rows` is a row whose format is defined by - * [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. The ith element - * in each row matches the ith field in - * [metadata.row_type][google.spanner.v1.ResultSetMetadata.row_type]. Elements are - * encoded based on type as described - * [here][google.spanner.v1.TypeCode]. - * - * Generated from protobuf field repeated .google.protobuf.ListValue rows = 2; - * @param array<\Google\Protobuf\ListValue>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setRows($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\ListValue::class); - $this->rows = $arr; - - return $this; - } - - /** - * Query plan and execution statistics for the SQL statement that - * produced this result set. These can be requested by setting - * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. - * DML statements always produce stats containing the number of rows - * modified, unless executed using the - * [ExecuteSqlRequest.QueryMode.PLAN][google.spanner.v1.ExecuteSqlRequest.QueryMode.PLAN] [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. - * Other fields may or may not be populated, based on the - * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. - * - * Generated from protobuf field .google.spanner.v1.ResultSetStats stats = 3; - * @return \Google\Cloud\Spanner\V1\ResultSetStats|null - */ - public function getStats() - { - return $this->stats; - } - - public function hasStats() - { - return isset($this->stats); - } - - public function clearStats() - { - unset($this->stats); - } - - /** - * Query plan and execution statistics for the SQL statement that - * produced this result set. These can be requested by setting - * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. - * DML statements always produce stats containing the number of rows - * modified, unless executed using the - * [ExecuteSqlRequest.QueryMode.PLAN][google.spanner.v1.ExecuteSqlRequest.QueryMode.PLAN] [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. - * Other fields may or may not be populated, based on the - * [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. - * - * Generated from protobuf field .google.spanner.v1.ResultSetStats stats = 3; - * @param \Google\Cloud\Spanner\V1\ResultSetStats $var - * @return $this - */ - public function setStats($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\ResultSetStats::class); - $this->stats = $var; - - return $this; - } - - /** - * Optional. A precommit token will be included if the read-write transaction - * is on a multiplexed session. - * The precommit token with the highest sequence number from this transaction - * attempt should be passed to the - * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @return \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken|null - */ - public function getPrecommitToken() - { - return $this->precommit_token; - } - - public function hasPrecommitToken() - { - return isset($this->precommit_token); - } - - public function clearPrecommitToken() - { - unset($this->precommit_token); - } - - /** - * Optional. A precommit token will be included if the read-write transaction - * is on a multiplexed session. - * The precommit token with the highest sequence number from this transaction - * attempt should be passed to the - * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; - * @param \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $var - * @return $this - */ - public function setPrecommitToken($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken::class); - $this->precommit_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSetMetadata.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSetMetadata.php deleted file mode 100644 index fac10e18e680..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSetMetadata.php +++ /dev/null @@ -1,225 +0,0 @@ -google.spanner.v1.ResultSetMetadata - */ -class ResultSetMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * Indicates the field names and types for the rows in the result - * set. For example, a SQL query like `"SELECT UserId, UserName FROM - * Users"` could return a `row_type` value like: - * "fields": [ - * { "name": "UserId", "type": { "code": "INT64" } }, - * { "name": "UserName", "type": { "code": "STRING" } }, - * ] - * - * Generated from protobuf field .google.spanner.v1.StructType row_type = 1; - */ - protected $row_type = null; - /** - * If the read or SQL query began a transaction as a side-effect, the - * information about the new transaction is yielded here. - * - * Generated from protobuf field .google.spanner.v1.Transaction transaction = 2; - */ - protected $transaction = null; - /** - * A SQL query can be parameterized. In PLAN mode, these parameters can be - * undeclared. This indicates the field names and types for those undeclared - * parameters in the SQL query. For example, a SQL query like `"SELECT * FROM - * Users where UserId = @userId and UserName = @userName "` could return a - * `undeclared_parameters` value like: - * "fields": [ - * { "name": "UserId", "type": { "code": "INT64" } }, - * { "name": "UserName", "type": { "code": "STRING" } }, - * ] - * - * Generated from protobuf field .google.spanner.v1.StructType undeclared_parameters = 3; - */ - protected $undeclared_parameters = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\V1\StructType $row_type - * Indicates the field names and types for the rows in the result - * set. For example, a SQL query like `"SELECT UserId, UserName FROM - * Users"` could return a `row_type` value like: - * "fields": [ - * { "name": "UserId", "type": { "code": "INT64" } }, - * { "name": "UserName", "type": { "code": "STRING" } }, - * ] - * @type \Google\Cloud\Spanner\V1\Transaction $transaction - * If the read or SQL query began a transaction as a side-effect, the - * information about the new transaction is yielded here. - * @type \Google\Cloud\Spanner\V1\StructType $undeclared_parameters - * A SQL query can be parameterized. In PLAN mode, these parameters can be - * undeclared. This indicates the field names and types for those undeclared - * parameters in the SQL query. For example, a SQL query like `"SELECT * FROM - * Users where UserId = @userId and UserName = @userName "` could return a - * `undeclared_parameters` value like: - * "fields": [ - * { "name": "UserId", "type": { "code": "INT64" } }, - * { "name": "UserName", "type": { "code": "STRING" } }, - * ] - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\ResultSet::initOnce(); - parent::__construct($data); - } - - /** - * Indicates the field names and types for the rows in the result - * set. For example, a SQL query like `"SELECT UserId, UserName FROM - * Users"` could return a `row_type` value like: - * "fields": [ - * { "name": "UserId", "type": { "code": "INT64" } }, - * { "name": "UserName", "type": { "code": "STRING" } }, - * ] - * - * Generated from protobuf field .google.spanner.v1.StructType row_type = 1; - * @return \Google\Cloud\Spanner\V1\StructType|null - */ - public function getRowType() - { - return $this->row_type; - } - - public function hasRowType() - { - return isset($this->row_type); - } - - public function clearRowType() - { - unset($this->row_type); - } - - /** - * Indicates the field names and types for the rows in the result - * set. For example, a SQL query like `"SELECT UserId, UserName FROM - * Users"` could return a `row_type` value like: - * "fields": [ - * { "name": "UserId", "type": { "code": "INT64" } }, - * { "name": "UserName", "type": { "code": "STRING" } }, - * ] - * - * Generated from protobuf field .google.spanner.v1.StructType row_type = 1; - * @param \Google\Cloud\Spanner\V1\StructType $var - * @return $this - */ - public function setRowType($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\StructType::class); - $this->row_type = $var; - - return $this; - } - - /** - * If the read or SQL query began a transaction as a side-effect, the - * information about the new transaction is yielded here. - * - * Generated from protobuf field .google.spanner.v1.Transaction transaction = 2; - * @return \Google\Cloud\Spanner\V1\Transaction|null - */ - public function getTransaction() - { - return $this->transaction; - } - - public function hasTransaction() - { - return isset($this->transaction); - } - - public function clearTransaction() - { - unset($this->transaction); - } - - /** - * If the read or SQL query began a transaction as a side-effect, the - * information about the new transaction is yielded here. - * - * Generated from protobuf field .google.spanner.v1.Transaction transaction = 2; - * @param \Google\Cloud\Spanner\V1\Transaction $var - * @return $this - */ - public function setTransaction($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Transaction::class); - $this->transaction = $var; - - return $this; - } - - /** - * A SQL query can be parameterized. In PLAN mode, these parameters can be - * undeclared. This indicates the field names and types for those undeclared - * parameters in the SQL query. For example, a SQL query like `"SELECT * FROM - * Users where UserId = @userId and UserName = @userName "` could return a - * `undeclared_parameters` value like: - * "fields": [ - * { "name": "UserId", "type": { "code": "INT64" } }, - * { "name": "UserName", "type": { "code": "STRING" } }, - * ] - * - * Generated from protobuf field .google.spanner.v1.StructType undeclared_parameters = 3; - * @return \Google\Cloud\Spanner\V1\StructType|null - */ - public function getUndeclaredParameters() - { - return $this->undeclared_parameters; - } - - public function hasUndeclaredParameters() - { - return isset($this->undeclared_parameters); - } - - public function clearUndeclaredParameters() - { - unset($this->undeclared_parameters); - } - - /** - * A SQL query can be parameterized. In PLAN mode, these parameters can be - * undeclared. This indicates the field names and types for those undeclared - * parameters in the SQL query. For example, a SQL query like `"SELECT * FROM - * Users where UserId = @userId and UserName = @userName "` could return a - * `undeclared_parameters` value like: - * "fields": [ - * { "name": "UserId", "type": { "code": "INT64" } }, - * { "name": "UserName", "type": { "code": "STRING" } }, - * ] - * - * Generated from protobuf field .google.spanner.v1.StructType undeclared_parameters = 3; - * @param \Google\Cloud\Spanner\V1\StructType $var - * @return $this - */ - public function setUndeclaredParameters($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\StructType::class); - $this->undeclared_parameters = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSetStats.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSetStats.php deleted file mode 100644 index e39cc1952951..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSetStats.php +++ /dev/null @@ -1,227 +0,0 @@ -google.spanner.v1.ResultSetStats - */ -class ResultSetStats extends \Google\Protobuf\Internal\Message -{ - /** - * [QueryPlan][google.spanner.v1.QueryPlan] for the query associated with this result. - * - * Generated from protobuf field .google.spanner.v1.QueryPlan query_plan = 1; - */ - protected $query_plan = null; - /** - * Aggregated statistics from the execution of the query. Only present when - * the query is profiled. For example, a query could return the statistics as - * follows: - * { - * "rows_returned": "3", - * "elapsed_time": "1.22 secs", - * "cpu_time": "1.19 secs" - * } - * - * Generated from protobuf field .google.protobuf.Struct query_stats = 2; - */ - protected $query_stats = null; - protected $row_count; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\V1\QueryPlan $query_plan - * [QueryPlan][google.spanner.v1.QueryPlan] for the query associated with this result. - * @type \Google\Protobuf\Struct $query_stats - * Aggregated statistics from the execution of the query. Only present when - * the query is profiled. For example, a query could return the statistics as - * follows: - * { - * "rows_returned": "3", - * "elapsed_time": "1.22 secs", - * "cpu_time": "1.19 secs" - * } - * @type int|string $row_count_exact - * Standard DML returns an exact count of rows that were modified. - * @type int|string $row_count_lower_bound - * Partitioned DML does not offer exactly-once semantics, so it - * returns a lower bound of the rows modified. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\ResultSet::initOnce(); - parent::__construct($data); - } - - /** - * [QueryPlan][google.spanner.v1.QueryPlan] for the query associated with this result. - * - * Generated from protobuf field .google.spanner.v1.QueryPlan query_plan = 1; - * @return \Google\Cloud\Spanner\V1\QueryPlan|null - */ - public function getQueryPlan() - { - return $this->query_plan; - } - - public function hasQueryPlan() - { - return isset($this->query_plan); - } - - public function clearQueryPlan() - { - unset($this->query_plan); - } - - /** - * [QueryPlan][google.spanner.v1.QueryPlan] for the query associated with this result. - * - * Generated from protobuf field .google.spanner.v1.QueryPlan query_plan = 1; - * @param \Google\Cloud\Spanner\V1\QueryPlan $var - * @return $this - */ - public function setQueryPlan($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\QueryPlan::class); - $this->query_plan = $var; - - return $this; - } - - /** - * Aggregated statistics from the execution of the query. Only present when - * the query is profiled. For example, a query could return the statistics as - * follows: - * { - * "rows_returned": "3", - * "elapsed_time": "1.22 secs", - * "cpu_time": "1.19 secs" - * } - * - * Generated from protobuf field .google.protobuf.Struct query_stats = 2; - * @return \Google\Protobuf\Struct|null - */ - public function getQueryStats() - { - return $this->query_stats; - } - - public function hasQueryStats() - { - return isset($this->query_stats); - } - - public function clearQueryStats() - { - unset($this->query_stats); - } - - /** - * Aggregated statistics from the execution of the query. Only present when - * the query is profiled. For example, a query could return the statistics as - * follows: - * { - * "rows_returned": "3", - * "elapsed_time": "1.22 secs", - * "cpu_time": "1.19 secs" - * } - * - * Generated from protobuf field .google.protobuf.Struct query_stats = 2; - * @param \Google\Protobuf\Struct $var - * @return $this - */ - public function setQueryStats($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); - $this->query_stats = $var; - - return $this; - } - - /** - * Standard DML returns an exact count of rows that were modified. - * - * Generated from protobuf field int64 row_count_exact = 3; - * @return int|string - */ - public function getRowCountExact() - { - return $this->readOneof(3); - } - - public function hasRowCountExact() - { - return $this->hasOneof(3); - } - - /** - * Standard DML returns an exact count of rows that were modified. - * - * Generated from protobuf field int64 row_count_exact = 3; - * @param int|string $var - * @return $this - */ - public function setRowCountExact($var) - { - GPBUtil::checkInt64($var); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * Partitioned DML does not offer exactly-once semantics, so it - * returns a lower bound of the rows modified. - * - * Generated from protobuf field int64 row_count_lower_bound = 4; - * @return int|string - */ - public function getRowCountLowerBound() - { - return $this->readOneof(4); - } - - public function hasRowCountLowerBound() - { - return $this->hasOneof(4); - } - - /** - * Partitioned DML does not offer exactly-once semantics, so it - * returns a lower bound of the rows modified. - * - * Generated from protobuf field int64 row_count_lower_bound = 4; - * @param int|string $var - * @return $this - */ - public function setRowCountLowerBound($var) - { - GPBUtil::checkInt64($var); - $this->writeOneof(4, $var); - - return $this; - } - - /** - * @return string - */ - public function getRowCount() - { - return $this->whichOneof("row_count"); - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RollbackRequest.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RollbackRequest.php deleted file mode 100644 index 23129ad2e295..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/RollbackRequest.php +++ /dev/null @@ -1,117 +0,0 @@ -google.spanner.v1.RollbackRequest - */ -class RollbackRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The session in which the transaction to roll back is running. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - protected $session = ''; - /** - * Required. The transaction to roll back. - * - * Generated from protobuf field bytes transaction_id = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $transaction_id = ''; - - /** - * @param string $session Required. The session in which the transaction to roll back is running. Please see - * {@see SpannerClient::sessionName()} for help formatting this field. - * @param string $transactionId Required. The transaction to roll back. - * - * @return \Google\Cloud\Spanner\V1\RollbackRequest - * - * @experimental - */ - public static function build(string $session, string $transactionId): self - { - return (new self()) - ->setSession($session) - ->setTransactionId($transactionId); - } - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $session - * Required. The session in which the transaction to roll back is running. - * @type string $transaction_id - * Required. The transaction to roll back. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * Required. The session in which the transaction to roll back is running. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @return string - */ - public function getSession() - { - return $this->session; - } - - /** - * Required. The session in which the transaction to roll back is running. - * - * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - * @param string $var - * @return $this - */ - public function setSession($var) - { - GPBUtil::checkString($var, True); - $this->session = $var; - - return $this; - } - - /** - * Required. The transaction to roll back. - * - * Generated from protobuf field bytes transaction_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getTransactionId() - { - return $this->transaction_id; - } - - /** - * Required. The transaction to roll back. - * - * Generated from protobuf field bytes transaction_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setTransactionId($var) - { - GPBUtil::checkString($var, False); - $this->transaction_id = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Session.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Session.php deleted file mode 100644 index 772272bb851a..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Session.php +++ /dev/null @@ -1,309 +0,0 @@ -google.spanner.v1.Session - */ -class Session extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. The name of the session. This is always system-assigned. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $name = ''; - /** - * The labels for the session. - * * Label keys must be between 1 and 63 characters long and must conform to - * the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. - * * Label values must be between 0 and 63 characters long and must conform - * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. - * * No more than 64 labels can be associated with a given session. - * See https://goo.gl/xmQnxf for more information on and examples of labels. - * - * Generated from protobuf field map labels = 2; - */ - private $labels; - /** - * Output only. The timestamp when the session is created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $create_time = null; - /** - * Output only. The approximate timestamp when the session is last used. It is - * typically earlier than the actual last use time. - * - * Generated from protobuf field .google.protobuf.Timestamp approximate_last_use_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $approximate_last_use_time = null; - /** - * The database role which created this session. - * - * Generated from protobuf field string creator_role = 5; - */ - protected $creator_role = ''; - /** - * Optional. If true, specifies a multiplexed session. A multiplexed session - * may be used for multiple, concurrent read-only operations but can not be - * used for read-write transactions, partitioned reads, or partitioned - * queries. Multiplexed sessions can be created via - * [CreateSession][google.spanner.v1.Spanner.CreateSession] but not via - * [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions]. - * Multiplexed sessions may not be deleted nor listed. - * - * Generated from protobuf field bool multiplexed = 6 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $multiplexed = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Output only. The name of the session. This is always system-assigned. - * @type array|\Google\Protobuf\Internal\MapField $labels - * The labels for the session. - * * Label keys must be between 1 and 63 characters long and must conform to - * the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. - * * Label values must be between 0 and 63 characters long and must conform - * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. - * * No more than 64 labels can be associated with a given session. - * See https://goo.gl/xmQnxf for more information on and examples of labels. - * @type \Google\Protobuf\Timestamp $create_time - * Output only. The timestamp when the session is created. - * @type \Google\Protobuf\Timestamp $approximate_last_use_time - * Output only. The approximate timestamp when the session is last used. It is - * typically earlier than the actual last use time. - * @type string $creator_role - * The database role which created this session. - * @type bool $multiplexed - * Optional. If true, specifies a multiplexed session. A multiplexed session - * may be used for multiple, concurrent read-only operations but can not be - * used for read-write transactions, partitioned reads, or partitioned - * queries. Multiplexed sessions can be created via - * [CreateSession][google.spanner.v1.Spanner.CreateSession] but not via - * [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions]. - * Multiplexed sessions may not be deleted nor listed. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Spanner::initOnce(); - parent::__construct($data); - } - - /** - * Output only. The name of the session. This is always system-assigned. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Output only. The name of the session. This is always system-assigned. - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The labels for the session. - * * Label keys must be between 1 and 63 characters long and must conform to - * the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. - * * Label values must be between 0 and 63 characters long and must conform - * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. - * * No more than 64 labels can be associated with a given session. - * See https://goo.gl/xmQnxf for more information on and examples of labels. - * - * Generated from protobuf field map labels = 2; - * @return \Google\Protobuf\Internal\MapField - */ - public function getLabels() - { - return $this->labels; - } - - /** - * The labels for the session. - * * Label keys must be between 1 and 63 characters long and must conform to - * the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. - * * Label values must be between 0 and 63 characters long and must conform - * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. - * * No more than 64 labels can be associated with a given session. - * See https://goo.gl/xmQnxf for more information on and examples of labels. - * - * Generated from protobuf field map labels = 2; - * @param array|\Google\Protobuf\Internal\MapField $var - * @return $this - */ - public function setLabels($var) - { - $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); - $this->labels = $arr; - - return $this; - } - - /** - * Output only. The timestamp when the session is created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getCreateTime() - { - return $this->create_time; - } - - public function hasCreateTime() - { - return isset($this->create_time); - } - - public function clearCreateTime() - { - unset($this->create_time); - } - - /** - * Output only. The timestamp when the session is created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setCreateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->create_time = $var; - - return $this; - } - - /** - * Output only. The approximate timestamp when the session is last used. It is - * typically earlier than the actual last use time. - * - * Generated from protobuf field .google.protobuf.Timestamp approximate_last_use_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getApproximateLastUseTime() - { - return $this->approximate_last_use_time; - } - - public function hasApproximateLastUseTime() - { - return isset($this->approximate_last_use_time); - } - - public function clearApproximateLastUseTime() - { - unset($this->approximate_last_use_time); - } - - /** - * Output only. The approximate timestamp when the session is last used. It is - * typically earlier than the actual last use time. - * - * Generated from protobuf field .google.protobuf.Timestamp approximate_last_use_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setApproximateLastUseTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->approximate_last_use_time = $var; - - return $this; - } - - /** - * The database role which created this session. - * - * Generated from protobuf field string creator_role = 5; - * @return string - */ - public function getCreatorRole() - { - return $this->creator_role; - } - - /** - * The database role which created this session. - * - * Generated from protobuf field string creator_role = 5; - * @param string $var - * @return $this - */ - public function setCreatorRole($var) - { - GPBUtil::checkString($var, True); - $this->creator_role = $var; - - return $this; - } - - /** - * Optional. If true, specifies a multiplexed session. A multiplexed session - * may be used for multiple, concurrent read-only operations but can not be - * used for read-write transactions, partitioned reads, or partitioned - * queries. Multiplexed sessions can be created via - * [CreateSession][google.spanner.v1.Spanner.CreateSession] but not via - * [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions]. - * Multiplexed sessions may not be deleted nor listed. - * - * Generated from protobuf field bool multiplexed = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @return bool - */ - public function getMultiplexed() - { - return $this->multiplexed; - } - - /** - * Optional. If true, specifies a multiplexed session. A multiplexed session - * may be used for multiple, concurrent read-only operations but can not be - * used for read-write transactions, partitioned reads, or partitioned - * queries. Multiplexed sessions can be created via - * [CreateSession][google.spanner.v1.Spanner.CreateSession] but not via - * [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions]. - * Multiplexed sessions may not be deleted nor listed. - * - * Generated from protobuf field bool multiplexed = 6 [(.google.api.field_behavior) = OPTIONAL]; - * @param bool $var - * @return $this - */ - public function setMultiplexed($var) - { - GPBUtil::checkBool($var); - $this->multiplexed = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/StructType.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/StructType.php deleted file mode 100644 index a67da0c0d598..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/StructType.php +++ /dev/null @@ -1,88 +0,0 @@ -google.spanner.v1.StructType - */ -class StructType extends \Google\Protobuf\Internal\Message -{ - /** - * The list of fields that make up this struct. Order is - * significant, because values of this struct type are represented as - * lists, where the order of field values matches the order of - * fields in the [StructType][google.spanner.v1.StructType]. In turn, the - * order of fields matches the order of columns in a read request, or the - * order of fields in the `SELECT` clause of a query. - * - * Generated from protobuf field repeated .google.spanner.v1.StructType.Field fields = 1; - */ - private $fields; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Spanner\V1\StructType\Field>|\Google\Protobuf\Internal\RepeatedField $fields - * The list of fields that make up this struct. Order is - * significant, because values of this struct type are represented as - * lists, where the order of field values matches the order of - * fields in the [StructType][google.spanner.v1.StructType]. In turn, the - * order of fields matches the order of columns in a read request, or the - * order of fields in the `SELECT` clause of a query. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Type::initOnce(); - parent::__construct($data); - } - - /** - * The list of fields that make up this struct. Order is - * significant, because values of this struct type are represented as - * lists, where the order of field values matches the order of - * fields in the [StructType][google.spanner.v1.StructType]. In turn, the - * order of fields matches the order of columns in a read request, or the - * order of fields in the `SELECT` clause of a query. - * - * Generated from protobuf field repeated .google.spanner.v1.StructType.Field fields = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getFields() - { - return $this->fields; - } - - /** - * The list of fields that make up this struct. Order is - * significant, because values of this struct type are represented as - * lists, where the order of field values matches the order of - * fields in the [StructType][google.spanner.v1.StructType]. In turn, the - * order of fields matches the order of columns in a read request, or the - * order of fields in the `SELECT` clause of a query. - * - * Generated from protobuf field repeated .google.spanner.v1.StructType.Field fields = 1; - * @param array<\Google\Cloud\Spanner\V1\StructType\Field>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setFields($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Spanner\V1\StructType\Field::class); - $this->fields = $arr; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/StructType/Field.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/StructType/Field.php deleted file mode 100644 index d14de6cea1b3..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/StructType/Field.php +++ /dev/null @@ -1,138 +0,0 @@ -google.spanner.v1.StructType.Field - */ -class Field extends \Google\Protobuf\Internal\Message -{ - /** - * The name of the field. For reads, this is the column name. For - * SQL queries, it is the column alias (e.g., `"Word"` in the - * query `"SELECT 'hello' AS Word"`), or the column name (e.g., - * `"ColName"` in the query `"SELECT ColName FROM Table"`). Some - * columns might have an empty name (e.g., `"SELECT - * UPPER(ColName)"`). Note that a query result can contain - * multiple fields with the same name. - * - * Generated from protobuf field string name = 1; - */ - protected $name = ''; - /** - * The type of the field. - * - * Generated from protobuf field .google.spanner.v1.Type type = 2; - */ - protected $type = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * The name of the field. For reads, this is the column name. For - * SQL queries, it is the column alias (e.g., `"Word"` in the - * query `"SELECT 'hello' AS Word"`), or the column name (e.g., - * `"ColName"` in the query `"SELECT ColName FROM Table"`). Some - * columns might have an empty name (e.g., `"SELECT - * UPPER(ColName)"`). Note that a query result can contain - * multiple fields with the same name. - * @type \Google\Cloud\Spanner\V1\Type $type - * The type of the field. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Type::initOnce(); - parent::__construct($data); - } - - /** - * The name of the field. For reads, this is the column name. For - * SQL queries, it is the column alias (e.g., `"Word"` in the - * query `"SELECT 'hello' AS Word"`), or the column name (e.g., - * `"ColName"` in the query `"SELECT ColName FROM Table"`). Some - * columns might have an empty name (e.g., `"SELECT - * UPPER(ColName)"`). Note that a query result can contain - * multiple fields with the same name. - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * The name of the field. For reads, this is the column name. For - * SQL queries, it is the column alias (e.g., `"Word"` in the - * query `"SELECT 'hello' AS Word"`), or the column name (e.g., - * `"ColName"` in the query `"SELECT ColName FROM Table"`). Some - * columns might have an empty name (e.g., `"SELECT - * UPPER(ColName)"`). Note that a query result can contain - * multiple fields with the same name. - * - * Generated from protobuf field string name = 1; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * The type of the field. - * - * Generated from protobuf field .google.spanner.v1.Type type = 2; - * @return \Google\Cloud\Spanner\V1\Type|null - */ - public function getType() - { - return $this->type; - } - - public function hasType() - { - return isset($this->type); - } - - public function clearType() - { - unset($this->type); - } - - /** - * The type of the field. - * - * Generated from protobuf field .google.spanner.v1.Type type = 2; - * @param \Google\Cloud\Spanner\V1\Type $var - * @return $this - */ - public function setType($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Type::class); - $this->type = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Field::class, \Google\Cloud\Spanner\V1\StructType_Field::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Transaction.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Transaction.php deleted file mode 100644 index 6bed7fe90d30..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Transaction.php +++ /dev/null @@ -1,227 +0,0 @@ -google.spanner.v1.Transaction - */ -class Transaction extends \Google\Protobuf\Internal\Message -{ - /** - * `id` may be used to identify the transaction in subsequent - * [Read][google.spanner.v1.Spanner.Read], - * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], - * [Commit][google.spanner.v1.Spanner.Commit], or - * [Rollback][google.spanner.v1.Spanner.Rollback] calls. - * Single-use read-only transactions do not have IDs, because - * single-use transactions do not support multiple requests. - * - * Generated from protobuf field bytes id = 1; - */ - protected $id = ''; - /** - * For snapshot read-only transactions, the read timestamp chosen - * for the transaction. Not returned by default: see - * [TransactionOptions.ReadOnly.return_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.return_read_timestamp]. - * A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. - * Example: `"2014-10-02T15:01:23.045123456Z"`. - * - * Generated from protobuf field .google.protobuf.Timestamp read_timestamp = 2; - */ - protected $read_timestamp = null; - /** - * A precommit token will be included in the response of a BeginTransaction - * request if the read-write transaction is on a multiplexed session and - * a mutation_key was specified in the - * [BeginTransaction][google.spanner.v1.BeginTransactionRequest]. - * The precommit token with the highest sequence number from this transaction - * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit] - * request for this transaction. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; - */ - protected $precommit_token = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $id - * `id` may be used to identify the transaction in subsequent - * [Read][google.spanner.v1.Spanner.Read], - * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], - * [Commit][google.spanner.v1.Spanner.Commit], or - * [Rollback][google.spanner.v1.Spanner.Rollback] calls. - * Single-use read-only transactions do not have IDs, because - * single-use transactions do not support multiple requests. - * @type \Google\Protobuf\Timestamp $read_timestamp - * For snapshot read-only transactions, the read timestamp chosen - * for the transaction. Not returned by default: see - * [TransactionOptions.ReadOnly.return_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.return_read_timestamp]. - * A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. - * Example: `"2014-10-02T15:01:23.045123456Z"`. - * @type \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $precommit_token - * A precommit token will be included in the response of a BeginTransaction - * request if the read-write transaction is on a multiplexed session and - * a mutation_key was specified in the - * [BeginTransaction][google.spanner.v1.BeginTransactionRequest]. - * The precommit token with the highest sequence number from this transaction - * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit] - * request for this transaction. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Transaction::initOnce(); - parent::__construct($data); - } - - /** - * `id` may be used to identify the transaction in subsequent - * [Read][google.spanner.v1.Spanner.Read], - * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], - * [Commit][google.spanner.v1.Spanner.Commit], or - * [Rollback][google.spanner.v1.Spanner.Rollback] calls. - * Single-use read-only transactions do not have IDs, because - * single-use transactions do not support multiple requests. - * - * Generated from protobuf field bytes id = 1; - * @return string - */ - public function getId() - { - return $this->id; - } - - /** - * `id` may be used to identify the transaction in subsequent - * [Read][google.spanner.v1.Spanner.Read], - * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], - * [Commit][google.spanner.v1.Spanner.Commit], or - * [Rollback][google.spanner.v1.Spanner.Rollback] calls. - * Single-use read-only transactions do not have IDs, because - * single-use transactions do not support multiple requests. - * - * Generated from protobuf field bytes id = 1; - * @param string $var - * @return $this - */ - public function setId($var) - { - GPBUtil::checkString($var, False); - $this->id = $var; - - return $this; - } - - /** - * For snapshot read-only transactions, the read timestamp chosen - * for the transaction. Not returned by default: see - * [TransactionOptions.ReadOnly.return_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.return_read_timestamp]. - * A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. - * Example: `"2014-10-02T15:01:23.045123456Z"`. - * - * Generated from protobuf field .google.protobuf.Timestamp read_timestamp = 2; - * @return \Google\Protobuf\Timestamp|null - */ - public function getReadTimestamp() - { - return $this->read_timestamp; - } - - public function hasReadTimestamp() - { - return isset($this->read_timestamp); - } - - public function clearReadTimestamp() - { - unset($this->read_timestamp); - } - - /** - * For snapshot read-only transactions, the read timestamp chosen - * for the transaction. Not returned by default: see - * [TransactionOptions.ReadOnly.return_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.return_read_timestamp]. - * A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. - * Example: `"2014-10-02T15:01:23.045123456Z"`. - * - * Generated from protobuf field .google.protobuf.Timestamp read_timestamp = 2; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setReadTimestamp($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->read_timestamp = $var; - - return $this; - } - - /** - * A precommit token will be included in the response of a BeginTransaction - * request if the read-write transaction is on a multiplexed session and - * a mutation_key was specified in the - * [BeginTransaction][google.spanner.v1.BeginTransactionRequest]. - * The precommit token with the highest sequence number from this transaction - * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit] - * request for this transaction. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; - * @return \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken|null - */ - public function getPrecommitToken() - { - return $this->precommit_token; - } - - public function hasPrecommitToken() - { - return isset($this->precommit_token); - } - - public function clearPrecommitToken() - { - unset($this->precommit_token); - } - - /** - * A precommit token will be included in the response of a BeginTransaction - * request if the read-write transaction is on a multiplexed session and - * a mutation_key was specified in the - * [BeginTransaction][google.spanner.v1.BeginTransactionRequest]. - * The precommit token with the highest sequence number from this transaction - * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit] - * request for this transaction. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; - * @param \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken $var - * @return $this - */ - public function setPrecommitToken($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken::class); - $this->precommit_token = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions.php deleted file mode 100644 index d72a12452c2e..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions.php +++ /dev/null @@ -1,504 +0,0 @@ -. - * All queries on change stream TVFs must be executed using the - * ExecuteStreamingSql API with a single-use read-only transaction with a - * strong read-only timestamp_bound. The change stream TVF allows users to - * specify the start_timestamp and end_timestamp for the time range of - * interest. All change records within the retention period is accessible - * using the strong read-only timestamp_bound. All other TransactionOptions - * are invalid for change stream queries. - * In addition, if TransactionOptions.read_only.return_read_timestamp is set - * to true, a special value of 2^63 - 2 will be returned in the - * [Transaction][google.spanner.v1.Transaction] message that describes the - * transaction, instead of a valid read timestamp. This special value should be - * discarded and not used for any subsequent queries. - * Please see https://cloud.google.com/spanner/docs/change-streams - * for more details on how to query the change stream TVFs. - * Partitioned DML transactions: - * Partitioned DML transactions are used to execute DML statements with a - * different execution strategy that provides different, and often better, - * scalability properties for large, table-wide operations than DML in a - * ReadWrite transaction. Smaller scoped statements, such as an OLTP workload, - * should prefer using ReadWrite transactions. - * Partitioned DML partitions the keyspace and runs the DML statement on each - * partition in separate, internal transactions. These transactions commit - * automatically when complete, and run independently from one another. - * To reduce lock contention, this execution strategy only acquires read locks - * on rows that match the WHERE clause of the statement. Additionally, the - * smaller per-partition transactions hold locks for less time. - * That said, Partitioned DML is not a drop-in replacement for standard DML used - * in ReadWrite transactions. - * - The DML statement must be fully-partitionable. Specifically, the statement - * must be expressible as the union of many statements which each access only - * a single row of the table. - * - The statement is not applied atomically to all rows of the table. Rather, - * the statement is applied atomically to partitions of the table, in - * independent transactions. Secondary index rows are updated atomically - * with the base table rows. - * - Partitioned DML does not guarantee exactly-once execution semantics - * against a partition. The statement will be applied at least once to each - * partition. It is strongly recommended that the DML statement should be - * idempotent to avoid unexpected results. For instance, it is potentially - * dangerous to run a statement such as - * `UPDATE table SET column = column + 1` as it could be run multiple times - * against some rows. - * - The partitions are committed automatically - there is no support for - * Commit or Rollback. If the call returns an error, or if the client issuing - * the ExecuteSql call dies, it is possible that some rows had the statement - * executed on them successfully. It is also possible that statement was - * never executed against other rows. - * - Partitioned DML transactions may only contain the execution of a single - * DML statement via ExecuteSql or ExecuteStreamingSql. - * - If any error is encountered during the execution of the partitioned DML - * operation (for instance, a UNIQUE INDEX violation, division by zero, or a - * value that cannot be stored due to schema constraints), then the - * operation is stopped at that point and an error is returned. It is - * possible that at this point, some partitions have been committed (or even - * committed multiple times), and other partitions have not been run at all. - * Given the above, Partitioned DML is good fit for large, database-wide, - * operations that are idempotent, such as deleting old rows from a very large - * table. - * - * Generated from protobuf message google.spanner.v1.TransactionOptions - */ -class TransactionOptions extends \Google\Protobuf\Internal\Message -{ - /** - * When `exclude_txn_from_change_streams` is set to `true`: - * * Mutations from this transaction will not be recorded in change streams - * with DDL option `allow_txn_exclusion=true` that are tracking columns - * modified by these transactions. - * * Mutations from this transaction will be recorded in change streams with - * DDL option `allow_txn_exclusion=false or not set` that are tracking - * columns modified by these transactions. - * When `exclude_txn_from_change_streams` is set to `false` or not set, - * mutations from this transaction will be recorded in all change streams that - * are tracking columns modified by these transactions. - * `exclude_txn_from_change_streams` may only be specified for read-write or - * partitioned-dml transactions, otherwise the API will return an - * `INVALID_ARGUMENT` error. - * - * Generated from protobuf field bool exclude_txn_from_change_streams = 5; - */ - protected $exclude_txn_from_change_streams = false; - protected $mode; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\V1\TransactionOptions\ReadWrite $read_write - * Transaction may write. - * Authorization to begin a read-write transaction requires - * `spanner.databases.beginOrRollbackReadWriteTransaction` permission - * on the `session` resource. - * @type \Google\Cloud\Spanner\V1\TransactionOptions\PartitionedDml $partitioned_dml - * Partitioned DML transaction. - * Authorization to begin a Partitioned DML transaction requires - * `spanner.databases.beginPartitionedDmlTransaction` permission - * on the `session` resource. - * @type \Google\Cloud\Spanner\V1\TransactionOptions\PBReadOnly $read_only - * Transaction will not write. - * Authorization to begin a read-only transaction requires - * `spanner.databases.beginReadOnlyTransaction` permission - * on the `session` resource. - * @type bool $exclude_txn_from_change_streams - * When `exclude_txn_from_change_streams` is set to `true`: - * * Mutations from this transaction will not be recorded in change streams - * with DDL option `allow_txn_exclusion=true` that are tracking columns - * modified by these transactions. - * * Mutations from this transaction will be recorded in change streams with - * DDL option `allow_txn_exclusion=false or not set` that are tracking - * columns modified by these transactions. - * When `exclude_txn_from_change_streams` is set to `false` or not set, - * mutations from this transaction will be recorded in all change streams that - * are tracking columns modified by these transactions. - * `exclude_txn_from_change_streams` may only be specified for read-write or - * partitioned-dml transactions, otherwise the API will return an - * `INVALID_ARGUMENT` error. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Transaction::initOnce(); - parent::__construct($data); - } - - /** - * Transaction may write. - * Authorization to begin a read-write transaction requires - * `spanner.databases.beginOrRollbackReadWriteTransaction` permission - * on the `session` resource. - * - * Generated from protobuf field .google.spanner.v1.TransactionOptions.ReadWrite read_write = 1; - * @return \Google\Cloud\Spanner\V1\TransactionOptions\ReadWrite|null - */ - public function getReadWrite() - { - return $this->readOneof(1); - } - - public function hasReadWrite() - { - return $this->hasOneof(1); - } - - /** - * Transaction may write. - * Authorization to begin a read-write transaction requires - * `spanner.databases.beginOrRollbackReadWriteTransaction` permission - * on the `session` resource. - * - * Generated from protobuf field .google.spanner.v1.TransactionOptions.ReadWrite read_write = 1; - * @param \Google\Cloud\Spanner\V1\TransactionOptions\ReadWrite $var - * @return $this - */ - public function setReadWrite($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionOptions\ReadWrite::class); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * Partitioned DML transaction. - * Authorization to begin a Partitioned DML transaction requires - * `spanner.databases.beginPartitionedDmlTransaction` permission - * on the `session` resource. - * - * Generated from protobuf field .google.spanner.v1.TransactionOptions.PartitionedDml partitioned_dml = 3; - * @return \Google\Cloud\Spanner\V1\TransactionOptions\PartitionedDml|null - */ - public function getPartitionedDml() - { - return $this->readOneof(3); - } - - public function hasPartitionedDml() - { - return $this->hasOneof(3); - } - - /** - * Partitioned DML transaction. - * Authorization to begin a Partitioned DML transaction requires - * `spanner.databases.beginPartitionedDmlTransaction` permission - * on the `session` resource. - * - * Generated from protobuf field .google.spanner.v1.TransactionOptions.PartitionedDml partitioned_dml = 3; - * @param \Google\Cloud\Spanner\V1\TransactionOptions\PartitionedDml $var - * @return $this - */ - public function setPartitionedDml($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionOptions\PartitionedDml::class); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * Transaction will not write. - * Authorization to begin a read-only transaction requires - * `spanner.databases.beginReadOnlyTransaction` permission - * on the `session` resource. - * - * Generated from protobuf field .google.spanner.v1.TransactionOptions.ReadOnly read_only = 2; - * @return \Google\Cloud\Spanner\V1\TransactionOptions\PBReadOnly|null - */ - public function getReadOnly() - { - return $this->readOneof(2); - } - - public function hasReadOnly() - { - return $this->hasOneof(2); - } - - /** - * Transaction will not write. - * Authorization to begin a read-only transaction requires - * `spanner.databases.beginReadOnlyTransaction` permission - * on the `session` resource. - * - * Generated from protobuf field .google.spanner.v1.TransactionOptions.ReadOnly read_only = 2; - * @param \Google\Cloud\Spanner\V1\TransactionOptions\PBReadOnly $var - * @return $this - */ - public function setReadOnly($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionOptions\PBReadOnly::class); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * When `exclude_txn_from_change_streams` is set to `true`: - * * Mutations from this transaction will not be recorded in change streams - * with DDL option `allow_txn_exclusion=true` that are tracking columns - * modified by these transactions. - * * Mutations from this transaction will be recorded in change streams with - * DDL option `allow_txn_exclusion=false or not set` that are tracking - * columns modified by these transactions. - * When `exclude_txn_from_change_streams` is set to `false` or not set, - * mutations from this transaction will be recorded in all change streams that - * are tracking columns modified by these transactions. - * `exclude_txn_from_change_streams` may only be specified for read-write or - * partitioned-dml transactions, otherwise the API will return an - * `INVALID_ARGUMENT` error. - * - * Generated from protobuf field bool exclude_txn_from_change_streams = 5; - * @return bool - */ - public function getExcludeTxnFromChangeStreams() - { - return $this->exclude_txn_from_change_streams; - } - - /** - * When `exclude_txn_from_change_streams` is set to `true`: - * * Mutations from this transaction will not be recorded in change streams - * with DDL option `allow_txn_exclusion=true` that are tracking columns - * modified by these transactions. - * * Mutations from this transaction will be recorded in change streams with - * DDL option `allow_txn_exclusion=false or not set` that are tracking - * columns modified by these transactions. - * When `exclude_txn_from_change_streams` is set to `false` or not set, - * mutations from this transaction will be recorded in all change streams that - * are tracking columns modified by these transactions. - * `exclude_txn_from_change_streams` may only be specified for read-write or - * partitioned-dml transactions, otherwise the API will return an - * `INVALID_ARGUMENT` error. - * - * Generated from protobuf field bool exclude_txn_from_change_streams = 5; - * @param bool $var - * @return $this - */ - public function setExcludeTxnFromChangeStreams($var) - { - GPBUtil::checkBool($var); - $this->exclude_txn_from_change_streams = $var; - - return $this; - } - - /** - * @return string - */ - public function getMode() - { - return $this->whichOneof("mode"); - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/PBReadOnly.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/PBReadOnly.php deleted file mode 100644 index 114fed83d6e2..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/PBReadOnly.php +++ /dev/null @@ -1,357 +0,0 @@ -google.spanner.v1.TransactionOptions.ReadOnly - */ -class PBReadOnly extends \Google\Protobuf\Internal\Message -{ - /** - * If true, the Cloud Spanner-selected read timestamp is included in - * the [Transaction][google.spanner.v1.Transaction] message that describes - * the transaction. - * - * Generated from protobuf field bool return_read_timestamp = 6; - */ - protected $return_read_timestamp = false; - protected $timestamp_bound; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type bool $strong - * Read at a timestamp where all previously committed transactions - * are visible. - * @type \Google\Protobuf\Timestamp $min_read_timestamp - * Executes all reads at a timestamp >= `min_read_timestamp`. - * This is useful for requesting fresher data than some previous - * read, or data that is fresh enough to observe the effects of some - * previously committed transaction whose timestamp is known. - * Note that this option can only be used in single-use transactions. - * A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. - * Example: `"2014-10-02T15:01:23.045123456Z"`. - * @type \Google\Protobuf\Duration $max_staleness - * Read data at a timestamp >= `NOW - max_staleness` - * seconds. Guarantees that all writes that have committed more - * than the specified number of seconds ago are visible. Because - * Cloud Spanner chooses the exact timestamp, this mode works even if - * the client's local clock is substantially skewed from Cloud Spanner - * commit timestamps. - * Useful for reading the freshest data available at a nearby - * replica, while bounding the possible staleness if the local - * replica has fallen behind. - * Note that this option can only be used in single-use - * transactions. - * @type \Google\Protobuf\Timestamp $read_timestamp - * Executes all reads at the given timestamp. Unlike other modes, - * reads at a specific timestamp are repeatable; the same read at - * the same timestamp always returns the same data. If the - * timestamp is in the future, the read will block until the - * specified timestamp, modulo the read's deadline. - * Useful for large scale consistent reads such as mapreduces, or - * for coordinating many reads against a consistent snapshot of the - * data. - * A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. - * Example: `"2014-10-02T15:01:23.045123456Z"`. - * @type \Google\Protobuf\Duration $exact_staleness - * Executes all reads at a timestamp that is `exact_staleness` - * old. The timestamp is chosen soon after the read is started. - * Guarantees that all writes that have committed more than the - * specified number of seconds ago are visible. Because Cloud Spanner - * chooses the exact timestamp, this mode works even if the client's - * local clock is substantially skewed from Cloud Spanner commit - * timestamps. - * Useful for reading at nearby replicas without the distributed - * timestamp negotiation overhead of `max_staleness`. - * @type bool $return_read_timestamp - * If true, the Cloud Spanner-selected read timestamp is included in - * the [Transaction][google.spanner.v1.Transaction] message that describes - * the transaction. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Transaction::initOnce(); - parent::__construct($data); - } - - /** - * Read at a timestamp where all previously committed transactions - * are visible. - * - * Generated from protobuf field bool strong = 1; - * @return bool - */ - public function getStrong() - { - return $this->readOneof(1); - } - - public function hasStrong() - { - return $this->hasOneof(1); - } - - /** - * Read at a timestamp where all previously committed transactions - * are visible. - * - * Generated from protobuf field bool strong = 1; - * @param bool $var - * @return $this - */ - public function setStrong($var) - { - GPBUtil::checkBool($var); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * Executes all reads at a timestamp >= `min_read_timestamp`. - * This is useful for requesting fresher data than some previous - * read, or data that is fresh enough to observe the effects of some - * previously committed transaction whose timestamp is known. - * Note that this option can only be used in single-use transactions. - * A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. - * Example: `"2014-10-02T15:01:23.045123456Z"`. - * - * Generated from protobuf field .google.protobuf.Timestamp min_read_timestamp = 2; - * @return \Google\Protobuf\Timestamp|null - */ - public function getMinReadTimestamp() - { - return $this->readOneof(2); - } - - public function hasMinReadTimestamp() - { - return $this->hasOneof(2); - } - - /** - * Executes all reads at a timestamp >= `min_read_timestamp`. - * This is useful for requesting fresher data than some previous - * read, or data that is fresh enough to observe the effects of some - * previously committed transaction whose timestamp is known. - * Note that this option can only be used in single-use transactions. - * A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. - * Example: `"2014-10-02T15:01:23.045123456Z"`. - * - * Generated from protobuf field .google.protobuf.Timestamp min_read_timestamp = 2; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setMinReadTimestamp($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * Read data at a timestamp >= `NOW - max_staleness` - * seconds. Guarantees that all writes that have committed more - * than the specified number of seconds ago are visible. Because - * Cloud Spanner chooses the exact timestamp, this mode works even if - * the client's local clock is substantially skewed from Cloud Spanner - * commit timestamps. - * Useful for reading the freshest data available at a nearby - * replica, while bounding the possible staleness if the local - * replica has fallen behind. - * Note that this option can only be used in single-use - * transactions. - * - * Generated from protobuf field .google.protobuf.Duration max_staleness = 3; - * @return \Google\Protobuf\Duration|null - */ - public function getMaxStaleness() - { - return $this->readOneof(3); - } - - public function hasMaxStaleness() - { - return $this->hasOneof(3); - } - - /** - * Read data at a timestamp >= `NOW - max_staleness` - * seconds. Guarantees that all writes that have committed more - * than the specified number of seconds ago are visible. Because - * Cloud Spanner chooses the exact timestamp, this mode works even if - * the client's local clock is substantially skewed from Cloud Spanner - * commit timestamps. - * Useful for reading the freshest data available at a nearby - * replica, while bounding the possible staleness if the local - * replica has fallen behind. - * Note that this option can only be used in single-use - * transactions. - * - * Generated from protobuf field .google.protobuf.Duration max_staleness = 3; - * @param \Google\Protobuf\Duration $var - * @return $this - */ - public function setMaxStaleness($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * Executes all reads at the given timestamp. Unlike other modes, - * reads at a specific timestamp are repeatable; the same read at - * the same timestamp always returns the same data. If the - * timestamp is in the future, the read will block until the - * specified timestamp, modulo the read's deadline. - * Useful for large scale consistent reads such as mapreduces, or - * for coordinating many reads against a consistent snapshot of the - * data. - * A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. - * Example: `"2014-10-02T15:01:23.045123456Z"`. - * - * Generated from protobuf field .google.protobuf.Timestamp read_timestamp = 4; - * @return \Google\Protobuf\Timestamp|null - */ - public function getReadTimestamp() - { - return $this->readOneof(4); - } - - public function hasReadTimestamp() - { - return $this->hasOneof(4); - } - - /** - * Executes all reads at the given timestamp. Unlike other modes, - * reads at a specific timestamp are repeatable; the same read at - * the same timestamp always returns the same data. If the - * timestamp is in the future, the read will block until the - * specified timestamp, modulo the read's deadline. - * Useful for large scale consistent reads such as mapreduces, or - * for coordinating many reads against a consistent snapshot of the - * data. - * A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. - * Example: `"2014-10-02T15:01:23.045123456Z"`. - * - * Generated from protobuf field .google.protobuf.Timestamp read_timestamp = 4; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setReadTimestamp($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->writeOneof(4, $var); - - return $this; - } - - /** - * Executes all reads at a timestamp that is `exact_staleness` - * old. The timestamp is chosen soon after the read is started. - * Guarantees that all writes that have committed more than the - * specified number of seconds ago are visible. Because Cloud Spanner - * chooses the exact timestamp, this mode works even if the client's - * local clock is substantially skewed from Cloud Spanner commit - * timestamps. - * Useful for reading at nearby replicas without the distributed - * timestamp negotiation overhead of `max_staleness`. - * - * Generated from protobuf field .google.protobuf.Duration exact_staleness = 5; - * @return \Google\Protobuf\Duration|null - */ - public function getExactStaleness() - { - return $this->readOneof(5); - } - - public function hasExactStaleness() - { - return $this->hasOneof(5); - } - - /** - * Executes all reads at a timestamp that is `exact_staleness` - * old. The timestamp is chosen soon after the read is started. - * Guarantees that all writes that have committed more than the - * specified number of seconds ago are visible. Because Cloud Spanner - * chooses the exact timestamp, this mode works even if the client's - * local clock is substantially skewed from Cloud Spanner commit - * timestamps. - * Useful for reading at nearby replicas without the distributed - * timestamp negotiation overhead of `max_staleness`. - * - * Generated from protobuf field .google.protobuf.Duration exact_staleness = 5; - * @param \Google\Protobuf\Duration $var - * @return $this - */ - public function setExactStaleness($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); - $this->writeOneof(5, $var); - - return $this; - } - - /** - * If true, the Cloud Spanner-selected read timestamp is included in - * the [Transaction][google.spanner.v1.Transaction] message that describes - * the transaction. - * - * Generated from protobuf field bool return_read_timestamp = 6; - * @return bool - */ - public function getReturnReadTimestamp() - { - return $this->return_read_timestamp; - } - - /** - * If true, the Cloud Spanner-selected read timestamp is included in - * the [Transaction][google.spanner.v1.Transaction] message that describes - * the transaction. - * - * Generated from protobuf field bool return_read_timestamp = 6; - * @param bool $var - * @return $this - */ - public function setReturnReadTimestamp($var) - { - GPBUtil::checkBool($var); - $this->return_read_timestamp = $var; - - return $this; - } - - /** - * @return string - */ - public function getTimestampBound() - { - return $this->whichOneof("timestamp_bound"); - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(PBReadOnly::class, \Google\Cloud\Spanner\V1\TransactionOptions_ReadOnly::class); - -// Adding a class alias for backwards compatibility with the "readonly" keyword. -class_alias(PBReadOnly::class, __NAMESPACE__ . '\ReadOnly'); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/PartitionedDml.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/PartitionedDml.php deleted file mode 100644 index 06d0e4b25c62..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/PartitionedDml.php +++ /dev/null @@ -1,36 +0,0 @@ -google.spanner.v1.TransactionOptions.PartitionedDml - */ -class PartitionedDml extends \Google\Protobuf\Internal\Message -{ - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Transaction::initOnce(); - parent::__construct($data); - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(PartitionedDml::class, \Google\Cloud\Spanner\V1\TransactionOptions_PartitionedDml::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/ReadOnly.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/ReadOnly.php deleted file mode 100644 index d9f5f7d4789f..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/ReadOnly.php +++ /dev/null @@ -1,9 +0,0 @@ -google.spanner.v1.TransactionOptions.ReadWrite - */ -class ReadWrite extends \Google\Protobuf\Internal\Message -{ - /** - * Read lock mode for the transaction. - * - * Generated from protobuf field .google.spanner.v1.TransactionOptions.ReadWrite.ReadLockMode read_lock_mode = 1; - */ - protected $read_lock_mode = 0; - /** - * Optional. Clients should pass the transaction ID of the previous - * transaction attempt that was aborted if this transaction is being - * executed on a multiplexed session. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field bytes multiplexed_session_previous_transaction_id = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - protected $multiplexed_session_previous_transaction_id = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $read_lock_mode - * Read lock mode for the transaction. - * @type string $multiplexed_session_previous_transaction_id - * Optional. Clients should pass the transaction ID of the previous - * transaction attempt that was aborted if this transaction is being - * executed on a multiplexed session. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Transaction::initOnce(); - parent::__construct($data); - } - - /** - * Read lock mode for the transaction. - * - * Generated from protobuf field .google.spanner.v1.TransactionOptions.ReadWrite.ReadLockMode read_lock_mode = 1; - * @return int - */ - public function getReadLockMode() - { - return $this->read_lock_mode; - } - - /** - * Read lock mode for the transaction. - * - * Generated from protobuf field .google.spanner.v1.TransactionOptions.ReadWrite.ReadLockMode read_lock_mode = 1; - * @param int $var - * @return $this - */ - public function setReadLockMode($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\V1\TransactionOptions\ReadWrite\ReadLockMode::class); - $this->read_lock_mode = $var; - - return $this; - } - - /** - * Optional. Clients should pass the transaction ID of the previous - * transaction attempt that was aborted if this transaction is being - * executed on a multiplexed session. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field bytes multiplexed_session_previous_transaction_id = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return string - */ - public function getMultiplexedSessionPreviousTransactionId() - { - return $this->multiplexed_session_previous_transaction_id; - } - - /** - * Optional. Clients should pass the transaction ID of the previous - * transaction attempt that was aborted if this transaction is being - * executed on a multiplexed session. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * - * Generated from protobuf field bytes multiplexed_session_previous_transaction_id = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param string $var - * @return $this - */ - public function setMultiplexedSessionPreviousTransactionId($var) - { - GPBUtil::checkString($var, False); - $this->multiplexed_session_previous_transaction_id = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(ReadWrite::class, \Google\Cloud\Spanner\V1\TransactionOptions_ReadWrite::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/ReadWrite/ReadLockMode.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/ReadWrite/ReadLockMode.php deleted file mode 100644 index 75b8922f96cb..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionOptions/ReadWrite/ReadLockMode.php +++ /dev/null @@ -1,70 +0,0 @@ -google.spanner.v1.TransactionOptions.ReadWrite.ReadLockMode - */ -class ReadLockMode -{ - /** - * Default value. - * If the value is not specified, the pessimistic read lock is used. - * - * Generated from protobuf enum READ_LOCK_MODE_UNSPECIFIED = 0; - */ - const READ_LOCK_MODE_UNSPECIFIED = 0; - /** - * Pessimistic lock mode. - * Read locks are acquired immediately on read. - * - * Generated from protobuf enum PESSIMISTIC = 1; - */ - const PESSIMISTIC = 1; - /** - * Optimistic lock mode. - * Locks for reads within the transaction are not acquired on read. - * Instead the locks are acquired on a commit to validate that - * read/queried data has not changed since the transaction started. - * - * Generated from protobuf enum OPTIMISTIC = 2; - */ - const OPTIMISTIC = 2; - - private static $valueToName = [ - self::READ_LOCK_MODE_UNSPECIFIED => 'READ_LOCK_MODE_UNSPECIFIED', - self::PESSIMISTIC => 'PESSIMISTIC', - self::OPTIMISTIC => 'OPTIMISTIC', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(ReadLockMode::class, \Google\Cloud\Spanner\V1\TransactionOptions_ReadWrite_ReadLockMode::class); - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionSelector.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionSelector.php deleted file mode 100644 index f955f410ee81..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TransactionSelector.php +++ /dev/null @@ -1,160 +0,0 @@ -google.spanner.v1.TransactionSelector - */ -class TransactionSelector extends \Google\Protobuf\Internal\Message -{ - protected $selector; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Spanner\V1\TransactionOptions $single_use - * Execute the read or SQL query in a temporary transaction. - * This is the most efficient way to execute a transaction that - * consists of a single SQL query. - * @type string $id - * Execute the read or SQL query in a previously-started transaction. - * @type \Google\Cloud\Spanner\V1\TransactionOptions $begin - * Begin a new transaction and execute this read or SQL query in - * it. The transaction ID of the new transaction is returned in - * [ResultSetMetadata.transaction][google.spanner.v1.ResultSetMetadata.transaction], - * which is a [Transaction][google.spanner.v1.Transaction]. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Transaction::initOnce(); - parent::__construct($data); - } - - /** - * Execute the read or SQL query in a temporary transaction. - * This is the most efficient way to execute a transaction that - * consists of a single SQL query. - * - * Generated from protobuf field .google.spanner.v1.TransactionOptions single_use = 1; - * @return \Google\Cloud\Spanner\V1\TransactionOptions|null - */ - public function getSingleUse() - { - return $this->readOneof(1); - } - - public function hasSingleUse() - { - return $this->hasOneof(1); - } - - /** - * Execute the read or SQL query in a temporary transaction. - * This is the most efficient way to execute a transaction that - * consists of a single SQL query. - * - * Generated from protobuf field .google.spanner.v1.TransactionOptions single_use = 1; - * @param \Google\Cloud\Spanner\V1\TransactionOptions $var - * @return $this - */ - public function setSingleUse($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionOptions::class); - $this->writeOneof(1, $var); - - return $this; - } - - /** - * Execute the read or SQL query in a previously-started transaction. - * - * Generated from protobuf field bytes id = 2; - * @return string - */ - public function getId() - { - return $this->readOneof(2); - } - - public function hasId() - { - return $this->hasOneof(2); - } - - /** - * Execute the read or SQL query in a previously-started transaction. - * - * Generated from protobuf field bytes id = 2; - * @param string $var - * @return $this - */ - public function setId($var) - { - GPBUtil::checkString($var, False); - $this->writeOneof(2, $var); - - return $this; - } - - /** - * Begin a new transaction and execute this read or SQL query in - * it. The transaction ID of the new transaction is returned in - * [ResultSetMetadata.transaction][google.spanner.v1.ResultSetMetadata.transaction], - * which is a [Transaction][google.spanner.v1.Transaction]. - * - * Generated from protobuf field .google.spanner.v1.TransactionOptions begin = 3; - * @return \Google\Cloud\Spanner\V1\TransactionOptions|null - */ - public function getBegin() - { - return $this->readOneof(3); - } - - public function hasBegin() - { - return $this->hasOneof(3); - } - - /** - * Begin a new transaction and execute this read or SQL query in - * it. The transaction ID of the new transaction is returned in - * [ResultSetMetadata.transaction][google.spanner.v1.ResultSetMetadata.transaction], - * which is a [Transaction][google.spanner.v1.Transaction]. - * - * Generated from protobuf field .google.spanner.v1.TransactionOptions begin = 3; - * @param \Google\Cloud\Spanner\V1\TransactionOptions $var - * @return $this - */ - public function setBegin($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\TransactionOptions::class); - $this->writeOneof(3, $var); - - return $this; - } - - /** - * @return string - */ - public function getSelector() - { - return $this->whichOneof("selector"); - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Type.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Type.php deleted file mode 100644 index 6527eae3f162..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Type.php +++ /dev/null @@ -1,284 +0,0 @@ -google.spanner.v1.Type - */ -class Type extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The [TypeCode][google.spanner.v1.TypeCode] for this type. - * - * Generated from protobuf field .google.spanner.v1.TypeCode code = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - protected $code = 0; - /** - * If [code][google.spanner.v1.Type.code] == - * [ARRAY][google.spanner.v1.TypeCode.ARRAY], then `array_element_type` is the - * type of the array elements. - * - * Generated from protobuf field .google.spanner.v1.Type array_element_type = 2; - */ - protected $array_element_type = null; - /** - * If [code][google.spanner.v1.Type.code] == - * [STRUCT][google.spanner.v1.TypeCode.STRUCT], then `struct_type` provides - * type information for the struct's fields. - * - * Generated from protobuf field .google.spanner.v1.StructType struct_type = 3; - */ - protected $struct_type = null; - /** - * The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that - * disambiguates SQL type that Spanner will use to represent values of this - * type during query processing. This is necessary for some type codes because - * a single [TypeCode][google.spanner.v1.TypeCode] can be mapped to different - * SQL types depending on the SQL dialect. - * [type_annotation][google.spanner.v1.Type.type_annotation] typically is not - * needed to process the content of a value (it doesn't affect serialization) - * and clients can ignore it on the read path. - * - * Generated from protobuf field .google.spanner.v1.TypeAnnotationCode type_annotation = 4; - */ - protected $type_annotation = 0; - /** - * If [code][google.spanner.v1.Type.code] == - * [PROTO][google.spanner.v1.TypeCode.PROTO] or - * [code][google.spanner.v1.Type.code] == - * [ENUM][google.spanner.v1.TypeCode.ENUM], then `proto_type_fqn` is the fully - * qualified name of the proto type representing the proto/enum definition. - * - * Generated from protobuf field string proto_type_fqn = 5; - */ - protected $proto_type_fqn = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $code - * Required. The [TypeCode][google.spanner.v1.TypeCode] for this type. - * @type \Google\Cloud\Spanner\V1\Type $array_element_type - * If [code][google.spanner.v1.Type.code] == - * [ARRAY][google.spanner.v1.TypeCode.ARRAY], then `array_element_type` is the - * type of the array elements. - * @type \Google\Cloud\Spanner\V1\StructType $struct_type - * If [code][google.spanner.v1.Type.code] == - * [STRUCT][google.spanner.v1.TypeCode.STRUCT], then `struct_type` provides - * type information for the struct's fields. - * @type int $type_annotation - * The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that - * disambiguates SQL type that Spanner will use to represent values of this - * type during query processing. This is necessary for some type codes because - * a single [TypeCode][google.spanner.v1.TypeCode] can be mapped to different - * SQL types depending on the SQL dialect. - * [type_annotation][google.spanner.v1.Type.type_annotation] typically is not - * needed to process the content of a value (it doesn't affect serialization) - * and clients can ignore it on the read path. - * @type string $proto_type_fqn - * If [code][google.spanner.v1.Type.code] == - * [PROTO][google.spanner.v1.TypeCode.PROTO] or - * [code][google.spanner.v1.Type.code] == - * [ENUM][google.spanner.v1.TypeCode.ENUM], then `proto_type_fqn` is the fully - * qualified name of the proto type representing the proto/enum definition. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Spanner\V1\Type::initOnce(); - parent::__construct($data); - } - - /** - * Required. The [TypeCode][google.spanner.v1.TypeCode] for this type. - * - * Generated from protobuf field .google.spanner.v1.TypeCode code = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return int - */ - public function getCode() - { - return $this->code; - } - - /** - * Required. The [TypeCode][google.spanner.v1.TypeCode] for this type. - * - * Generated from protobuf field .google.spanner.v1.TypeCode code = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param int $var - * @return $this - */ - public function setCode($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\V1\TypeCode::class); - $this->code = $var; - - return $this; - } - - /** - * If [code][google.spanner.v1.Type.code] == - * [ARRAY][google.spanner.v1.TypeCode.ARRAY], then `array_element_type` is the - * type of the array elements. - * - * Generated from protobuf field .google.spanner.v1.Type array_element_type = 2; - * @return \Google\Cloud\Spanner\V1\Type|null - */ - public function getArrayElementType() - { - return $this->array_element_type; - } - - public function hasArrayElementType() - { - return isset($this->array_element_type); - } - - public function clearArrayElementType() - { - unset($this->array_element_type); - } - - /** - * If [code][google.spanner.v1.Type.code] == - * [ARRAY][google.spanner.v1.TypeCode.ARRAY], then `array_element_type` is the - * type of the array elements. - * - * Generated from protobuf field .google.spanner.v1.Type array_element_type = 2; - * @param \Google\Cloud\Spanner\V1\Type $var - * @return $this - */ - public function setArrayElementType($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\Type::class); - $this->array_element_type = $var; - - return $this; - } - - /** - * If [code][google.spanner.v1.Type.code] == - * [STRUCT][google.spanner.v1.TypeCode.STRUCT], then `struct_type` provides - * type information for the struct's fields. - * - * Generated from protobuf field .google.spanner.v1.StructType struct_type = 3; - * @return \Google\Cloud\Spanner\V1\StructType|null - */ - public function getStructType() - { - return $this->struct_type; - } - - public function hasStructType() - { - return isset($this->struct_type); - } - - public function clearStructType() - { - unset($this->struct_type); - } - - /** - * If [code][google.spanner.v1.Type.code] == - * [STRUCT][google.spanner.v1.TypeCode.STRUCT], then `struct_type` provides - * type information for the struct's fields. - * - * Generated from protobuf field .google.spanner.v1.StructType struct_type = 3; - * @param \Google\Cloud\Spanner\V1\StructType $var - * @return $this - */ - public function setStructType($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Spanner\V1\StructType::class); - $this->struct_type = $var; - - return $this; - } - - /** - * The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that - * disambiguates SQL type that Spanner will use to represent values of this - * type during query processing. This is necessary for some type codes because - * a single [TypeCode][google.spanner.v1.TypeCode] can be mapped to different - * SQL types depending on the SQL dialect. - * [type_annotation][google.spanner.v1.Type.type_annotation] typically is not - * needed to process the content of a value (it doesn't affect serialization) - * and clients can ignore it on the read path. - * - * Generated from protobuf field .google.spanner.v1.TypeAnnotationCode type_annotation = 4; - * @return int - */ - public function getTypeAnnotation() - { - return $this->type_annotation; - } - - /** - * The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that - * disambiguates SQL type that Spanner will use to represent values of this - * type during query processing. This is necessary for some type codes because - * a single [TypeCode][google.spanner.v1.TypeCode] can be mapped to different - * SQL types depending on the SQL dialect. - * [type_annotation][google.spanner.v1.Type.type_annotation] typically is not - * needed to process the content of a value (it doesn't affect serialization) - * and clients can ignore it on the read path. - * - * Generated from protobuf field .google.spanner.v1.TypeAnnotationCode type_annotation = 4; - * @param int $var - * @return $this - */ - public function setTypeAnnotation($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Spanner\V1\TypeAnnotationCode::class); - $this->type_annotation = $var; - - return $this; - } - - /** - * If [code][google.spanner.v1.Type.code] == - * [PROTO][google.spanner.v1.TypeCode.PROTO] or - * [code][google.spanner.v1.Type.code] == - * [ENUM][google.spanner.v1.TypeCode.ENUM], then `proto_type_fqn` is the fully - * qualified name of the proto type representing the proto/enum definition. - * - * Generated from protobuf field string proto_type_fqn = 5; - * @return string - */ - public function getProtoTypeFqn() - { - return $this->proto_type_fqn; - } - - /** - * If [code][google.spanner.v1.Type.code] == - * [PROTO][google.spanner.v1.TypeCode.PROTO] or - * [code][google.spanner.v1.Type.code] == - * [ENUM][google.spanner.v1.TypeCode.ENUM], then `proto_type_fqn` is the fully - * qualified name of the proto type representing the proto/enum definition. - * - * Generated from protobuf field string proto_type_fqn = 5; - * @param string $var - * @return $this - */ - public function setProtoTypeFqn($var) - { - GPBUtil::checkString($var, True); - $this->proto_type_fqn = $var; - - return $this; - } - -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TypeAnnotationCode.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TypeAnnotationCode.php deleted file mode 100644 index 5aa003011f3d..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TypeAnnotationCode.php +++ /dev/null @@ -1,85 +0,0 @@ -google.spanner.v1.TypeAnnotationCode - */ -class TypeAnnotationCode -{ - /** - * Not specified. - * - * Generated from protobuf enum TYPE_ANNOTATION_CODE_UNSPECIFIED = 0; - */ - const TYPE_ANNOTATION_CODE_UNSPECIFIED = 0; - /** - * PostgreSQL compatible NUMERIC type. This annotation needs to be applied to - * [Type][google.spanner.v1.Type] instances having - * [NUMERIC][google.spanner.v1.TypeCode.NUMERIC] type code to specify that - * values of this type should be treated as PostgreSQL NUMERIC values. - * Currently this annotation is always needed for - * [NUMERIC][google.spanner.v1.TypeCode.NUMERIC] when a client interacts with - * PostgreSQL-enabled Spanner databases. - * - * Generated from protobuf enum PG_NUMERIC = 2; - */ - const PG_NUMERIC = 2; - /** - * PostgreSQL compatible JSONB type. This annotation needs to be applied to - * [Type][google.spanner.v1.Type] instances having - * [JSON][google.spanner.v1.TypeCode.JSON] type code to specify that values of - * this type should be treated as PostgreSQL JSONB values. Currently this - * annotation is always needed for [JSON][google.spanner.v1.TypeCode.JSON] - * when a client interacts with PostgreSQL-enabled Spanner databases. - * - * Generated from protobuf enum PG_JSONB = 3; - */ - const PG_JSONB = 3; - /** - * PostgreSQL compatible OID type. This annotation can be used by a client - * interacting with PostgreSQL-enabled Spanner database to specify that a - * value should be treated using the semantics of the OID type. - * - * Generated from protobuf enum PG_OID = 4; - */ - const PG_OID = 4; - - private static $valueToName = [ - self::TYPE_ANNOTATION_CODE_UNSPECIFIED => 'TYPE_ANNOTATION_CODE_UNSPECIFIED', - self::PG_NUMERIC => 'PG_NUMERIC', - self::PG_JSONB => 'PG_JSONB', - self::PG_OID => 'PG_OID', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($const); - } -} - diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TypeCode.php b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TypeCode.php deleted file mode 100644 index 19ca4f38e502..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TypeCode.php +++ /dev/null @@ -1,199 +0,0 @@ -google.spanner.v1.TypeCode - */ -class TypeCode -{ - /** - * Not specified. - * - * Generated from protobuf enum TYPE_CODE_UNSPECIFIED = 0; - */ - const TYPE_CODE_UNSPECIFIED = 0; - /** - * Encoded as JSON `true` or `false`. - * - * Generated from protobuf enum BOOL = 1; - */ - const BOOL = 1; - /** - * Encoded as `string`, in decimal format. - * - * Generated from protobuf enum INT64 = 2; - */ - const INT64 = 2; - /** - * Encoded as `number`, or the strings `"NaN"`, `"Infinity"`, or - * `"-Infinity"`. - * - * Generated from protobuf enum FLOAT64 = 3; - */ - const FLOAT64 = 3; - /** - * Encoded as `number`, or the strings `"NaN"`, `"Infinity"`, or - * `"-Infinity"`. - * - * Generated from protobuf enum FLOAT32 = 15; - */ - const FLOAT32 = 15; - /** - * Encoded as `string` in RFC 3339 timestamp format. The time zone - * must be present, and must be `"Z"`. - * If the schema has the column option - * `allow_commit_timestamp=true`, the placeholder string - * `"spanner.commit_timestamp()"` can be used to instruct the system - * to insert the commit timestamp associated with the transaction - * commit. - * - * Generated from protobuf enum TIMESTAMP = 4; - */ - const TIMESTAMP = 4; - /** - * Encoded as `string` in RFC 3339 date format. - * - * Generated from protobuf enum DATE = 5; - */ - const DATE = 5; - /** - * Encoded as `string`. - * - * Generated from protobuf enum STRING = 6; - */ - const STRING = 6; - /** - * Encoded as a base64-encoded `string`, as described in RFC 4648, - * section 4. - * - * Generated from protobuf enum BYTES = 7; - */ - const BYTES = 7; - /** - * Encoded as `list`, where the list elements are represented - * according to - * [array_element_type][google.spanner.v1.Type.array_element_type]. - * - * Generated from protobuf enum ARRAY = 8; - */ - const PBARRAY = 8; - /** - * Encoded as `list`, where list element `i` is represented according - * to [struct_type.fields[i]][google.spanner.v1.StructType.fields]. - * - * Generated from protobuf enum STRUCT = 9; - */ - const STRUCT = 9; - /** - * Encoded as `string`, in decimal format or scientific notation format. - * Decimal format: - * `[+-]Digits[.[Digits]]` or - * `[+-][Digits].Digits` - * Scientific notation: - * `[+-]Digits[.[Digits]][ExponentIndicator[+-]Digits]` or - * `[+-][Digits].Digits[ExponentIndicator[+-]Digits]` - * (ExponentIndicator is `"e"` or `"E"`) - * - * Generated from protobuf enum NUMERIC = 10; - */ - const NUMERIC = 10; - /** - * Encoded as a JSON-formatted `string` as described in RFC 7159. The - * following rules are applied when parsing JSON input: - * - Whitespace characters are not preserved. - * - If a JSON object has duplicate keys, only the first key is preserved. - * - Members of a JSON object are not guaranteed to have their order - * preserved. - * - JSON array elements will have their order preserved. - * - * Generated from protobuf enum JSON = 11; - */ - const JSON = 11; - /** - * Encoded as a base64-encoded `string`, as described in RFC 4648, - * section 4. - * - * Generated from protobuf enum PROTO = 13; - */ - const PROTO = 13; - /** - * Encoded as `string`, in decimal format. - * - * Generated from protobuf enum ENUM = 14; - */ - const ENUM = 14; - /** - * Encoded as `string`, in `ISO8601` duration format - - * `P[n]Y[n]M[n]DT[n]H[n]M[n[.fraction]]S` - * where `n` is an integer. - * For example, `P1Y2M3DT4H5M6.5S` represents time duration of 1 year, 2 - * months, 3 days, 4 hours, 5 minutes, and 6.5 seconds. - * - * Generated from protobuf enum INTERVAL = 16; - */ - const INTERVAL = 16; - /** - * Encoded as `string`, in lower-case hexa-decimal format, as described - * in RFC 9562, section 4. - * - * Generated from protobuf enum UUID = 17; - */ - const UUID = 17; - - private static $valueToName = [ - self::TYPE_CODE_UNSPECIFIED => 'TYPE_CODE_UNSPECIFIED', - self::BOOL => 'BOOL', - self::INT64 => 'INT64', - self::FLOAT64 => 'FLOAT64', - self::FLOAT32 => 'FLOAT32', - self::TIMESTAMP => 'TIMESTAMP', - self::DATE => 'DATE', - self::STRING => 'STRING', - self::BYTES => 'BYTES', - self::PBARRAY => 'ARRAY', - self::STRUCT => 'STRUCT', - self::NUMERIC => 'NUMERIC', - self::JSON => 'JSON', - self::PROTO => 'PROTO', - self::ENUM => 'ENUM', - self::INTERVAL => 'INTERVAL', - self::UUID => 'UUID', - ]; - - public static function name($value) - { - if (!isset(self::$valueToName[$value])) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no name defined for value %s', __CLASS__, $value)); - } - return self::$valueToName[$value]; - } - - - public static function value($name) - { - $const = __CLASS__ . '::' . strtoupper($name); - if (!defined($const)) { - $pbconst = __CLASS__. '::PB' . strtoupper($name); - if (!defined($pbconst)) { - throw new UnexpectedValueException(sprintf( - 'Enum %s has no value defined for name %s', __CLASS__, $name)); - } - return constant($pbconst); - } - return constant($const); - } -} - diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/batch_create_sessions.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/batch_create_sessions.php deleted file mode 100644 index 40be97dbffc6..000000000000 --- a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/batch_create_sessions.php +++ /dev/null @@ -1,82 +0,0 @@ -setDatabase($formattedDatabase) - ->setSessionCount($sessionCount); - - // Call the API and handle any network failures. - try { - /** @var BatchCreateSessionsResponse $response */ - $response = $spannerClient->batchCreateSessions($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedDatabase = SpannerClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $sessionCount = 0; - - batch_create_sessions_sample($formattedDatabase, $sessionCount); -} -// [END spanner_v1_generated_Spanner_BatchCreateSessions_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/batch_write.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/batch_write.php deleted file mode 100644 index 7d3aa26e340e..000000000000 --- a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/batch_write.php +++ /dev/null @@ -1,102 +0,0 @@ -setMutations($mutationGroupsMutations); - $mutationGroups = [$mutationGroup,]; - $request = (new BatchWriteRequest()) - ->setSession($formattedSession) - ->setMutationGroups($mutationGroups); - - // Call the API and handle any network failures. - try { - /** @var ServerStream $stream */ - $stream = $spannerClient->batchWrite($request); - - /** @var BatchWriteResponse $element */ - foreach ($stream->readAll() as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSession = SpannerClient::sessionName( - '[PROJECT]', - '[INSTANCE]', - '[DATABASE]', - '[SESSION]' - ); - - batch_write_sample($formattedSession); -} -// [END spanner_v1_generated_Spanner_BatchWrite_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/begin_transaction.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/begin_transaction.php deleted file mode 100644 index f1bd435dc644..000000000000 --- a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/begin_transaction.php +++ /dev/null @@ -1,83 +0,0 @@ -setSession($formattedSession) - ->setOptions($options); - - // Call the API and handle any network failures. - try { - /** @var Transaction $response */ - $response = $spannerClient->beginTransaction($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSession = SpannerClient::sessionName( - '[PROJECT]', - '[INSTANCE]', - '[DATABASE]', - '[SESSION]' - ); - - begin_transaction_sample($formattedSession); -} -// [END spanner_v1_generated_Spanner_BeginTransaction_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/commit.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/commit.php deleted file mode 100644 index abd85545fc62..000000000000 --- a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/commit.php +++ /dev/null @@ -1,92 +0,0 @@ -setSession($formattedSession) - ->setMutations($mutations); - - // Call the API and handle any network failures. - try { - /** @var CommitResponse $response */ - $response = $spannerClient->commit($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSession = SpannerClient::sessionName( - '[PROJECT]', - '[INSTANCE]', - '[DATABASE]', - '[SESSION]' - ); - - commit_sample($formattedSession); -} -// [END spanner_v1_generated_Spanner_Commit_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/create_session.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/create_session.php deleted file mode 100644 index e16f02cbd08e..000000000000 --- a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/create_session.php +++ /dev/null @@ -1,89 +0,0 @@ -setDatabase($formattedDatabase); - - // Call the API and handle any network failures. - try { - /** @var Session $response */ - $response = $spannerClient->createSession($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedDatabase = SpannerClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - - create_session_sample($formattedDatabase); -} -// [END spanner_v1_generated_Spanner_CreateSession_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/delete_session.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/delete_session.php deleted file mode 100644 index 73c3e3c4da9f..000000000000 --- a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/delete_session.php +++ /dev/null @@ -1,71 +0,0 @@ -setName($formattedName); - - // Call the API and handle any network failures. - try { - $spannerClient->deleteSession($request); - printf('Call completed successfully.' . PHP_EOL); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = SpannerClient::sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - - delete_session_sample($formattedName); -} -// [END spanner_v1_generated_Spanner_DeleteSession_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_batch_dml.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_batch_dml.php deleted file mode 100644 index 1c40318ba4d2..000000000000 --- a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_batch_dml.php +++ /dev/null @@ -1,110 +0,0 @@ -setSql($statementsSql); - $statements = [$statement,]; - $request = (new ExecuteBatchDmlRequest()) - ->setSession($formattedSession) - ->setTransaction($transaction) - ->setStatements($statements) - ->setSeqno($seqno); - - // Call the API and handle any network failures. - try { - /** @var ExecuteBatchDmlResponse $response */ - $response = $spannerClient->executeBatchDml($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSession = SpannerClient::sessionName( - '[PROJECT]', - '[INSTANCE]', - '[DATABASE]', - '[SESSION]' - ); - $statementsSql = '[SQL]'; - $seqno = 0; - - execute_batch_dml_sample($formattedSession, $statementsSql, $seqno); -} -// [END spanner_v1_generated_Spanner_ExecuteBatchDml_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_sql.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_sql.php deleted file mode 100644 index 5e27212686bb..000000000000 --- a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_sql.php +++ /dev/null @@ -1,91 +0,0 @@ -setSession($formattedSession) - ->setSql($sql); - - // Call the API and handle any network failures. - try { - /** @var ResultSet $response */ - $response = $spannerClient->executeSql($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSession = SpannerClient::sessionName( - '[PROJECT]', - '[INSTANCE]', - '[DATABASE]', - '[SESSION]' - ); - $sql = '[SQL]'; - - execute_sql_sample($formattedSession, $sql); -} -// [END spanner_v1_generated_Spanner_ExecuteSql_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_streaming_sql.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_streaming_sql.php deleted file mode 100644 index 330bd96b65ca..000000000000 --- a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/execute_streaming_sql.php +++ /dev/null @@ -1,88 +0,0 @@ -setSession($formattedSession) - ->setSql($sql); - - // Call the API and handle any network failures. - try { - /** @var ServerStream $stream */ - $stream = $spannerClient->executeStreamingSql($request); - - /** @var PartialResultSet $element */ - foreach ($stream->readAll() as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSession = SpannerClient::sessionName( - '[PROJECT]', - '[INSTANCE]', - '[DATABASE]', - '[SESSION]' - ); - $sql = '[SQL]'; - - execute_streaming_sql_sample($formattedSession, $sql); -} -// [END spanner_v1_generated_Spanner_ExecuteStreamingSql_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/get_session.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/get_session.php deleted file mode 100644 index 02478a3ef603..000000000000 --- a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/get_session.php +++ /dev/null @@ -1,73 +0,0 @@ -setName($formattedName); - - // Call the API and handle any network failures. - try { - /** @var Session $response */ - $response = $spannerClient->getSession($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedName = SpannerClient::sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - - get_session_sample($formattedName); -} -// [END spanner_v1_generated_Spanner_GetSession_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/list_sessions.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/list_sessions.php deleted file mode 100644 index 1f91d9202b21..000000000000 --- a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/list_sessions.php +++ /dev/null @@ -1,76 +0,0 @@ -setDatabase($formattedDatabase); - - // Call the API and handle any network failures. - try { - /** @var PagedListResponse $response */ - $response = $spannerClient->listSessions($request); - - /** @var Session $element */ - foreach ($response as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedDatabase = SpannerClient::databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - - list_sessions_sample($formattedDatabase); -} -// [END spanner_v1_generated_Spanner_ListSessions_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/partition_query.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/partition_query.php deleted file mode 100644 index 9af6f93afe0b..000000000000 --- a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/partition_query.php +++ /dev/null @@ -1,101 +0,0 @@ -setSession($formattedSession) - ->setSql($sql); - - // Call the API and handle any network failures. - try { - /** @var PartitionResponse $response */ - $response = $spannerClient->partitionQuery($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSession = SpannerClient::sessionName( - '[PROJECT]', - '[INSTANCE]', - '[DATABASE]', - '[SESSION]' - ); - $sql = '[SQL]'; - - partition_query_sample($formattedSession, $sql); -} -// [END spanner_v1_generated_Spanner_PartitionQuery_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/partition_read.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/partition_read.php deleted file mode 100644 index 4db50f8a4371..000000000000 --- a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/partition_read.php +++ /dev/null @@ -1,95 +0,0 @@ -setSession($formattedSession) - ->setTable($table) - ->setKeySet($keySet); - - // Call the API and handle any network failures. - try { - /** @var PartitionResponse $response */ - $response = $spannerClient->partitionRead($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSession = SpannerClient::sessionName( - '[PROJECT]', - '[INSTANCE]', - '[DATABASE]', - '[SESSION]' - ); - $table = '[TABLE]'; - - partition_read_sample($formattedSession, $table); -} -// [END spanner_v1_generated_Spanner_PartitionRead_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/read.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/read.php deleted file mode 100644 index 0efe5830717f..000000000000 --- a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/read.php +++ /dev/null @@ -1,100 +0,0 @@ -setSession($formattedSession) - ->setTable($table) - ->setColumns($columns) - ->setKeySet($keySet); - - // Call the API and handle any network failures. - try { - /** @var ResultSet $response */ - $response = $spannerClient->read($request); - printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSession = SpannerClient::sessionName( - '[PROJECT]', - '[INSTANCE]', - '[DATABASE]', - '[SESSION]' - ); - $table = '[TABLE]'; - $columnsElement = '[COLUMNS]'; - - read_sample($formattedSession, $table, $columnsElement); -} -// [END spanner_v1_generated_Spanner_Read_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/rollback.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/rollback.php deleted file mode 100644 index 1eb7e9a22772..000000000000 --- a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/rollback.php +++ /dev/null @@ -1,85 +0,0 @@ -setSession($formattedSession) - ->setTransactionId($transactionId); - - // Call the API and handle any network failures. - try { - $spannerClient->rollback($request); - printf('Call completed successfully.' . PHP_EOL); - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSession = SpannerClient::sessionName( - '[PROJECT]', - '[INSTANCE]', - '[DATABASE]', - '[SESSION]' - ); - $transactionId = '...'; - - rollback_sample($formattedSession, $transactionId); -} -// [END spanner_v1_generated_Spanner_Rollback_sync] diff --git a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/streaming_read.php b/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/streaming_read.php deleted file mode 100644 index 48ee32a9a094..000000000000 --- a/owl-bot-staging/Spanner/v1/samples/V1/SpannerClient/streaming_read.php +++ /dev/null @@ -1,99 +0,0 @@ -setSession($formattedSession) - ->setTable($table) - ->setColumns($columns) - ->setKeySet($keySet); - - // Call the API and handle any network failures. - try { - /** @var ServerStream $stream */ - $stream = $spannerClient->streamingRead($request); - - /** @var PartialResultSet $element */ - foreach ($stream->readAll() as $element) { - printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); - } - } catch (ApiException $ex) { - printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); - } -} - -/** - * Helper to execute the sample. - * - * This sample has been automatically generated and should be regarded as a code - * template only. It will require modifications to work: - * - It may require correct/in-range values for request initialization. - * - It may require specifying regional endpoints when creating the service client, - * please see the apiEndpoint client configuration option for more details. - */ -function callSample(): void -{ - $formattedSession = SpannerClient::sessionName( - '[PROJECT]', - '[INSTANCE]', - '[DATABASE]', - '[SESSION]' - ); - $table = '[TABLE]'; - $columnsElement = '[COLUMNS]'; - - streaming_read_sample($formattedSession, $table, $columnsElement); -} -// [END spanner_v1_generated_Spanner_StreamingRead_sync] diff --git a/owl-bot-staging/Spanner/v1/src/V1/Client/SpannerClient.php b/owl-bot-staging/Spanner/v1/src/V1/Client/SpannerClient.php deleted file mode 100644 index e794a10d3d54..000000000000 --- a/owl-bot-staging/Spanner/v1/src/V1/Client/SpannerClient.php +++ /dev/null @@ -1,836 +0,0 @@ - batchCreateSessionsAsync(BatchCreateSessionsRequest $request, array $optionalArgs = []) - * @method PromiseInterface beginTransactionAsync(BeginTransactionRequest $request, array $optionalArgs = []) - * @method PromiseInterface commitAsync(CommitRequest $request, array $optionalArgs = []) - * @method PromiseInterface createSessionAsync(CreateSessionRequest $request, array $optionalArgs = []) - * @method PromiseInterface deleteSessionAsync(DeleteSessionRequest $request, array $optionalArgs = []) - * @method PromiseInterface executeBatchDmlAsync(ExecuteBatchDmlRequest $request, array $optionalArgs = []) - * @method PromiseInterface executeSqlAsync(ExecuteSqlRequest $request, array $optionalArgs = []) - * @method PromiseInterface getSessionAsync(GetSessionRequest $request, array $optionalArgs = []) - * @method PromiseInterface listSessionsAsync(ListSessionsRequest $request, array $optionalArgs = []) - * @method PromiseInterface partitionQueryAsync(PartitionQueryRequest $request, array $optionalArgs = []) - * @method PromiseInterface partitionReadAsync(PartitionReadRequest $request, array $optionalArgs = []) - * @method PromiseInterface readAsync(ReadRequest $request, array $optionalArgs = []) - * @method PromiseInterface rollbackAsync(RollbackRequest $request, array $optionalArgs = []) - */ -final class SpannerClient -{ - use GapicClientTrait; - use ResourceHelperTrait; - - /** The name of the service. */ - private const SERVICE_NAME = 'google.spanner.v1.Spanner'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - private const SERVICE_ADDRESS = 'spanner.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'spanner.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - private const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - private const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/spanner.data', - ]; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/spanner_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/spanner_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/spanner_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/spanner_rest_client_config.php', - ], - ], - ]; - } - - /** - * Formats a string containing the fully-qualified path to represent a database - * resource. - * - * @param string $project - * @param string $instance - * @param string $database - * - * @return string The formatted database resource. - */ - public static function databaseName(string $project, string $instance, string $database): string - { - return self::getPathTemplate('database')->render([ - 'project' => $project, - 'instance' => $instance, - 'database' => $database, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a session - * resource. - * - * @param string $project - * @param string $instance - * @param string $database - * @param string $session - * - * @return string The formatted session resource. - */ - public static function sessionName(string $project, string $instance, string $database, string $session): string - { - return self::getPathTemplate('session')->render([ - 'project' => $project, - 'instance' => $instance, - 'database' => $database, - 'session' => $session, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - database: projects/{project}/instances/{instance}/databases/{database} - * - session: projects/{project}/instances/{instance}/databases/{database}/sessions/{session} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param ?string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName(string $formattedName, ?string $template = null): array - { - return self::parseFormattedName($formattedName, $template); - } - - /** - * Constructor. - * - * Setting the "SPANNER_EMULATOR_HOST" environment variable will automatically set - * the API Endpoint to the value specified in the variable, as well as ensure that - * empty credentials are used in the transport layer. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'spanner.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * @type false|LoggerInterface $logger - * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the - * 'GOOGLE_SDK_PHP_LOGGING' environment flag - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $options = $this->setDefaultEmulatorConfig($options); - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** Handles execution of the async variants for each documented method. */ - public function __call($method, $args) - { - if (substr($method, -5) !== 'Async') { - trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); - } - - array_unshift($args, substr($method, 0, -5)); - return call_user_func_array([$this, 'startAsyncCall'], $args); - } - - /** - * Creates multiple new sessions. - * - * This API can be used to initialize a session cache on the clients. - * See https://goo.gl/TgSFN2 for best practices on session cache management. - * - * The async variant is {@see SpannerClient::batchCreateSessionsAsync()} . - * - * @example samples/V1/SpannerClient/batch_create_sessions.php - * - * @param BatchCreateSessionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return BatchCreateSessionsResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function batchCreateSessions(BatchCreateSessionsRequest $request, array $callOptions = []): BatchCreateSessionsResponse - { - return $this->startApiCall('BatchCreateSessions', $request, $callOptions)->wait(); - } - - /** - * Batches the supplied mutation groups in a collection of efficient - * transactions. All mutations in a group are committed atomically. However, - * mutations across groups can be committed non-atomically in an unspecified - * order and thus, they must be independent of each other. Partial failure is - * possible, i.e., some groups may have been committed successfully, while - * some may have failed. The results of individual batches are streamed into - * the response as the batches are applied. - * - * BatchWrite requests are not replay protected, meaning that each mutation - * group may be applied more than once. Replays of non-idempotent mutations - * may have undesirable effects. For example, replays of an insert mutation - * may produce an already exists error or if you use generated or commit - * timestamp-based keys, it may result in additional rows being added to the - * mutation's table. We recommend structuring your mutation groups to be - * idempotent to avoid this issue. - * - * @example samples/V1/SpannerClient/batch_write.php - * - * @param BatchWriteRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return ServerStream - * - * @throws ApiException Thrown if the API call fails. - */ - public function batchWrite(BatchWriteRequest $request, array $callOptions = []): ServerStream - { - return $this->startApiCall('BatchWrite', $request, $callOptions); - } - - /** - * Begins a new transaction. This step can often be skipped: - * [Read][google.spanner.v1.Spanner.Read], - * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and - * [Commit][google.spanner.v1.Spanner.Commit] can begin a new transaction as a - * side-effect. - * - * The async variant is {@see SpannerClient::beginTransactionAsync()} . - * - * @example samples/V1/SpannerClient/begin_transaction.php - * - * @param BeginTransactionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Transaction - * - * @throws ApiException Thrown if the API call fails. - */ - public function beginTransaction(BeginTransactionRequest $request, array $callOptions = []): Transaction - { - return $this->startApiCall('BeginTransaction', $request, $callOptions)->wait(); - } - - /** - * Commits a transaction. The request includes the mutations to be - * applied to rows in the database. - * - * `Commit` might return an `ABORTED` error. This can occur at any time; - * commonly, the cause is conflicts with concurrent - * transactions. However, it can also happen for a variety of other - * reasons. If `Commit` returns `ABORTED`, the caller should re-attempt - * the transaction from the beginning, re-using the same session. - * - * On very rare occasions, `Commit` might return `UNKNOWN`. This can happen, - * for example, if the client job experiences a 1+ hour networking failure. - * At that point, Cloud Spanner has lost track of the transaction outcome and - * we recommend that you perform another read from the database to see the - * state of things as they are now. - * - * The async variant is {@see SpannerClient::commitAsync()} . - * - * @example samples/V1/SpannerClient/commit.php - * - * @param CommitRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return CommitResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function commit(CommitRequest $request, array $callOptions = []): CommitResponse - { - return $this->startApiCall('Commit', $request, $callOptions)->wait(); - } - - /** - * Creates a new session. A session can be used to perform - * transactions that read and/or modify data in a Cloud Spanner database. - * Sessions are meant to be reused for many consecutive - * transactions. - * - * Sessions can only execute one transaction at a time. To execute - * multiple concurrent read-write/write-only transactions, create - * multiple sessions. Note that standalone reads and queries use a - * transaction internally, and count toward the one transaction - * limit. - * - * Active sessions use additional server resources, so it is a good idea to - * delete idle and unneeded sessions. - * Aside from explicit deletes, Cloud Spanner may delete sessions for which no - * operations are sent for more than an hour. If a session is deleted, - * requests to it return `NOT_FOUND`. - * - * Idle sessions can be kept alive by sending a trivial SQL query - * periodically, e.g., `"SELECT 1"`. - * - * The async variant is {@see SpannerClient::createSessionAsync()} . - * - * @example samples/V1/SpannerClient/create_session.php - * - * @param CreateSessionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Session - * - * @throws ApiException Thrown if the API call fails. - */ - public function createSession(CreateSessionRequest $request, array $callOptions = []): Session - { - return $this->startApiCall('CreateSession', $request, $callOptions)->wait(); - } - - /** - * Ends a session, releasing server resources associated with it. This will - * asynchronously trigger cancellation of any operations that are running with - * this session. - * - * The async variant is {@see SpannerClient::deleteSessionAsync()} . - * - * @example samples/V1/SpannerClient/delete_session.php - * - * @param DeleteSessionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException Thrown if the API call fails. - */ - public function deleteSession(DeleteSessionRequest $request, array $callOptions = []): void - { - $this->startApiCall('DeleteSession', $request, $callOptions)->wait(); - } - - /** - * Executes a batch of SQL DML statements. This method allows many statements - * to be run with lower latency than submitting them sequentially with - * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. - * - * Statements are executed in sequential order. A request can succeed even if - * a statement fails. The - * [ExecuteBatchDmlResponse.status][google.spanner.v1.ExecuteBatchDmlResponse.status] - * field in the response provides information about the statement that failed. - * Clients must inspect this field to determine whether an error occurred. - * - * Execution stops after the first failed statement; the remaining statements - * are not executed. - * - * The async variant is {@see SpannerClient::executeBatchDmlAsync()} . - * - * @example samples/V1/SpannerClient/execute_batch_dml.php - * - * @param ExecuteBatchDmlRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return ExecuteBatchDmlResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function executeBatchDml(ExecuteBatchDmlRequest $request, array $callOptions = []): ExecuteBatchDmlResponse - { - return $this->startApiCall('ExecuteBatchDml', $request, $callOptions)->wait(); - } - - /** - * Executes an SQL statement, returning all results in a single reply. This - * method cannot be used to return a result set larger than 10 MiB; - * if the query yields more data than that, the query fails with - * a `FAILED_PRECONDITION` error. - * - * Operations inside read-write transactions might return `ABORTED`. If - * this occurs, the application should restart the transaction from - * the beginning. See [Transaction][google.spanner.v1.Transaction] for more - * details. - * - * Larger result sets can be fetched in streaming fashion by calling - * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] - * instead. - * - * The async variant is {@see SpannerClient::executeSqlAsync()} . - * - * @example samples/V1/SpannerClient/execute_sql.php - * - * @param ExecuteSqlRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return ResultSet - * - * @throws ApiException Thrown if the API call fails. - */ - public function executeSql(ExecuteSqlRequest $request, array $callOptions = []): ResultSet - { - return $this->startApiCall('ExecuteSql', $request, $callOptions)->wait(); - } - - /** - * Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the - * result set as a stream. Unlike - * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there is no limit on - * the size of the returned result set. However, no individual row in the - * result set can exceed 100 MiB, and no column value can exceed 10 MiB. - * - * @example samples/V1/SpannerClient/execute_streaming_sql.php - * - * @param ExecuteSqlRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return ServerStream - * - * @throws ApiException Thrown if the API call fails. - */ - public function executeStreamingSql(ExecuteSqlRequest $request, array $callOptions = []): ServerStream - { - return $this->startApiCall('ExecuteStreamingSql', $request, $callOptions); - } - - /** - * Gets a session. Returns `NOT_FOUND` if the session does not exist. - * This is mainly useful for determining whether a session is still - * alive. - * - * The async variant is {@see SpannerClient::getSessionAsync()} . - * - * @example samples/V1/SpannerClient/get_session.php - * - * @param GetSessionRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return Session - * - * @throws ApiException Thrown if the API call fails. - */ - public function getSession(GetSessionRequest $request, array $callOptions = []): Session - { - return $this->startApiCall('GetSession', $request, $callOptions)->wait(); - } - - /** - * Lists all sessions in a given database. - * - * The async variant is {@see SpannerClient::listSessionsAsync()} . - * - * @example samples/V1/SpannerClient/list_sessions.php - * - * @param ListSessionsRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PagedListResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function listSessions(ListSessionsRequest $request, array $callOptions = []): PagedListResponse - { - return $this->startApiCall('ListSessions', $request, $callOptions); - } - - /** - * Creates a set of partition tokens that can be used to execute a query - * operation in parallel. Each of the returned partition tokens can be used - * by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to - * specify a subset of the query result to read. The same session and - * read-only transaction must be used by the PartitionQueryRequest used to - * create the partition tokens and the ExecuteSqlRequests that use the - * partition tokens. - * - * Partition tokens become invalid when the session used to create them - * is deleted, is idle for too long, begins a new transaction, or becomes too - * old. When any of these happen, it is not possible to resume the query, and - * the whole operation must be restarted from the beginning. - * - * The async variant is {@see SpannerClient::partitionQueryAsync()} . - * - * @example samples/V1/SpannerClient/partition_query.php - * - * @param PartitionQueryRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PartitionResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function partitionQuery(PartitionQueryRequest $request, array $callOptions = []): PartitionResponse - { - return $this->startApiCall('PartitionQuery', $request, $callOptions)->wait(); - } - - /** - * Creates a set of partition tokens that can be used to execute a read - * operation in parallel. Each of the returned partition tokens can be used - * by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a - * subset of the read result to read. The same session and read-only - * transaction must be used by the PartitionReadRequest used to create the - * partition tokens and the ReadRequests that use the partition tokens. There - * are no ordering guarantees on rows returned among the returned partition - * tokens, or even within each individual StreamingRead call issued with a - * partition_token. - * - * Partition tokens become invalid when the session used to create them - * is deleted, is idle for too long, begins a new transaction, or becomes too - * old. When any of these happen, it is not possible to resume the read, and - * the whole operation must be restarted from the beginning. - * - * The async variant is {@see SpannerClient::partitionReadAsync()} . - * - * @example samples/V1/SpannerClient/partition_read.php - * - * @param PartitionReadRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return PartitionResponse - * - * @throws ApiException Thrown if the API call fails. - */ - public function partitionRead(PartitionReadRequest $request, array $callOptions = []): PartitionResponse - { - return $this->startApiCall('PartitionRead', $request, $callOptions)->wait(); - } - - /** - * Reads rows from the database using key lookups and scans, as a - * simple key/value style alternative to - * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be - * used to return a result set larger than 10 MiB; if the read matches more - * data than that, the read fails with a `FAILED_PRECONDITION` - * error. - * - * Reads inside read-write transactions might return `ABORTED`. If - * this occurs, the application should restart the transaction from - * the beginning. See [Transaction][google.spanner.v1.Transaction] for more - * details. - * - * Larger result sets can be yielded in streaming fashion by calling - * [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead. - * - * The async variant is {@see SpannerClient::readAsync()} . - * - * @example samples/V1/SpannerClient/read.php - * - * @param ReadRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return ResultSet - * - * @throws ApiException Thrown if the API call fails. - */ - public function read(ReadRequest $request, array $callOptions = []): ResultSet - { - return $this->startApiCall('Read', $request, $callOptions)->wait(); - } - - /** - * Rolls back a transaction, releasing any locks it holds. It is a good - * idea to call this for any transaction that includes one or more - * [Read][google.spanner.v1.Spanner.Read] or - * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and ultimately - * decides not to commit. - * - * `Rollback` returns `OK` if it successfully aborts the transaction, the - * transaction was already aborted, or the transaction is not - * found. `Rollback` never returns `ABORTED`. - * - * The async variant is {@see SpannerClient::rollbackAsync()} . - * - * @example samples/V1/SpannerClient/rollback.php - * - * @param RollbackRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException Thrown if the API call fails. - */ - public function rollback(RollbackRequest $request, array $callOptions = []): void - { - $this->startApiCall('Rollback', $request, $callOptions)->wait(); - } - - /** - * Like [Read][google.spanner.v1.Spanner.Read], except returns the result set - * as a stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no - * limit on the size of the returned result set. However, no individual row in - * the result set can exceed 100 MiB, and no column value can exceed - * 10 MiB. - * - * @example samples/V1/SpannerClient/streaming_read.php - * - * @param ReadRequest $request A request to house fields associated with the call. - * @param array $callOptions { - * Optional. - * - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return ServerStream - * - * @throws ApiException Thrown if the API call fails. - */ - public function streamingRead(ReadRequest $request, array $callOptions = []): ServerStream - { - return $this->startApiCall('StreamingRead', $request, $callOptions); - } - - /** Configure the gapic configuration to use a service emulator. */ - private function setDefaultEmulatorConfig(array $options): array - { - $emulatorHost = getenv('SPANNER_EMULATOR_HOST'); - if (empty($emulatorHost)) { - return $options; - } - - if ($scheme = parse_url($emulatorHost, PHP_URL_SCHEME)) { - $search = $scheme . '://'; - $emulatorHost = str_replace($search, '', $emulatorHost); - } - - $options['apiEndpoint'] ??= $emulatorHost; - $options['transportConfig']['grpc']['stubOpts']['credentials'] ??= ChannelCredentials::createInsecure(); - $options['credentials'] ??= new InsecureCredentialsWrapper(); - return $options; - } -} diff --git a/owl-bot-staging/Spanner/v1/src/V1/Gapic/SpannerGapicClient.php b/owl-bot-staging/Spanner/v1/src/V1/Gapic/SpannerGapicClient.php deleted file mode 100644 index 836e5478470b..000000000000 --- a/owl-bot-staging/Spanner/v1/src/V1/Gapic/SpannerGapicClient.php +++ /dev/null @@ -1,1919 +0,0 @@ -databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - * $sessionCount = 0; - * $response = $spannerClient->batchCreateSessions($formattedDatabase, $sessionCount); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\Spanner\V1\Client\SpannerClient}. - */ -class SpannerGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.spanner.v1.Spanner'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'spanner.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'spanner.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/spanner.data', - ]; - - private static $databaseNameTemplate; - - private static $sessionNameTemplate; - - private static $pathTemplateMap; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/spanner_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/spanner_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/spanner_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/spanner_rest_client_config.php', - ], - ], - ]; - } - - private static function getDatabaseNameTemplate() - { - if (self::$databaseNameTemplate == null) { - self::$databaseNameTemplate = new PathTemplate('projects/{project}/instances/{instance}/databases/{database}'); - } - - return self::$databaseNameTemplate; - } - - private static function getSessionNameTemplate() - { - if (self::$sessionNameTemplate == null) { - self::$sessionNameTemplate = new PathTemplate('projects/{project}/instances/{instance}/databases/{database}/sessions/{session}'); - } - - return self::$sessionNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'database' => self::getDatabaseNameTemplate(), - 'session' => self::getSessionNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a database - * resource. - * - * @param string $project - * @param string $instance - * @param string $database - * - * @return string The formatted database resource. - */ - public static function databaseName($project, $instance, $database) - { - return self::getDatabaseNameTemplate()->render([ - 'project' => $project, - 'instance' => $instance, - 'database' => $database, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a session - * resource. - * - * @param string $project - * @param string $instance - * @param string $database - * @param string $session - * - * @return string The formatted session resource. - */ - public static function sessionName($project, $instance, $database, $session) - { - return self::getSessionNameTemplate()->render([ - 'project' => $project, - 'instance' => $instance, - 'database' => $database, - 'session' => $session, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - database: projects/{project}/instances/{instance}/databases/{database} - * - session: projects/{project}/instances/{instance}/databases/{database}/sessions/{session} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException("Template name $template does not exist"); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException("Input did not match any known format. Input: $formattedName"); - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'spanner.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** - * Creates multiple new sessions. - * - * This API can be used to initialize a session cache on the clients. - * See https://goo.gl/TgSFN2 for best practices on session cache management. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedDatabase = $spannerClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - * $sessionCount = 0; - * $response = $spannerClient->batchCreateSessions($formattedDatabase, $sessionCount); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $database Required. The database in which the new sessions are created. - * @param int $sessionCount Required. The number of sessions to be created in this batch call. - * The API may return fewer than the requested number of sessions. If a - * specific number of sessions are desired, the client can make additional - * calls to BatchCreateSessions (adjusting - * [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count] - * as necessary). - * @param array $optionalArgs { - * Optional. - * - * @type Session $sessionTemplate - * Parameters to be applied to each created session. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\V1\BatchCreateSessionsResponse - * - * @throws ApiException if the remote call fails - */ - public function batchCreateSessions($database, $sessionCount, array $optionalArgs = []) - { - $request = new BatchCreateSessionsRequest(); - $requestParamHeaders = []; - $request->setDatabase($database); - $request->setSessionCount($sessionCount); - $requestParamHeaders['database'] = $database; - if (isset($optionalArgs['sessionTemplate'])) { - $request->setSessionTemplate($optionalArgs['sessionTemplate']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('BatchCreateSessions', BatchCreateSessionsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Batches the supplied mutation groups in a collection of efficient - * transactions. All mutations in a group are committed atomically. However, - * mutations across groups can be committed non-atomically in an unspecified - * order and thus, they must be independent of each other. Partial failure is - * possible, i.e., some groups may have been committed successfully, while - * some may have failed. The results of individual batches are streamed into - * the response as the batches are applied. - * - * BatchWrite requests are not replay protected, meaning that each mutation - * group may be applied more than once. Replays of non-idempotent mutations - * may have undesirable effects. For example, replays of an insert mutation - * may produce an already exists error or if you use generated or commit - * timestamp-based keys, it may result in additional rows being added to the - * mutation's table. We recommend structuring your mutation groups to be - * idempotent to avoid this issue. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $mutationGroups = []; - * // Read all responses until the stream is complete - * $stream = $spannerClient->batchWrite($formattedSession, $mutationGroups); - * foreach ($stream->readAll() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $session Required. The session in which the batch request is to be run. - * @param MutationGroup[] $mutationGroups Required. The groups of mutations to be applied. - * @param array $optionalArgs { - * Optional. - * - * @type RequestOptions $requestOptions - * Common options for this request. - * @type bool $excludeTxnFromChangeStreams - * Optional. When `exclude_txn_from_change_streams` is set to `true`: - * * Mutations from all transactions in this batch write operation will not - * be recorded in change streams with DDL option `allow_txn_exclusion=true` - * that are tracking columns modified by these transactions. - * * Mutations from all transactions in this batch write operation will be - * recorded in change streams with DDL option `allow_txn_exclusion=false or - * not set` that are tracking columns modified by these transactions. - * - * When `exclude_txn_from_change_streams` is set to `false` or not set, - * mutations from all transactions in this batch write operation will be - * recorded in all change streams that are tracking columns modified by these - * transactions. - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return \Google\ApiCore\ServerStream - * - * @throws ApiException if the remote call fails - */ - public function batchWrite($session, $mutationGroups, array $optionalArgs = []) - { - $request = new BatchWriteRequest(); - $requestParamHeaders = []; - $request->setSession($session); - $request->setMutationGroups($mutationGroups); - $requestParamHeaders['session'] = $session; - if (isset($optionalArgs['requestOptions'])) { - $request->setRequestOptions($optionalArgs['requestOptions']); - } - - if (isset($optionalArgs['excludeTxnFromChangeStreams'])) { - $request->setExcludeTxnFromChangeStreams($optionalArgs['excludeTxnFromChangeStreams']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('BatchWrite', BatchWriteResponse::class, $optionalArgs, $request, Call::SERVER_STREAMING_CALL); - } - - /** - * Begins a new transaction. This step can often be skipped: - * [Read][google.spanner.v1.Spanner.Read], - * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and - * [Commit][google.spanner.v1.Spanner.Commit] can begin a new transaction as a - * side-effect. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $options = new TransactionOptions(); - * $response = $spannerClient->beginTransaction($formattedSession, $options); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $session Required. The session in which the transaction runs. - * @param TransactionOptions $options Required. Options for the new transaction. - * @param array $optionalArgs { - * Optional. - * - * @type RequestOptions $requestOptions - * Common options for this request. - * Priority is ignored for this request. Setting the priority in this - * request_options struct will not do anything. To set the priority for a - * transaction, set it on the reads and writes that are part of this - * transaction instead. - * @type Mutation $mutationKey - * Optional. Required for read-write transactions on a multiplexed session - * that commit mutations but do not perform any reads or queries. Clients - * should randomly select one of the mutations from the mutation set and send - * it as a part of this request. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\V1\Transaction - * - * @throws ApiException if the remote call fails - */ - public function beginTransaction($session, $options, array $optionalArgs = []) - { - $request = new BeginTransactionRequest(); - $requestParamHeaders = []; - $request->setSession($session); - $request->setOptions($options); - $requestParamHeaders['session'] = $session; - if (isset($optionalArgs['requestOptions'])) { - $request->setRequestOptions($optionalArgs['requestOptions']); - } - - if (isset($optionalArgs['mutationKey'])) { - $request->setMutationKey($optionalArgs['mutationKey']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('BeginTransaction', Transaction::class, $optionalArgs, $request)->wait(); - } - - /** - * Commits a transaction. The request includes the mutations to be - * applied to rows in the database. - * - * `Commit` might return an `ABORTED` error. This can occur at any time; - * commonly, the cause is conflicts with concurrent - * transactions. However, it can also happen for a variety of other - * reasons. If `Commit` returns `ABORTED`, the caller should re-attempt - * the transaction from the beginning, re-using the same session. - * - * On very rare occasions, `Commit` might return `UNKNOWN`. This can happen, - * for example, if the client job experiences a 1+ hour networking failure. - * At that point, Cloud Spanner has lost track of the transaction outcome and - * we recommend that you perform another read from the database to see the - * state of things as they are now. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $mutations = []; - * $response = $spannerClient->commit($formattedSession, $mutations); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $session Required. The session in which the transaction to be committed is running. - * @param Mutation[] $mutations The mutations to be executed when this transaction commits. All - * mutations are applied atomically, in the order they appear in - * this list. - * @param array $optionalArgs { - * Optional. - * - * @type string $transactionId - * Commit a previously-started transaction. - * @type TransactionOptions $singleUseTransaction - * Execute mutations in a temporary transaction. Note that unlike - * commit of a previously-started transaction, commit with a - * temporary transaction is non-idempotent. That is, if the - * `CommitRequest` is sent to Cloud Spanner more than once (for - * instance, due to retries in the application, or in the - * transport library), it is possible that the mutations are - * executed more than once. If this is undesirable, use - * [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction] and - * [Commit][google.spanner.v1.Spanner.Commit] instead. - * @type bool $returnCommitStats - * If `true`, then statistics related to the transaction will be included in - * the [CommitResponse][google.spanner.v1.CommitResponse.commit_stats]. - * Default value is `false`. - * @type Duration $maxCommitDelay - * Optional. The amount of latency this request is willing to incur in order - * to improve throughput. If this field is not set, Spanner assumes requests - * are relatively latency sensitive and automatically determines an - * appropriate delay time. You can specify a batching delay value between 0 - * and 500 ms. - * @type RequestOptions $requestOptions - * Common options for this request. - * @type MultiplexedSessionPrecommitToken $precommitToken - * Optional. If the read-write transaction was executed on a multiplexed - * session, the precommit token with the highest sequence number received in - * this transaction attempt, should be included here. Failing to do so will - * result in a FailedPrecondition error. - * This feature is not yet supported and will result in an UNIMPLEMENTED - * error. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\V1\CommitResponse - * - * @throws ApiException if the remote call fails - */ - public function commit($session, $mutations, array $optionalArgs = []) - { - $request = new CommitRequest(); - $requestParamHeaders = []; - $request->setSession($session); - $request->setMutations($mutations); - $requestParamHeaders['session'] = $session; - if (isset($optionalArgs['transactionId'])) { - $request->setTransactionId($optionalArgs['transactionId']); - } - - if (isset($optionalArgs['singleUseTransaction'])) { - $request->setSingleUseTransaction($optionalArgs['singleUseTransaction']); - } - - if (isset($optionalArgs['returnCommitStats'])) { - $request->setReturnCommitStats($optionalArgs['returnCommitStats']); - } - - if (isset($optionalArgs['maxCommitDelay'])) { - $request->setMaxCommitDelay($optionalArgs['maxCommitDelay']); - } - - if (isset($optionalArgs['requestOptions'])) { - $request->setRequestOptions($optionalArgs['requestOptions']); - } - - if (isset($optionalArgs['precommitToken'])) { - $request->setPrecommitToken($optionalArgs['precommitToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Commit', CommitResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a new session. A session can be used to perform - * transactions that read and/or modify data in a Cloud Spanner database. - * Sessions are meant to be reused for many consecutive - * transactions. - * - * Sessions can only execute one transaction at a time. To execute - * multiple concurrent read-write/write-only transactions, create - * multiple sessions. Note that standalone reads and queries use a - * transaction internally, and count toward the one transaction - * limit. - * - * Active sessions use additional server resources, so it is a good idea to - * delete idle and unneeded sessions. - * Aside from explicit deletes, Cloud Spanner may delete sessions for which no - * operations are sent for more than an hour. If a session is deleted, - * requests to it return `NOT_FOUND`. - * - * Idle sessions can be kept alive by sending a trivial SQL query - * periodically, e.g., `"SELECT 1"`. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedDatabase = $spannerClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - * $response = $spannerClient->createSession($formattedDatabase); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $database Required. The database in which the new session is created. - * @param array $optionalArgs { - * Optional. - * - * @type Session $session - * Required. The session to create. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\V1\Session - * - * @throws ApiException if the remote call fails - */ - public function createSession($database, array $optionalArgs = []) - { - $request = new CreateSessionRequest(); - $requestParamHeaders = []; - $request->setDatabase($database); - $requestParamHeaders['database'] = $database; - if (isset($optionalArgs['session'])) { - $request->setSession($optionalArgs['session']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('CreateSession', Session::class, $optionalArgs, $request)->wait(); - } - - /** - * Ends a session, releasing server resources associated with it. This will - * asynchronously trigger cancellation of any operations that are running with - * this session. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedName = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $spannerClient->deleteSession($formattedName); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the session to delete. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function deleteSession($name, array $optionalArgs = []) - { - $request = new DeleteSessionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DeleteSession', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Executes a batch of SQL DML statements. This method allows many statements - * to be run with lower latency than submitting them sequentially with - * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. - * - * Statements are executed in sequential order. A request can succeed even if - * a statement fails. The - * [ExecuteBatchDmlResponse.status][google.spanner.v1.ExecuteBatchDmlResponse.status] - * field in the response provides information about the statement that failed. - * Clients must inspect this field to determine whether an error occurred. - * - * Execution stops after the first failed statement; the remaining statements - * are not executed. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $transaction = new TransactionSelector(); - * $statements = []; - * $seqno = 0; - * $response = $spannerClient->executeBatchDml($formattedSession, $transaction, $statements, $seqno); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $session Required. The session in which the DML statements should be performed. - * @param TransactionSelector $transaction Required. The transaction to use. Must be a read-write transaction. - * - * To protect against replays, single-use transactions are not supported. The - * caller must either supply an existing transaction ID or begin a new - * transaction. - * @param Statement[] $statements Required. The list of statements to execute in this batch. Statements are - * executed serially, such that the effects of statement `i` are visible to - * statement `i+1`. Each statement must be a DML statement. Execution stops at - * the first failed statement; the remaining statements are not executed. - * - * Callers must provide at least one statement. - * @param int $seqno Required. A per-transaction sequence number used to identify this request. - * This field makes each request idempotent such that if the request is - * received multiple times, at most one will succeed. - * - * The sequence number must be monotonically increasing within the - * transaction. If a request arrives for the first time with an out-of-order - * sequence number, the transaction may be aborted. Replays of previously - * handled requests will yield the same response as the first execution. - * @param array $optionalArgs { - * Optional. - * - * @type RequestOptions $requestOptions - * Common options for this request. - * @type bool $lastStatements - * Optional. If set to true, this request marks the end of the transaction. - * The transaction should be committed or aborted after these statements - * execute, and attempts to execute any other requests against this - * transaction (including reads and queries) will be rejected. - * - * Setting this option may cause some error reporting to be deferred until - * commit time (e.g. validation of unique constraints). Given this, successful - * execution of statements should not be assumed until a subsequent Commit - * call completes successfully. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\V1\ExecuteBatchDmlResponse - * - * @throws ApiException if the remote call fails - */ - public function executeBatchDml($session, $transaction, $statements, $seqno, array $optionalArgs = []) - { - $request = new ExecuteBatchDmlRequest(); - $requestParamHeaders = []; - $request->setSession($session); - $request->setTransaction($transaction); - $request->setStatements($statements); - $request->setSeqno($seqno); - $requestParamHeaders['session'] = $session; - if (isset($optionalArgs['requestOptions'])) { - $request->setRequestOptions($optionalArgs['requestOptions']); - } - - if (isset($optionalArgs['lastStatements'])) { - $request->setLastStatements($optionalArgs['lastStatements']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('ExecuteBatchDml', ExecuteBatchDmlResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Executes an SQL statement, returning all results in a single reply. This - * method cannot be used to return a result set larger than 10 MiB; - * if the query yields more data than that, the query fails with - * a `FAILED_PRECONDITION` error. - * - * Operations inside read-write transactions might return `ABORTED`. If - * this occurs, the application should restart the transaction from - * the beginning. See [Transaction][google.spanner.v1.Transaction] for more - * details. - * - * Larger result sets can be fetched in streaming fashion by calling - * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] - * instead. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $sql = 'sql'; - * $response = $spannerClient->executeSql($formattedSession, $sql); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $session Required. The session in which the SQL query should be performed. - * @param string $sql Required. The SQL string. - * @param array $optionalArgs { - * Optional. - * - * @type TransactionSelector $transaction - * The transaction to use. - * - * For queries, if none is provided, the default is a temporary read-only - * transaction with strong concurrency. - * - * Standard DML statements require a read-write transaction. To protect - * against replays, single-use transactions are not supported. The caller - * must either supply an existing transaction ID or begin a new transaction. - * - * Partitioned DML requires an existing Partitioned DML transaction ID. - * @type Struct $params - * Parameter names and values that bind to placeholders in the SQL string. - * - * A parameter placeholder consists of the `@` character followed by the - * parameter name (for example, `@firstName`). Parameter names must conform - * to the naming requirements of identifiers as specified at - * https://cloud.google.com/spanner/docs/lexical#identifiers. - * - * Parameters can appear anywhere that a literal value is expected. The same - * parameter name can be used more than once, for example: - * - * `"WHERE id > @msg_id AND id < @msg_id + 100"` - * - * It is an error to execute a SQL statement with unbound parameters. - * @type array $paramTypes - * It is not always possible for Cloud Spanner to infer the right SQL type - * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in - * [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings. - * - * In these cases, `param_types` can be used to specify the exact - * SQL type for some or all of the SQL statement parameters. See the - * definition of [Type][google.spanner.v1.Type] for more information - * about SQL types. - * @type string $resumeToken - * If this request is resuming a previously interrupted SQL statement - * execution, `resume_token` should be copied from the last - * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the - * interruption. Doing this enables the new SQL statement execution to resume - * where the last one left off. The rest of the request parameters must - * exactly match the request that yielded this token. - * @type int $queryMode - * Used to control the amount of debugging information returned in - * [ResultSetStats][google.spanner.v1.ResultSetStats]. If - * [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is - * set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only - * be set to - * [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL]. - * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryMode} - * @type string $partitionToken - * If present, results will be restricted to the specified partition - * previously created using PartitionQuery(). There must be an exact - * match for the values of fields common to this message and the - * PartitionQueryRequest message used to create this partition_token. - * @type int $seqno - * A per-transaction sequence number used to identify this request. This field - * makes each request idempotent such that if the request is received multiple - * times, at most one will succeed. - * - * The sequence number must be monotonically increasing within the - * transaction. If a request arrives for the first time with an out-of-order - * sequence number, the transaction may be aborted. Replays of previously - * handled requests will yield the same response as the first execution. - * - * Required for DML statements. Ignored for queries. - * @type QueryOptions $queryOptions - * Query optimizer configuration to use for the given query. - * @type RequestOptions $requestOptions - * Common options for this request. - * @type DirectedReadOptions $directedReadOptions - * Directed read options for this request. - * @type bool $dataBoostEnabled - * If this is for a partitioned query and this field is set to `true`, the - * request is executed with Spanner Data Boost independent compute resources. - * - * If the field is set to `true` but the request does not set - * `partition_token`, the API returns an `INVALID_ARGUMENT` error. - * @type bool $lastStatement - * Optional. If set to true, this statement marks the end of the transaction. - * The transaction should be committed or aborted after this statement - * executes, and attempts to execute any other requests against this - * transaction (including reads and queries) will be rejected. - * - * For DML statements, setting this option may cause some error reporting to - * be deferred until commit time (e.g. validation of unique constraints). - * Given this, successful execution of a DML statement should not be assumed - * until a subsequent Commit call completes successfully. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\V1\ResultSet - * - * @throws ApiException if the remote call fails - */ - public function executeSql($session, $sql, array $optionalArgs = []) - { - $request = new ExecuteSqlRequest(); - $requestParamHeaders = []; - $request->setSession($session); - $request->setSql($sql); - $requestParamHeaders['session'] = $session; - if (isset($optionalArgs['transaction'])) { - $request->setTransaction($optionalArgs['transaction']); - } - - if (isset($optionalArgs['params'])) { - $request->setParams($optionalArgs['params']); - } - - if (isset($optionalArgs['paramTypes'])) { - $request->setParamTypes($optionalArgs['paramTypes']); - } - - if (isset($optionalArgs['resumeToken'])) { - $request->setResumeToken($optionalArgs['resumeToken']); - } - - if (isset($optionalArgs['queryMode'])) { - $request->setQueryMode($optionalArgs['queryMode']); - } - - if (isset($optionalArgs['partitionToken'])) { - $request->setPartitionToken($optionalArgs['partitionToken']); - } - - if (isset($optionalArgs['seqno'])) { - $request->setSeqno($optionalArgs['seqno']); - } - - if (isset($optionalArgs['queryOptions'])) { - $request->setQueryOptions($optionalArgs['queryOptions']); - } - - if (isset($optionalArgs['requestOptions'])) { - $request->setRequestOptions($optionalArgs['requestOptions']); - } - - if (isset($optionalArgs['directedReadOptions'])) { - $request->setDirectedReadOptions($optionalArgs['directedReadOptions']); - } - - if (isset($optionalArgs['dataBoostEnabled'])) { - $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']); - } - - if (isset($optionalArgs['lastStatement'])) { - $request->setLastStatement($optionalArgs['lastStatement']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('ExecuteSql', ResultSet::class, $optionalArgs, $request)->wait(); - } - - /** - * Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the - * result set as a stream. Unlike - * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there is no limit on - * the size of the returned result set. However, no individual row in the - * result set can exceed 100 MiB, and no column value can exceed 10 MiB. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $sql = 'sql'; - * // Read all responses until the stream is complete - * $stream = $spannerClient->executeStreamingSql($formattedSession, $sql); - * foreach ($stream->readAll() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $session Required. The session in which the SQL query should be performed. - * @param string $sql Required. The SQL string. - * @param array $optionalArgs { - * Optional. - * - * @type TransactionSelector $transaction - * The transaction to use. - * - * For queries, if none is provided, the default is a temporary read-only - * transaction with strong concurrency. - * - * Standard DML statements require a read-write transaction. To protect - * against replays, single-use transactions are not supported. The caller - * must either supply an existing transaction ID or begin a new transaction. - * - * Partitioned DML requires an existing Partitioned DML transaction ID. - * @type Struct $params - * Parameter names and values that bind to placeholders in the SQL string. - * - * A parameter placeholder consists of the `@` character followed by the - * parameter name (for example, `@firstName`). Parameter names must conform - * to the naming requirements of identifiers as specified at - * https://cloud.google.com/spanner/docs/lexical#identifiers. - * - * Parameters can appear anywhere that a literal value is expected. The same - * parameter name can be used more than once, for example: - * - * `"WHERE id > @msg_id AND id < @msg_id + 100"` - * - * It is an error to execute a SQL statement with unbound parameters. - * @type array $paramTypes - * It is not always possible for Cloud Spanner to infer the right SQL type - * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in - * [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings. - * - * In these cases, `param_types` can be used to specify the exact - * SQL type for some or all of the SQL statement parameters. See the - * definition of [Type][google.spanner.v1.Type] for more information - * about SQL types. - * @type string $resumeToken - * If this request is resuming a previously interrupted SQL statement - * execution, `resume_token` should be copied from the last - * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the - * interruption. Doing this enables the new SQL statement execution to resume - * where the last one left off. The rest of the request parameters must - * exactly match the request that yielded this token. - * @type int $queryMode - * Used to control the amount of debugging information returned in - * [ResultSetStats][google.spanner.v1.ResultSetStats]. If - * [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is - * set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only - * be set to - * [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL]. - * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryMode} - * @type string $partitionToken - * If present, results will be restricted to the specified partition - * previously created using PartitionQuery(). There must be an exact - * match for the values of fields common to this message and the - * PartitionQueryRequest message used to create this partition_token. - * @type int $seqno - * A per-transaction sequence number used to identify this request. This field - * makes each request idempotent such that if the request is received multiple - * times, at most one will succeed. - * - * The sequence number must be monotonically increasing within the - * transaction. If a request arrives for the first time with an out-of-order - * sequence number, the transaction may be aborted. Replays of previously - * handled requests will yield the same response as the first execution. - * - * Required for DML statements. Ignored for queries. - * @type QueryOptions $queryOptions - * Query optimizer configuration to use for the given query. - * @type RequestOptions $requestOptions - * Common options for this request. - * @type DirectedReadOptions $directedReadOptions - * Directed read options for this request. - * @type bool $dataBoostEnabled - * If this is for a partitioned query and this field is set to `true`, the - * request is executed with Spanner Data Boost independent compute resources. - * - * If the field is set to `true` but the request does not set - * `partition_token`, the API returns an `INVALID_ARGUMENT` error. - * @type bool $lastStatement - * Optional. If set to true, this statement marks the end of the transaction. - * The transaction should be committed or aborted after this statement - * executes, and attempts to execute any other requests against this - * transaction (including reads and queries) will be rejected. - * - * For DML statements, setting this option may cause some error reporting to - * be deferred until commit time (e.g. validation of unique constraints). - * Given this, successful execution of a DML statement should not be assumed - * until a subsequent Commit call completes successfully. - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return \Google\ApiCore\ServerStream - * - * @throws ApiException if the remote call fails - */ - public function executeStreamingSql($session, $sql, array $optionalArgs = []) - { - $request = new ExecuteSqlRequest(); - $requestParamHeaders = []; - $request->setSession($session); - $request->setSql($sql); - $requestParamHeaders['session'] = $session; - if (isset($optionalArgs['transaction'])) { - $request->setTransaction($optionalArgs['transaction']); - } - - if (isset($optionalArgs['params'])) { - $request->setParams($optionalArgs['params']); - } - - if (isset($optionalArgs['paramTypes'])) { - $request->setParamTypes($optionalArgs['paramTypes']); - } - - if (isset($optionalArgs['resumeToken'])) { - $request->setResumeToken($optionalArgs['resumeToken']); - } - - if (isset($optionalArgs['queryMode'])) { - $request->setQueryMode($optionalArgs['queryMode']); - } - - if (isset($optionalArgs['partitionToken'])) { - $request->setPartitionToken($optionalArgs['partitionToken']); - } - - if (isset($optionalArgs['seqno'])) { - $request->setSeqno($optionalArgs['seqno']); - } - - if (isset($optionalArgs['queryOptions'])) { - $request->setQueryOptions($optionalArgs['queryOptions']); - } - - if (isset($optionalArgs['requestOptions'])) { - $request->setRequestOptions($optionalArgs['requestOptions']); - } - - if (isset($optionalArgs['directedReadOptions'])) { - $request->setDirectedReadOptions($optionalArgs['directedReadOptions']); - } - - if (isset($optionalArgs['dataBoostEnabled'])) { - $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']); - } - - if (isset($optionalArgs['lastStatement'])) { - $request->setLastStatement($optionalArgs['lastStatement']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('ExecuteStreamingSql', PartialResultSet::class, $optionalArgs, $request, Call::SERVER_STREAMING_CALL); - } - - /** - * Gets a session. Returns `NOT_FOUND` if the session does not exist. - * This is mainly useful for determining whether a session is still - * alive. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedName = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $response = $spannerClient->getSession($formattedName); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the session to retrieve. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\V1\Session - * - * @throws ApiException if the remote call fails - */ - public function getSession($name, array $optionalArgs = []) - { - $request = new GetSessionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetSession', Session::class, $optionalArgs, $request)->wait(); - } - - /** - * Lists all sessions in a given database. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedDatabase = $spannerClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - * // Iterate over pages of elements - * $pagedResponse = $spannerClient->listSessions($formattedDatabase); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $spannerClient->listSessions($formattedDatabase); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $database Required. The database in which to list sessions. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $filter - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * - * * `labels.key` where key is the name of a label - * - * Some examples of using filters are: - * - * * `labels.env:*` --> The session has the label "env". - * * `labels.env:dev` --> The session has the label "env" and the value of - * the label contains the string "dev". - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listSessions($database, array $optionalArgs = []) - { - $request = new ListSessionsRequest(); - $requestParamHeaders = []; - $request->setDatabase($database); - $requestParamHeaders['database'] = $database; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListSessions', $optionalArgs, ListSessionsResponse::class, $request); - } - - /** - * Creates a set of partition tokens that can be used to execute a query - * operation in parallel. Each of the returned partition tokens can be used - * by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to - * specify a subset of the query result to read. The same session and - * read-only transaction must be used by the PartitionQueryRequest used to - * create the partition tokens and the ExecuteSqlRequests that use the - * partition tokens. - * - * Partition tokens become invalid when the session used to create them - * is deleted, is idle for too long, begins a new transaction, or becomes too - * old. When any of these happen, it is not possible to resume the query, and - * the whole operation must be restarted from the beginning. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $sql = 'sql'; - * $response = $spannerClient->partitionQuery($formattedSession, $sql); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $session Required. The session used to create the partitions. - * @param string $sql Required. The query request to generate partitions for. The request will - * fail if the query is not root partitionable. For a query to be root - * partitionable, it needs to satisfy a few conditions. For example, if the - * query execution plan contains a distributed union operator, then it must be - * the first operator in the plan. For more information about other - * conditions, see [Read data in - * parallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel). - * - * The query request must not contain DML commands, such as INSERT, UPDATE, or - * DELETE. Use - * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] with a - * PartitionedDml transaction for large, partition-friendly DML operations. - * @param array $optionalArgs { - * Optional. - * - * @type TransactionSelector $transaction - * Read only snapshot transactions are supported, read/write and single use - * transactions are not. - * @type Struct $params - * Parameter names and values that bind to placeholders in the SQL string. - * - * A parameter placeholder consists of the `@` character followed by the - * parameter name (for example, `@firstName`). Parameter names can contain - * letters, numbers, and underscores. - * - * Parameters can appear anywhere that a literal value is expected. The same - * parameter name can be used more than once, for example: - * - * `"WHERE id > @msg_id AND id < @msg_id + 100"` - * - * It is an error to execute a SQL statement with unbound parameters. - * @type array $paramTypes - * It is not always possible for Cloud Spanner to infer the right SQL type - * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in - * [params][google.spanner.v1.PartitionQueryRequest.params] as JSON strings. - * - * In these cases, `param_types` can be used to specify the exact - * SQL type for some or all of the SQL query parameters. See the - * definition of [Type][google.spanner.v1.Type] for more information - * about SQL types. - * @type PartitionOptions $partitionOptions - * Additional options that affect how many partitions are created. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\V1\PartitionResponse - * - * @throws ApiException if the remote call fails - */ - public function partitionQuery($session, $sql, array $optionalArgs = []) - { - $request = new PartitionQueryRequest(); - $requestParamHeaders = []; - $request->setSession($session); - $request->setSql($sql); - $requestParamHeaders['session'] = $session; - if (isset($optionalArgs['transaction'])) { - $request->setTransaction($optionalArgs['transaction']); - } - - if (isset($optionalArgs['params'])) { - $request->setParams($optionalArgs['params']); - } - - if (isset($optionalArgs['paramTypes'])) { - $request->setParamTypes($optionalArgs['paramTypes']); - } - - if (isset($optionalArgs['partitionOptions'])) { - $request->setPartitionOptions($optionalArgs['partitionOptions']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('PartitionQuery', PartitionResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a set of partition tokens that can be used to execute a read - * operation in parallel. Each of the returned partition tokens can be used - * by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a - * subset of the read result to read. The same session and read-only - * transaction must be used by the PartitionReadRequest used to create the - * partition tokens and the ReadRequests that use the partition tokens. There - * are no ordering guarantees on rows returned among the returned partition - * tokens, or even within each individual StreamingRead call issued with a - * partition_token. - * - * Partition tokens become invalid when the session used to create them - * is deleted, is idle for too long, begins a new transaction, or becomes too - * old. When any of these happen, it is not possible to resume the read, and - * the whole operation must be restarted from the beginning. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $table = 'table'; - * $keySet = new KeySet(); - * $response = $spannerClient->partitionRead($formattedSession, $table, $keySet); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $session Required. The session used to create the partitions. - * @param string $table Required. The name of the table in the database to be read. - * @param KeySet $keySet Required. `key_set` identifies the rows to be yielded. `key_set` names the - * primary keys of the rows in - * [table][google.spanner.v1.PartitionReadRequest.table] to be yielded, unless - * [index][google.spanner.v1.PartitionReadRequest.index] is present. If - * [index][google.spanner.v1.PartitionReadRequest.index] is present, then - * [key_set][google.spanner.v1.PartitionReadRequest.key_set] instead names - * index keys in [index][google.spanner.v1.PartitionReadRequest.index]. - * - * It is not an error for the `key_set` to name rows that do not - * exist in the database. Read yields nothing for nonexistent rows. - * @param array $optionalArgs { - * Optional. - * - * @type TransactionSelector $transaction - * Read only snapshot transactions are supported, read/write and single use - * transactions are not. - * @type string $index - * If non-empty, the name of an index on - * [table][google.spanner.v1.PartitionReadRequest.table]. This index is used - * instead of the table primary key when interpreting - * [key_set][google.spanner.v1.PartitionReadRequest.key_set] and sorting - * result rows. See [key_set][google.spanner.v1.PartitionReadRequest.key_set] - * for further information. - * @type string[] $columns - * The columns of [table][google.spanner.v1.PartitionReadRequest.table] to be - * returned for each row matching this request. - * @type PartitionOptions $partitionOptions - * Additional options that affect how many partitions are created. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\V1\PartitionResponse - * - * @throws ApiException if the remote call fails - */ - public function partitionRead($session, $table, $keySet, array $optionalArgs = []) - { - $request = new PartitionReadRequest(); - $requestParamHeaders = []; - $request->setSession($session); - $request->setTable($table); - $request->setKeySet($keySet); - $requestParamHeaders['session'] = $session; - if (isset($optionalArgs['transaction'])) { - $request->setTransaction($optionalArgs['transaction']); - } - - if (isset($optionalArgs['index'])) { - $request->setIndex($optionalArgs['index']); - } - - if (isset($optionalArgs['columns'])) { - $request->setColumns($optionalArgs['columns']); - } - - if (isset($optionalArgs['partitionOptions'])) { - $request->setPartitionOptions($optionalArgs['partitionOptions']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('PartitionRead', PartitionResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Reads rows from the database using key lookups and scans, as a - * simple key/value style alternative to - * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be - * used to return a result set larger than 10 MiB; if the read matches more - * data than that, the read fails with a `FAILED_PRECONDITION` - * error. - * - * Reads inside read-write transactions might return `ABORTED`. If - * this occurs, the application should restart the transaction from - * the beginning. See [Transaction][google.spanner.v1.Transaction] for more - * details. - * - * Larger result sets can be yielded in streaming fashion by calling - * [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $table = 'table'; - * $columns = []; - * $keySet = new KeySet(); - * $response = $spannerClient->read($formattedSession, $table, $columns, $keySet); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $session Required. The session in which the read should be performed. - * @param string $table Required. The name of the table in the database to be read. - * @param string[] $columns Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be - * returned for each row matching this request. - * @param KeySet $keySet Required. `key_set` identifies the rows to be yielded. `key_set` names the - * primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to - * be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present. - * If [index][google.spanner.v1.ReadRequest.index] is present, then - * [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys - * in [index][google.spanner.v1.ReadRequest.index]. - * - * If the [partition_token][google.spanner.v1.ReadRequest.partition_token] - * field is empty, rows are yielded in table primary key order (if - * [index][google.spanner.v1.ReadRequest.index] is empty) or index key order - * (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the - * [partition_token][google.spanner.v1.ReadRequest.partition_token] field is - * not empty, rows will be yielded in an unspecified order. - * - * It is not an error for the `key_set` to name rows that do not - * exist in the database. Read yields nothing for nonexistent rows. - * @param array $optionalArgs { - * Optional. - * - * @type TransactionSelector $transaction - * The transaction to use. If none is provided, the default is a - * temporary read-only transaction with strong concurrency. - * @type string $index - * If non-empty, the name of an index on - * [table][google.spanner.v1.ReadRequest.table]. This index is used instead of - * the table primary key when interpreting - * [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows. - * See [key_set][google.spanner.v1.ReadRequest.key_set] for further - * information. - * @type int $limit - * If greater than zero, only the first `limit` rows are yielded. If `limit` - * is zero, the default is no limit. A limit cannot be specified if - * `partition_token` is set. - * @type string $resumeToken - * If this request is resuming a previously interrupted read, - * `resume_token` should be copied from the last - * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the - * interruption. Doing this enables the new read to resume where the last read - * left off. The rest of the request parameters must exactly match the request - * that yielded this token. - * @type string $partitionToken - * If present, results will be restricted to the specified partition - * previously created using PartitionRead(). There must be an exact - * match for the values of fields common to this message and the - * PartitionReadRequest message used to create this partition_token. - * @type RequestOptions $requestOptions - * Common options for this request. - * @type DirectedReadOptions $directedReadOptions - * Directed read options for this request. - * @type bool $dataBoostEnabled - * If this is for a partitioned read and this field is set to `true`, the - * request is executed with Spanner Data Boost independent compute resources. - * - * If the field is set to `true` but the request does not set - * `partition_token`, the API returns an `INVALID_ARGUMENT` error. - * @type int $orderBy - * Optional. Order for the returned rows. - * - * By default, Spanner will return result rows in primary key order except for - * PartitionRead requests. For applications that do not require rows to be - * returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting - * `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval, - * resulting in lower latencies in certain cases (e.g. bulk point lookups). - * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\OrderBy} - * @type int $lockHint - * Optional. Lock Hint for the request, it can only be used with read-write - * transactions. - * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\LockHint} - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\V1\ResultSet - * - * @throws ApiException if the remote call fails - */ - public function read($session, $table, $columns, $keySet, array $optionalArgs = []) - { - $request = new ReadRequest(); - $requestParamHeaders = []; - $request->setSession($session); - $request->setTable($table); - $request->setColumns($columns); - $request->setKeySet($keySet); - $requestParamHeaders['session'] = $session; - if (isset($optionalArgs['transaction'])) { - $request->setTransaction($optionalArgs['transaction']); - } - - if (isset($optionalArgs['index'])) { - $request->setIndex($optionalArgs['index']); - } - - if (isset($optionalArgs['limit'])) { - $request->setLimit($optionalArgs['limit']); - } - - if (isset($optionalArgs['resumeToken'])) { - $request->setResumeToken($optionalArgs['resumeToken']); - } - - if (isset($optionalArgs['partitionToken'])) { - $request->setPartitionToken($optionalArgs['partitionToken']); - } - - if (isset($optionalArgs['requestOptions'])) { - $request->setRequestOptions($optionalArgs['requestOptions']); - } - - if (isset($optionalArgs['directedReadOptions'])) { - $request->setDirectedReadOptions($optionalArgs['directedReadOptions']); - } - - if (isset($optionalArgs['dataBoostEnabled'])) { - $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['lockHint'])) { - $request->setLockHint($optionalArgs['lockHint']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Read', ResultSet::class, $optionalArgs, $request)->wait(); - } - - /** - * Rolls back a transaction, releasing any locks it holds. It is a good - * idea to call this for any transaction that includes one or more - * [Read][google.spanner.v1.Spanner.Read] or - * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and ultimately - * decides not to commit. - * - * `Rollback` returns `OK` if it successfully aborts the transaction, the - * transaction was already aborted, or the transaction is not - * found. `Rollback` never returns `ABORTED`. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $transactionId = '...'; - * $spannerClient->rollback($formattedSession, $transactionId); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $session Required. The session in which the transaction to roll back is running. - * @param string $transactionId Required. The transaction to roll back. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function rollback($session, $transactionId, array $optionalArgs = []) - { - $request = new RollbackRequest(); - $requestParamHeaders = []; - $request->setSession($session); - $request->setTransactionId($transactionId); - $requestParamHeaders['session'] = $session; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Rollback', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Like [Read][google.spanner.v1.Spanner.Read], except returns the result set - * as a stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no - * limit on the size of the returned result set. However, no individual row in - * the result set can exceed 100 MiB, and no column value can exceed - * 10 MiB. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $table = 'table'; - * $columns = []; - * $keySet = new KeySet(); - * // Read all responses until the stream is complete - * $stream = $spannerClient->streamingRead($formattedSession, $table, $columns, $keySet); - * foreach ($stream->readAll() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $session Required. The session in which the read should be performed. - * @param string $table Required. The name of the table in the database to be read. - * @param string[] $columns Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be - * returned for each row matching this request. - * @param KeySet $keySet Required. `key_set` identifies the rows to be yielded. `key_set` names the - * primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to - * be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present. - * If [index][google.spanner.v1.ReadRequest.index] is present, then - * [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys - * in [index][google.spanner.v1.ReadRequest.index]. - * - * If the [partition_token][google.spanner.v1.ReadRequest.partition_token] - * field is empty, rows are yielded in table primary key order (if - * [index][google.spanner.v1.ReadRequest.index] is empty) or index key order - * (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the - * [partition_token][google.spanner.v1.ReadRequest.partition_token] field is - * not empty, rows will be yielded in an unspecified order. - * - * It is not an error for the `key_set` to name rows that do not - * exist in the database. Read yields nothing for nonexistent rows. - * @param array $optionalArgs { - * Optional. - * - * @type TransactionSelector $transaction - * The transaction to use. If none is provided, the default is a - * temporary read-only transaction with strong concurrency. - * @type string $index - * If non-empty, the name of an index on - * [table][google.spanner.v1.ReadRequest.table]. This index is used instead of - * the table primary key when interpreting - * [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows. - * See [key_set][google.spanner.v1.ReadRequest.key_set] for further - * information. - * @type int $limit - * If greater than zero, only the first `limit` rows are yielded. If `limit` - * is zero, the default is no limit. A limit cannot be specified if - * `partition_token` is set. - * @type string $resumeToken - * If this request is resuming a previously interrupted read, - * `resume_token` should be copied from the last - * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the - * interruption. Doing this enables the new read to resume where the last read - * left off. The rest of the request parameters must exactly match the request - * that yielded this token. - * @type string $partitionToken - * If present, results will be restricted to the specified partition - * previously created using PartitionRead(). There must be an exact - * match for the values of fields common to this message and the - * PartitionReadRequest message used to create this partition_token. - * @type RequestOptions $requestOptions - * Common options for this request. - * @type DirectedReadOptions $directedReadOptions - * Directed read options for this request. - * @type bool $dataBoostEnabled - * If this is for a partitioned read and this field is set to `true`, the - * request is executed with Spanner Data Boost independent compute resources. - * - * If the field is set to `true` but the request does not set - * `partition_token`, the API returns an `INVALID_ARGUMENT` error. - * @type int $orderBy - * Optional. Order for the returned rows. - * - * By default, Spanner will return result rows in primary key order except for - * PartitionRead requests. For applications that do not require rows to be - * returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting - * `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval, - * resulting in lower latencies in certain cases (e.g. bulk point lookups). - * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\OrderBy} - * @type int $lockHint - * Optional. Lock Hint for the request, it can only be used with read-write - * transactions. - * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\LockHint} - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return \Google\ApiCore\ServerStream - * - * @throws ApiException if the remote call fails - */ - public function streamingRead($session, $table, $columns, $keySet, array $optionalArgs = []) - { - $request = new ReadRequest(); - $requestParamHeaders = []; - $request->setSession($session); - $request->setTable($table); - $request->setColumns($columns); - $request->setKeySet($keySet); - $requestParamHeaders['session'] = $session; - if (isset($optionalArgs['transaction'])) { - $request->setTransaction($optionalArgs['transaction']); - } - - if (isset($optionalArgs['index'])) { - $request->setIndex($optionalArgs['index']); - } - - if (isset($optionalArgs['limit'])) { - $request->setLimit($optionalArgs['limit']); - } - - if (isset($optionalArgs['resumeToken'])) { - $request->setResumeToken($optionalArgs['resumeToken']); - } - - if (isset($optionalArgs['partitionToken'])) { - $request->setPartitionToken($optionalArgs['partitionToken']); - } - - if (isset($optionalArgs['requestOptions'])) { - $request->setRequestOptions($optionalArgs['requestOptions']); - } - - if (isset($optionalArgs['directedReadOptions'])) { - $request->setDirectedReadOptions($optionalArgs['directedReadOptions']); - } - - if (isset($optionalArgs['dataBoostEnabled'])) { - $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['lockHint'])) { - $request->setLockHint($optionalArgs['lockHint']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('StreamingRead', PartialResultSet::class, $optionalArgs, $request, Call::SERVER_STREAMING_CALL); - } -} diff --git a/owl-bot-staging/Spanner/v1/src/V1/SpannerClient.php b/owl-bot-staging/Spanner/v1/src/V1/SpannerClient.php deleted file mode 100644 index d4d3a0e783b3..000000000000 --- a/owl-bot-staging/Spanner/v1/src/V1/SpannerClient.php +++ /dev/null @@ -1,34 +0,0 @@ - [ - 'google.spanner.v1.Spanner' => [ - 'BatchCreateSessions' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Spanner\V1\BatchCreateSessionsResponse', - 'headerParams' => [ - [ - 'keyName' => 'database', - 'fieldAccessors' => [ - 'getDatabase', - ], - ], - ], - ], - 'BatchWrite' => [ - 'grpcStreaming' => [ - 'grpcStreamingType' => 'ServerStreaming', - ], - 'callType' => \Google\ApiCore\Call::SERVER_STREAMING_CALL, - 'responseType' => 'Google\Cloud\Spanner\V1\BatchWriteResponse', - 'headerParams' => [ - [ - 'keyName' => 'session', - 'fieldAccessors' => [ - 'getSession', - ], - ], - ], - ], - 'BeginTransaction' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Spanner\V1\Transaction', - 'headerParams' => [ - [ - 'keyName' => 'session', - 'fieldAccessors' => [ - 'getSession', - ], - ], - ], - ], - 'Commit' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Spanner\V1\CommitResponse', - 'headerParams' => [ - [ - 'keyName' => 'session', - 'fieldAccessors' => [ - 'getSession', - ], - ], - ], - ], - 'CreateSession' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Spanner\V1\Session', - 'headerParams' => [ - [ - 'keyName' => 'database', - 'fieldAccessors' => [ - 'getDatabase', - ], - ], - ], - ], - 'DeleteSession' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Protobuf\GPBEmpty', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'ExecuteBatchDml' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Spanner\V1\ExecuteBatchDmlResponse', - 'headerParams' => [ - [ - 'keyName' => 'session', - 'fieldAccessors' => [ - 'getSession', - ], - ], - ], - ], - 'ExecuteSql' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Spanner\V1\ResultSet', - 'headerParams' => [ - [ - 'keyName' => 'session', - 'fieldAccessors' => [ - 'getSession', - ], - ], - ], - ], - 'ExecuteStreamingSql' => [ - 'grpcStreaming' => [ - 'grpcStreamingType' => 'ServerStreaming', - ], - 'callType' => \Google\ApiCore\Call::SERVER_STREAMING_CALL, - 'responseType' => 'Google\Cloud\Spanner\V1\PartialResultSet', - 'headerParams' => [ - [ - 'keyName' => 'session', - 'fieldAccessors' => [ - 'getSession', - ], - ], - ], - ], - 'GetSession' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Spanner\V1\Session', - 'headerParams' => [ - [ - 'keyName' => 'name', - 'fieldAccessors' => [ - 'getName', - ], - ], - ], - ], - 'ListSessions' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getSessions', - ], - 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, - 'responseType' => 'Google\Cloud\Spanner\V1\ListSessionsResponse', - 'headerParams' => [ - [ - 'keyName' => 'database', - 'fieldAccessors' => [ - 'getDatabase', - ], - ], - ], - ], - 'PartitionQuery' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Spanner\V1\PartitionResponse', - 'headerParams' => [ - [ - 'keyName' => 'session', - 'fieldAccessors' => [ - 'getSession', - ], - ], - ], - ], - 'PartitionRead' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Spanner\V1\PartitionResponse', - 'headerParams' => [ - [ - 'keyName' => 'session', - 'fieldAccessors' => [ - 'getSession', - ], - ], - ], - ], - 'Read' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Cloud\Spanner\V1\ResultSet', - 'headerParams' => [ - [ - 'keyName' => 'session', - 'fieldAccessors' => [ - 'getSession', - ], - ], - ], - ], - 'Rollback' => [ - 'callType' => \Google\ApiCore\Call::UNARY_CALL, - 'responseType' => 'Google\Protobuf\GPBEmpty', - 'headerParams' => [ - [ - 'keyName' => 'session', - 'fieldAccessors' => [ - 'getSession', - ], - ], - ], - ], - 'StreamingRead' => [ - 'grpcStreaming' => [ - 'grpcStreamingType' => 'ServerStreaming', - ], - 'callType' => \Google\ApiCore\Call::SERVER_STREAMING_CALL, - 'responseType' => 'Google\Cloud\Spanner\V1\PartialResultSet', - 'headerParams' => [ - [ - 'keyName' => 'session', - 'fieldAccessors' => [ - 'getSession', - ], - ], - ], - ], - 'templateMap' => [ - 'database' => 'projects/{project}/instances/{instance}/databases/{database}', - 'session' => 'projects/{project}/instances/{instance}/databases/{database}/sessions/{session}', - ], - ], - ], -]; diff --git a/owl-bot-staging/Spanner/v1/src/V1/resources/spanner_rest_client_config.php b/owl-bot-staging/Spanner/v1/src/V1/resources/spanner_rest_client_config.php deleted file mode 100644 index e661da669861..000000000000 --- a/owl-bot-staging/Spanner/v1/src/V1/resources/spanner_rest_client_config.php +++ /dev/null @@ -1,320 +0,0 @@ - [ - 'google.longrunning.Operations' => [ - 'CancelOperation' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations/*}:cancel', - 'additionalBindings' => [ - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations/*}:cancel', - ], - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/backups/*/operations/*}:cancel', - ], - [ - 'method' => 'post', - 'uriTemplate' => '/v1/{name=projects/*/instanceConfigs/*/operations/*}:cancel', - ], - ], - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'DeleteOperation' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations/*}', - 'additionalBindings' => [ - [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations/*}', - ], - [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/backups/*/operations/*}', - ], - [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/instanceConfigs/*/operations/*}', - ], - ], - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetOperation' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations/*}', - 'additionalBindings' => [ - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations/*}', - ], - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/backups/*/operations/*}', - ], - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instanceConfigs/*/operations/*}', - ], - ], - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListOperations' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/operations}', - 'additionalBindings' => [ - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/operations}', - ], - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/backups/*/operations}', - ], - [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instanceConfigs/*/operations}', - ], - ], - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - ], - 'google.spanner.v1.Spanner' => [ - 'BatchCreateSessions' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{database=projects/*/instances/*/databases/*}/sessions:batchCreate', - 'body' => '*', - 'placeholders' => [ - 'database' => [ - 'getters' => [ - 'getDatabase', - ], - ], - ], - ], - 'BatchWrite' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:batchWrite', - 'body' => '*', - 'placeholders' => [ - 'session' => [ - 'getters' => [ - 'getSession', - ], - ], - ], - ], - 'BeginTransaction' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:beginTransaction', - 'body' => '*', - 'placeholders' => [ - 'session' => [ - 'getters' => [ - 'getSession', - ], - ], - ], - ], - 'Commit' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:commit', - 'body' => '*', - 'placeholders' => [ - 'session' => [ - 'getters' => [ - 'getSession', - ], - ], - ], - ], - 'CreateSession' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{database=projects/*/instances/*/databases/*}/sessions', - 'body' => '*', - 'placeholders' => [ - 'database' => [ - 'getters' => [ - 'getDatabase', - ], - ], - ], - ], - 'DeleteSession' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/sessions/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ExecuteBatchDml' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeBatchDml', - 'body' => '*', - 'placeholders' => [ - 'session' => [ - 'getters' => [ - 'getSession', - ], - ], - ], - ], - 'ExecuteSql' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeSql', - 'body' => '*', - 'placeholders' => [ - 'session' => [ - 'getters' => [ - 'getSession', - ], - ], - ], - ], - 'ExecuteStreamingSql' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeStreamingSql', - 'body' => '*', - 'placeholders' => [ - 'session' => [ - 'getters' => [ - 'getSession', - ], - ], - ], - ], - 'GetSession' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{name=projects/*/instances/*/databases/*/sessions/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListSessions' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{database=projects/*/instances/*/databases/*}/sessions', - 'placeholders' => [ - 'database' => [ - 'getters' => [ - 'getDatabase', - ], - ], - ], - ], - 'PartitionQuery' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:partitionQuery', - 'body' => '*', - 'placeholders' => [ - 'session' => [ - 'getters' => [ - 'getSession', - ], - ], - ], - ], - 'PartitionRead' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:partitionRead', - 'body' => '*', - 'placeholders' => [ - 'session' => [ - 'getters' => [ - 'getSession', - ], - ], - ], - ], - 'Read' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:read', - 'body' => '*', - 'placeholders' => [ - 'session' => [ - 'getters' => [ - 'getSession', - ], - ], - ], - ], - 'Rollback' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:rollback', - 'body' => '*', - 'placeholders' => [ - 'session' => [ - 'getters' => [ - 'getSession', - ], - ], - ], - ], - 'StreamingRead' => [ - 'method' => 'post', - 'uriTemplate' => '/v1/{session=projects/*/instances/*/databases/*/sessions/*}:streamingRead', - 'body' => '*', - 'placeholders' => [ - 'session' => [ - 'getters' => [ - 'getSession', - ], - ], - ], - ], - ], - ], - 'numericEnums' => true, -]; diff --git a/owl-bot-staging/Spanner/v1/tests/Unit/V1/Client/SpannerClientTest.php b/owl-bot-staging/Spanner/v1/tests/Unit/V1/Client/SpannerClientTest.php deleted file mode 100644 index 1a1021bad381..000000000000 --- a/owl-bot-staging/Spanner/v1/tests/Unit/V1/Client/SpannerClientTest.php +++ /dev/null @@ -1,1308 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return SpannerClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new SpannerClient($options); - } - - /** @test */ - public function batchCreateSessionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new BatchCreateSessionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $sessionCount = 185691686; - $request = (new BatchCreateSessionsRequest()) - ->setDatabase($formattedDatabase) - ->setSessionCount($sessionCount); - $response = $gapicClient->batchCreateSessions($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/BatchCreateSessions', $actualFuncCall); - $actualValue = $actualRequestObject->getDatabase(); - $this->assertProtobufEquals($formattedDatabase, $actualValue); - $actualValue = $actualRequestObject->getSessionCount(); - $this->assertProtobufEquals($sessionCount, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function batchCreateSessionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $sessionCount = 185691686; - $request = (new BatchCreateSessionsRequest()) - ->setDatabase($formattedDatabase) - ->setSessionCount($sessionCount); - try { - $gapicClient->batchCreateSessions($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function batchWriteTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new BatchWriteResponse(); - $transport->addResponse($expectedResponse); - $expectedResponse2 = new BatchWriteResponse(); - $transport->addResponse($expectedResponse2); - $expectedResponse3 = new BatchWriteResponse(); - $transport->addResponse($expectedResponse3); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $mutationGroups = []; - $request = (new BatchWriteRequest()) - ->setSession($formattedSession) - ->setMutationGroups($mutationGroups); - $serverStream = $gapicClient->batchWrite($request); - $this->assertInstanceOf(ServerStream::class, $serverStream); - $responses = iterator_to_array($serverStream->readAll()); - $expectedResponses = []; - $expectedResponses[] = $expectedResponse; - $expectedResponses[] = $expectedResponse2; - $expectedResponses[] = $expectedResponse3; - $this->assertEquals($expectedResponses, $responses); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/BatchWrite', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getMutationGroups(); - $this->assertProtobufEquals($mutationGroups, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function batchWriteExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->setStreamingStatus($status); - $this->assertTrue($transport->isExhausted()); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $mutationGroups = []; - $request = (new BatchWriteRequest()) - ->setSession($formattedSession) - ->setMutationGroups($mutationGroups); - $serverStream = $gapicClient->batchWrite($request); - $results = $serverStream->readAll(); - try { - iterator_to_array($results); - // If the close stream method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function beginTransactionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = '27'; - $expectedResponse = new Transaction(); - $expectedResponse->setId($id); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $options = new TransactionOptions(); - $request = (new BeginTransactionRequest()) - ->setSession($formattedSession) - ->setOptions($options); - $response = $gapicClient->beginTransaction($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/BeginTransaction', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getOptions(); - $this->assertProtobufEquals($options, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function beginTransactionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $options = new TransactionOptions(); - $request = (new BeginTransactionRequest()) - ->setSession($formattedSession) - ->setOptions($options); - try { - $gapicClient->beginTransaction($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function commitTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new CommitResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $mutations = []; - $request = (new CommitRequest()) - ->setSession($formattedSession) - ->setMutations($mutations); - $response = $gapicClient->commit($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/Commit', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getMutations(); - $this->assertProtobufEquals($mutations, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function commitExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $mutations = []; - $request = (new CommitRequest()) - ->setSession($formattedSession) - ->setMutations($mutations); - try { - $gapicClient->commit($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createSessionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $creatorRole = 'creatorRole-1605962583'; - $multiplexed = false; - $expectedResponse = new Session(); - $expectedResponse->setName($name); - $expectedResponse->setCreatorRole($creatorRole); - $expectedResponse->setMultiplexed($multiplexed); - $transport->addResponse($expectedResponse); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $request = (new CreateSessionRequest()) - ->setDatabase($formattedDatabase); - $response = $gapicClient->createSession($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/CreateSession', $actualFuncCall); - $actualValue = $actualRequestObject->getDatabase(); - $this->assertProtobufEquals($formattedDatabase, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createSessionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $request = (new CreateSessionRequest()) - ->setDatabase($formattedDatabase); - try { - $gapicClient->createSession($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteSessionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $request = (new DeleteSessionRequest()) - ->setName($formattedName); - $gapicClient->deleteSession($request); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/DeleteSession', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteSessionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $request = (new DeleteSessionRequest()) - ->setName($formattedName); - try { - $gapicClient->deleteSession($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function executeBatchDmlTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ExecuteBatchDmlResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $transaction = new TransactionSelector(); - $statements = []; - $seqno = 109325920; - $request = (new ExecuteBatchDmlRequest()) - ->setSession($formattedSession) - ->setTransaction($transaction) - ->setStatements($statements) - ->setSeqno($seqno); - $response = $gapicClient->executeBatchDml($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/ExecuteBatchDml', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getTransaction(); - $this->assertProtobufEquals($transaction, $actualValue); - $actualValue = $actualRequestObject->getStatements(); - $this->assertProtobufEquals($statements, $actualValue); - $actualValue = $actualRequestObject->getSeqno(); - $this->assertProtobufEquals($seqno, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function executeBatchDmlExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $transaction = new TransactionSelector(); - $statements = []; - $seqno = 109325920; - $request = (new ExecuteBatchDmlRequest()) - ->setSession($formattedSession) - ->setTransaction($transaction) - ->setStatements($statements) - ->setSeqno($seqno); - try { - $gapicClient->executeBatchDml($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function executeSqlTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ResultSet(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $sql = 'sql114126'; - $request = (new ExecuteSqlRequest()) - ->setSession($formattedSession) - ->setSql($sql); - $response = $gapicClient->executeSql($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/ExecuteSql', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getSql(); - $this->assertProtobufEquals($sql, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function executeSqlExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $sql = 'sql114126'; - $request = (new ExecuteSqlRequest()) - ->setSession($formattedSession) - ->setSql($sql); - try { - $gapicClient->executeSql($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function executeStreamingSqlTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $chunkedValue = true; - $resumeToken2 = '90'; - $expectedResponse = new PartialResultSet(); - $expectedResponse->setChunkedValue($chunkedValue); - $expectedResponse->setResumeToken($resumeToken2); - $transport->addResponse($expectedResponse); - $chunkedValue2 = false; - $resumeToken3 = '91'; - $expectedResponse2 = new PartialResultSet(); - $expectedResponse2->setChunkedValue($chunkedValue2); - $expectedResponse2->setResumeToken($resumeToken3); - $transport->addResponse($expectedResponse2); - $chunkedValue3 = true; - $resumeToken4 = '92'; - $expectedResponse3 = new PartialResultSet(); - $expectedResponse3->setChunkedValue($chunkedValue3); - $expectedResponse3->setResumeToken($resumeToken4); - $transport->addResponse($expectedResponse3); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $sql = 'sql114126'; - $request = (new ExecuteSqlRequest()) - ->setSession($formattedSession) - ->setSql($sql); - $serverStream = $gapicClient->executeStreamingSql($request); - $this->assertInstanceOf(ServerStream::class, $serverStream); - $responses = iterator_to_array($serverStream->readAll()); - $expectedResponses = []; - $expectedResponses[] = $expectedResponse; - $expectedResponses[] = $expectedResponse2; - $expectedResponses[] = $expectedResponse3; - $this->assertEquals($expectedResponses, $responses); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/ExecuteStreamingSql', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getSql(); - $this->assertProtobufEquals($sql, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function executeStreamingSqlExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->setStreamingStatus($status); - $this->assertTrue($transport->isExhausted()); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $sql = 'sql114126'; - $request = (new ExecuteSqlRequest()) - ->setSession($formattedSession) - ->setSql($sql); - $serverStream = $gapicClient->executeStreamingSql($request); - $results = $serverStream->readAll(); - try { - iterator_to_array($results); - // If the close stream method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSessionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $creatorRole = 'creatorRole-1605962583'; - $multiplexed = false; - $expectedResponse = new Session(); - $expectedResponse->setName($name2); - $expectedResponse->setCreatorRole($creatorRole); - $expectedResponse->setMultiplexed($multiplexed); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $request = (new GetSessionRequest()) - ->setName($formattedName); - $response = $gapicClient->getSession($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/GetSession', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSessionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $request = (new GetSessionRequest()) - ->setName($formattedName); - try { - $gapicClient->getSession($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSessionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $sessionsElement = new Session(); - $sessions = [ - $sessionsElement, - ]; - $expectedResponse = new ListSessionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSessions($sessions); - $transport->addResponse($expectedResponse); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $request = (new ListSessionsRequest()) - ->setDatabase($formattedDatabase); - $response = $gapicClient->listSessions($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSessions()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/ListSessions', $actualFuncCall); - $actualValue = $actualRequestObject->getDatabase(); - $this->assertProtobufEquals($formattedDatabase, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSessionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $request = (new ListSessionsRequest()) - ->setDatabase($formattedDatabase); - try { - $gapicClient->listSessions($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function partitionQueryTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new PartitionResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $sql = 'sql114126'; - $request = (new PartitionQueryRequest()) - ->setSession($formattedSession) - ->setSql($sql); - $response = $gapicClient->partitionQuery($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/PartitionQuery', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getSql(); - $this->assertProtobufEquals($sql, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function partitionQueryExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $sql = 'sql114126'; - $request = (new PartitionQueryRequest()) - ->setSession($formattedSession) - ->setSql($sql); - try { - $gapicClient->partitionQuery($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function partitionReadTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new PartitionResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $table = 'table110115790'; - $keySet = new KeySet(); - $request = (new PartitionReadRequest()) - ->setSession($formattedSession) - ->setTable($table) - ->setKeySet($keySet); - $response = $gapicClient->partitionRead($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/PartitionRead', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getTable(); - $this->assertProtobufEquals($table, $actualValue); - $actualValue = $actualRequestObject->getKeySet(); - $this->assertProtobufEquals($keySet, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function partitionReadExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $table = 'table110115790'; - $keySet = new KeySet(); - $request = (new PartitionReadRequest()) - ->setSession($formattedSession) - ->setTable($table) - ->setKeySet($keySet); - try { - $gapicClient->partitionRead($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function readTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ResultSet(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $table = 'table110115790'; - $columns = []; - $keySet = new KeySet(); - $request = (new ReadRequest()) - ->setSession($formattedSession) - ->setTable($table) - ->setColumns($columns) - ->setKeySet($keySet); - $response = $gapicClient->read($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/Read', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getTable(); - $this->assertProtobufEquals($table, $actualValue); - $actualValue = $actualRequestObject->getColumns(); - $this->assertProtobufEquals($columns, $actualValue); - $actualValue = $actualRequestObject->getKeySet(); - $this->assertProtobufEquals($keySet, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function readExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $table = 'table110115790'; - $columns = []; - $keySet = new KeySet(); - $request = (new ReadRequest()) - ->setSession($formattedSession) - ->setTable($table) - ->setColumns($columns) - ->setKeySet($keySet); - try { - $gapicClient->read($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function rollbackTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $transactionId = '28'; - $request = (new RollbackRequest()) - ->setSession($formattedSession) - ->setTransactionId($transactionId); - $gapicClient->rollback($request); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/Rollback', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getTransactionId(); - $this->assertProtobufEquals($transactionId, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function rollbackExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $transactionId = '28'; - $request = (new RollbackRequest()) - ->setSession($formattedSession) - ->setTransactionId($transactionId); - try { - $gapicClient->rollback($request); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamingReadTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $chunkedValue = true; - $resumeToken2 = '90'; - $expectedResponse = new PartialResultSet(); - $expectedResponse->setChunkedValue($chunkedValue); - $expectedResponse->setResumeToken($resumeToken2); - $transport->addResponse($expectedResponse); - $chunkedValue2 = false; - $resumeToken3 = '91'; - $expectedResponse2 = new PartialResultSet(); - $expectedResponse2->setChunkedValue($chunkedValue2); - $expectedResponse2->setResumeToken($resumeToken3); - $transport->addResponse($expectedResponse2); - $chunkedValue3 = true; - $resumeToken4 = '92'; - $expectedResponse3 = new PartialResultSet(); - $expectedResponse3->setChunkedValue($chunkedValue3); - $expectedResponse3->setResumeToken($resumeToken4); - $transport->addResponse($expectedResponse3); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $table = 'table110115790'; - $columns = []; - $keySet = new KeySet(); - $request = (new ReadRequest()) - ->setSession($formattedSession) - ->setTable($table) - ->setColumns($columns) - ->setKeySet($keySet); - $serverStream = $gapicClient->streamingRead($request); - $this->assertInstanceOf(ServerStream::class, $serverStream); - $responses = iterator_to_array($serverStream->readAll()); - $expectedResponses = []; - $expectedResponses[] = $expectedResponse; - $expectedResponses[] = $expectedResponse2; - $expectedResponses[] = $expectedResponse3; - $this->assertEquals($expectedResponses, $responses); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/StreamingRead', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getTable(); - $this->assertProtobufEquals($table, $actualValue); - $actualValue = $actualRequestObject->getColumns(); - $this->assertProtobufEquals($columns, $actualValue); - $actualValue = $actualRequestObject->getKeySet(); - $this->assertProtobufEquals($keySet, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamingReadExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->setStreamingStatus($status); - $this->assertTrue($transport->isExhausted()); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $table = 'table110115790'; - $columns = []; - $keySet = new KeySet(); - $request = (new ReadRequest()) - ->setSession($formattedSession) - ->setTable($table) - ->setColumns($columns) - ->setKeySet($keySet); - $serverStream = $gapicClient->streamingRead($request); - $results = $serverStream->readAll(); - try { - iterator_to_array($results); - // If the close stream method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function batchCreateSessionsAsyncTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new BatchCreateSessionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $sessionCount = 185691686; - $request = (new BatchCreateSessionsRequest()) - ->setDatabase($formattedDatabase) - ->setSessionCount($sessionCount); - $response = $gapicClient->batchCreateSessionsAsync($request)->wait(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/BatchCreateSessions', $actualFuncCall); - $actualValue = $actualRequestObject->getDatabase(); - $this->assertProtobufEquals($formattedDatabase, $actualValue); - $actualValue = $actualRequestObject->getSessionCount(); - $this->assertProtobufEquals($sessionCount, $actualValue); - $this->assertTrue($transport->isExhausted()); - } -} diff --git a/owl-bot-staging/Spanner/v1/tests/Unit/V1/SpannerClientTest.php b/owl-bot-staging/Spanner/v1/tests/Unit/V1/SpannerClientTest.php deleted file mode 100644 index adf20f12570b..000000000000 --- a/owl-bot-staging/Spanner/v1/tests/Unit/V1/SpannerClientTest.php +++ /dev/null @@ -1,1161 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return SpannerClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new SpannerClient($options); - } - - /** @test */ - public function batchCreateSessionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new BatchCreateSessionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $sessionCount = 185691686; - $response = $gapicClient->batchCreateSessions($formattedDatabase, $sessionCount); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/BatchCreateSessions', $actualFuncCall); - $actualValue = $actualRequestObject->getDatabase(); - $this->assertProtobufEquals($formattedDatabase, $actualValue); - $actualValue = $actualRequestObject->getSessionCount(); - $this->assertProtobufEquals($sessionCount, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function batchCreateSessionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $sessionCount = 185691686; - try { - $gapicClient->batchCreateSessions($formattedDatabase, $sessionCount); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function batchWriteTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new BatchWriteResponse(); - $transport->addResponse($expectedResponse); - $expectedResponse2 = new BatchWriteResponse(); - $transport->addResponse($expectedResponse2); - $expectedResponse3 = new BatchWriteResponse(); - $transport->addResponse($expectedResponse3); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $mutationGroups = []; - $serverStream = $gapicClient->batchWrite($formattedSession, $mutationGroups); - $this->assertInstanceOf(ServerStream::class, $serverStream); - $responses = iterator_to_array($serverStream->readAll()); - $expectedResponses = []; - $expectedResponses[] = $expectedResponse; - $expectedResponses[] = $expectedResponse2; - $expectedResponses[] = $expectedResponse3; - $this->assertEquals($expectedResponses, $responses); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/BatchWrite', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getMutationGroups(); - $this->assertProtobufEquals($mutationGroups, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function batchWriteExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->setStreamingStatus($status); - $this->assertTrue($transport->isExhausted()); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $mutationGroups = []; - $serverStream = $gapicClient->batchWrite($formattedSession, $mutationGroups); - $results = $serverStream->readAll(); - try { - iterator_to_array($results); - // If the close stream method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function beginTransactionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = '27'; - $expectedResponse = new Transaction(); - $expectedResponse->setId($id); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $options = new TransactionOptions(); - $response = $gapicClient->beginTransaction($formattedSession, $options); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/BeginTransaction', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getOptions(); - $this->assertProtobufEquals($options, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function beginTransactionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $options = new TransactionOptions(); - try { - $gapicClient->beginTransaction($formattedSession, $options); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function commitTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new CommitResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $mutations = []; - $response = $gapicClient->commit($formattedSession, $mutations); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/Commit', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getMutations(); - $this->assertProtobufEquals($mutations, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function commitExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $mutations = []; - try { - $gapicClient->commit($formattedSession, $mutations); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createSessionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $creatorRole = 'creatorRole-1605962583'; - $multiplexed = false; - $expectedResponse = new Session(); - $expectedResponse->setName($name); - $expectedResponse->setCreatorRole($creatorRole); - $expectedResponse->setMultiplexed($multiplexed); - $transport->addResponse($expectedResponse); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $response = $gapicClient->createSession($formattedDatabase); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/CreateSession', $actualFuncCall); - $actualValue = $actualRequestObject->getDatabase(); - $this->assertProtobufEquals($formattedDatabase, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createSessionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - try { - $gapicClient->createSession($formattedDatabase); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteSessionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $gapicClient->deleteSession($formattedName); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/DeleteSession', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteSessionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - try { - $gapicClient->deleteSession($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function executeBatchDmlTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ExecuteBatchDmlResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $transaction = new TransactionSelector(); - $statements = []; - $seqno = 109325920; - $response = $gapicClient->executeBatchDml($formattedSession, $transaction, $statements, $seqno); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/ExecuteBatchDml', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getTransaction(); - $this->assertProtobufEquals($transaction, $actualValue); - $actualValue = $actualRequestObject->getStatements(); - $this->assertProtobufEquals($statements, $actualValue); - $actualValue = $actualRequestObject->getSeqno(); - $this->assertProtobufEquals($seqno, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function executeBatchDmlExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $transaction = new TransactionSelector(); - $statements = []; - $seqno = 109325920; - try { - $gapicClient->executeBatchDml($formattedSession, $transaction, $statements, $seqno); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function executeSqlTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ResultSet(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $sql = 'sql114126'; - $response = $gapicClient->executeSql($formattedSession, $sql); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/ExecuteSql', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getSql(); - $this->assertProtobufEquals($sql, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function executeSqlExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $sql = 'sql114126'; - try { - $gapicClient->executeSql($formattedSession, $sql); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function executeStreamingSqlTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $chunkedValue = true; - $resumeToken2 = '90'; - $expectedResponse = new PartialResultSet(); - $expectedResponse->setChunkedValue($chunkedValue); - $expectedResponse->setResumeToken($resumeToken2); - $transport->addResponse($expectedResponse); - $chunkedValue2 = false; - $resumeToken3 = '91'; - $expectedResponse2 = new PartialResultSet(); - $expectedResponse2->setChunkedValue($chunkedValue2); - $expectedResponse2->setResumeToken($resumeToken3); - $transport->addResponse($expectedResponse2); - $chunkedValue3 = true; - $resumeToken4 = '92'; - $expectedResponse3 = new PartialResultSet(); - $expectedResponse3->setChunkedValue($chunkedValue3); - $expectedResponse3->setResumeToken($resumeToken4); - $transport->addResponse($expectedResponse3); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $sql = 'sql114126'; - $serverStream = $gapicClient->executeStreamingSql($formattedSession, $sql); - $this->assertInstanceOf(ServerStream::class, $serverStream); - $responses = iterator_to_array($serverStream->readAll()); - $expectedResponses = []; - $expectedResponses[] = $expectedResponse; - $expectedResponses[] = $expectedResponse2; - $expectedResponses[] = $expectedResponse3; - $this->assertEquals($expectedResponses, $responses); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/ExecuteStreamingSql', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getSql(); - $this->assertProtobufEquals($sql, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function executeStreamingSqlExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->setStreamingStatus($status); - $this->assertTrue($transport->isExhausted()); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $sql = 'sql114126'; - $serverStream = $gapicClient->executeStreamingSql($formattedSession, $sql); - $results = $serverStream->readAll(); - try { - iterator_to_array($results); - // If the close stream method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSessionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $creatorRole = 'creatorRole-1605962583'; - $multiplexed = false; - $expectedResponse = new Session(); - $expectedResponse->setName($name2); - $expectedResponse->setCreatorRole($creatorRole); - $expectedResponse->setMultiplexed($multiplexed); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $response = $gapicClient->getSession($formattedName); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/GetSession', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSessionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedName = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - try { - $gapicClient->getSession($formattedName); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSessionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $sessionsElement = new Session(); - $sessions = [ - $sessionsElement, - ]; - $expectedResponse = new ListSessionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSessions($sessions); - $transport->addResponse($expectedResponse); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - $response = $gapicClient->listSessions($formattedDatabase); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getSessions()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/ListSessions', $actualFuncCall); - $actualValue = $actualRequestObject->getDatabase(); - $this->assertProtobufEquals($formattedDatabase, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listSessionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedDatabase = $gapicClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - try { - $gapicClient->listSessions($formattedDatabase); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function partitionQueryTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new PartitionResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $sql = 'sql114126'; - $response = $gapicClient->partitionQuery($formattedSession, $sql); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/PartitionQuery', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getSql(); - $this->assertProtobufEquals($sql, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function partitionQueryExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $sql = 'sql114126'; - try { - $gapicClient->partitionQuery($formattedSession, $sql); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function partitionReadTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new PartitionResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $table = 'table110115790'; - $keySet = new KeySet(); - $response = $gapicClient->partitionRead($formattedSession, $table, $keySet); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/PartitionRead', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getTable(); - $this->assertProtobufEquals($table, $actualValue); - $actualValue = $actualRequestObject->getKeySet(); - $this->assertProtobufEquals($keySet, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function partitionReadExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $table = 'table110115790'; - $keySet = new KeySet(); - try { - $gapicClient->partitionRead($formattedSession, $table, $keySet); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function readTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ResultSet(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $table = 'table110115790'; - $columns = []; - $keySet = new KeySet(); - $response = $gapicClient->read($formattedSession, $table, $columns, $keySet); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/Read', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getTable(); - $this->assertProtobufEquals($table, $actualValue); - $actualValue = $actualRequestObject->getColumns(); - $this->assertProtobufEquals($columns, $actualValue); - $actualValue = $actualRequestObject->getKeySet(); - $this->assertProtobufEquals($keySet, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function readExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $table = 'table110115790'; - $columns = []; - $keySet = new KeySet(); - try { - $gapicClient->read($formattedSession, $table, $columns, $keySet); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function rollbackTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new GPBEmpty(); - $transport->addResponse($expectedResponse); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $transactionId = '28'; - $gapicClient->rollback($formattedSession, $transactionId); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/Rollback', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getTransactionId(); - $this->assertProtobufEquals($transactionId, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function rollbackExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $transactionId = '28'; - try { - $gapicClient->rollback($formattedSession, $transactionId); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamingReadTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $chunkedValue = true; - $resumeToken2 = '90'; - $expectedResponse = new PartialResultSet(); - $expectedResponse->setChunkedValue($chunkedValue); - $expectedResponse->setResumeToken($resumeToken2); - $transport->addResponse($expectedResponse); - $chunkedValue2 = false; - $resumeToken3 = '91'; - $expectedResponse2 = new PartialResultSet(); - $expectedResponse2->setChunkedValue($chunkedValue2); - $expectedResponse2->setResumeToken($resumeToken3); - $transport->addResponse($expectedResponse2); - $chunkedValue3 = true; - $resumeToken4 = '92'; - $expectedResponse3 = new PartialResultSet(); - $expectedResponse3->setChunkedValue($chunkedValue3); - $expectedResponse3->setResumeToken($resumeToken4); - $transport->addResponse($expectedResponse3); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $table = 'table110115790'; - $columns = []; - $keySet = new KeySet(); - $serverStream = $gapicClient->streamingRead($formattedSession, $table, $columns, $keySet); - $this->assertInstanceOf(ServerStream::class, $serverStream); - $responses = iterator_to_array($serverStream->readAll()); - $expectedResponses = []; - $expectedResponses[] = $expectedResponse; - $expectedResponses[] = $expectedResponse2; - $expectedResponses[] = $expectedResponse3; - $this->assertEquals($expectedResponses, $responses); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.spanner.v1.Spanner/StreamingRead', $actualFuncCall); - $actualValue = $actualRequestObject->getSession(); - $this->assertProtobufEquals($formattedSession, $actualValue); - $actualValue = $actualRequestObject->getTable(); - $this->assertProtobufEquals($table, $actualValue); - $actualValue = $actualRequestObject->getColumns(); - $this->assertProtobufEquals($columns, $actualValue); - $actualValue = $actualRequestObject->getKeySet(); - $this->assertProtobufEquals($keySet, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function streamingReadExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->setStreamingStatus($status); - $this->assertTrue($transport->isExhausted()); - // Mock request - $formattedSession = $gapicClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - $table = 'table110115790'; - $columns = []; - $keySet = new KeySet(); - $serverStream = $gapicClient->streamingRead($formattedSession, $table, $columns, $keySet); - $results = $serverStream->readAll(); - try { - iterator_to_array($results); - // If the close stream method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -}