From ce83fb7975d7bbcd31e4cb446d925fb1f899eb29 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 24 May 2024 05:00:14 +0000 Subject: [PATCH 1/2] feat: add field order_by in spanner.proto feat: add field lock_hint in spanner.proto PiperOrigin-RevId: 636759139 Source-Link: https://github.com/googleapis/googleapis/commit/eeed69d446a90eb4a4a2d1762c49d637075390c1 Source-Link: https://github.com/googleapis/googleapis-gen/commit/8b4c5dae2157cd683a9229d40de8c71665c21a0a Copy-Tag: eyJwIjoiU3Bhbm5lci8uT3dsQm90LnlhbWwiLCJoIjoiOGI0YzVkYWUyMTU3Y2Q2ODNhOTIyOWQ0MGRlOGM3MTY2NWMyMWEwYSJ9 --- .../Spanner/Admin/Database/V1/Backup.php | Bin 0 -> 5331 bytes .../Spanner/Admin/Database/V1/Common.php | Bin 0 -> 2220 bytes .../Database/V1/SpannerDatabaseAdmin.php | Bin 0 -> 11945 bytes .../Spanner/Admin/Database/V1/Backup.php | 725 ++++++ .../Admin/Database/V1/Backup/State.php | 65 + .../Spanner/Admin/Database/V1/BackupInfo.php | 213 ++ .../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 ++ .../Database/V1/CreateDatabaseMetadata.php | 68 + .../Database/V1/CreateDatabaseRequest.php | 365 +++ .../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 + .../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/GetBackupRequest.php | 92 + .../Database/V1/GetDatabaseDdlRequest.php | 92 + .../Database/V1/GetDatabaseDdlResponse.php | 122 + .../Admin/Database/V1/GetDatabaseRequest.php | 87 + .../V1/ListBackupOperationsRequest.php | 461 ++++ .../V1/ListBackupOperationsResponse.php | 142 ++ .../Admin/Database/V1/ListBackupsRequest.php | 329 +++ .../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 ++ .../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 + .../DatabaseAdminClient/create_database.php | 98 + .../V1/DatabaseAdminClient/delete_backup.php | 72 + .../V1/DatabaseAdminClient/drop_database.php | 73 + .../V1/DatabaseAdminClient/get_backup.php | 74 + .../V1/DatabaseAdminClient/get_database.php | 72 + .../DatabaseAdminClient/get_database_ddl.php | 75 + .../V1/DatabaseAdminClient/get_iam_policy.php | 78 + .../list_backup_operations.php | 86 + .../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 + .../DatabaseAdminClient/update_database.php | 126 + .../update_database_ddl.php | 91 + .../v1/src/V1/Client/DatabaseAdminClient.php | 1074 +++++++++ .../v1/src/V1/DatabaseAdminClient.php | 34 + .../src/V1/Gapic/DatabaseAdminGapicClient.php | 2112 ++++++++++++++++ .../Database/v1/src/V1/gapic_metadata.json | 118 + .../database_admin_client_config.json | 168 ++ .../database_admin_descriptor_config.php | 359 +++ .../database_admin_rest_client_config.php | 398 +++ .../V1/Client/DatabaseAdminClientTest.php | 1972 +++++++++++++++ .../tests/Unit/V1/DatabaseAdminClientTest.php | 1766 ++++++++++++++ .../Spanner/Admin/Instance/V1/Common.php | Bin 0 -> 1231 bytes .../Instance/V1/SpannerInstanceAdmin.php | Bin 0 -> 14756 bytes .../Admin/Instance/V1/AutoscalingConfig.php | 121 + .../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 | 625 +++++ .../Admin/Instance/V1/Instance/State.php | 67 + .../Admin/Instance/V1/InstanceConfig.php | 552 +++++ .../Instance/V1/InstanceConfig/State.php | 65 + .../Admin/Instance/V1/InstanceConfig/Type.php | 64 + .../Admin/Instance/V1/InstancePartition.php | 559 +++++ .../Instance/V1/InstancePartition/State.php | 67 + .../ListInstanceConfigOperationsRequest.php | 353 +++ .../ListInstanceConfigOperationsResponse.php | 126 + .../V1/ListInstanceConfigsRequest.php | 176 ++ .../V1/ListInstanceConfigsResponse.php | 110 + ...ListInstancePartitionOperationsRequest.php | 413 ++++ ...istInstancePartitionOperationsResponse.php | 172 ++ .../V1/ListInstancePartitionsRequest.php | 235 ++ .../V1/ListInstancePartitionsResponse.php | 156 ++ .../Instance/V1/ListInstancesRequest.php | 329 +++ .../Instance/V1/ListInstancesResponse.php | 156 ++ .../Admin/Instance/V1/OperationProgress.php | 164 ++ .../Spanner/Admin/Instance/V1/ReplicaInfo.php | 145 ++ .../Instance/V1/ReplicaInfo/ReplicaType.php | 87 + .../V1/UpdateInstanceConfigMetadata.php | 174 ++ .../V1/UpdateInstanceConfigRequest.php | 225 ++ .../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 | 78 + .../list_instance_partition_operations.php | 91 + .../list_instance_partitions.php | 77 + .../V1/InstanceAdminClient/list_instances.php | 77 + .../V1/InstanceAdminClient/set_iam_policy.php | 77 + .../test_iam_permissions.php | 83 + .../InstanceAdminClient/update_instance.php | 146 ++ .../update_instance_config.php | 117 + .../update_instance_partition.php | 156 ++ .../v1/src/V1/Client/InstanceAdminClient.php | 1216 ++++++++++ .../src/V1/Gapic/InstanceAdminGapicClient.php | 2144 +++++++++++++++++ .../v1/src/V1/InstanceAdminClient.php | 34 + .../Instance/v1/src/V1/gapic_metadata.json | 118 + .../instance_admin_client_config.json | 168 ++ .../instance_admin_descriptor_config.php | 359 +++ .../instance_admin_rest_client_config.php | 331 +++ .../V1/Client/InstanceAdminClientTest.php | 2037 ++++++++++++++++ .../tests/Unit/V1/InstanceAdminClientTest.php | 1827 ++++++++++++++ .../Google/Spanner/V1/CommitResponse.php | 33 + .../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 -> 1875 bytes .../GPBMetadata/Google/Spanner/V1/Spanner.php | Bin 0 -> 11701 bytes .../Google/Spanner/V1/Transaction.php | Bin 0 -> 1977 bytes .../GPBMetadata/Google/Spanner/V1/Type.php | Bin 0 -> 1501 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 | 188 ++ .../Google/Cloud/Spanner/V1/CommitRequest.php | 402 ++++ .../Cloud/Spanner/V1/CommitResponse.php | 129 + .../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 | 275 +++ .../V1/ExecuteBatchDmlRequest/Statement.php | 208 ++ .../Spanner/V1/ExecuteBatchDmlResponse.php | 167 ++ .../Cloud/Spanner/V1/ExecuteSqlRequest.php | 702 ++++++ .../V1/ExecuteSqlRequest/QueryMode.php | 66 + .../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 + .../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 | 505 ++++ .../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 | 204 ++ .../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 | 87 + .../Cloud/Spanner/V1/StructType/Field.php | 138 ++ .../Google/Cloud/Spanner/V1/Transaction.php | 151 ++ .../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 | 71 + .../ReadWrite/ReadLockMode.php | 70 + .../Cloud/Spanner/V1/TransactionSelector.php | 160 ++ .../src/Google/Cloud/Spanner/V1/Type.php | 268 +++ .../Cloud/Spanner/V1/TypeAnnotationCode.php | 84 + .../src/Google/Cloud/Spanner/V1/TypeCode.php | 180 ++ .../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 | 806 +++++++ .../v1/src/V1/Gapic/SpannerGapicClient.php | 1854 ++++++++++++++ .../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 +++++++++ 252 files changed, 57341 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/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/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/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/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/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/GetBackupRequest.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/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/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/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_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/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_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_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_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/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/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/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/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/OperationProgress.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/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/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/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..b610f628c7710a42b0e686c9a703228810f5ff09 GIT binary patch literal 5331 zcmd5=UvJw~6esE0wWnSGxNOV1P4%)uJB>MOhZytLf%B(PSldKxI;qIQa-5sYYhoMQ zsaB@G!3z?603P6p7kKAG@F@_F`vfoviF5C@9rxdobwXn=bDeX3_uO-S=Xa0qgHN0% z4qO+D#3HWlle$>j6a6PdbX?oF4Z9`QI*kT#MZ<18W{bFzDCW!JdbuhV@}=rEboK0x zYYu%cAdgNPKlsbcx?_t@|u)3a}qNsmCNu zaZGi^B&~XuJkfVe+m+?+uDT#6xo(i4l6`xv+E&x;Se9uu)v`nRgPHXDUo}c6i+WA> zc2412HIYZY-gf%;J&|2%&ThAD>v$wahFcHKp!7<;9#wh;J7XcL4XxBX{G5hcuhkMl z&_PnrK@#gADeNF=cX8%Y0H`}=#tq8F`)THS@KdW>lZ+kJBrpnll(iu8IMbkX(b|~# zz+yIli7fmuy@5gRJ)u%y4!L>yhqExmTUGc7hQqz2l44?EBs=#~xdyZ0cKOP8Plqu$L**!ypkWCg z!l>aA6hrQQrk8tm;16X$xCr2(+-S8upLnT3bQ<74WMPmtJxLAWyYVF{3_RTTkupm> zVbUh`;utG%-X$o*#4@niv@nle>Z~|`iB#t?g1(Zu4ikvs?m4toQ6(F8YMAZscJHtX zkz)z{cwk#_;SiqNW-^dEhmnmgof5VJli?nMt4g(?ZLM!s z3c1ossgR$1M;L?Q+(tpEmez}t31I{V@sIrWWKveu7s__exUgHFVv4-X^WbSeV_HZ$ zJkRi5__!aO!1#)9e?R?A5~g#E>wJqFSX0*r8Q z&8!D)j_r{YmSKp$Pw{qK=v_x15=~%I_yVS4JTq*oVK!5|GavRwif^&Y;v7Sv_=)si z33xYd6%Hh*J~3&?re7*OS#nyPE5I;TuZgsvgH1D$b)z4|->}o0j8Q^LGM- zuFV^8=HB7l@B^|Ry1gyhe4BvjEeBPa93)P+(dlVAy7Zcjj&<%ZR5q0`1v&1pk0wSY z59uOI7Kwi_kUIxDw?CStKZEH!X_3R5Iu+K}$c|Oh3&Qf=TwBLssA0D7%YzH6Fa;xy z-Xt2GJD6k)3IYIo<=Z>NVgfmmHevce7@mVuIuY){S>A{qiab55`>qtuIujOo=4-K~ z7-7@jCE#**tw@~S-rk?WmE+?HlCTKSosxq*Tn&XGHcLy&3Vj>EHVPnlzK9~)L_8IJ3h?r^*e6M+ne6BeURpVN5yrvbPUKPV3iqp)*e!u0nX z!e)r^rL{1v;gEH7@O>4q)Lp5HpnNR&1jcsSp0-2wG&aC<*}Q=#`b*_HTr*mBr;Y}} z%F(w)jt;=~BeExa3g_Yg^yH-jb^i$I?-MY7Ff?HnE*I8w8{3s?sl2XLw=0Loy~}WM zYqOx`m8z0e@S$ss)8AFNR4kW^tN43iMcG=d#(z#y@Z8pBwY*l?(AJc7rC7+v4F=M` z4!}(JQ0j)p#~r~usXmYTs82K|9ESbBR_Di4ROcqB^Rzs<^7=}t7*(OXp=FiaqpeCj z-EUm3>^}*Z!|&am$P;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^#dUhQ9wRYrmlBk=MB(5XX%3s;UN!OC>m?pNcoigcYSk}_Bvqaim zcGqd#;0wcWVJOUSfkWwma)EN-z)ZPu;7~Hd1voGs4jg(a16-J4rYFAlx7wAZ?8=ER zlJ&mtd*A=hd+*u}=bnR3{W#7O~dnY0zxh^K=cUZ z;Lq9KXqxq$=NmqJoHjk(v`pVLn&x{T?_6%vXnF()?T6jmw(7oVTRDobV%5pnb2(0v z!k%_)(9c{>GFhc619jDwET6cR(X5q;S9eXvx7{j$s_GW;14Ywc&Ylz7QgY^I?kwj~ zRrfJDm-F3i65c(RbBVw0T2~q0l)!HAt=2__nq$^9%d)8!Y|B&CwoGjjy%0-HlURO# zI146eHs;Aac}Pn%rR90PlIbh|VD{Kiv4P>3 zg*uB7p3aV)3@vQZK+rctBnW`15P&P(T`ZjtOQzAHX%jwlhdH%aKNek&tep~T&9-|M z?7%$*ftLl4BNA4DPzMx?GLHv~oc$KKnShY81rWaUB>`|=&=-2^QVKSh!z2cW;saj6 z!IfX7&@dzjNUCJX+O+XaG|aPw?(aAxo64omjutQEIS;*UmlrhFSovB9R9r&CoG~a6 zn|3x0l!l8l@szmxQ)X^HH-9)_hZ0d9527Jil<+uuo|ZYrV`hHfA6goh(IJ}j3EOS7 z_Y13TMzE_@{h#ERA16W9+NGQe9uVz4Q(R7*IDp*K~AJ`V5agNQ+(`g0~=9 z$JcG_hHw@SXX4R*p;(4b?u zU{VoTwKEV}UuduN?hy8PpmABiHu^SiH?mu2bw5? z=TJtn=fURGJ*Sgf5+6lJEb`FTLmSeplTrSfMiV6#(Nfr_m-RRr6G?()oEFs=+l~4| z8pATM;u?Ce>VZZEcwD4#*AV9!eh1THD9bSaYQWBoCp_M;SG%!XwcvZpLRYO{305rwawq*?GOua zx~ce)joCb|l~2=XYM=0daSs>}G=FwVjxV8c+QXSXvkNS@9G+Z;i~IdA=u+?`%J}!7 zqWMkIV40YgE*$ojLoDeY$Xk}s3tV+HMbOm!M!frWw*usq7t2t8JA?KqJV;qZ6QRWN zY}`^=M3bFFMJ0=xjh3+Cp$FK ziGr<2Qy&`Gs!z>MzP%Zp=6K1wfky7PJpDe|(b?q1HF^$OfiJXE=#_fY-fjSZ*gWW0 zOLUa6-y%EsO>{U+K(<85DJVZnq0uO7_#}F{vRqod3;pxTvc7(|+Sz-*hH7W-tX1^V z%JRa}qF$~nXm@U{>np4JyjFVaPE~KCLvMZ@O)ajhEZ(XFfT86y-K}(IZGGi-WmUhe zEo+OFau|O=`N04>+F`h$3KS!aOrn;kb0ViYe>M|2pKJS^$RpK)`~HEdMMrPJr`so0 zFF260VIXe7Xwg3N4)PE8M?QFVoEdzOLb(-zDeTgaLHJaL3D-?(mEk1kBtb5eT^9A| z5y{W0-6UPkHPlC+YY)*WnOk~{gADnr(D)sABn;+6N(yF07e02C_fR%m3D}x!>iSO3 zQqpJ{qU!6M6{&k>ly9S{E}M%Av;e0AGQm?`WfjWDr$5ODm8NG|nubnGxJ>9^3nun1 zNd}=oo=wJ5#ectw4$BSL-3k7E3LOs1;o-~iJVp?N#*ZZ!3Oew(vXtw4nwaaq^Ow(l zoG#$=^gQ$tANA(~x0w!|AWVl&4)8~5G#Z`uZ~|VU7*dEQw+YJcQjfI;Iv0EBD0Pgl z#DYfoka54K9p&=R)cJv5&}%at6_x&Uq^73vui-#7)D+^2@pcY@O9l0D?4exS)7U|1 z#H_SF_b_S@Jt#G5Z( zW?m}+@=4`XgYyXdK^l!m`G;`;tMPW)hm=t6k3sG=G$DKxB8^>a=GjFRR%2av-?nY< zeNpORCU9Jj=}9eKis&hcD-;@yCiUQ-(}ENlzwo7a)r8@tRwgA{RAQyPrv=7f%wCwD z?VDNrC-B=);7}7LNJmi&$!UT~wG&Y!)tjBNT)_uZJpLzWeU13Rohw$P`ryh6ZpZTB zMalR?2MoV=RX$AZX-8af4>rTEw3w#9mr|}XRm;UBexZ6Hw!lH&(Ufb6i0~1MW|>YB z_%o0eRN7nG@M4U#KLKfnq(Dz0=2nQG1B%%}0{<_K@H(8SQ#py-GCg`>;^DI$X4?-U zMLw4RQn=#x(~vl&8fM@sMsCMc@~@OqPGmHhQJC5MeY{h}EGqMfNQLa*ozPunJrSW0 zPeJiwZ76lEuB7pYX*9xXJ|EwcB(X5OG(b#A`vg+^H(8wFF~a8# zMXqFluPVGbi&2xr_EadRR7o`Yp<|g057xm!j)!l^BHcTzyJJcXzIkv0!XFl+{_qCo zV^TsvL$drm#a{(*uMREDCF8LZPl|Z`py)!tN>sqh_+s)D9+CpY8xPxpbrDHszkNtj zu&c=glX1p21pj3Z9+c&%R5$Qkyi`F4M3a5+52JhR;bU!5Iw6lDc?kb!tya6|`;Mm; z3h%!Au3%cO7L0BG9=y4O^ZWBo)9^QKw>1+7E;nLDZ2oU)bQ*3YW3@3qwZltEqPu7!Q&NeeAMj%cstrFW-Q9IKYy@>TFzXfBj|pON;ESbG}4n%8M=YY_GiB zIsf+TV+mNRG00l*I9j}pZas=l^Gf4h0c^B;>^ndq36Epw- literal 0 HcmV?d00001 diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Backup.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Backup.php new file mode 100644 index 000000000000..807389b65941 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Backup.php @@ -0,0 +1,725 @@ +google.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 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; + + /** + * 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 $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`. + * } + */ + 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 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; + } + +} + 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/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/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/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/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/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/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/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/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..a5ff36930990 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupsRequest.php @@ -0,0 +1,329 @@ +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` + * 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 + * + * 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` + * 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 + * @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` + * 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 + * + * 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` + * 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 + * + * 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/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_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/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_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_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_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..8c2c91ef21ae --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/Client/DatabaseAdminClient.php @@ -0,0 +1,1074 @@ + 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 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} + * - 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. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $options = $options + $this->getDefaultEmulatorConfig(); + $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 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(); + } + + /** + * 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 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 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 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 getDefaultEmulatorConfig(): array + { + $emulatorHost = getenv('SPANNER_EMULATOR_HOST'); + if (empty($emulatorHost)) { + return []; + } + + if ($scheme = parse_url($emulatorHost, PHP_URL_SCHEME)) { + $search = $scheme . '://'; + $emulatorHost = str_replace($search, '', $emulatorHost); + } + + return [ + 'apiEndpoint' => $emulatorHost, + 'transportConfig' => [ + 'grpc' => [ + 'stubOpts' => [ + 'credentials' => ChannelCredentials::createInsecure(), + ], + ], + ], + 'credentials' => new InsecureCredentialsWrapper(), + ]; + } +} 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 $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 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(), + '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 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} + * - 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 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(); + } + + /** + * 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 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 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` + * + * 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 + * @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 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..928ba32f9557 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/gapic_metadata.json @@ -0,0 +1,118 @@ +{ + "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" + ] + }, + "CreateDatabase": { + "methods": [ + "createDatabase" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "DropDatabase": { + "methods": [ + "dropDatabase" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "GetDatabase": { + "methods": [ + "getDatabase" + ] + }, + "GetDatabaseDdl": { + "methods": [ + "getDatabaseDdl" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "ListBackupOperations": { + "methods": [ + "listBackupOperations" + ] + }, + "ListBackups": { + "methods": [ + "listBackups" + ] + }, + "ListDatabaseOperations": { + "methods": [ + "listDatabaseOperations" + ] + }, + "ListDatabaseRoles": { + "methods": [ + "listDatabaseRoles" + ] + }, + "ListDatabases": { + "methods": [ + "listDatabases" + ] + }, + "RestoreDatabase": { + "methods": [ + "restoreDatabase" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "UpdateBackup": { + "methods": [ + "updateBackup" + ] + }, + "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..ca8f1d556f1a --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_client_config.json @@ -0,0 +1,168 @@ +{ + "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" + }, + "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" + }, + "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" + }, + "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" + }, + "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" + }, + "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..fc499b10c129 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_descriptor_config.php @@ -0,0 +1,359 @@ + [ + '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', + ], + ], + ], + ], + 'DeleteBackup' => [ + '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', + ], + ], + ], + ], + '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', + ], + ], + ], + ], + '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', + ], + ], + ], + ], + 'templateMap' => [ + 'backup' => 'projects/{project}/instances/{instance}/backups/{backup}', + '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..001f0f774002 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_rest_client_config.php @@ -0,0 +1,398 @@ + [ + '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', + ], + ], + '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', + ], + ], + ], + ], + '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', + ], + ], + ], + ], + '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' => '*', + ], + ], + 'placeholders' => [ + 'resource' => [ + 'getters' => [ + 'getResource', + ], + ], + ], + ], + 'ListBackupOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/backupOperations', + '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' => '*', + ], + ], + '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/*/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', + ], + ], + '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..2d3ff15ea63c --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/tests/Unit/V1/Client/DatabaseAdminClientTest.php @@ -0,0 +1,1972 @@ +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; + $expectedResponse = new Backup(); + $expectedResponse->setDatabase($database); + $expectedResponse->setName($name); + $expectedResponse->setSizeBytes($sizeBytes); + $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; + $expectedResponse = new Backup(); + $expectedResponse->setDatabase($database); + $expectedResponse->setName($name); + $expectedResponse->setSizeBytes($sizeBytes); + $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 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 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; + $expectedResponse = new Backup(); + $expectedResponse->setDatabase($database); + $expectedResponse->setName($name2); + $expectedResponse->setSizeBytes($sizeBytes); + $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 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 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; + $expectedResponse = new Backup(); + $expectedResponse->setDatabase($database); + $expectedResponse->setName($name); + $expectedResponse->setSizeBytes($sizeBytes); + $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 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; + $expectedResponse = new Backup(); + $expectedResponse->setDatabase($database); + $expectedResponse->setName($name); + $expectedResponse->setSizeBytes($sizeBytes); + $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..d9f4ed4da6f4 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Database/v1/tests/Unit/V1/DatabaseAdminClientTest.php @@ -0,0 +1,1766 @@ +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; + $expectedResponse = new Backup(); + $expectedResponse->setDatabase($database); + $expectedResponse->setName($name); + $expectedResponse->setSizeBytes($sizeBytes); + $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; + $expectedResponse = new Backup(); + $expectedResponse->setDatabase($database); + $expectedResponse->setName($name); + $expectedResponse->setSizeBytes($sizeBytes); + $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 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 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; + $expectedResponse = new Backup(); + $expectedResponse->setDatabase($database); + $expectedResponse->setName($name2); + $expectedResponse->setSizeBytes($sizeBytes); + $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 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 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; + $expectedResponse = new Backup(); + $expectedResponse->setDatabase($database); + $expectedResponse->setName($name); + $expectedResponse->setSizeBytes($sizeBytes); + $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 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..4e83339471a1d21a0b2b153ece57ff0d84ca93c0 GIT binary patch literal 1231 zcmb7D-EPw`7^US$$h+BcH9&wF6YF4eRk-sQXlv7{QrAXXH=!v~(w;-9v55DFreB)DzK&^LtP ziPK3W0t}@Lyw*iB7E&0&BJmYE+Qm~AB^<6^$4*lj7@;K2E(}3vV-x3`8FoEZFo9iM z%JQ@TF3oBU*BbX7f)F&M z&DcO|t9AIc^!72yRpo|)t&pm3XA3>#GR)C;|Al`28Lf2FXey#;4kbOVg$kWD^sIZ* z@AmrrLw7J5d+t$h*cqP;jy<>C>-OBv@*U?XdUOM3Fg!Zk>o3=w=jh1|zuiwGchG_R z_5D9Jv<|5#8@Y8}`%Agq?S{SDSvQDO8kX09p*d5x1&_r7vR4j2p6o1+KkBdYypgu$ zD^f>n>PVS7a@zV?0)5{i{VJeELKhK*jQ*~_$!RIIXi5uWN-Z;`B{ij|t;qw}xl!*n XD%)-4Nw^Z6TSH@!xw9|PB|?7zOj?rv 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..e063ce16eedddfceebbb98fa2636ff3607d9d036 GIT binary patch literal 14756 zcmeHOPi!1#74NKL*ZZyG*k7E)wP~`Qq>ba+yUC_)!X|E5+iS;_V_UJ?(rT+^ygRms z%+3rmvuWJOASw=(kl@e*5&{GVE^q?D0S<6LNDv{U(wk2p^+H4?ByOB|-@o~@|7LdU zA_U|T@67k!_ul*7`+e`d@0**qtUU{zPcN&6YAdcgg~-90sJ*`{k&Og+6_-`P>^ zbj7S$ny%WJbb4_;y|%uUE-tQYJp-hUS+^@{KD}$2ySkcnEX4p`S*2RjjI3rju3}Ww z?ENd^O<6oE(;*o;6GDbkQ-QXkrk6M7@2IX)Ra~XCOqrH88PigMFfFZcrlr@e+(4+J zD~^-qBg88@5Isa`_-EC(b*+*HL0tIng64n(nyV?g_73Pfm)=oyM+HXBV|VIC#nntB zO$gROjj2m%#*>V_V3}Z_xwH^+gP07=1@gJ7Z76zaQFSV|X1S)l0YmfoUDfprO`c3$ z;?oj#+D>|k$(YYK2|1T`?YbJAJ)O2yw{9CZsN96Xf%jLbg$WCmRw@{VNvvQRPCoDJ z0OmORcs+wlp1(L3I5wKVX^n)&&MgdC0jL( zUAt}=nz372w@B=CXI0NxV5y2V%k4s9kCa;Yj^f;ludPSBr9rs4O3jK-+cpSG3udim z8m&3eD4Bg(<1taFR=p5d0zjGaoR+xoMf7tG&3z&y!5oM(044;8G7Mz|=w$9+nK;8I zP%JH5p`Oh^XyRPp#SU@b@;3KhKH#aq0Gm50e|46>(v%tjJNU0`QCH;eC&KST@6Pjg zy6;q3({n1$V3H5AILu^K;x_!HKws}A6Tb$|!AA()yb-SO06t)r^XGPJ0pPF)z%sMp z@}Y!McU235O<6H^Ogw@Hb+balU|dQ|Q%Ssxj=B4mI-Y=E!@19982|R`k_oUAe{TT; zd=8zdsyj+ucgwn}R8_m|&D00H2jz876gqwkjcmQKQ7pf@wz*MUSXo*rE{;5bhY`A4 zEG(8^zq_(k9Fg#Gl%&7c*H+&cN#GQE^7WOiwc_UHNT2+x0W>VOk_FS)(RT3=I!3lA zuG<(Is%nmp$(sp2n2D;}OILzI~B`*WcW-$H{nv#~SYm+qTN zPkJCU8oP<27ZN*W`Ov~{niPrPe|16X)qGv_Cv1NwXax&mB z*|2VS6%FXhwyHbhgH(!}(fWirWL7D8(Qxg3vM7)#?2ad?`A?%^?jKBNXZ#q(&8@;# zqstGW!3FT~t(CQ9piiQH;_%??`7b;!ycKuFUI4`SqFQmC>_h(7ftS{?*nl@0PszAv z9LWFZL!*VdYdRIkvy5Ff5bq$Y_z%mvR?}RE+9;JPMjOA0VJ7fol`madUj9S-2;Y@ zm1*vNxnkAJbr&Mz9g5v$*mf$A>(NE&XV#oTlMdvt%C6dSB*8v5QvOXp8WiD*M}vsT zIL)B}4jmLQ=VxKDxmyWk3raFhHAF2HMb#}P_KatD9v5Cg z=OT6>T)GI_wS%$%h#ko9NoZnKb6l}J9Ov$;U#dgaj2F;=rPv}$lJi%o8_%NWE4o>) zio~#{7!Wcxx2(4zZZH`jJdzd(DF@0>icI|&e3(9R&3mc=8$LL<{H}y1TZ-aXP{yhF z6*STSz65bds?de|adZ+|}|3q%!C2}l}ZZaQ};0F>q-y8~l z^?js1GmHjyG#wf_%umAMO5|w_SF*%O*+v&Si^#+F3POH`#{>3h0m6YgFypC*+eYU@ zgagqjtngweE=w0FMm-aak{N{j;xXE1O%NMG%EBeSE1g8{8^<5O~-9o{u-=9 zgD%|H=1@{F6njG#mTK#Fkg%re24Ht(PubR0TA(K7Z-N+Mj1x8ut`~!~E~H@4bhSI* zWQ)9pPKAL>2-IVQ$iGgY(_xPn{c3zO;FDeJh#~Z#9JO7RnGr1Pxa2qssT}F9>x_V) zQfGo0Gzcjn8%><8^XSi`N%esRrJq_Y@6>gGL%jw`4=E8evr1iZI8L^_4+m4G@oz4j$C^uLXh%%6D4t1OOIj6oM4?MMfU$bJO*#fE z-iDHNFbbInt~ZsWq_FRZXN*clr)(8YG*xH^LJNkRGLn|218qU*6|ymDbTT+*TdCZu zTMm@U-U!inBz17I_deX09~T~?DUq$T>74p*u^zL2_4;!jX`s4=>W;hF!8}GIo2EuzWh z$nxu~$gG$|k|cj0T(6xXyz1IOCz~e{^;a*x*JUC0v4oy$DWaE|9f8qLdbKN!cxoJc zI@sBytrGV9OsKs{i(U32VogXhKXPZ699c0>chg5bNYbjUXH{q zo}E6xze}L8@V3w8k73VNbV7yBjXn7T=~2N#*~t45!gGXBkp!(|5_`>I;SyWU84sl@ z^zK6AZ^%rjA!p>+UXYij@guNhc)Jr~NBcr6x|p{7@YAwoE17&-`g;mDVx1k9k-j^% z-p$-K8bS@m&P019G3F1UPZ`eK;v2ISoiOHUu@(^0?AVXqMQezlX}<8$vf{r($=-}C z{*HrVobq>~7lOw)!|%+7BV8ekbUA!E9?%6e`k91|2j_Bdj04*cfl%t2SPfASHn*=E z=(rZSuoma>Gf`SN_#+9O4s!ETF?_2#Iebc?$me=zz%^P9YjhpI)LJ7C#T~$J?}slD zhBKp7U~9oIM2i*}E)?pbQ7vB%?ml8E+Jz1g8-FK(hQm;eW4J(hUExAV&nFrRlTi+LgI6Bw3`y}`!1L#jJ|Qq6Q+o1o}V7QdBSq|=JASy z8UM76nkAc?4($|ew+P}p#6Is!XgCb=aqJVO5cX-eA%vZJnk`&Mr~bBthBo2OfVh#3 zWf6IBH5P8+W`Zxp^rsreuv^*k`eEUOxK%O3Zq8CuU6XUvRN`H$^p0A|2?)YXHbla_ zt#HAY5yIU*EWjmAc456csdfVr5UHR###?Z|govfuH4QF_!4(fY)nJt7Awt4SF-CHL zeeJG;JjFfhyaGYcglT@Dxx;xOn>));t2y!DQQ@?R2^RF?#^Ij|rP7}3T24Njef#aV zxf0@S7A{Kf!DldVad8&DXK;5+yEYRwTuej@l=-hG&;>X~inPxBQ=9CY9D!4`1-3y- z&kgC#B`SkpLOvbXHN`iBjUS_c@Z=jC-bu5zZ}@-yDDm7f{b(?=Ky=FRDKm7gjF>s| z+LcFQV5vk$mb|YF`DcdycZTq3+2h3XjBP$oN9XgLaXwEu=ktPfKL6U4?EzX)U%lvk f-892K;0t{32RA+7d&Cys`q7c>o4f;bfY84H{{gk> 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..fddbdb839f58 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig.php @@ -0,0 +1,121 @@ +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; + + /** + * 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. + * } + */ + 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; + } + +} + 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..a4325501a92d --- /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, 100] 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, 100] 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, 100] 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, 100] 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..d1bf6ef51190 --- /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 config 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 config 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 config 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 config 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..282f9f6b434c --- /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 config. + * 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 config 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 config. + * 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 config 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 config. + * Values are of the form `projects/`. + * @type string $instance_config_id + * Required. The ID of the instance config 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 config. + * 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 config. + * 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 config 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 config 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..e74c44bf938e --- /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 config from overwriting each + * other. If not empty, the API + * only deletes the instance config when the etag provided matches the current + * status of the requested instance config. Otherwise, deletes the instance + * config without checking the current status of the requested instance + * config. + * + * 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 config from overwriting each + * other. If not empty, the API + * only deletes the instance config when the etag provided matches the current + * status of the requested instance config. Otherwise, deletes the instance + * config without checking the current status of the requested instance + * config. + * @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 config from overwriting each + * other. If not empty, the API + * only deletes the instance config when the etag provided matches the current + * status of the requested instance config. Otherwise, deletes the instance + * config without checking the current status of the requested instance + * config. + * + * 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 config from overwriting each + * other. If not empty, the API + * only deletes the instance config when the etag provided matches the current + * status of the requested instance config. Otherwise, deletes the instance + * config without checking the current status of the requested instance + * config. + * + * 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/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..e49cb5cfc976 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance.php @@ -0,0 +1,625 @@ +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. + * This may be zero in API responses for instances that are not yet in state + * `READY`. + * See [the + * documentation](https://cloud.google.com/spanner/docs/compute-capacity) + * for more information about nodes and processing units. + * + * 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 + * 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. + * This may be zero in API responses for instances that are not yet in state + * `READY`. + * See [the + * documentation](https://cloud.google.com/spanner/docs/compute-capacity) + * for more information about nodes and processing units. + * + * Generated from protobuf field int32 processing_units = 9; + */ + protected $processing_units = 0; + /** + * 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; + /** + * 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; + + /** + * 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. + * This may be zero in API responses for instances that are not yet in state + * `READY`. + * See [the + * documentation](https://cloud.google.com/spanner/docs/compute-capacity) + * for more information about nodes and processing units. + * @type int $processing_units + * The number of processing units allocated to this instance. At most one of + * 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. + * This may be zero in API responses for instances that are not yet in state + * `READY`. + * See [the + * documentation](https://cloud.google.com/spanner/docs/compute-capacity) + * for more information about nodes and processing units. + * @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 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. + * } + */ + 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. + * This may be zero in API responses for instances that are not yet in state + * `READY`. + * See [the + * documentation](https://cloud.google.com/spanner/docs/compute-capacity) + * for more information about nodes and processing units. + * + * 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. + * This may be zero in API responses for instances that are not yet in state + * `READY`. + * See [the + * documentation](https://cloud.google.com/spanner/docs/compute-capacity) + * for more information about nodes and processing units. + * + * 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 + * 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. + * This may be zero in API responses for instances that are not yet in state + * `READY`. + * See [the + * documentation](https://cloud.google.com/spanner/docs/compute-capacity) + * for more information about nodes and processing units. + * + * 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 + * 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. + * This may be zero in API responses for instances that are not yet in state + * `READY`. + * See [the + * documentation](https://cloud.google.com/spanner/docs/compute-capacity) + * for more information about nodes and processing units. + * + * 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; + } + + /** + * 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; + } + + /** + * 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; + } + +} + 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..5d39c55025d2 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig.php @@ -0,0 +1,552 @@ +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]*`. + * + * 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 config is a Google 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. + * + * 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 config from overwriting + * each other. It is strongly suggested that systems make use of the etag in + * the read-modify-write cycle to perform instance config updates in order to + * avoid race conditions: An etag is returned in the response which contains + * instance configs, and systems are expected to put that etag in the request + * to update instance config to ensure that their change will be applied to + * the same version of the instance config. + * If no etag is provided in the call to update instance config, then the + * existing instance config 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 config is being created or updated. If + * false, there are no ongoing operations for the instance config. + * + * Generated from protobuf field bool reconciling = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reconciling = false; + /** + * Output only. The current instance config state. + * + * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.State state = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 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]*`. + * @type string $display_name + * The name of this instance configuration as it appears in UIs. + * @type int $config_type + * Output only. Whether this instance config is a Google 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. + * @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 config from overwriting + * each other. It is strongly suggested that systems make use of the etag in + * the read-modify-write cycle to perform instance config updates in order to + * avoid race conditions: An etag is returned in the response which contains + * instance configs, and systems are expected to put that etag in the request + * to update instance config to ensure that their change will be applied to + * the same version of the instance config. + * If no etag is provided in the call to update instance config, then the + * existing instance config 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 config is being created or updated. If + * false, there are no ongoing operations for the instance config. + * @type int $state + * Output only. The current instance config state. + * } + */ + 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]*`. + * + * 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]*`. + * + * 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 config is a Google 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 config is a Google 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. + * + * 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. + * + * 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 config from overwriting + * each other. It is strongly suggested that systems make use of the etag in + * the read-modify-write cycle to perform instance config updates in order to + * avoid race conditions: An etag is returned in the response which contains + * instance configs, and systems are expected to put that etag in the request + * to update instance config to ensure that their change will be applied to + * the same version of the instance config. + * If no etag is provided in the call to update instance config, then the + * existing instance config 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 config from overwriting + * each other. It is strongly suggested that systems make use of the etag in + * the read-modify-write cycle to perform instance config updates in order to + * avoid race conditions: An etag is returned in the response which contains + * instance configs, and systems are expected to put that etag in the request + * to update instance config to ensure that their change will be applied to + * the same version of the instance config. + * If no etag is provided in the call to update instance config, then the + * existing instance config 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 config is being created or updated. If + * false, there are no ongoing operations for the instance config. + * + * 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 config is being created or updated. If + * false, there are no ongoing operations for the instance config. + * + * 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 config state. + * + * 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 config state. + * + * 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; + } + +} + 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..5468265294fe --- /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 config is still being created. + * + * Generated from protobuf enum CREATING = 1; + */ + const CREATING = 1; + /** + * The instance config 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..c51f5593a52e --- /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..19500c295351 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstancePartition.php @@ -0,0 +1,559 @@ +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. 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]; + */ + 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 may be zero in API responses for instance partitions that are not + * yet in state `READY`. + * @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. 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 may be zero in API responses for instance partitions that are not + * yet in state `READY`. + * + * 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 may be zero in API responses for instance partitions that are not + * yet in state `READY`. + * + * 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. 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]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReferencingBackups() + { + return $this->referencing_backups; + } + + /** + * 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]; + * @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; + } + + /** + * 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..885b8b76140a --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigOperationsRequest.php @@ -0,0 +1,353 @@ +google.spanner.admin.instance.v1.ListInstanceConfigOperationsRequest + */ +class ListInstanceConfigOperationsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The project of the instance config 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][google.longrunning.Operation] + * are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata] + * is + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=` \ + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) + * AND` \ + * `(metadata.instance_config.name:custom-config) AND` \ + * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. + * * The instance config 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 config 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 config 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][google.longrunning.Operation] + * are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata] + * is + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=` \ + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) + * AND` \ + * `(metadata.instance_config.name:custom-config) AND` \ + * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. + * * The instance config 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 config 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 config 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][google.longrunning.Operation] + * are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata] + * is + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=` \ + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) + * AND` \ + * `(metadata.instance_config.name:custom-config) AND` \ + * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. + * * The instance config 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][google.longrunning.Operation] + * are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata] + * is + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=` \ + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) + * AND` \ + * `(metadata.instance_config.name:custom-config) AND` \ + * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. + * * The instance config 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..81388a77cec6 --- /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 config [long-running + * operations][google.longrunning.Operation]. Each operation's name will be + * prefixed by the instance config'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 + * [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 config [long-running + * operations][google.longrunning.Operation]. Each operation's name will be + * prefixed by the instance config'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 + * [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 config [long-running + * operations][google.longrunning.Operation]. Each operation's name will be + * prefixed by the instance config'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 instance config [long-running + * operations][google.longrunning.Operation]. Each operation's name will be + * prefixed by the instance config'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 + * [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..a5dfe05b950b --- /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][google.longrunning.Operation] + * are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] + * is + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=` \ + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) + * AND` \ + * `(metadata.instance_partition.name:custom-instance-partition) AND` \ + * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * * The instance partition name contains "custom-instance-partition". + * * The operation started before 2021-03-28T14:50:00Z. + * * The operation resulted in an error. + * + * 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][ListInstancePartitionOperationsResponse.unreachable] 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][google.longrunning.Operation] + * are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] + * is + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=` \ + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) + * AND` \ + * `(metadata.instance_partition.name:custom-instance-partition) AND` \ + * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * * The instance partition name contains "custom-instance-partition". + * * The operation started before 2021-03-28T14:50:00Z. + * * The operation resulted in an error. + * @type int $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][ListInstancePartitionOperationsResponse.unreachable] 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][google.longrunning.Operation] + * are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] + * is + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=` \ + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) + * AND` \ + * `(metadata.instance_partition.name:custom-instance-partition) AND` \ + * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * * The instance partition name contains "custom-instance-partition". + * * The operation started before 2021-03-28T14:50:00Z. + * * The operation resulted in an error. + * + * 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][google.longrunning.Operation] + * are eligible for filtering: + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] + * is + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * Here are a few examples: + * * `done:true` - The operation is complete. + * * `(metadata.@type=` \ + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) + * AND` \ + * `(metadata.instance_partition.name:custom-instance-partition) AND` \ + * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * * The instance partition name contains "custom-instance-partition". + * * The operation started before 2021-03-28T14:50:00Z. + * * The operation resulted in an error. + * + * 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][ListInstancePartitionOperationsResponse.unreachable] 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][ListInstancePartitionOperationsResponse.unreachable] 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..44acc94c32aa --- /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][google.longrunning.Operation]. Each operation's name will be + * prefixed by the instance partition'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 + * [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][google.longrunning.Operation]. Each operation's name will be + * prefixed by the instance partition'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 + * [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][google.longrunning.Operation]. Each operation's name will be + * prefixed by the instance partition'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 instance partition [long-running + * operations][google.longrunning.Operation]. Each operation's name will be + * prefixed by the instance partition'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 + * [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..aa607b0405c0 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionsRequest.php @@ -0,0 +1,235 @@ +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/`. + * + * 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/`. 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/`. + * @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/`. + * + * 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/`. + * + * 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..17a9ccba92b2 --- /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 instance partitions. + * It includes the names of 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 instance partitions. + * It includes the names of 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 instance partitions. + * It includes the names of 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 instance partitions. + * It includes the names of 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/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/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..634aae3a12c4 --- /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/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..5a543d790623 --- /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 config 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 config 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 config 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 config 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..801f509c8c79 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceConfigRequest.php @@ -0,0 +1,225 @@ +google.spanner.admin.instance.v1.UpdateInstanceConfigRequest + */ +class UpdateInstanceConfigRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The user instance config to update, which must always include the + * instance config 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 config to update, which must always include the + * instance config 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 config to update, which must always include the + * instance config 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 config to update, which must always include the + * instance config 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 config to update, which must always include the + * instance config 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..8632ada1f4b5 --- /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][google.longrunning.Operation.metadata] field type is + * [CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Instance][google.spanner.admin.instance.v1.Instance], if successful. + * + * @param 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..c9dec56b8436 --- /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 config. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if + * successful. + * + * Authorization requires `spanner.instanceConfigs.create` permission on + * the resource + * [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.parent]. + * + * @param string $formattedParent The name of the project in which to create the instance config. + * Values are of the form `projects/`. Please see + * {@see InstanceAdminClient::projectName()} for help formatting this field. + * @param string $instanceConfigId The ID of the instance config 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..fff4f05b1fa6 --- /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][google.longrunning.Operation.metadata] field type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if + * successful. + * + * @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..2b206018d034 --- /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..c8d25b9dee97 --- /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][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that have completed/failed/canceled within the last 7 days, + * and pending operations. Operations returned are ordered by + * `operation.metadata.value.start_time` in descending order starting + * from the most recently started operation. + * + * @param string $formattedParent The project of the instance config 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..73a03f5278ef --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_configs.php @@ -0,0 +1,78 @@ +`. 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..19aa6a4c874e --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_partition_operations.php @@ -0,0 +1,91 @@ +/instances//instancePartitions//operations/`. + * The long-running operation + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that have completed/failed/canceled within the last 7 days, + * and pending operations. Operations returned are ordered by + * `operation.metadata.value.start_time` in descending order starting from the + * most recently started operation. + * + * Authorization requires `spanner.instancePartitionOperations.list` + * permission on the resource + * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]. + * + * @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..ca352433324b --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_partitions.php @@ -0,0 +1,77 @@ +/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/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..ed51a424240f --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance.php @@ -0,0 +1,146 @@ +/operations/` and + * can be used to track the instance modification. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Instance][google.spanner.admin.instance.v1.Instance], if successful. + * + * Authorization requires `spanner.instances.update` permission on + * the resource [name][google.spanner.admin.instance.v1.Instance.name]. + * + * @param 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..a8c280ab3ac9 --- /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 config modification. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if + * successful. + * + * Authorization requires `spanner.instanceConfigs.update` permission on + * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. + * + * 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..c4808d970488 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance_partition.php @@ -0,0 +1,156 @@ +/operations/` and can be used to + * track the instance partition modification. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if + * successful. + * + * Authorization requires `spanner.instancePartitions.update` permission on + * the resource + * [name][google.spanner.admin.instance.v1.InstancePartition.name]. + * + * @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..c3f32b5e509c --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/Client/InstanceAdminClient.php @@ -0,0 +1,1216 @@ + 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. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $options = $options + $this->getDefaultEmulatorConfig(); + $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][google.longrunning.Operation] + * can be used to track the progress of preparing the new + * instance. The instance name is assigned by the caller. If the + * named instance already exists, `CreateInstance` returns + * `ALREADY_EXISTS`. + * + * Immediately upon completion of this request: + * + * * The instance is readable via the API, with all requested attributes + * but no allocated resources. Its state is `CREATING`. + * + * Until completion of the returned operation: + * + * * Cancelling the operation renders the instance immediately unreadable + * via the API. + * * The instance can be deleted. + * * All other attempts to modify the instance are rejected. + * + * Upon completion of the returned operation: + * + * * Billing for all successfully-allocated resources begins (some types + * may have lower than the requested levels). + * * Databases can be created in the instance. + * * The instance's allocated resource levels are readable via the API. + * * The instance's state becomes `READY`. + * + * The returned [long-running operation][google.longrunning.Operation] will + * have a name of the format `/operations/` and + * can be used to track creation of the instance. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Instance][google.spanner.admin.instance.v1.Instance], if successful. + * + * 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 config and begins preparing it to be used. The + * returned [long-running operation][google.longrunning.Operation] + * can be used to track the progress of preparing the new + * instance config. The instance config name is assigned by the caller. If the + * named instance config already exists, `CreateInstanceConfig` returns + * `ALREADY_EXISTS`. + * + * Immediately after the request returns: + * + * * The instance config is readable via the API, with all requested + * attributes. The instance config's + * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] + * field is set to true. Its state is `CREATING`. + * + * While the operation is pending: + * + * * Cancelling the operation renders the instance config immediately + * unreadable via the API. + * * Except for deleting the creating resource, all other attempts to modify + * the instance config are rejected. + * + * Upon completion of the returned operation: + * + * * Instances can be created using the instance configuration. + * * The instance config's + * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] + * field becomes false. Its state becomes `READY`. + * + * The returned [long-running operation][google.longrunning.Operation] will + * have a name of the format + * `/operations/` and can be used to track + * creation of the instance config. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if + * successful. + * + * Authorization requires `spanner.instanceConfigs.create` permission on + * the resource + * [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.parent]. + * + * 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][google.longrunning.Operation] + * can be used to track the progress of preparing the new instance partition. + * The instance partition name is assigned by the caller. If the named + * instance partition already exists, `CreateInstancePartition` returns + * `ALREADY_EXISTS`. + * + * Immediately upon completion of this request: + * + * * The instance partition is readable via the API, with all requested + * attributes but no allocated resources. Its state is `CREATING`. + * + * Until completion of the returned operation: + * + * * Cancelling the operation renders the instance partition immediately + * unreadable via the API. + * * The instance partition can be deleted. + * * All other attempts to modify the instance partition are rejected. + * + * Upon completion of the returned operation: + * + * * Billing for all successfully-allocated resources begins (some types + * may have lower than the requested levels). + * * Databases can start using this instance partition. + * * The instance partition's allocated resource levels are readable via the + * API. + * * The instance partition's state becomes `READY`. + * + * The returned [long-running operation][google.longrunning.Operation] will + * have a name of the format + * `/operations/` and can be used to + * track creation of the instance partition. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if + * successful. + * + * 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 config. Deletion is only allowed when no + * instances are using the configuration. If any instances are using + * the config, returns `FAILED_PRECONDITION`. + * + * Only user managed configurations can be deleted. + * + * Authorization requires `spanner.instanceConfigs.delete` permission on + * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. + * + * 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 config [long-running + * operations][google.longrunning.Operation] in the given project. An instance + * config operation has a name of the form + * `projects//instanceConfigs//operations/`. + * The long-running operation + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that have completed/failed/canceled within the last 7 days, + * and pending operations. Operations returned are ordered by + * `operation.metadata.value.start_time` in descending order starting + * from the most recently started operation. + * + * 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. + * + * 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][google.longrunning.Operation] in the given instance. + * An instance partition operation has a name of the form + * `projects//instances//instancePartitions//operations/`. + * The long-running operation + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that have completed/failed/canceled within the last 7 days, + * and pending operations. Operations returned are ordered by + * `operation.metadata.value.start_time` in descending order starting from the + * most recently started operation. + * + * Authorization requires `spanner.instancePartitionOperations.list` + * permission on the resource + * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]. + * + * 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); + } + + /** + * 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][google.longrunning.Operation] can be used to track the + * progress of updating the instance. If the named instance does not + * exist, returns `NOT_FOUND`. + * + * Immediately upon completion of this request: + * + * * For resource types for which a decrease in the instance's allocation + * has been requested, billing is based on the newly-requested level. + * + * Until completion of the returned operation: + * + * * Cancelling the operation sets its metadata's + * [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time], + * and begins restoring resources to their pre-request values. The + * operation is guaranteed to succeed at undoing all resource changes, + * after which point it terminates with a `CANCELLED` status. + * * All other attempts to modify the instance are rejected. + * * Reading the instance via the API continues to give the pre-request + * resource levels. + * + * Upon completion of the returned operation: + * + * * Billing begins for all successfully-allocated resources (some types + * may have lower than the requested levels). + * * All newly-reserved resources are available for serving the instance's + * tables. + * * The instance's new resource levels are readable via the API. + * + * The returned [long-running operation][google.longrunning.Operation] will + * have a name of the format `/operations/` and + * can be used to track the instance modification. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Instance][google.spanner.admin.instance.v1.Instance], if successful. + * + * Authorization requires `spanner.instances.update` permission on + * the resource [name][google.spanner.admin.instance.v1.Instance.name]. + * + * 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 config. The returned + * [long-running operation][google.longrunning.Operation] can be used to track + * the progress of updating the instance. If the named instance config does + * not exist, returns `NOT_FOUND`. + * + * Only user managed configurations can be updated. + * + * Immediately after the request returns: + * + * * The instance config's + * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] + * field is set to true. + * + * While the operation is pending: + * + * * Cancelling the operation sets its metadata's + * [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.cancel_time]. + * The operation is guaranteed to succeed at undoing all changes, after + * which point it terminates with a `CANCELLED` status. + * * All other attempts to modify the instance config are rejected. + * * Reading the instance config via the API continues to give the + * pre-request values. + * + * Upon completion of the returned operation: + * + * * Creating instances using the instance configuration uses the new + * values. + * * The instance config's new values are readable via the API. + * * The instance config's + * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] + * field becomes false. + * + * The returned [long-running operation][google.longrunning.Operation] will + * have a name of the format + * `/operations/` and can be used to track + * the instance config modification. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if + * successful. + * + * Authorization requires `spanner.instanceConfigs.update` permission on + * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. + * + * 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][google.longrunning.Operation] can be used to track the + * progress of updating the instance partition. If the named instance + * partition does not exist, returns `NOT_FOUND`. + * + * Immediately upon completion of this request: + * + * * For resource types for which a decrease in the instance partition's + * allocation has been requested, billing is based on the newly-requested + * level. + * + * Until completion of the returned operation: + * + * * Cancelling the operation sets its metadata's + * [cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time], + * and begins restoring resources to their pre-request values. The + * operation is guaranteed to succeed at undoing all resource changes, + * after which point it terminates with a `CANCELLED` status. + * * All other attempts to modify the instance partition are rejected. + * * Reading the instance partition via the API continues to give the + * pre-request resource levels. + * + * Upon completion of the returned operation: + * + * * Billing begins for all successfully-allocated resources (some types + * may have lower than the requested levels). + * * All newly-reserved resources are available for serving the instance + * partition's tables. + * * The instance partition's new resource levels are readable via the API. + * + * The returned [long-running operation][google.longrunning.Operation] will + * have a name of the format + * `/operations/` and can be used to + * track the instance partition modification. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if + * successful. + * + * Authorization requires `spanner.instancePartitions.update` permission on + * the resource + * [name][google.spanner.admin.instance.v1.InstancePartition.name]. + * + * 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 getDefaultEmulatorConfig(): array + { + $emulatorHost = getenv('SPANNER_EMULATOR_HOST'); + if (empty($emulatorHost)) { + return []; + } + + if ($scheme = parse_url($emulatorHost, PHP_URL_SCHEME)) { + $search = $scheme . '://'; + $emulatorHost = str_replace($search, '', $emulatorHost); + } + + return [ + 'apiEndpoint' => $emulatorHost, + 'transportConfig' => [ + 'grpc' => [ + 'stubOpts' => [ + 'credentials' => ChannelCredentials::createInsecure(), + ], + ], + ], + 'credentials' => new InsecureCredentialsWrapper(), + ]; + } +} 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..2c06f15f3c6c --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/Gapic/InstanceAdminGapicClient.php @@ -0,0 +1,2144 @@ +projectName('[PROJECT]'); + * $instanceId = 'instance_id'; + * $instance = new Instance(); + * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'createInstance'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * @deprecated Please use the new service client {@see \Google\Cloud\Spanner\Admin\Instance\V1\Client\InstanceAdminClient}. + */ +class InstanceAdminGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.spanner.admin.instance.v1.InstanceAdmin'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + const SERVICE_ADDRESS = 'spanner.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'spanner.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/spanner.admin', + ]; + + private static $instanceNameTemplate; + + private static $instanceConfigNameTemplate; + + private static $instancePartitionNameTemplate; + + private static $projectNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/instance_admin_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/instance_admin_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/instance_admin_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/instance_admin_rest_client_config.php', + ], + ], + ]; + } + + private static function getInstanceNameTemplate() + { + if (self::$instanceNameTemplate == null) { + self::$instanceNameTemplate = new PathTemplate('projects/{project}/instances/{instance}'); + } + + return self::$instanceNameTemplate; + } + + private static function getInstanceConfigNameTemplate() + { + if (self::$instanceConfigNameTemplate == null) { + self::$instanceConfigNameTemplate = new PathTemplate('projects/{project}/instanceConfigs/{instance_config}'); + } + + return self::$instanceConfigNameTemplate; + } + + private static function getInstancePartitionNameTemplate() + { + if (self::$instancePartitionNameTemplate == null) { + self::$instancePartitionNameTemplate = new PathTemplate('projects/{project}/instances/{instance}/instancePartitions/{instance_partition}'); + } + + return self::$instancePartitionNameTemplate; + } + + private static function getProjectNameTemplate() + { + if (self::$projectNameTemplate == null) { + self::$projectNameTemplate = new PathTemplate('projects/{project}'); + } + + return self::$projectNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'instance' => self::getInstanceNameTemplate(), + 'instanceConfig' => self::getInstanceConfigNameTemplate(), + 'instancePartition' => self::getInstancePartitionNameTemplate(), + 'project' => self::getProjectNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a instance + * resource. + * + * @param string $project + * @param string $instance + * + * @return string The formatted instance resource. + */ + public static function instanceName($project, $instance) + { + return self::getInstanceNameTemplate()->render([ + 'project' => $project, + 'instance' => $instance, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * instance_config resource. + * + * @param string $project + * @param string $instanceConfig + * + * @return string The formatted instance_config resource. + */ + public static function instanceConfigName($project, $instanceConfig) + { + return self::getInstanceConfigNameTemplate()->render([ + 'project' => $project, + 'instance_config' => $instanceConfig, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * instance_partition resource. + * + * @param string $project + * @param string $instance + * @param string $instancePartition + * + * @return string The formatted instance_partition resource. + */ + public static function instancePartitionName($project, $instance, $instancePartition) + { + return self::getInstancePartitionNameTemplate()->render([ + 'project' => $project, + 'instance' => $instance, + 'instance_partition' => $instancePartition, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName($project) + { + return self::getProjectNameTemplate()->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - instance: projects/{project}/instances/{instance} + * - instanceConfig: projects/{project}/instanceConfigs/{instance_config} + * - instancePartition: projects/{project}/instances/{instance}/instancePartitions/{instance_partition} + * - project: projects/{project} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'spanner.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Creates an instance and begins preparing it to begin serving. The + * returned [long-running operation][google.longrunning.Operation] + * can be used to track the progress of preparing the new + * instance. The instance name is assigned by the caller. If the + * named instance already exists, `CreateInstance` returns + * `ALREADY_EXISTS`. + * + * Immediately upon completion of this request: + * + * * The instance is readable via the API, with all requested attributes + * but no allocated resources. Its state is `CREATING`. + * + * Until completion of the returned operation: + * + * * Cancelling the operation renders the instance immediately unreadable + * via the API. + * * The instance can be deleted. + * * All other attempts to modify the instance are rejected. + * + * Upon completion of the returned operation: + * + * * Billing for all successfully-allocated resources begins (some types + * may have lower than the requested levels). + * * Databases can be created in the instance. + * * The instance's allocated resource levels are readable via the API. + * * The instance's state becomes `READY`. + * + * The returned [long-running operation][google.longrunning.Operation] will + * have a name of the format `/operations/` and + * can be used to track creation of the instance. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Instance][google.spanner.admin.instance.v1.Instance], if successful. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedParent = $instanceAdminClient->projectName('[PROJECT]'); + * $instanceId = 'instance_id'; + * $instance = new Instance(); + * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'createInstance'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the project in which to create the instance. Values + * are of the form `projects/`. + * @param string $instanceId Required. The ID of the instance to create. Valid identifiers are of the + * form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in + * length. + * @param Instance $instance Required. The instance to create. The name may be omitted, but if + * specified must be `/instances/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createInstance($parent, $instanceId, $instance, array $optionalArgs = []) + { + $request = new CreateInstanceRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setInstanceId($instanceId); + $request->setInstance($instance); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateInstance', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates an instance config and begins preparing it to be used. The + * returned [long-running operation][google.longrunning.Operation] + * can be used to track the progress of preparing the new + * instance config. The instance config name is assigned by the caller. If the + * named instance config already exists, `CreateInstanceConfig` returns + * `ALREADY_EXISTS`. + * + * Immediately after the request returns: + * + * * The instance config is readable via the API, with all requested + * attributes. The instance config's + * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] + * field is set to true. Its state is `CREATING`. + * + * While the operation is pending: + * + * * Cancelling the operation renders the instance config immediately + * unreadable via the API. + * * Except for deleting the creating resource, all other attempts to modify + * the instance config are rejected. + * + * Upon completion of the returned operation: + * + * * Instances can be created using the instance configuration. + * * The instance config's + * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] + * field becomes false. Its state becomes `READY`. + * + * The returned [long-running operation][google.longrunning.Operation] will + * have a name of the format + * `/operations/` and can be used to track + * creation of the instance config. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if + * successful. + * + * Authorization requires `spanner.instanceConfigs.create` permission on + * the resource + * [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.parent]. + * + * 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 config. + * Values are of the form `projects/`. + * @param string $instanceConfigId Required. The ID of the instance config to create. Valid identifiers are + * of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + * characters in length. The `custom-` prefix is required to avoid name + * conflicts with Google managed configurations. + * @param InstanceConfig $instanceConfig Required. The InstanceConfig proto of the configuration to create. + * instance_config.name must be + * `/instanceConfigs/`. + * instance_config.base_config must be a Google managed configuration name, + * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * An option to validate, but not actually execute, a request, + * and provide the same response. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createInstanceConfig($parent, $instanceConfigId, $instanceConfig, array $optionalArgs = []) + { + $request = new CreateInstanceConfigRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setInstanceConfigId($instanceConfigId); + $request->setInstanceConfig($instanceConfig); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateInstanceConfig', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates an instance partition and begins preparing it to be used. The + * returned [long-running operation][google.longrunning.Operation] + * can be used to track the progress of preparing the new instance partition. + * The instance partition name is assigned by the caller. If the named + * instance partition already exists, `CreateInstancePartition` returns + * `ALREADY_EXISTS`. + * + * Immediately upon completion of this request: + * + * * The instance partition is readable via the API, with all requested + * attributes but no allocated resources. Its state is `CREATING`. + * + * Until completion of the returned operation: + * + * * Cancelling the operation renders the instance partition immediately + * unreadable via the API. + * * The instance partition can be deleted. + * * All other attempts to modify the instance partition are rejected. + * + * Upon completion of the returned operation: + * + * * Billing for all successfully-allocated resources begins (some types + * may have lower than the requested levels). + * * Databases can start using this instance partition. + * * The instance partition's allocated resource levels are readable via the + * API. + * * The instance partition's state becomes `READY`. + * + * The returned [long-running operation][google.longrunning.Operation] will + * have a name of the format + * `/operations/` and can be used to + * track creation of the instance partition. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if + * successful. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedParent = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); + * $instancePartitionId = 'instance_partition_id'; + * $instancePartition = new InstancePartition(); + * $operationResponse = $instanceAdminClient->createInstancePartition($formattedParent, $instancePartitionId, $instancePartition); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $instanceAdminClient->createInstancePartition($formattedParent, $instancePartitionId, $instancePartition); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'createInstancePartition'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the instance in which to create the instance + * partition. Values are of the form + * `projects//instances/`. + * @param string $instancePartitionId Required. The ID of the instance partition to create. Valid identifiers are + * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 + * characters in length. + * @param InstancePartition $instancePartition Required. The instance partition to create. The instance_partition.name may + * be omitted, but if specified must be + * `/instancePartitions/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createInstancePartition($parent, $instancePartitionId, $instancePartition, array $optionalArgs = []) + { + $request = new CreateInstancePartitionRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setInstancePartitionId($instancePartitionId); + $request->setInstancePartition($instancePartition); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateInstancePartition', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes an instance. + * + * Immediately upon completion of the request: + * + * * Billing ceases for all of the instance's reserved resources. + * + * Soon afterward: + * + * * The instance and *all of its databases* immediately and + * irrevocably disappear from the API. All data in the databases + * is permanently deleted. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedName = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); + * $instanceAdminClient->deleteInstance($formattedName); + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the instance to be deleted. Values are of the form + * `projects//instances/` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteInstance($name, array $optionalArgs = []) + { + $request = new DeleteInstanceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteInstance', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes the instance config. Deletion is only allowed when no + * instances are using the configuration. If any instances are using + * the config, returns `FAILED_PRECONDITION`. + * + * Only user managed configurations can be deleted. + * + * Authorization requires `spanner.instanceConfigs.delete` permission on + * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. + * + * 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 config from overwriting each + * other. If not empty, the API + * only deletes the instance config when the etag provided matches the current + * status of the requested instance config. Otherwise, deletes the instance + * config without checking the current status of the requested instance + * config. + * @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 config [long-running + * operations][google.longrunning.Operation] in the given project. An instance + * config operation has a name of the form + * `projects//instanceConfigs//operations/`. + * The long-running operation + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that have completed/failed/canceled within the last 7 days, + * and pending operations. Operations returned are ordered by + * `operation.metadata.value.start_time` in descending order starting + * from the most recently started operation. + * + * 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 config operations. + * Values are of the form `projects/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * An expression that filters the list of returned operations. + * + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * + * The following fields in the [Operation][google.longrunning.Operation] + * are eligible for filtering: + * + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata] + * is + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * + * Here are a few examples: + * + * * `done:true` - The operation is complete. + * * `(metadata.@type=` \ + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) + * AND` \ + * `(metadata.instance_config.name:custom-config) AND` \ + * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. + * * The instance config name contains "custom-config". + * * The operation started before 2021-03-28T14:50:00Z. + * * The operation resulted in an error. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listInstanceConfigOperations($parent, array $optionalArgs = []) + { + $request = new ListInstanceConfigOperationsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListInstanceConfigOperations', $optionalArgs, ListInstanceConfigOperationsResponse::class, $request); + } + + /** + * Lists the supported instance configurations for a given project. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedParent = $instanceAdminClient->projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $instanceAdminClient->listInstanceConfigs($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $instanceAdminClient->listInstanceConfigs($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the project for which a list of supported instance + * configurations is requested. Values are of the form + * `projects/`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listInstanceConfigs($parent, array $optionalArgs = []) + { + $request = new ListInstanceConfigsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListInstanceConfigs', $optionalArgs, ListInstanceConfigsResponse::class, $request); + } + + /** + * Lists instance partition [long-running + * operations][google.longrunning.Operation] in the given instance. + * An instance partition operation has a name of the form + * `projects//instances//instancePartitions//operations/`. + * The long-running operation + * [metadata][google.longrunning.Operation.metadata] field type + * `metadata.type_url` describes the type of the metadata. Operations returned + * include those that have completed/failed/canceled within the last 7 days, + * and pending operations. Operations returned are ordered by + * `operation.metadata.value.start_time` in descending order starting from the + * most recently started operation. + * + * Authorization requires `spanner.instancePartitionOperations.list` + * permission on the resource + * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedParent = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); + * // Iterate over pages of elements + * $pagedResponse = $instanceAdminClient->listInstancePartitionOperations($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $instanceAdminClient->listInstancePartitionOperations($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent instance of the instance partition operations. + * Values are of the form `projects//instances/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * Optional. An expression that filters the list of returned operations. + * + * A filter expression consists of a field name, a + * comparison operator, and a value for filtering. + * The value must be a string, a number, or a boolean. The comparison operator + * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. + * Colon `:` is the contains operator. Filter rules are not case sensitive. + * + * The following fields in the [Operation][google.longrunning.Operation] + * are eligible for filtering: + * + * * `name` - The name of the long-running operation + * * `done` - False if the operation is in progress, else true. + * * `metadata.@type` - the type of metadata. For example, the type string + * for + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] + * is + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. + * * `metadata.` - any field in metadata.value. + * `metadata.@type` must be specified first, if filtering on metadata + * fields. + * * `error` - Error associated with the long-running operation. + * * `response.@type` - the type of response. + * * `response.` - any field in response.value. + * + * You can combine multiple expressions by enclosing each expression in + * parentheses. By default, expressions are combined with AND logic. However, + * you can specify AND, OR, and NOT logic explicitly. + * + * Here are a few examples: + * + * * `done:true` - The operation is complete. + * * `(metadata.@type=` \ + * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) + * AND` \ + * `(metadata.instance_partition.name:custom-instance-partition) AND` \ + * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ + * `(error:*)` - Return operations where: + * * The operation's metadata type is + * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. + * * The instance partition name contains "custom-instance-partition". + * * The operation started before 2021-03-28T14:50:00Z. + * * The operation resulted in an error. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type Timestamp $instancePartitionDeadline + * Optional. Deadline used while retrieving metadata for instance partition + * operations. Instance partitions whose operation metadata cannot be + * retrieved within this deadline will be added to + * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in + * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listInstancePartitionOperations($parent, array $optionalArgs = []) + { + $request = new ListInstancePartitionOperationsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['instancePartitionDeadline'])) { + $request->setInstancePartitionDeadline($optionalArgs['instancePartitionDeadline']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListInstancePartitionOperations', $optionalArgs, ListInstancePartitionOperationsResponse::class, $request); + } + + /** + * Lists all instance partitions for the given instance. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedParent = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); + * // Iterate over pages of elements + * $pagedResponse = $instanceAdminClient->listInstancePartitions($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $instanceAdminClient->listInstancePartitions($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The instance whose instance partitions should be listed. Values + * are of the form `projects//instances/`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type Timestamp $instancePartitionDeadline + * Optional. Deadline used while retrieving metadata for instance partitions. + * Instance partitions whose metadata cannot be retrieved within this deadline + * will be added to + * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable] + * in + * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listInstancePartitions($parent, array $optionalArgs = []) + { + $request = new ListInstancePartitionsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['instancePartitionDeadline'])) { + $request->setInstancePartitionDeadline($optionalArgs['instancePartitionDeadline']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListInstancePartitions', $optionalArgs, ListInstancePartitionsResponse::class, $request); + } + + /** + * Lists all instances in the given project. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $formattedParent = $instanceAdminClient->projectName('[PROJECT]'); + * // Iterate over pages of elements + * $pagedResponse = $instanceAdminClient->listInstances($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $instanceAdminClient->listInstances($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the project for which a list of instances is + * requested. Values are of the form `projects/`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * + * * `name` + * * `display_name` + * * `labels.key` where key is the name of a label + * + * Some examples of using filters are: + * + * * `name:*` --> The instance has a name. + * * `name:Howl` --> The instance's name contains the string "howl". + * * `name:HOWL` --> Equivalent to above. + * * `NAME:howl` --> Equivalent to above. + * * `labels.env:*` --> The instance has the label "env". + * * `labels.env:dev` --> The instance has the label "env" and the value of + * the label contains the string "dev". + * * `name:howl labels.env:dev` --> The instance's name contains "howl" and + * it has the label "env" with its value + * containing "dev". + * @type Timestamp $instanceDeadline + * Deadline used while retrieving metadata for instances. + * Instances whose metadata cannot be retrieved within this deadline will be + * added to + * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable] + * in + * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listInstances($parent, array $optionalArgs = []) + { + $request = new ListInstancesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['instanceDeadline'])) { + $request->setInstanceDeadline($optionalArgs['instanceDeadline']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListInstances', $optionalArgs, ListInstancesResponse::class, $request); + } + + /** + * Sets the access control policy on an instance resource. Replaces any + * existing policy. + * + * Authorization requires `spanner.instances.setIamPolicy` on + * [resource][google.iam.v1.SetIamPolicyRequest.resource]. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $resource = 'resource'; + * $policy = new Policy(); + * $response = $instanceAdminClient->setIamPolicy($resource, $policy); + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\Policy + * + * @throws ApiException if the remote call fails + */ + public function setIamPolicy($resource, $policy, array $optionalArgs = []) + { + $request = new SetIamPolicyRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPolicy($policy); + $requestParamHeaders['resource'] = $resource; + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns permissions that the caller has on the specified instance resource. + * + * Attempting this RPC on a non-existent Cloud Spanner instance resource will + * result in a NOT_FOUND error if the user has `spanner.instances.list` + * permission on the containing Google Cloud Project. Otherwise returns an + * empty set of permissions. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $resource = 'resource'; + * $permissions = []; + * $response = $instanceAdminClient->testIamPermissions($resource, $permissions); + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param string $resource REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse + * + * @throws ApiException if the remote call fails + */ + public function testIamPermissions($resource, $permissions, array $optionalArgs = []) + { + $request = new TestIamPermissionsRequest(); + $requestParamHeaders = []; + $request->setResource($resource); + $request->setPermissions($permissions); + $requestParamHeaders['resource'] = $resource; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates an instance, and begins allocating or releasing resources + * as requested. The returned [long-running + * operation][google.longrunning.Operation] can be used to track the + * progress of updating the instance. If the named instance does not + * exist, returns `NOT_FOUND`. + * + * Immediately upon completion of this request: + * + * * For resource types for which a decrease in the instance's allocation + * has been requested, billing is based on the newly-requested level. + * + * Until completion of the returned operation: + * + * * Cancelling the operation sets its metadata's + * [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time], + * and begins restoring resources to their pre-request values. The + * operation is guaranteed to succeed at undoing all resource changes, + * after which point it terminates with a `CANCELLED` status. + * * All other attempts to modify the instance are rejected. + * * Reading the instance via the API continues to give the pre-request + * resource levels. + * + * Upon completion of the returned operation: + * + * * Billing begins for all successfully-allocated resources (some types + * may have lower than the requested levels). + * * All newly-reserved resources are available for serving the instance's + * tables. + * * The instance's new resource levels are readable via the API. + * + * The returned [long-running operation][google.longrunning.Operation] will + * have a name of the format `/operations/` and + * can be used to track the instance modification. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [Instance][google.spanner.admin.instance.v1.Instance], if successful. + * + * Authorization requires `spanner.instances.update` permission on + * the resource [name][google.spanner.admin.instance.v1.Instance.name]. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $instance = new Instance(); + * $fieldMask = new FieldMask(); + * $operationResponse = $instanceAdminClient->updateInstance($instance, $fieldMask); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $instanceAdminClient->updateInstance($instance, $fieldMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'updateInstance'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param Instance $instance Required. The instance to update, which must always include the instance + * name. Otherwise, only fields mentioned in + * [field_mask][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] + * need be included. + * @param FieldMask $fieldMask Required. A mask specifying which fields in + * [Instance][google.spanner.admin.instance.v1.Instance] should be updated. + * The field mask must always be specified; this prevents any future fields in + * [Instance][google.spanner.admin.instance.v1.Instance] from being erased + * accidentally by clients that do not know about them. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateInstance($instance, $fieldMask, array $optionalArgs = []) + { + $request = new UpdateInstanceRequest(); + $requestParamHeaders = []; + $request->setInstance($instance); + $request->setFieldMask($fieldMask); + $requestParamHeaders['instance.name'] = $instance->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateInstance', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates an instance config. The returned + * [long-running operation][google.longrunning.Operation] can be used to track + * the progress of updating the instance. If the named instance config does + * not exist, returns `NOT_FOUND`. + * + * Only user managed configurations can be updated. + * + * Immediately after the request returns: + * + * * The instance config's + * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] + * field is set to true. + * + * While the operation is pending: + * + * * Cancelling the operation sets its metadata's + * [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.cancel_time]. + * The operation is guaranteed to succeed at undoing all changes, after + * which point it terminates with a `CANCELLED` status. + * * All other attempts to modify the instance config are rejected. + * * Reading the instance config via the API continues to give the + * pre-request values. + * + * Upon completion of the returned operation: + * + * * Creating instances using the instance configuration uses the new + * values. + * * The instance config's new values are readable via the API. + * * The instance config's + * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] + * field becomes false. + * + * The returned [long-running operation][google.longrunning.Operation] will + * have a name of the format + * `/operations/` and can be used to track + * the instance config modification. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if + * successful. + * + * Authorization requires `spanner.instanceConfigs.update` permission on + * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. + * + * 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 config to update, which must always include the + * instance config name. Otherwise, only fields mentioned in + * [update_mask][google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask] + * need be included. To prevent conflicts of concurrent updates, + * [etag][google.spanner.admin.instance.v1.InstanceConfig.reconciling] can + * be used. + * @param FieldMask $updateMask Required. A mask specifying which fields in + * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] should be + * updated. The field mask must always be specified; this prevents any future + * fields in [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] + * from being erased accidentally by clients that do not know about them. Only + * display_name and labels can be updated. + * @param array $optionalArgs { + * Optional. + * + * @type bool $validateOnly + * An option to validate, but not actually execute, a request, + * and provide the same response. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateInstanceConfig($instanceConfig, $updateMask, array $optionalArgs = []) + { + $request = new UpdateInstanceConfigRequest(); + $requestParamHeaders = []; + $request->setInstanceConfig($instanceConfig); + $request->setUpdateMask($updateMask); + $requestParamHeaders['instance_config.name'] = $instanceConfig->getName(); + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateInstanceConfig', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates an instance partition, and begins allocating or releasing resources + * as requested. The returned [long-running + * operation][google.longrunning.Operation] can be used to track the + * progress of updating the instance partition. If the named instance + * partition does not exist, returns `NOT_FOUND`. + * + * Immediately upon completion of this request: + * + * * For resource types for which a decrease in the instance partition's + * allocation has been requested, billing is based on the newly-requested + * level. + * + * Until completion of the returned operation: + * + * * Cancelling the operation sets its metadata's + * [cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time], + * and begins restoring resources to their pre-request values. The + * operation is guaranteed to succeed at undoing all resource changes, + * after which point it terminates with a `CANCELLED` status. + * * All other attempts to modify the instance partition are rejected. + * * Reading the instance partition via the API continues to give the + * pre-request resource levels. + * + * Upon completion of the returned operation: + * + * * Billing begins for all successfully-allocated resources (some types + * may have lower than the requested levels). + * * All newly-reserved resources are available for serving the instance + * partition's tables. + * * The instance partition's new resource levels are readable via the API. + * + * The returned [long-running operation][google.longrunning.Operation] will + * have a name of the format + * `/operations/` and can be used to + * track the instance partition modification. The + * [metadata][google.longrunning.Operation.metadata] field type is + * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. + * The [response][google.longrunning.Operation.response] field type is + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if + * successful. + * + * Authorization requires `spanner.instancePartitions.update` permission on + * the resource + * [name][google.spanner.admin.instance.v1.InstancePartition.name]. + * + * Sample code: + * ``` + * $instanceAdminClient = new InstanceAdminClient(); + * try { + * $instancePartition = new InstancePartition(); + * $fieldMask = new FieldMask(); + * $operationResponse = $instanceAdminClient->updateInstancePartition($instancePartition, $fieldMask); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $instanceAdminClient->updateInstancePartition($instancePartition, $fieldMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'updateInstancePartition'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $instanceAdminClient->close(); + * } + * ``` + * + * @param InstancePartition $instancePartition Required. The instance partition to update, which must always include the + * instance partition name. Otherwise, only fields mentioned in + * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask] + * need be included. + * @param FieldMask $fieldMask Required. A mask specifying which fields in + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] + * should be updated. The field mask must always be specified; this prevents + * any future fields in + * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] + * from being erased accidentally by clients that do not know about them. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateInstancePartition($instancePartition, $fieldMask, array $optionalArgs = []) + { + $request = new UpdateInstancePartitionRequest(); + $requestParamHeaders = []; + $request->setInstancePartition($instancePartition); + $request->setFieldMask($fieldMask); + $requestParamHeaders['instance_partition.name'] = $instancePartition->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateInstancePartition', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } +} diff --git a/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', + ], + ], + ], + ], + '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..5016880cb8c3 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/resources/instance_admin_rest_client_config.php @@ -0,0 +1,331 @@ + [ + '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', + ], + ], + ], + ], + '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..953b7565ee51 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/tests/Unit/V1/Client/InstanceAdminClientTest.php @@ -0,0 +1,2037 @@ +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; + $expectedResponse = new InstanceConfig(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setBaseConfig($baseConfig); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $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; + $expectedResponse = new InstanceConfig(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setBaseConfig($baseConfig); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $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 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; + $expectedResponse = new InstanceConfig(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setBaseConfig($baseConfig); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $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..9a1611ceb073 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/Admin/Instance/v1/tests/Unit/V1/InstanceAdminClientTest.php @@ -0,0 +1,1827 @@ +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; + $expectedResponse = new InstanceConfig(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setBaseConfig($baseConfig); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $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; + $expectedResponse = new InstanceConfig(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setBaseConfig($baseConfig); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $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 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; + $expectedResponse = new InstanceConfig(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setBaseConfig($baseConfig); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $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 000000000000..46823eb678dc --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/CommitResponse.php @@ -0,0 +1,33 @@ +internalAddGeneratedFile( + ' +² +\'google/spanner/v1/commit_response.protogoogle.spanner.v1"² +CommitResponse4 +commit_timestamp ( 2.google.protobuf.TimestampC + commit_stats ( 2-.google.spanner.v1.CommitResponse.CommitStats% + CommitStats +mutation_count (B¶ +com.google.spanner.v1BCommitResponseProtoPZ5cloud.google.com/go/spanner/apiv1/spannerpb;spannerpbªGoogle.Cloud.Spanner.V1ÊGoogle\\Cloud\\Spanner\\V1êGoogle::Cloud::Spanner::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + 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..2f63b0c51704ac35eabe39b9dac1ce59ebb6d5c1 GIT binary patch literal 1875 zcmbVN%Wl&^6vcfhos>r{LPJzwnpQNGibJSi;kF<`AyfhyNR$P#6iw_&YSppLc-&G@ zzlA+(B*Z7cj^E%5SaLnK$B_~NYBq^7=iE8>+{f%Z@(+EqiW}6WjBsk<-YMpX6#LBM zp6NNb7xw#wnLeQ@!kP`bKn=W*nN-IE&l@cNmC+z{ zcsHP26X6hY$&doTq`1+nzoeX4gcGA7m_{pR8lBoULZ(B40KX9tT9l)Y2*bw@dyZ}5 zfD;a1Yj)7JU7Op)u|I(HUEC*5K!H7u?T4<(ZO_FK;lMR%Wdp}CBkY>*L8`krmC}r| zhs=$Ams92v$JnER$!wo{tO-zEA5bnmi~gx>B-cja>^`o<8g+e4$*+l;sY5r&?Rf9li8L{W)5 z5ADSF$Cf2+eg^$lk;X(et)uTbRQ`A4sf#g2OPW(Vu9YUx-bJ2teJ~~N*V5{EXr5)B zfR-nKAiems{7FIcvWwLRC^t;HzNlcOlE1g6jY-oaKAjM?f@YX^5)`NKG;m5OM@$v8 zsrJGSc!xM4RqvwNsPls2v@Z||2kr4(6;I8*gHx*XYJdZEj^^gWEVsK)g3 z3+gRY$c`NEgtBfAV3sHh0P1-(F9G#03M#-mk=~PeTF+7vyQ`_Zy>B{RXr)kKRR^AY zJBV+?^O5lV-nRVpTTwnwEj7e@p*;~1TJfu)b!tD-6T=WkhI~=rN%=KZifOto4s|^t k>UyWvn-iXFt;_AQ887LPogP_fn-liAK*oFb44onL2hQhW+yDRo 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..c5904d92a6e986818242f4f20afd005295b8d52f GIT binary patch literal 11701 zcmdTKO>7%!bseXP{hS}?YudVQ)%DJnZML-bHd}U!+wQKNxQW{&_Bv^IyBJ1edy>p{ z>~UwtZL+Hf2_!ghT5&*#3(`sm5Fn6{xFK%9B5{CQ#bFPe7S0@yka*wUcl@YPJni zx6`TAd?~e3T1yq?i)$|+s$+HRx}HsKSk{KAXPmayLRy(eSLDw$qXp2?nmVr5_0&Q+ zzpT4jLvyw20z<2=a>YNk<7Ij-j7f9DNHHCl#iXr}Q2 za(y$ku9=RGxVvH3JFU8FSgjOAD7EVP%*!cGlfs^FTPWqtlw_n#1xKN)#g?nvEzPXX z>rUM^+OB1n5j30K&|Obm^vlf4Vp~eiSWnGx9<$k9Ox{enc1QQ`o=Vxe+p$~M8Q+w^ zj`yqjR5exStY*`2E2vVd<>=XLSGq2-AQHK@QO&hl7F8r-9t?5LH1w8xFq~V4ZZ`7z zruN9N?1Q1AblkfJmd-QZd1^eAsKY)^ao!&4=23ZM(fk zq_8w_`3*w^eXh~)V*D27y%{emX^dWgAD7|zeG(p-;s9xfr?&K?E6KA0M{64yOp`JO zd4^1$@~zfcpos;!6-8U8(WKTyI0=B$K1^H0j95A+mf9k(Wf~$d#QK^3b)CAtSd{#F z$PV*wu`1c}R$b}D0ze96x9b_26gy5IU7;FUEFPdciq(Kp(iA=?AQZv04Z0LI6m@^DND{^+R^95f+(Z}!ImVg24QB#*EVmn7jrfrdHEU2U(`1UfNrc=_LkOXu0+_xeBp5v#LrRmNDwcDd28N#GZ+ZPeHV;ZRo0ljUw~yV}t;(PpQ7b*++ikWF9w81FH*WJFvxL;**w>&uC~F{7Nx@YGALW1fge@A1`!W40n_D5 zu~aFp-B<6ftdTpeOxRqEXKpi zXTxxO-muYW^+rY48dAmz#En+n>@;-M*4ubI&>R*VvDw!GWDTH@E^_pWz+QZgAWeO% zk0#I4gVHQ;^e)Zh&qELwf3Bj@S^t9Sh?rKL^{67EZ^JMxK1|yavo{75p`UP?HaW_5 z7^eS|X^5}gFBkeuF#%91RSGfeA|ZmSK$(P}0pL8|gdavdi7wD~{bBM%S}!a2(CM_{V3 zrPn(cn-5J{WMB8!E%f>PfGLe!hnO#Dm|Ve?%GcX+C$Vhwk+Ad7B6XAn|^7z0$PPdQj>sHLt-Xjvp4T}kf}HeIG0Q1@|o!Njsf+p8uP zJC-qNg&MNWoDDKVvN=c0knG4BPqa%hDbx0aI}UhDNHg7 zLH$QS(!utL(1NPgEDL)Gy~RB~jx-|45{xnJNOn)d6y2nW#miPPLTDE%(#3f=+g+mV zH5N{z?qIE{Kfr>=lXmhp=GZ=S_OuZ%`P&GeJNX=hdIIe)lr%)UrUMvRDOHwpOPJat zFkD{BtzagJ!DzWsx>Z~%#D|n04#P>|U92aZZyr6K-a0}&@eo=9pxV-#ILUA@wrE_u z8esfj&eN+Bms2CsQEA%{=HCK*jCOjl+5LSi`OgqUy)9${;Aaea81N?mUY7Pu0PprD z050gBPtB?OkM0(L)eo_+tL2<|7#`87&tn> z(;sV|dB(tUXS5pn7C(HDNf^c1d#BmrbvsHjFp4KXI^AH$!`STU043r?4+m?UV4(hK zEgek%%6W)-DhsO8G%&`L4`9lJ!XRXmXdH0h>B@@~-XR7>t%pfo4a(`~0wnbHNXoyC zLF{v3%;`R3aswUMqUa(f_5p5!Hb`M??0b7MYTL0OOVLhgj0BXVqqjX1NIJNg9lY(K zty6^DgotG~u*IouCuk!y5jf28nLAyg;Q4K;%n*4KqIi~ipl;&)HZjHUs}}^C+*YY>s! zkkfEtsWf*-T`aDw^&Q9Xkk(yVUCdSRyc|MX9`AlFygRpaceQwrwpD)$!Ku8yVYGbV z@C;JgDD5WkMo5&-F9hh%x1mVX+?fNsizc^08Xo08LohDyvarX;>FS}+S_znNyCYuJ z;K#@@Jk>A2Nylj6{UjgRb%9tCj?E4xEE2*NSk9v935@oRX95%@??}iQIL>eQR2%|h z^s2Nyp;?`J{WXZwzCx@tbW_`A(d|p`-linIZ}p6X+?FzwmNNT%h>>1?&3Kut-C-` zc?4X7=jGVQ-D;`pw$)VYn_7zw9$j0f=XGXtX1?S+jQ7yM3g~kyUNWENR$QT92jb^V zlwa%}SS!K0*YM1-L3&~wiN}Q(dUrS?GQ8Uf&lA15`0RHQIG^XYTjWO}3}Y13n`q)m zB|w=yAi@Wd-X6X-Q_Pc<@{^o**Yb_O{{6c{Zz@@OU*yfCZ;C0lley@dV_)=*uP=7T z*4fZS@+l6PncjMMameKWb_3uf(?O$-KyYps<^3nQlX8xJNsN#&^zr(HiFHT0bp)|$ z-RmJL;`c%T-I+W&A0SzGSqk(tD=a+8vFjJcYL;AMtkV0K0kq$}Gq|`zei4E(|6H8} z4Nd$2lDj}}>ID>vUhemp8{`NcL%xrW-7~5WcI+My$@EF7crSR^!vdvOofi+U&X3X1 z-T7Uhp}WhHtDt7wJ3=dO_qd~Q)B~D1t9t`f>W;s~h?8uvWQe60XR8CUyXSdP!)cOu zO`yETxL#9A%rlS3wU0++|CJE=9S+2W04&6DkVRgWw)G{gJ{YO+pqrOnpu&6aF+s}8 zoo673iHosTJc%Zc@1JCDDvCQQlUTjv`8} z@2o&o|Bn!i@UEMr0vwqyNxp-cN(mv{_6MOSxs>F+w+X)_TP^2FZbpIxcjH}9CijAp zKZ@MEqoLCNG6WIX8us)o!{2RQ|^(G{2 zwn%0I81Ds<><1Nm4^j?ll)H@Ql5+bfJh$bjhw(@`|20OnZ!=6efwj8_Mat9?S@``x7t+Ew?q={xP;u zkXJ&<$Dg2^if3oN?~wkI`^u*4ww-Jy^Z4;&;ZWWqCA^H?%+yV*)3{9E0=+kcjXhgQmwM3s`sQA-xPl~l;mjHEL+TG1!6Xfi#c`wS6er{Q^p}) o&6J<3jj#^z)eGJ`!b|)uu%Dl0WL*fgOPV0=FYOoB#j- 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..be467b14b3f65800f51d924335d6c3558e7c7cf9 GIT binary patch literal 1977 zcma)7+iu%N5RKGCaK^5!un6i3XtQw=SOHoJa^0e!;}+2+j?gF+BGm;70>p}3$wbLr zf?TFf3;#twArD0#+rP-CBfUrz_nbL%W_IS$58+t|_s9w3ETWRRWcrH8 zGe*KlNZ|;dOq1D+MZ^(7==m(t3F(>Sxj7;I-e7VUp|MCJhZ$rp#N21CIHVl8S})rz z8BrcnM|y(miVuL(fZ+*;k&{tp$Ru^Cq}GXoTH_3Aowknv9G}K9nJg&a4Jd=-N4`dNO2vm$2D4jdx4LHUAU=q z3GTnzttu*gJ*rfei6|to_TdgYcl^Xn(S^~dAEa4?<>y7h{-4PcHY#dEb$hwXQLYy4G(jWkA@zgCAD zCMoz_m30IC_ztwdjYz0)@CBz)& zE-oTnS9QEP(jn}ya~ya}vCk53b#5ZO>b8y;eIM!m1<8Zf=xVUEz3ilTG_>y~u zPHrht=`Gm8r*GlLl+8V!*I-?i4!}m7%jx`Ef!nx_Rt0qGOX}5x994e##_>hs7Kahn znu~Ht(a^&^m8TF+kIG+vS3f;bOG)o4_&8fl`f2-3@y4>$E2~^vxVPR`8yUdl5Ae$FCUGkzMdT&B-g9Qo%!^-h9GDUAq3$(`E->-~ zFY+wULET}$j{{_Rm%i=bKtQOfqNb`NxvJZJ>nQ=r2_!VF~bn)gbSYmk)J>8I<|$v$c)I} zh8=cn*N$w{u|E;LN2qT)AtuCWY=7ulk?pyN5>(g1#cec-NwFKgN9sF56BQaQnUrfN zZiEBZbc`wvt-$spFVF~76bCqp8%4hqx5sH|IJ=LEBaNasCGrSG!4Tigj!=N3Vc;Gx z-88^WyfS9=Nb+r?W@D#U#uw(5?FFKETh(n4R@AFwdt8Fl>&1#|WPZgs2hF$zU+3Z3 zzXr!Y8l4K`u?knEwLb|+)A8^Eq%E(9R}v^uEbKiMrl10aRS2Y<`Xwd#ec;U?Ft0n< z!I#*LI`o39Bndmew|ozq--CQedS{K%DTaPN1KnmQChQm%Y3L5Qi5|T*p1YD}8aHR~ zC_{>YR4xA)3hdf4ft~(GcO^sUxwS6T9rGe&9)|2l$s(}xd(g}(q&aW;Szif zGD=f_`3tqTc96h0^tffJ>X|F zeghCINoo>@k#t3E&Z@2epw&B*R7ujxEZNg+Wl|Z@Om?bL<#ZiH$f4??!b$U%=B&IW#jwrcMsy#x8(B3zk~{-k6lbSEB&0D7zR5sVuvFZ s_dB^dqKP6q6vZ)76wgZCId<{(x8isDa^xI$jOJdGVaSmc+`tXMU#Q)^p8x;= 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..5d54040d9d3b --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BeginTransactionRequest.php @@ -0,0 +1,188 @@ +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; + + /** + * @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. + * } + */ + 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; + } + +} + 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..41376b808da3 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitRequest.php @@ -0,0 +1,402 @@ +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; + 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. + * } + */ + 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; + } + + /** + * @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..8caa87b03c34 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitResponse.php @@ -0,0 +1,129 @@ +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; + + /** + * 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]. + * } + */ + 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; + } + +} + 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..ce0243d0d79d --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlRequest.php @@ -0,0 +1,275 @@ +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; + + /** + * 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. + * } + */ + 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; + } + +} + 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..4ca50513d3f4 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlResponse.php @@ -0,0 +1,167 @@ +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; + + /** + * 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. + * } + */ + 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; + } + +} + 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..f46ac1170929 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest.php @@ -0,0 +1,702 @@ +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; + + /** + * 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. + * } + */ + 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; + } + +} + 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..c1d1be3f1fa5 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest/QueryMode.php @@ -0,0 +1,66 @@ +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 both the query plan and the execution statistics along + * with the results. + * + * Generated from protobuf enum PROFILE = 2; + */ + const PROFILE = 2; + + private static $valueToName = [ + self::NORMAL => 'NORMAL', + self::PLAN => 'PLAN', + self::PROFILE => 'PROFILE', + ]; + + 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/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..a33584b6ad41 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartialResultSet.php @@ -0,0 +1,505 @@ +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; + + /** + * 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. + * } + */ + 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; + } + +} + 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..262ca6a04f1a --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSet.php @@ -0,0 +1,204 @@ +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; + + /** + * 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]. + * } + */ + 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; + } + +} + 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..fd5d1b31fb0e --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/StructType.php @@ -0,0 +1,87 @@ +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..3dc5882969d2 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Transaction.php @@ -0,0 +1,151 @@ +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; + + /** + * 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"`. + * } + */ + 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; + } + +} + 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; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $read_lock_mode + * Read lock mode for the transaction. + * } + */ + 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; + } + +} + +// 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..0293c37a2320 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Type.php @@ -0,0 +1,268 @@ +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..6575fb750544 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TypeAnnotationCode.php @@ -0,0 +1,84 @@ +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..21c35fb44bd8 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TypeCode.php @@ -0,0 +1,180 @@ +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; + + 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', + ]; + + 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..774c2ff9c152 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/src/V1/Client/SpannerClient.php @@ -0,0 +1,806 @@ + 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. + * + * @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); + } + + /** 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); + } +} 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..56ba10eb8e15 --- /dev/null +++ b/owl-bot-staging/Spanner/v1/src/V1/Gapic/SpannerGapicClient.php @@ -0,0 +1,1854 @@ +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 RetrySettings|array $retrySettings + * Retry settings to use for this 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']); + } + + $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 RetrySettings|array $retrySettings + * Retry settings to use for this 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']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('Commit', CommitResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a new session. A session can be used to perform + * transactions that read and/or modify data in a Cloud Spanner database. + * Sessions are meant to be reused for many consecutive + * transactions. + * + * Sessions can only execute one transaction at a time. To execute + * multiple concurrent read-write/write-only transactions, create + * multiple sessions. Note that standalone reads and queries use a + * transaction internally, and count toward the one transaction + * limit. + * + * Active sessions use additional server resources, so it is a good idea to + * delete idle and unneeded sessions. + * Aside from explicit deletes, Cloud Spanner may delete sessions for which no + * operations are sent for more than an hour. If a session is deleted, + * requests to it return `NOT_FOUND`. + * + * Idle sessions can be kept alive by sending a trivial SQL query + * periodically, e.g., `"SELECT 1"`. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedDatabase = $spannerClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + * $response = $spannerClient->createSession($formattedDatabase); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $database Required. The database in which the new session is created. + * @param array $optionalArgs { + * Optional. + * + * @type Session $session + * Required. The session to create. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\V1\Session + * + * @throws ApiException if the remote call fails + */ + public function createSession($database, array $optionalArgs = []) + { + $request = new CreateSessionRequest(); + $requestParamHeaders = []; + $request->setDatabase($database); + $requestParamHeaders['database'] = $database; + if (isset($optionalArgs['session'])) { + $request->setSession($optionalArgs['session']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateSession', Session::class, $optionalArgs, $request)->wait(); + } + + /** + * Ends a session, releasing server resources associated with it. This will + * asynchronously trigger cancellation of any operations that are running with + * this session. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedName = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $spannerClient->deleteSession($formattedName); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the session to delete. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteSession($name, array $optionalArgs = []) + { + $request = new DeleteSessionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteSession', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Executes a batch of SQL DML statements. This method allows many statements + * to be run with lower latency than submitting them sequentially with + * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. + * + * Statements are executed in sequential order. A request can succeed even if + * a statement fails. The + * [ExecuteBatchDmlResponse.status][google.spanner.v1.ExecuteBatchDmlResponse.status] + * field in the response provides information about the statement that failed. + * Clients must inspect this field to determine whether an error occurred. + * + * Execution stops after the first failed statement; the remaining statements + * are not executed. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $transaction = new TransactionSelector(); + * $statements = []; + * $seqno = 0; + * $response = $spannerClient->executeBatchDml($formattedSession, $transaction, $statements, $seqno); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $session Required. The session in which the DML statements should be performed. + * @param TransactionSelector $transaction Required. The transaction to use. Must be a read-write transaction. + * + * To protect against replays, single-use transactions are not supported. The + * caller must either supply an existing transaction ID or begin a new + * transaction. + * @param Statement[] $statements Required. The list of statements to execute in this batch. Statements are + * executed serially, such that the effects of statement `i` are visible to + * statement `i+1`. Each statement must be a DML statement. Execution stops at + * the first failed statement; the remaining statements are not executed. + * + * Callers must provide at least one statement. + * @param int $seqno Required. A per-transaction sequence number used to identify this request. + * This field makes each request idempotent such that if the request is + * received multiple times, at most one will succeed. + * + * The sequence number must be monotonically increasing within the + * transaction. If a request arrives for the first time with an out-of-order + * sequence number, the transaction may be aborted. Replays of previously + * handled requests will yield the same response as the first execution. + * @param array $optionalArgs { + * Optional. + * + * @type RequestOptions $requestOptions + * Common options for this request. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\V1\ExecuteBatchDmlResponse + * + * @throws ApiException if the remote call fails + */ + public function executeBatchDml($session, $transaction, $statements, $seqno, array $optionalArgs = []) + { + $request = new ExecuteBatchDmlRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setTransaction($transaction); + $request->setStatements($statements); + $request->setSeqno($seqno); + $requestParamHeaders['session'] = $session; + if (isset($optionalArgs['requestOptions'])) { + $request->setRequestOptions($optionalArgs['requestOptions']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ExecuteBatchDml', ExecuteBatchDmlResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Executes an SQL statement, returning all results in a single reply. This + * method cannot be used to return a result set larger than 10 MiB; + * if the query yields more data than that, the query fails with + * a `FAILED_PRECONDITION` error. + * + * Operations inside read-write transactions might return `ABORTED`. If + * this occurs, the application should restart the transaction from + * the beginning. See [Transaction][google.spanner.v1.Transaction] for more + * details. + * + * Larger result sets can be fetched in streaming fashion by calling + * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] + * instead. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $sql = 'sql'; + * $response = $spannerClient->executeSql($formattedSession, $sql); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $session Required. The session in which the SQL query should be performed. + * @param string $sql Required. The SQL string. + * @param array $optionalArgs { + * Optional. + * + * @type TransactionSelector $transaction + * The transaction to use. + * + * For queries, if none is provided, the default is a temporary read-only + * transaction with strong concurrency. + * + * Standard DML statements require a read-write transaction. To protect + * against replays, single-use transactions are not supported. The caller + * must either supply an existing transaction ID or begin a new transaction. + * + * Partitioned DML requires an existing Partitioned DML transaction ID. + * @type Struct $params + * Parameter names and values that bind to placeholders in the SQL string. + * + * A parameter placeholder consists of the `@` character followed by the + * parameter name (for example, `@firstName`). Parameter names must conform + * to the naming requirements of identifiers as specified at + * https://cloud.google.com/spanner/docs/lexical#identifiers. + * + * Parameters can appear anywhere that a literal value is expected. The same + * parameter name can be used more than once, for example: + * + * `"WHERE id > @msg_id AND id < @msg_id + 100"` + * + * It is an error to execute a SQL statement with unbound parameters. + * @type array $paramTypes + * It is not always possible for Cloud Spanner to infer the right SQL type + * from a JSON value. For example, values of type `BYTES` and values + * of type `STRING` both appear in + * [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings. + * + * In these cases, `param_types` can be used to specify the exact + * SQL type for some or all of the SQL statement parameters. See the + * definition of [Type][google.spanner.v1.Type] for more information + * about SQL types. + * @type string $resumeToken + * If this request is resuming a previously interrupted SQL statement + * execution, `resume_token` should be copied from the last + * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the + * interruption. Doing this enables the new SQL statement execution to resume + * where the last one left off. The rest of the request parameters must + * exactly match the request that yielded this token. + * @type int $queryMode + * Used to control the amount of debugging information returned in + * [ResultSetStats][google.spanner.v1.ResultSetStats]. If + * [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is + * set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only + * be set to + * [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL]. + * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryMode} + * @type string $partitionToken + * If present, results will be restricted to the specified partition + * previously created using PartitionQuery(). There must be an exact + * match for the values of fields common to this message and the + * PartitionQueryRequest message used to create this partition_token. + * @type int $seqno + * A per-transaction sequence number used to identify this request. This field + * makes each request idempotent such that if the request is received multiple + * times, at most one will succeed. + * + * The sequence number must be monotonically increasing within the + * transaction. If a request arrives for the first time with an out-of-order + * sequence number, the transaction may be aborted. Replays of previously + * handled requests will yield the same response as the first execution. + * + * Required for DML statements. Ignored for queries. + * @type QueryOptions $queryOptions + * Query optimizer configuration to use for the given query. + * @type RequestOptions $requestOptions + * Common options for this request. + * @type DirectedReadOptions $directedReadOptions + * Directed read options for this request. + * @type bool $dataBoostEnabled + * If this is for a partitioned query and this field is set to `true`, the + * request is executed with Spanner Data Boost independent compute resources. + * + * If the field is set to `true` but the request does not set + * `partition_token`, the API returns an `INVALID_ARGUMENT` error. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\V1\ResultSet + * + * @throws ApiException if the remote call fails + */ + public function executeSql($session, $sql, array $optionalArgs = []) + { + $request = new ExecuteSqlRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setSql($sql); + $requestParamHeaders['session'] = $session; + if (isset($optionalArgs['transaction'])) { + $request->setTransaction($optionalArgs['transaction']); + } + + if (isset($optionalArgs['params'])) { + $request->setParams($optionalArgs['params']); + } + + if (isset($optionalArgs['paramTypes'])) { + $request->setParamTypes($optionalArgs['paramTypes']); + } + + if (isset($optionalArgs['resumeToken'])) { + $request->setResumeToken($optionalArgs['resumeToken']); + } + + if (isset($optionalArgs['queryMode'])) { + $request->setQueryMode($optionalArgs['queryMode']); + } + + if (isset($optionalArgs['partitionToken'])) { + $request->setPartitionToken($optionalArgs['partitionToken']); + } + + if (isset($optionalArgs['seqno'])) { + $request->setSeqno($optionalArgs['seqno']); + } + + if (isset($optionalArgs['queryOptions'])) { + $request->setQueryOptions($optionalArgs['queryOptions']); + } + + if (isset($optionalArgs['requestOptions'])) { + $request->setRequestOptions($optionalArgs['requestOptions']); + } + + if (isset($optionalArgs['directedReadOptions'])) { + $request->setDirectedReadOptions($optionalArgs['directedReadOptions']); + } + + if (isset($optionalArgs['dataBoostEnabled'])) { + $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ExecuteSql', ResultSet::class, $optionalArgs, $request)->wait(); + } + + /** + * Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the + * result set as a stream. Unlike + * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there is no limit on + * the size of the returned result set. However, no individual row in the + * result set can exceed 100 MiB, and no column value can exceed 10 MiB. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $sql = 'sql'; + * // Read all responses until the stream is complete + * $stream = $spannerClient->executeStreamingSql($formattedSession, $sql); + * foreach ($stream->readAll() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $session Required. The session in which the SQL query should be performed. + * @param string $sql Required. The SQL string. + * @param array $optionalArgs { + * Optional. + * + * @type TransactionSelector $transaction + * The transaction to use. + * + * For queries, if none is provided, the default is a temporary read-only + * transaction with strong concurrency. + * + * Standard DML statements require a read-write transaction. To protect + * against replays, single-use transactions are not supported. The caller + * must either supply an existing transaction ID or begin a new transaction. + * + * Partitioned DML requires an existing Partitioned DML transaction ID. + * @type Struct $params + * Parameter names and values that bind to placeholders in the SQL string. + * + * A parameter placeholder consists of the `@` character followed by the + * parameter name (for example, `@firstName`). Parameter names must conform + * to the naming requirements of identifiers as specified at + * https://cloud.google.com/spanner/docs/lexical#identifiers. + * + * Parameters can appear anywhere that a literal value is expected. The same + * parameter name can be used more than once, for example: + * + * `"WHERE id > @msg_id AND id < @msg_id + 100"` + * + * It is an error to execute a SQL statement with unbound parameters. + * @type array $paramTypes + * It is not always possible for Cloud Spanner to infer the right SQL type + * from a JSON value. For example, values of type `BYTES` and values + * of type `STRING` both appear in + * [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings. + * + * In these cases, `param_types` can be used to specify the exact + * SQL type for some or all of the SQL statement parameters. See the + * definition of [Type][google.spanner.v1.Type] for more information + * about SQL types. + * @type string $resumeToken + * If this request is resuming a previously interrupted SQL statement + * execution, `resume_token` should be copied from the last + * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the + * interruption. Doing this enables the new SQL statement execution to resume + * where the last one left off. The rest of the request parameters must + * exactly match the request that yielded this token. + * @type int $queryMode + * Used to control the amount of debugging information returned in + * [ResultSetStats][google.spanner.v1.ResultSetStats]. If + * [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is + * set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only + * be set to + * [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL]. + * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryMode} + * @type string $partitionToken + * If present, results will be restricted to the specified partition + * previously created using PartitionQuery(). There must be an exact + * match for the values of fields common to this message and the + * PartitionQueryRequest message used to create this partition_token. + * @type int $seqno + * A per-transaction sequence number used to identify this request. This field + * makes each request idempotent such that if the request is received multiple + * times, at most one will succeed. + * + * The sequence number must be monotonically increasing within the + * transaction. If a request arrives for the first time with an out-of-order + * sequence number, the transaction may be aborted. Replays of previously + * handled requests will yield the same response as the first execution. + * + * Required for DML statements. Ignored for queries. + * @type QueryOptions $queryOptions + * Query optimizer configuration to use for the given query. + * @type RequestOptions $requestOptions + * Common options for this request. + * @type DirectedReadOptions $directedReadOptions + * Directed read options for this request. + * @type bool $dataBoostEnabled + * If this is for a partitioned query and this field is set to `true`, the + * request is executed with Spanner Data Boost independent compute resources. + * + * If the field is set to `true` but the request does not set + * `partition_token`, the API returns an `INVALID_ARGUMENT` error. + * @type int $timeoutMillis + * Timeout to use for this call. + * } + * + * @return \Google\ApiCore\ServerStream + * + * @throws ApiException if the remote call fails + */ + public function executeStreamingSql($session, $sql, array $optionalArgs = []) + { + $request = new ExecuteSqlRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setSql($sql); + $requestParamHeaders['session'] = $session; + if (isset($optionalArgs['transaction'])) { + $request->setTransaction($optionalArgs['transaction']); + } + + if (isset($optionalArgs['params'])) { + $request->setParams($optionalArgs['params']); + } + + if (isset($optionalArgs['paramTypes'])) { + $request->setParamTypes($optionalArgs['paramTypes']); + } + + if (isset($optionalArgs['resumeToken'])) { + $request->setResumeToken($optionalArgs['resumeToken']); + } + + if (isset($optionalArgs['queryMode'])) { + $request->setQueryMode($optionalArgs['queryMode']); + } + + if (isset($optionalArgs['partitionToken'])) { + $request->setPartitionToken($optionalArgs['partitionToken']); + } + + if (isset($optionalArgs['seqno'])) { + $request->setSeqno($optionalArgs['seqno']); + } + + if (isset($optionalArgs['queryOptions'])) { + $request->setQueryOptions($optionalArgs['queryOptions']); + } + + if (isset($optionalArgs['requestOptions'])) { + $request->setRequestOptions($optionalArgs['requestOptions']); + } + + if (isset($optionalArgs['directedReadOptions'])) { + $request->setDirectedReadOptions($optionalArgs['directedReadOptions']); + } + + if (isset($optionalArgs['dataBoostEnabled'])) { + $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ExecuteStreamingSql', PartialResultSet::class, $optionalArgs, $request, Call::SERVER_STREAMING_CALL); + } + + /** + * Gets a session. Returns `NOT_FOUND` if the session does not exist. + * This is mainly useful for determining whether a session is still + * alive. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedName = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $response = $spannerClient->getSession($formattedName); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the session to retrieve. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\V1\Session + * + * @throws ApiException if the remote call fails + */ + public function getSession($name, array $optionalArgs = []) + { + $request = new GetSessionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetSession', Session::class, $optionalArgs, $request)->wait(); + } + + /** + * Lists all sessions in a given database. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedDatabase = $spannerClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); + * // Iterate over pages of elements + * $pagedResponse = $spannerClient->listSessions($formattedDatabase); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $spannerClient->listSessions($formattedDatabase); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $database Required. The database in which to list sessions. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * An expression for filtering the results of the request. Filter rules are + * case insensitive. The fields eligible for filtering are: + * + * * `labels.key` where key is the name of a label + * + * Some examples of using filters are: + * + * * `labels.env:*` --> The session has the label "env". + * * `labels.env:dev` --> The session has the label "env" and the value of + * the label contains the string "dev". + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listSessions($database, array $optionalArgs = []) + { + $request = new ListSessionsRequest(); + $requestParamHeaders = []; + $request->setDatabase($database); + $requestParamHeaders['database'] = $database; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListSessions', $optionalArgs, ListSessionsResponse::class, $request); + } + + /** + * Creates a set of partition tokens that can be used to execute a query + * operation in parallel. Each of the returned partition tokens can be used + * by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to + * specify a subset of the query result to read. The same session and + * read-only transaction must be used by the PartitionQueryRequest used to + * create the partition tokens and the ExecuteSqlRequests that use the + * partition tokens. + * + * Partition tokens become invalid when the session used to create them + * is deleted, is idle for too long, begins a new transaction, or becomes too + * old. When any of these happen, it is not possible to resume the query, and + * the whole operation must be restarted from the beginning. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $sql = 'sql'; + * $response = $spannerClient->partitionQuery($formattedSession, $sql); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $session Required. The session used to create the partitions. + * @param string $sql Required. The query request to generate partitions for. The request will + * fail if the query is not root partitionable. For a query to be root + * partitionable, it needs to satisfy a few conditions. For example, if the + * query execution plan contains a distributed union operator, then it must be + * the first operator in the plan. For more information about other + * conditions, see [Read data in + * parallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel). + * + * The query request must not contain DML commands, such as INSERT, UPDATE, or + * DELETE. Use + * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] with a + * PartitionedDml transaction for large, partition-friendly DML operations. + * @param array $optionalArgs { + * Optional. + * + * @type TransactionSelector $transaction + * Read only snapshot transactions are supported, read/write and single use + * transactions are not. + * @type Struct $params + * Parameter names and values that bind to placeholders in the SQL string. + * + * A parameter placeholder consists of the `@` character followed by the + * parameter name (for example, `@firstName`). Parameter names can contain + * letters, numbers, and underscores. + * + * Parameters can appear anywhere that a literal value is expected. The same + * parameter name can be used more than once, for example: + * + * `"WHERE id > @msg_id AND id < @msg_id + 100"` + * + * It is an error to execute a SQL statement with unbound parameters. + * @type array $paramTypes + * It is not always possible for Cloud Spanner to infer the right SQL type + * from a JSON value. For example, values of type `BYTES` and values + * of type `STRING` both appear in + * [params][google.spanner.v1.PartitionQueryRequest.params] as JSON strings. + * + * In these cases, `param_types` can be used to specify the exact + * SQL type for some or all of the SQL query parameters. See the + * definition of [Type][google.spanner.v1.Type] for more information + * about SQL types. + * @type PartitionOptions $partitionOptions + * Additional options that affect how many partitions are created. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\V1\PartitionResponse + * + * @throws ApiException if the remote call fails + */ + public function partitionQuery($session, $sql, array $optionalArgs = []) + { + $request = new PartitionQueryRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setSql($sql); + $requestParamHeaders['session'] = $session; + if (isset($optionalArgs['transaction'])) { + $request->setTransaction($optionalArgs['transaction']); + } + + if (isset($optionalArgs['params'])) { + $request->setParams($optionalArgs['params']); + } + + if (isset($optionalArgs['paramTypes'])) { + $request->setParamTypes($optionalArgs['paramTypes']); + } + + if (isset($optionalArgs['partitionOptions'])) { + $request->setPartitionOptions($optionalArgs['partitionOptions']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('PartitionQuery', PartitionResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a set of partition tokens that can be used to execute a read + * operation in parallel. Each of the returned partition tokens can be used + * by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a + * subset of the read result to read. The same session and read-only + * transaction must be used by the PartitionReadRequest used to create the + * partition tokens and the ReadRequests that use the partition tokens. There + * are no ordering guarantees on rows returned among the returned partition + * tokens, or even within each individual StreamingRead call issued with a + * partition_token. + * + * Partition tokens become invalid when the session used to create them + * is deleted, is idle for too long, begins a new transaction, or becomes too + * old. When any of these happen, it is not possible to resume the read, and + * the whole operation must be restarted from the beginning. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $table = 'table'; + * $keySet = new KeySet(); + * $response = $spannerClient->partitionRead($formattedSession, $table, $keySet); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $session Required. The session used to create the partitions. + * @param string $table Required. The name of the table in the database to be read. + * @param KeySet $keySet Required. `key_set` identifies the rows to be yielded. `key_set` names the + * primary keys of the rows in + * [table][google.spanner.v1.PartitionReadRequest.table] to be yielded, unless + * [index][google.spanner.v1.PartitionReadRequest.index] is present. If + * [index][google.spanner.v1.PartitionReadRequest.index] is present, then + * [key_set][google.spanner.v1.PartitionReadRequest.key_set] instead names + * index keys in [index][google.spanner.v1.PartitionReadRequest.index]. + * + * It is not an error for the `key_set` to name rows that do not + * exist in the database. Read yields nothing for nonexistent rows. + * @param array $optionalArgs { + * Optional. + * + * @type TransactionSelector $transaction + * Read only snapshot transactions are supported, read/write and single use + * transactions are not. + * @type string $index + * If non-empty, the name of an index on + * [table][google.spanner.v1.PartitionReadRequest.table]. This index is used + * instead of the table primary key when interpreting + * [key_set][google.spanner.v1.PartitionReadRequest.key_set] and sorting + * result rows. See [key_set][google.spanner.v1.PartitionReadRequest.key_set] + * for further information. + * @type string[] $columns + * The columns of [table][google.spanner.v1.PartitionReadRequest.table] to be + * returned for each row matching this request. + * @type PartitionOptions $partitionOptions + * Additional options that affect how many partitions are created. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\V1\PartitionResponse + * + * @throws ApiException if the remote call fails + */ + public function partitionRead($session, $table, $keySet, array $optionalArgs = []) + { + $request = new PartitionReadRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setTable($table); + $request->setKeySet($keySet); + $requestParamHeaders['session'] = $session; + if (isset($optionalArgs['transaction'])) { + $request->setTransaction($optionalArgs['transaction']); + } + + if (isset($optionalArgs['index'])) { + $request->setIndex($optionalArgs['index']); + } + + if (isset($optionalArgs['columns'])) { + $request->setColumns($optionalArgs['columns']); + } + + if (isset($optionalArgs['partitionOptions'])) { + $request->setPartitionOptions($optionalArgs['partitionOptions']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('PartitionRead', PartitionResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Reads rows from the database using key lookups and scans, as a + * simple key/value style alternative to + * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be + * used to return a result set larger than 10 MiB; if the read matches more + * data than that, the read fails with a `FAILED_PRECONDITION` + * error. + * + * Reads inside read-write transactions might return `ABORTED`. If + * this occurs, the application should restart the transaction from + * the beginning. See [Transaction][google.spanner.v1.Transaction] for more + * details. + * + * Larger result sets can be yielded in streaming fashion by calling + * [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $table = 'table'; + * $columns = []; + * $keySet = new KeySet(); + * $response = $spannerClient->read($formattedSession, $table, $columns, $keySet); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $session Required. The session in which the read should be performed. + * @param string $table Required. The name of the table in the database to be read. + * @param string[] $columns Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be + * returned for each row matching this request. + * @param KeySet $keySet Required. `key_set` identifies the rows to be yielded. `key_set` names the + * primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to + * be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present. + * If [index][google.spanner.v1.ReadRequest.index] is present, then + * [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys + * in [index][google.spanner.v1.ReadRequest.index]. + * + * If the [partition_token][google.spanner.v1.ReadRequest.partition_token] + * field is empty, rows are yielded in table primary key order (if + * [index][google.spanner.v1.ReadRequest.index] is empty) or index key order + * (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the + * [partition_token][google.spanner.v1.ReadRequest.partition_token] field is + * not empty, rows will be yielded in an unspecified order. + * + * It is not an error for the `key_set` to name rows that do not + * exist in the database. Read yields nothing for nonexistent rows. + * @param array $optionalArgs { + * Optional. + * + * @type TransactionSelector $transaction + * The transaction to use. If none is provided, the default is a + * temporary read-only transaction with strong concurrency. + * @type string $index + * If non-empty, the name of an index on + * [table][google.spanner.v1.ReadRequest.table]. This index is used instead of + * the table primary key when interpreting + * [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows. + * See [key_set][google.spanner.v1.ReadRequest.key_set] for further + * information. + * @type int $limit + * If greater than zero, only the first `limit` rows are yielded. If `limit` + * is zero, the default is no limit. A limit cannot be specified if + * `partition_token` is set. + * @type string $resumeToken + * If this request is resuming a previously interrupted read, + * `resume_token` should be copied from the last + * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the + * interruption. Doing this enables the new read to resume where the last read + * left off. The rest of the request parameters must exactly match the request + * that yielded this token. + * @type string $partitionToken + * If present, results will be restricted to the specified partition + * previously created using PartitionRead(). There must be an exact + * match for the values of fields common to this message and the + * PartitionReadRequest message used to create this partition_token. + * @type RequestOptions $requestOptions + * Common options for this request. + * @type DirectedReadOptions $directedReadOptions + * Directed read options for this request. + * @type bool $dataBoostEnabled + * If this is for a partitioned read and this field is set to `true`, the + * request is executed with Spanner Data Boost independent compute resources. + * + * If the field is set to `true` but the request does not set + * `partition_token`, the API returns an `INVALID_ARGUMENT` error. + * @type int $orderBy + * Optional. Order for the returned rows. + * + * By default, Spanner will return result rows in primary key order except for + * PartitionRead requests. For applications that do not require rows to be + * returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting + * `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval, + * resulting in lower latencies in certain cases (e.g. bulk point lookups). + * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\OrderBy} + * @type int $lockHint + * Optional. Lock Hint for the request, it can only be used with read-write + * transactions. + * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\LockHint} + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Spanner\V1\ResultSet + * + * @throws ApiException if the remote call fails + */ + public function read($session, $table, $columns, $keySet, array $optionalArgs = []) + { + $request = new ReadRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setTable($table); + $request->setColumns($columns); + $request->setKeySet($keySet); + $requestParamHeaders['session'] = $session; + if (isset($optionalArgs['transaction'])) { + $request->setTransaction($optionalArgs['transaction']); + } + + if (isset($optionalArgs['index'])) { + $request->setIndex($optionalArgs['index']); + } + + if (isset($optionalArgs['limit'])) { + $request->setLimit($optionalArgs['limit']); + } + + if (isset($optionalArgs['resumeToken'])) { + $request->setResumeToken($optionalArgs['resumeToken']); + } + + if (isset($optionalArgs['partitionToken'])) { + $request->setPartitionToken($optionalArgs['partitionToken']); + } + + if (isset($optionalArgs['requestOptions'])) { + $request->setRequestOptions($optionalArgs['requestOptions']); + } + + if (isset($optionalArgs['directedReadOptions'])) { + $request->setDirectedReadOptions($optionalArgs['directedReadOptions']); + } + + if (isset($optionalArgs['dataBoostEnabled'])) { + $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + if (isset($optionalArgs['lockHint'])) { + $request->setLockHint($optionalArgs['lockHint']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('Read', ResultSet::class, $optionalArgs, $request)->wait(); + } + + /** + * Rolls back a transaction, releasing any locks it holds. It is a good + * idea to call this for any transaction that includes one or more + * [Read][google.spanner.v1.Spanner.Read] or + * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and ultimately + * decides not to commit. + * + * `Rollback` returns `OK` if it successfully aborts the transaction, the + * transaction was already aborted, or the transaction is not + * found. `Rollback` never returns `ABORTED`. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $transactionId = '...'; + * $spannerClient->rollback($formattedSession, $transactionId); + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $session Required. The session in which the transaction to roll back is running. + * @param string $transactionId Required. The transaction to roll back. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function rollback($session, $transactionId, array $optionalArgs = []) + { + $request = new RollbackRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setTransactionId($transactionId); + $requestParamHeaders['session'] = $session; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('Rollback', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Like [Read][google.spanner.v1.Spanner.Read], except returns the result set + * as a stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no + * limit on the size of the returned result set. However, no individual row in + * the result set can exceed 100 MiB, and no column value can exceed + * 10 MiB. + * + * Sample code: + * ``` + * $spannerClient = new SpannerClient(); + * try { + * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); + * $table = 'table'; + * $columns = []; + * $keySet = new KeySet(); + * // Read all responses until the stream is complete + * $stream = $spannerClient->streamingRead($formattedSession, $table, $columns, $keySet); + * foreach ($stream->readAll() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $spannerClient->close(); + * } + * ``` + * + * @param string $session Required. The session in which the read should be performed. + * @param string $table Required. The name of the table in the database to be read. + * @param string[] $columns Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be + * returned for each row matching this request. + * @param KeySet $keySet Required. `key_set` identifies the rows to be yielded. `key_set` names the + * primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to + * be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present. + * If [index][google.spanner.v1.ReadRequest.index] is present, then + * [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys + * in [index][google.spanner.v1.ReadRequest.index]. + * + * If the [partition_token][google.spanner.v1.ReadRequest.partition_token] + * field is empty, rows are yielded in table primary key order (if + * [index][google.spanner.v1.ReadRequest.index] is empty) or index key order + * (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the + * [partition_token][google.spanner.v1.ReadRequest.partition_token] field is + * not empty, rows will be yielded in an unspecified order. + * + * It is not an error for the `key_set` to name rows that do not + * exist in the database. Read yields nothing for nonexistent rows. + * @param array $optionalArgs { + * Optional. + * + * @type TransactionSelector $transaction + * The transaction to use. If none is provided, the default is a + * temporary read-only transaction with strong concurrency. + * @type string $index + * If non-empty, the name of an index on + * [table][google.spanner.v1.ReadRequest.table]. This index is used instead of + * the table primary key when interpreting + * [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows. + * See [key_set][google.spanner.v1.ReadRequest.key_set] for further + * information. + * @type int $limit + * If greater than zero, only the first `limit` rows are yielded. If `limit` + * is zero, the default is no limit. A limit cannot be specified if + * `partition_token` is set. + * @type string $resumeToken + * If this request is resuming a previously interrupted read, + * `resume_token` should be copied from the last + * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the + * interruption. Doing this enables the new read to resume where the last read + * left off. The rest of the request parameters must exactly match the request + * that yielded this token. + * @type string $partitionToken + * If present, results will be restricted to the specified partition + * previously created using PartitionRead(). There must be an exact + * match for the values of fields common to this message and the + * PartitionReadRequest message used to create this partition_token. + * @type RequestOptions $requestOptions + * Common options for this request. + * @type DirectedReadOptions $directedReadOptions + * Directed read options for this request. + * @type bool $dataBoostEnabled + * If this is for a partitioned read and this field is set to `true`, the + * request is executed with Spanner Data Boost independent compute resources. + * + * If the field is set to `true` but the request does not set + * `partition_token`, the API returns an `INVALID_ARGUMENT` error. + * @type int $orderBy + * Optional. Order for the returned rows. + * + * By default, Spanner will return result rows in primary key order except for + * PartitionRead requests. For applications that do not require rows to be + * returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting + * `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval, + * resulting in lower latencies in certain cases (e.g. bulk point lookups). + * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\OrderBy} + * @type int $lockHint + * Optional. Lock Hint for the request, it can only be used with read-write + * transactions. + * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\LockHint} + * @type int $timeoutMillis + * Timeout to use for this call. + * } + * + * @return \Google\ApiCore\ServerStream + * + * @throws ApiException if the remote call fails + */ + public function streamingRead($session, $table, $columns, $keySet, array $optionalArgs = []) + { + $request = new ReadRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setTable($table); + $request->setColumns($columns); + $request->setKeySet($keySet); + $requestParamHeaders['session'] = $session; + if (isset($optionalArgs['transaction'])) { + $request->setTransaction($optionalArgs['transaction']); + } + + if (isset($optionalArgs['index'])) { + $request->setIndex($optionalArgs['index']); + } + + if (isset($optionalArgs['limit'])) { + $request->setLimit($optionalArgs['limit']); + } + + if (isset($optionalArgs['resumeToken'])) { + $request->setResumeToken($optionalArgs['resumeToken']); + } + + if (isset($optionalArgs['partitionToken'])) { + $request->setPartitionToken($optionalArgs['partitionToken']); + } + + if (isset($optionalArgs['requestOptions'])) { + $request->setRequestOptions($optionalArgs['requestOptions']); + } + + if (isset($optionalArgs['directedReadOptions'])) { + $request->setDirectedReadOptions($optionalArgs['directedReadOptions']); + } + + if (isset($optionalArgs['dataBoostEnabled'])) { + $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + if (isset($optionalArgs['lockHint'])) { + $request->setLockHint($optionalArgs['lockHint']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('StreamingRead', PartialResultSet::class, $optionalArgs, $request, Call::SERVER_STREAMING_CALL); + } +} diff --git a/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 d239d44ebacfce2890149e16a6073f33c6a73b7f Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 24 May 2024 05:03:30 +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/V1/Spanner.php | Bin 11400 -> 11701 bytes Spanner/src/V1/Gapic/SpannerGapicClient.php | 42 + Spanner/src/V1/ReadRequest.php | 92 + .../src}/V1/ReadRequest/LockHint.php | 0 .../src}/V1/ReadRequest/OrderBy.php | 0 .../Spanner/Admin/Database/V1/Backup.php | Bin 5331 -> 0 bytes .../Spanner/Admin/Database/V1/Common.php | Bin 2220 -> 0 bytes .../Database/V1/SpannerDatabaseAdmin.php | Bin 11945 -> 0 bytes .../Spanner/Admin/Database/V1/Backup.php | 725 ------ .../Admin/Database/V1/Backup/State.php | 65 - .../Spanner/Admin/Database/V1/BackupInfo.php | 213 -- .../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 -- .../Database/V1/CreateDatabaseMetadata.php | 68 - .../Database/V1/CreateDatabaseRequest.php | 365 --- .../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 - .../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/GetBackupRequest.php | 92 - .../Database/V1/GetDatabaseDdlRequest.php | 92 - .../Database/V1/GetDatabaseDdlResponse.php | 122 - .../Admin/Database/V1/GetDatabaseRequest.php | 87 - .../V1/ListBackupOperationsRequest.php | 461 ---- .../V1/ListBackupOperationsResponse.php | 142 -- .../Admin/Database/V1/ListBackupsRequest.php | 329 --- .../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 -- .../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 - .../DatabaseAdminClient/create_database.php | 98 - .../V1/DatabaseAdminClient/delete_backup.php | 72 - .../V1/DatabaseAdminClient/drop_database.php | 73 - .../V1/DatabaseAdminClient/get_backup.php | 74 - .../V1/DatabaseAdminClient/get_database.php | 72 - .../DatabaseAdminClient/get_database_ddl.php | 75 - .../V1/DatabaseAdminClient/get_iam_policy.php | 78 - .../list_backup_operations.php | 86 - .../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 - .../DatabaseAdminClient/update_database.php | 126 - .../update_database_ddl.php | 91 - .../v1/src/V1/Client/DatabaseAdminClient.php | 1074 --------- .../v1/src/V1/DatabaseAdminClient.php | 34 - .../src/V1/Gapic/DatabaseAdminGapicClient.php | 2112 ---------------- .../Database/v1/src/V1/gapic_metadata.json | 118 - .../database_admin_client_config.json | 168 -- .../database_admin_descriptor_config.php | 359 --- .../database_admin_rest_client_config.php | 398 --- .../V1/Client/DatabaseAdminClientTest.php | 1972 --------------- .../tests/Unit/V1/DatabaseAdminClientTest.php | 1766 -------------- .../Spanner/Admin/Instance/V1/Common.php | Bin 1231 -> 0 bytes .../Instance/V1/SpannerInstanceAdmin.php | Bin 14756 -> 0 bytes .../Admin/Instance/V1/AutoscalingConfig.php | 121 - .../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 | 625 ----- .../Admin/Instance/V1/Instance/State.php | 67 - .../Admin/Instance/V1/InstanceConfig.php | 552 ----- .../Instance/V1/InstanceConfig/State.php | 65 - .../Admin/Instance/V1/InstanceConfig/Type.php | 64 - .../Admin/Instance/V1/InstancePartition.php | 559 ----- .../Instance/V1/InstancePartition/State.php | 67 - .../ListInstanceConfigOperationsRequest.php | 353 --- .../ListInstanceConfigOperationsResponse.php | 126 - .../V1/ListInstanceConfigsRequest.php | 176 -- .../V1/ListInstanceConfigsResponse.php | 110 - ...ListInstancePartitionOperationsRequest.php | 413 ---- ...istInstancePartitionOperationsResponse.php | 172 -- .../V1/ListInstancePartitionsRequest.php | 235 -- .../V1/ListInstancePartitionsResponse.php | 156 -- .../Instance/V1/ListInstancesRequest.php | 329 --- .../Instance/V1/ListInstancesResponse.php | 156 -- .../Admin/Instance/V1/OperationProgress.php | 164 -- .../Spanner/Admin/Instance/V1/ReplicaInfo.php | 145 -- .../Instance/V1/ReplicaInfo/ReplicaType.php | 87 - .../V1/UpdateInstanceConfigMetadata.php | 174 -- .../V1/UpdateInstanceConfigRequest.php | 225 -- .../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 | 78 - .../list_instance_partition_operations.php | 91 - .../list_instance_partitions.php | 77 - .../V1/InstanceAdminClient/list_instances.php | 77 - .../V1/InstanceAdminClient/set_iam_policy.php | 77 - .../test_iam_permissions.php | 83 - .../InstanceAdminClient/update_instance.php | 146 -- .../update_instance_config.php | 117 - .../update_instance_partition.php | 156 -- .../v1/src/V1/Client/InstanceAdminClient.php | 1216 ---------- .../src/V1/Gapic/InstanceAdminGapicClient.php | 2144 ----------------- .../v1/src/V1/InstanceAdminClient.php | 34 - .../Instance/v1/src/V1/gapic_metadata.json | 118 - .../instance_admin_client_config.json | 168 -- .../instance_admin_descriptor_config.php | 359 --- .../instance_admin_rest_client_config.php | 331 --- .../V1/Client/InstanceAdminClientTest.php | 2037 ---------------- .../tests/Unit/V1/InstanceAdminClientTest.php | 1827 -------------- .../Google/Spanner/V1/CommitResponse.php | 33 - .../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 1875 -> 0 bytes .../GPBMetadata/Google/Spanner/V1/Spanner.php | Bin 11701 -> 0 bytes .../Google/Spanner/V1/Transaction.php | Bin 1977 -> 0 bytes .../GPBMetadata/Google/Spanner/V1/Type.php | Bin 1501 -> 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 | 188 -- .../Google/Cloud/Spanner/V1/CommitRequest.php | 402 ---- .../Cloud/Spanner/V1/CommitResponse.php | 129 - .../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 | 275 --- .../V1/ExecuteBatchDmlRequest/Statement.php | 208 -- .../Spanner/V1/ExecuteBatchDmlResponse.php | 167 -- .../Cloud/Spanner/V1/ExecuteSqlRequest.php | 702 ------ .../V1/ExecuteSqlRequest/QueryMode.php | 66 - .../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 - .../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 | 505 ---- .../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/RequestOptions.php | 211 -- .../Spanner/V1/RequestOptions/Priority.php | 84 - .../src/Google/Cloud/Spanner/V1/ResultSet.php | 204 -- .../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 | 87 - .../Cloud/Spanner/V1/StructType/Field.php | 138 -- .../Google/Cloud/Spanner/V1/Transaction.php | 151 -- .../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 | 71 - .../ReadWrite/ReadLockMode.php | 70 - .../Cloud/Spanner/V1/TransactionSelector.php | 160 -- .../src/Google/Cloud/Spanner/V1/Type.php | 268 --- .../Cloud/Spanner/V1/TypeAnnotationCode.php | 84 - .../src/Google/Cloud/Spanner/V1/TypeCode.php | 180 -- .../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 | 806 ------- .../v1/src/V1/Gapic/SpannerGapicClient.php | 1854 -------------- .../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 --------- 255 files changed, 134 insertions(+), 57179 deletions(-) rename {owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner => Spanner/src}/V1/ReadRequest/LockHint.php (100%) rename {owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner => Spanner/src}/V1/ReadRequest/OrderBy.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/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/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/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/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/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/GetBackupRequest.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/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/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/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_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/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_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_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_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/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/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/OperationProgress.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/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/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/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/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/V1/Spanner.php b/Spanner/metadata/V1/Spanner.php index 84e977db75db8bfbc409ed4e8d15b1c0709ed7a7..c5904d92a6e986818242f4f20afd005295b8d52f 100644 GIT binary patch delta 289 zcmeB(+#0>Xf|Y4Sz-BAfMq#FJtef{roMIFavgP8)FG@)*ichMP5Kv&$;4@O2{E=UH z@+}o^Wj%k8j8ml(^8-glA$u;)oc!eM_>9cF5(z=D(inA^+Il@7pqvL#3anTugo_=j zSxACQ#6QTzH7MRGGCtHVIKb7})6LV>MSuZCCLqYu*D)wE-rF@&fKf=4OAxNd&p#f_ z7GMIJ$^o-RNRms`$KTmI-ow)`BtFy{#b6OG0fbzzhhq@XIz}OJE@6bIYlO2;Xs~CP Ms{qsHb}2?70J~yO(f|Me delta 28 kcmdlQ-4VILf|coy?`A93Mq#E?%$xU0oMPO(MVe6v0HHVvX8-^I diff --git a/Spanner/src/V1/Gapic/SpannerGapicClient.php b/Spanner/src/V1/Gapic/SpannerGapicClient.php index fdcd037f3803..7b28cd26a3f0 100644 --- a/Spanner/src/V1/Gapic/SpannerGapicClient.php +++ b/Spanner/src/V1/Gapic/SpannerGapicClient.php @@ -1730,6 +1730,19 @@ public function partitionRead( * * 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 @@ -1788,6 +1801,14 @@ public function read( $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']); } + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + if (isset($optionalArgs['lockHint'])) { + $request->setLockHint($optionalArgs['lockHint']); + } + $requestParams = new RequestParamsHeaderDescriptor( $requestParamHeaders ); @@ -1943,6 +1964,19 @@ public function rollback($session, $transactionId, array $optionalArgs = []) * * 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. * } @@ -1999,6 +2033,14 @@ public function streamingRead( $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']); } + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + if (isset($optionalArgs['lockHint'])) { + $request->setLockHint($optionalArgs['lockHint']); + } + $requestParams = new RequestParamsHeaderDescriptor( $requestParamHeaders ); diff --git a/Spanner/src/V1/ReadRequest.php b/Spanner/src/V1/ReadRequest.php index 09495c409f1c..aac660a488ba 100644 --- a/Spanner/src/V1/ReadRequest.php +++ b/Spanner/src/V1/ReadRequest.php @@ -121,6 +121,24 @@ class ReadRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field bool data_boost_enabled = 15; */ private $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]; + */ + private $order_by = 0; + /** + * Optional. Lock Hint for the request, it can only be used with read-write + * transactions. + * + * Generated from protobuf field .google.spanner.v1.ReadRequest.LockHint lock_hint = 17 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $lock_hint = 0; /** * Constructor. @@ -185,6 +203,16 @@ class ReadRequest extends \Google\Protobuf\Internal\Message * 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) { @@ -610,5 +638,69 @@ public function setDataBoostEnabled($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/Spanner/src/V1/ReadRequest/LockHint.php similarity index 100% rename from owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest/LockHint.php rename to Spanner/src/V1/ReadRequest/LockHint.php diff --git a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest/OrderBy.php b/Spanner/src/V1/ReadRequest/OrderBy.php similarity index 100% rename from owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ReadRequest/OrderBy.php rename to Spanner/src/V1/ReadRequest/OrderBy.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 deleted file mode 100644 index b610f628c7710a42b0e686c9a703228810f5ff09..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5331 zcmd5=UvJw~6esE0wWnSGxNOV1P4%)uJB>MOhZytLf%B(PSldKxI;qIQa-5sYYhoMQ zsaB@G!3z?603P6p7kKAG@F@_F`vfoviF5C@9rxdobwXn=bDeX3_uO-S=Xa0qgHN0% z4qO+D#3HWlle$>j6a6PdbX?oF4Z9`QI*kT#MZ<18W{bFzDCW!JdbuhV@}=rEboK0x zYYu%cAdgNPKlsbcx?_t@|u)3a}qNsmCNu zaZGi^B&~XuJkfVe+m+?+uDT#6xo(i4l6`xv+E&x;Se9uu)v`nRgPHXDUo}c6i+WA> zc2412HIYZY-gf%;J&|2%&ThAD>v$wahFcHKp!7<;9#wh;J7XcL4XxBX{G5hcuhkMl z&_PnrK@#gADeNF=cX8%Y0H`}=#tq8F`)THS@KdW>lZ+kJBrpnll(iu8IMbkX(b|~# zz+yIli7fmuy@5gRJ)u%y4!L>yhqExmTUGc7hQqz2l44?EBs=#~xdyZ0cKOP8Plqu$L**!ypkWCg z!l>aA6hrQQrk8tm;16X$xCr2(+-S8upLnT3bQ<74WMPmtJxLAWyYVF{3_RTTkupm> zVbUh`;utG%-X$o*#4@niv@nle>Z~|`iB#t?g1(Zu4ikvs?m4toQ6(F8YMAZscJHtX zkz)z{cwk#_;SiqNW-^dEhmnmgof5VJli?nMt4g(?ZLM!s z3c1ossgR$1M;L?Q+(tpEmez}t31I{V@sIrWWKveu7s__exUgHFVv4-X^WbSeV_HZ$ zJkRi5__!aO!1#)9e?R?A5~g#E>wJqFSX0*r8Q z&8!D)j_r{YmSKp$Pw{qK=v_x15=~%I_yVS4JTq*oVK!5|GavRwif^&Y;v7Sv_=)si z33xYd6%Hh*J~3&?re7*OS#nyPE5I;TuZgsvgH1D$b)z4|->}o0j8Q^LGM- zuFV^8=HB7l@B^|Ry1gyhe4BvjEeBPa93)P+(dlVAy7Zcjj&<%ZR5q0`1v&1pk0wSY z59uOI7Kwi_kUIxDw?CStKZEH!X_3R5Iu+K}$c|Oh3&Qf=TwBLssA0D7%YzH6Fa;xy z-Xt2GJD6k)3IYIo<=Z>NVgfmmHevce7@mVuIuY){S>A{qiab55`>qtuIujOo=4-K~ z7-7@jCE#**tw@~S-rk?WmE+?HlCTKSosxq*Tn&XGHcLy&3Vj>EHVPnlzK9~)L_8IJ3h?r^*e6M+ne6BeURpVN5yrvbPUKPV3iqp)*e!u0nX z!e)r^rL{1v;gEH7@O>4q)Lp5HpnNR&1jcsSp0-2wG&aC<*}Q=#`b*_HTr*mBr;Y}} z%F(w)jt;=~BeExa3g_Yg^yH-jb^i$I?-MY7Ff?HnE*I8w8{3s?sl2XLw=0Loy~}WM zYqOx`m8z0e@S$ss)8AFNR4kW^tN43iMcG=d#(z#y@Z8pBwY*l?(AJc7rC7+v4F=M` z4!}(JQ0j)p#~r~usXmYTs82K|9ESbBR_Di4ROcqB^Rzs<^7=}t7*(OXp=FiaqpeCj z-EUm3>^}*Z!|&am$P;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^#dUhQ9wRYrmlBk=MB(5XX%3s;UN!OC>m?pNcoigcYSk}_Bvqaim zcGqd#;0wcWVJOUSfkWwma)EN-z)ZPu;7~Hd1voGs4jg(a16-J4rYFAlx7wAZ?8=ER zlJ&mtd*A=hd+*u}=bnR3{W#7O~dnY0zxh^K=cUZ z;Lq9KXqxq$=NmqJoHjk(v`pVLn&x{T?_6%vXnF()?T6jmw(7oVTRDobV%5pnb2(0v z!k%_)(9c{>GFhc619jDwET6cR(X5q;S9eXvx7{j$s_GW;14Ywc&Ylz7QgY^I?kwj~ zRrfJDm-F3i65c(RbBVw0T2~q0l)!HAt=2__nq$^9%d)8!Y|B&CwoGjjy%0-HlURO# zI146eHs;Aac}Pn%rR90PlIbh|VD{Kiv4P>3 zg*uB7p3aV)3@vQZK+rctBnW`15P&P(T`ZjtOQzAHX%jwlhdH%aKNek&tep~T&9-|M z?7%$*ftLl4BNA4DPzMx?GLHv~oc$KKnShY81rWaUB>`|=&=-2^QVKSh!z2cW;saj6 z!IfX7&@dzjNUCJX+O+XaG|aPw?(aAxo64omjutQEIS;*UmlrhFSovB9R9r&CoG~a6 zn|3x0l!l8l@szmxQ)X^HH-9)_hZ0d9527Jil<+uuo|ZYrV`hHfA6goh(IJ}j3EOS7 z_Y13TMzE_@{h#ERA16W9+NGQe9uVz4Q(R7*IDp*K~AJ`V5agNQ+(`g0~=9 z$JcG_hHw@SXX4R*p;(4b?u zU{VoTwKEV}UuduN?hy8PpmABiHu^SiH?mu2bw5? z=TJtn=fURGJ*Sgf5+6lJEb`FTLmSeplTrSfMiV6#(Nfr_m-RRr6G?()oEFs=+l~4| z8pATM;u?Ce>VZZEcwD4#*AV9!eh1THD9bSaYQWBoCp_M;SG%!XwcvZpLRYO{305rwawq*?GOua zx~ce)joCb|l~2=XYM=0daSs>}G=FwVjxV8c+QXSXvkNS@9G+Z;i~IdA=u+?`%J}!7 zqWMkIV40YgE*$ojLoDeY$Xk}s3tV+HMbOm!M!frWw*usq7t2t8JA?KqJV;qZ6QRWN zY}`^=M3bFFMJ0=xjh3+Cp$FK ziGr<2Qy&`Gs!z>MzP%Zp=6K1wfky7PJpDe|(b?q1HF^$OfiJXE=#_fY-fjSZ*gWW0 zOLUa6-y%EsO>{U+K(<85DJVZnq0uO7_#}F{vRqod3;pxTvc7(|+Sz-*hH7W-tX1^V z%JRa}qF$~nXm@U{>np4JyjFVaPE~KCLvMZ@O)ajhEZ(XFfT86y-K}(IZGGi-WmUhe zEo+OFau|O=`N04>+F`h$3KS!aOrn;kb0ViYe>M|2pKJS^$RpK)`~HEdMMrPJr`so0 zFF260VIXe7Xwg3N4)PE8M?QFVoEdzOLb(-zDeTgaLHJaL3D-?(mEk1kBtb5eT^9A| z5y{W0-6UPkHPlC+YY)*WnOk~{gADnr(D)sABn;+6N(yF07e02C_fR%m3D}x!>iSO3 zQqpJ{qU!6M6{&k>ly9S{E}M%Av;e0AGQm?`WfjWDr$5ODm8NG|nubnGxJ>9^3nun1 zNd}=oo=wJ5#ectw4$BSL-3k7E3LOs1;o-~iJVp?N#*ZZ!3Oew(vXtw4nwaaq^Ow(l zoG#$=^gQ$tANA(~x0w!|AWVl&4)8~5G#Z`uZ~|VU7*dEQw+YJcQjfI;Iv0EBD0Pgl z#DYfoka54K9p&=R)cJv5&}%at6_x&Uq^73vui-#7)D+^2@pcY@O9l0D?4exS)7U|1 z#H_SF_b_S@Jt#G5Z( zW?m}+@=4`XgYyXdK^l!m`G;`;tMPW)hm=t6k3sG=G$DKxB8^>a=GjFRR%2av-?nY< zeNpORCU9Jj=}9eKis&hcD-;@yCiUQ-(}ENlzwo7a)r8@tRwgA{RAQyPrv=7f%wCwD z?VDNrC-B=);7}7LNJmi&$!UT~wG&Y!)tjBNT)_uZJpLzWeU13Rohw$P`ryh6ZpZTB zMalR?2MoV=RX$AZX-8af4>rTEw3w#9mr|}XRm;UBexZ6Hw!lH&(Ufb6i0~1MW|>YB z_%o0eRN7nG@M4U#KLKfnq(Dz0=2nQG1B%%}0{<_K@H(8SQ#py-GCg`>;^DI$X4?-U zMLw4RQn=#x(~vl&8fM@sMsCMc@~@OqPGmHhQJC5MeY{h}EGqMfNQLa*ozPunJrSW0 zPeJiwZ76lEuB7pYX*9xXJ|EwcB(X5OG(b#A`vg+^H(8wFF~a8# zMXqFluPVGbi&2xr_EadRR7o`Yp<|g057xm!j)!l^BHcTzyJJcXzIkv0!XFl+{_qCo zV^TsvL$drm#a{(*uMREDCF8LZPl|Z`py)!tN>sqh_+s)D9+CpY8xPxpbrDHszkNtj zu&c=glX1p21pj3Z9+c&%R5$Qkyi`F4M3a5+52JhR;bU!5Iw6lDc?kb!tya6|`;Mm; z3h%!Au3%cO7L0BG9=y4O^ZWBo)9^QKw>1+7E;nLDZ2oU)bQ*3YW3@3qwZltEqPu7!Q&NeeAMj%cstrFW-Q9IKYy@>TFzXfBj|pON;ESbG}4n%8M=YY_GiB zIsf+TV+mNRG00l*I9j}pZas=l^Gf4h0c^B;>^ndq36Epw- diff --git a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Backup.php b/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Backup.php deleted file mode 100644 index 807389b65941..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/Backup.php +++ /dev/null @@ -1,725 +0,0 @@ -google.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 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; - - /** - * 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 $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`. - * } - */ - 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 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; - } - -} - 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/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/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/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/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/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/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/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/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 a5ff36930990..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/proto/src/Google/Cloud/Spanner/Admin/Database/V1/ListBackupsRequest.php +++ /dev/null @@ -1,329 +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` - * 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 - * - * 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` - * 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 - * @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` - * 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 - * - * 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` - * 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 - * - * 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/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_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/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_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_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_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 8c2c91ef21ae..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/Client/DatabaseAdminClient.php +++ /dev/null @@ -1,1074 +0,0 @@ - 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 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} - * - 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. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $options = $options + $this->getDefaultEmulatorConfig(); - $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 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(); - } - - /** - * 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 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 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 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 getDefaultEmulatorConfig(): array - { - $emulatorHost = getenv('SPANNER_EMULATOR_HOST'); - if (empty($emulatorHost)) { - return []; - } - - if ($scheme = parse_url($emulatorHost, PHP_URL_SCHEME)) { - $search = $scheme . '://'; - $emulatorHost = str_replace($search, '', $emulatorHost); - } - - return [ - 'apiEndpoint' => $emulatorHost, - 'transportConfig' => [ - 'grpc' => [ - 'stubOpts' => [ - 'credentials' => ChannelCredentials::createInsecure(), - ], - ], - ], - 'credentials' => new InsecureCredentialsWrapper(), - ]; - } -} 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 $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 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(), - '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 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} - * - 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 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(); - } - - /** - * 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 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 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` - * - * 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 - * @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 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 928ba32f9557..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/gapic_metadata.json +++ /dev/null @@ -1,118 +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" - ] - }, - "CreateDatabase": { - "methods": [ - "createDatabase" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "DropDatabase": { - "methods": [ - "dropDatabase" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "GetDatabase": { - "methods": [ - "getDatabase" - ] - }, - "GetDatabaseDdl": { - "methods": [ - "getDatabaseDdl" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "ListBackupOperations": { - "methods": [ - "listBackupOperations" - ] - }, - "ListBackups": { - "methods": [ - "listBackups" - ] - }, - "ListDatabaseOperations": { - "methods": [ - "listDatabaseOperations" - ] - }, - "ListDatabaseRoles": { - "methods": [ - "listDatabaseRoles" - ] - }, - "ListDatabases": { - "methods": [ - "listDatabases" - ] - }, - "RestoreDatabase": { - "methods": [ - "restoreDatabase" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "UpdateBackup": { - "methods": [ - "updateBackup" - ] - }, - "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 ca8f1d556f1a..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_client_config.json +++ /dev/null @@ -1,168 +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" - }, - "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" - }, - "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" - }, - "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" - }, - "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" - }, - "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 fc499b10c129..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_descriptor_config.php +++ /dev/null @@ -1,359 +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', - ], - ], - ], - ], - 'DeleteBackup' => [ - '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', - ], - ], - ], - ], - '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', - ], - ], - ], - ], - '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', - ], - ], - ], - ], - 'templateMap' => [ - 'backup' => 'projects/{project}/instances/{instance}/backups/{backup}', - '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 001f0f774002..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/src/V1/resources/database_admin_rest_client_config.php +++ /dev/null @@ -1,398 +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', - ], - ], - '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', - ], - ], - ], - ], - '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', - ], - ], - ], - ], - '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' => '*', - ], - ], - 'placeholders' => [ - 'resource' => [ - 'getters' => [ - 'getResource', - ], - ], - ], - ], - 'ListBackupOperations' => [ - 'method' => 'get', - 'uriTemplate' => '/v1/{parent=projects/*/instances/*}/backupOperations', - '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' => '*', - ], - ], - '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/*/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', - ], - ], - '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 2d3ff15ea63c..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/tests/Unit/V1/Client/DatabaseAdminClientTest.php +++ /dev/null @@ -1,1972 +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; - $expectedResponse = new Backup(); - $expectedResponse->setDatabase($database); - $expectedResponse->setName($name); - $expectedResponse->setSizeBytes($sizeBytes); - $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; - $expectedResponse = new Backup(); - $expectedResponse->setDatabase($database); - $expectedResponse->setName($name); - $expectedResponse->setSizeBytes($sizeBytes); - $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 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 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; - $expectedResponse = new Backup(); - $expectedResponse->setDatabase($database); - $expectedResponse->setName($name2); - $expectedResponse->setSizeBytes($sizeBytes); - $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 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 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; - $expectedResponse = new Backup(); - $expectedResponse->setDatabase($database); - $expectedResponse->setName($name); - $expectedResponse->setSizeBytes($sizeBytes); - $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 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; - $expectedResponse = new Backup(); - $expectedResponse->setDatabase($database); - $expectedResponse->setName($name); - $expectedResponse->setSizeBytes($sizeBytes); - $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 d9f4ed4da6f4..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Database/v1/tests/Unit/V1/DatabaseAdminClientTest.php +++ /dev/null @@ -1,1766 +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; - $expectedResponse = new Backup(); - $expectedResponse->setDatabase($database); - $expectedResponse->setName($name); - $expectedResponse->setSizeBytes($sizeBytes); - $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; - $expectedResponse = new Backup(); - $expectedResponse->setDatabase($database); - $expectedResponse->setName($name); - $expectedResponse->setSizeBytes($sizeBytes); - $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 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 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; - $expectedResponse = new Backup(); - $expectedResponse->setDatabase($database); - $expectedResponse->setName($name2); - $expectedResponse->setSizeBytes($sizeBytes); - $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 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 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; - $expectedResponse = new Backup(); - $expectedResponse->setDatabase($database); - $expectedResponse->setName($name); - $expectedResponse->setSizeBytes($sizeBytes); - $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 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 4e83339471a1d21a0b2b153ece57ff0d84ca93c0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1231 zcmb7D-EPw`7^US$$h+BcH9&wF6YF4eRk-sQXlv7{QrAXXH=!v~(w;-9v55DFreB)DzK&^LtP ziPK3W0t}@Lyw*iB7E&0&BJmYE+Qm~AB^<6^$4*lj7@;K2E(}3vV-x3`8FoEZFo9iM z%JQ@TF3oBU*BbX7f)F&M z&DcO|t9AIc^!72yRpo|)t&pm3XA3>#GR)C;|Al`28Lf2FXey#;4kbOVg$kWD^sIZ* z@AmrrLw7J5d+t$h*cqP;jy<>C>-OBv@*U?XdUOM3Fg!Zk>o3=w=jh1|zuiwGchG_R z_5D9Jv<|5#8@Y8}`%Agq?S{SDSvQDO8kX09p*d5x1&_r7vR4j2p6o1+KkBdYypgu$ zD^f>n>PVS7a@zV?0)5{i{VJeELKhK*jQ*~_$!RIIXi5uWN-Z;`B{ij|t;qw}xl!*n XD%)-4Nw^Z6TSH@!xw9|PB|?7zOj?rv 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 e063ce16eedddfceebbb98fa2636ff3607d9d036..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14756 zcmeHOPi!1#74NKL*ZZyG*k7E)wP~`Qq>ba+yUC_)!X|E5+iS;_V_UJ?(rT+^ygRms z%+3rmvuWJOASw=(kl@e*5&{GVE^q?D0S<6LNDv{U(wk2p^+H4?ByOB|-@o~@|7LdU zA_U|T@67k!_ul*7`+e`d@0**qtUU{zPcN&6YAdcgg~-90sJ*`{k&Og+6_-`P>^ zbj7S$ny%WJbb4_;y|%uUE-tQYJp-hUS+^@{KD}$2ySkcnEX4p`S*2RjjI3rju3}Ww z?ENd^O<6oE(;*o;6GDbkQ-QXkrk6M7@2IX)Ra~XCOqrH88PigMFfFZcrlr@e+(4+J zD~^-qBg88@5Isa`_-EC(b*+*HL0tIng64n(nyV?g_73Pfm)=oyM+HXBV|VIC#nntB zO$gROjj2m%#*>V_V3}Z_xwH^+gP07=1@gJ7Z76zaQFSV|X1S)l0YmfoUDfprO`c3$ z;?oj#+D>|k$(YYK2|1T`?YbJAJ)O2yw{9CZsN96Xf%jLbg$WCmRw@{VNvvQRPCoDJ z0OmORcs+wlp1(L3I5wKVX^n)&&MgdC0jL( zUAt}=nz372w@B=CXI0NxV5y2V%k4s9kCa;Yj^f;ludPSBr9rs4O3jK-+cpSG3udim z8m&3eD4Bg(<1taFR=p5d0zjGaoR+xoMf7tG&3z&y!5oM(044;8G7Mz|=w$9+nK;8I zP%JH5p`Oh^XyRPp#SU@b@;3KhKH#aq0Gm50e|46>(v%tjJNU0`QCH;eC&KST@6Pjg zy6;q3({n1$V3H5AILu^K;x_!HKws}A6Tb$|!AA()yb-SO06t)r^XGPJ0pPF)z%sMp z@}Y!McU235O<6H^Ogw@Hb+balU|dQ|Q%Ssxj=B4mI-Y=E!@19982|R`k_oUAe{TT; zd=8zdsyj+ucgwn}R8_m|&D00H2jz876gqwkjcmQKQ7pf@wz*MUSXo*rE{;5bhY`A4 zEG(8^zq_(k9Fg#Gl%&7c*H+&cN#GQE^7WOiwc_UHNT2+x0W>VOk_FS)(RT3=I!3lA zuG<(Is%nmp$(sp2n2D;}OILzI~B`*WcW-$H{nv#~SYm+qTN zPkJCU8oP<27ZN*W`Ov~{niPrPe|16X)qGv_Cv1NwXax&mB z*|2VS6%FXhwyHbhgH(!}(fWirWL7D8(Qxg3vM7)#?2ad?`A?%^?jKBNXZ#q(&8@;# zqstGW!3FT~t(CQ9piiQH;_%??`7b;!ycKuFUI4`SqFQmC>_h(7ftS{?*nl@0PszAv z9LWFZL!*VdYdRIkvy5Ff5bq$Y_z%mvR?}RE+9;JPMjOA0VJ7fol`madUj9S-2;Y@ zm1*vNxnkAJbr&Mz9g5v$*mf$A>(NE&XV#oTlMdvt%C6dSB*8v5QvOXp8WiD*M}vsT zIL)B}4jmLQ=VxKDxmyWk3raFhHAF2HMb#}P_KatD9v5Cg z=OT6>T)GI_wS%$%h#ko9NoZnKb6l}J9Ov$;U#dgaj2F;=rPv}$lJi%o8_%NWE4o>) zio~#{7!Wcxx2(4zZZH`jJdzd(DF@0>icI|&e3(9R&3mc=8$LL<{H}y1TZ-aXP{yhF z6*STSz65bds?de|adZ+|}|3q%!C2}l}ZZaQ};0F>q-y8~l z^?js1GmHjyG#wf_%umAMO5|w_SF*%O*+v&Si^#+F3POH`#{>3h0m6YgFypC*+eYU@ zgagqjtngweE=w0FMm-aak{N{j;xXE1O%NMG%EBeSE1g8{8^<5O~-9o{u-=9 zgD%|H=1@{F6njG#mTK#Fkg%re24Ht(PubR0TA(K7Z-N+Mj1x8ut`~!~E~H@4bhSI* zWQ)9pPKAL>2-IVQ$iGgY(_xPn{c3zO;FDeJh#~Z#9JO7RnGr1Pxa2qssT}F9>x_V) zQfGo0Gzcjn8%><8^XSi`N%esRrJq_Y@6>gGL%jw`4=E8evr1iZI8L^_4+m4G@oz4j$C^uLXh%%6D4t1OOIj6oM4?MMfU$bJO*#fE z-iDHNFbbInt~ZsWq_FRZXN*clr)(8YG*xH^LJNkRGLn|218qU*6|ymDbTT+*TdCZu zTMm@U-U!inBz17I_deX09~T~?DUq$T>74p*u^zL2_4;!jX`s4=>W;hF!8}GIo2EuzWh z$nxu~$gG$|k|cj0T(6xXyz1IOCz~e{^;a*x*JUC0v4oy$DWaE|9f8qLdbKN!cxoJc zI@sBytrGV9OsKs{i(U32VogXhKXPZ699c0>chg5bNYbjUXH{q zo}E6xze}L8@V3w8k73VNbV7yBjXn7T=~2N#*~t45!gGXBkp!(|5_`>I;SyWU84sl@ z^zK6AZ^%rjA!p>+UXYij@guNhc)Jr~NBcr6x|p{7@YAwoE17&-`g;mDVx1k9k-j^% z-p$-K8bS@m&P019G3F1UPZ`eK;v2ISoiOHUu@(^0?AVXqMQezlX}<8$vf{r($=-}C z{*HrVobq>~7lOw)!|%+7BV8ekbUA!E9?%6e`k91|2j_Bdj04*cfl%t2SPfASHn*=E z=(rZSuoma>Gf`SN_#+9O4s!ETF?_2#Iebc?$me=zz%^P9YjhpI)LJ7C#T~$J?}slD zhBKp7U~9oIM2i*}E)?pbQ7vB%?ml8E+Jz1g8-FK(hQm;eW4J(hUExAV&nFrRlTi+LgI6Bw3`y}`!1L#jJ|Qq6Q+o1o}V7QdBSq|=JASy z8UM76nkAc?4($|ew+P}p#6Is!XgCb=aqJVO5cX-eA%vZJnk`&Mr~bBthBo2OfVh#3 zWf6IBH5P8+W`Zxp^rsreuv^*k`eEUOxK%O3Zq8CuU6XUvRN`H$^p0A|2?)YXHbla_ zt#HAY5yIU*EWjmAc456csdfVr5UHR###?Z|govfuH4QF_!4(fY)nJt7Awt4SF-CHL zeeJG;JjFfhyaGYcglT@Dxx;xOn>));t2y!DQQ@?R2^RF?#^Ij|rP7}3T24Njef#aV zxf0@S7A{Kf!DldVad8&DXK;5+yEYRwTuej@l=-hG&;>X~inPxBQ=9CY9D!4`1-3y- z&kgC#B`SkpLOvbXHN`iBjUS_c@Z=jC-bu5zZ}@-yDDm7f{b(?=Ky=FRDKm7gjF>s| z+LcFQV5vk$mb|YF`DcdycZTq3+2h3XjBP$oN9XgLaXwEu=ktPfKL6U4?EzX)U%lvk f-892K;0t{32RA+7d&Cys`q7c>o4f;bfY84H{{gk> 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 fddbdb839f58..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/AutoscalingConfig.php +++ /dev/null @@ -1,121 +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; - - /** - * 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. - * } - */ - 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; - } - -} - 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 a4325501a92d..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, 100] 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, 100] 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, 100] 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, 100] 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 d1bf6ef51190..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 config 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 config 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 config 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 config 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 282f9f6b434c..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 config. - * 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 config 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 config. - * 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 config 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 config. - * Values are of the form `projects/`. - * @type string $instance_config_id - * Required. The ID of the instance config 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 config. - * 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 config. - * 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 config 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 config 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 e74c44bf938e..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 config from overwriting each - * other. If not empty, the API - * only deletes the instance config when the etag provided matches the current - * status of the requested instance config. Otherwise, deletes the instance - * config without checking the current status of the requested instance - * config. - * - * 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 config from overwriting each - * other. If not empty, the API - * only deletes the instance config when the etag provided matches the current - * status of the requested instance config. Otherwise, deletes the instance - * config without checking the current status of the requested instance - * config. - * @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 config from overwriting each - * other. If not empty, the API - * only deletes the instance config when the etag provided matches the current - * status of the requested instance config. Otherwise, deletes the instance - * config without checking the current status of the requested instance - * config. - * - * 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 config from overwriting each - * other. If not empty, the API - * only deletes the instance config when the etag provided matches the current - * status of the requested instance config. Otherwise, deletes the instance - * config without checking the current status of the requested instance - * config. - * - * 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 e49cb5cfc976..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/Instance.php +++ /dev/null @@ -1,625 +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. - * This may be zero in API responses for instances that are not yet in state - * `READY`. - * See [the - * documentation](https://cloud.google.com/spanner/docs/compute-capacity) - * for more information about nodes and processing units. - * - * 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 - * 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. - * This may be zero in API responses for instances that are not yet in state - * `READY`. - * See [the - * documentation](https://cloud.google.com/spanner/docs/compute-capacity) - * for more information about nodes and processing units. - * - * Generated from protobuf field int32 processing_units = 9; - */ - protected $processing_units = 0; - /** - * 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; - /** - * 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; - - /** - * 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. - * This may be zero in API responses for instances that are not yet in state - * `READY`. - * See [the - * documentation](https://cloud.google.com/spanner/docs/compute-capacity) - * for more information about nodes and processing units. - * @type int $processing_units - * The number of processing units allocated to this instance. At most one of - * 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. - * This may be zero in API responses for instances that are not yet in state - * `READY`. - * See [the - * documentation](https://cloud.google.com/spanner/docs/compute-capacity) - * for more information about nodes and processing units. - * @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 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. - * } - */ - 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. - * This may be zero in API responses for instances that are not yet in state - * `READY`. - * See [the - * documentation](https://cloud.google.com/spanner/docs/compute-capacity) - * for more information about nodes and processing units. - * - * 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. - * This may be zero in API responses for instances that are not yet in state - * `READY`. - * See [the - * documentation](https://cloud.google.com/spanner/docs/compute-capacity) - * for more information about nodes and processing units. - * - * 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 - * 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. - * This may be zero in API responses for instances that are not yet in state - * `READY`. - * See [the - * documentation](https://cloud.google.com/spanner/docs/compute-capacity) - * for more information about nodes and processing units. - * - * 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 - * 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. - * This may be zero in API responses for instances that are not yet in state - * `READY`. - * See [the - * documentation](https://cloud.google.com/spanner/docs/compute-capacity) - * for more information about nodes and processing units. - * - * 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; - } - - /** - * 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; - } - - /** - * 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; - } - -} - 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 5d39c55025d2..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstanceConfig.php +++ /dev/null @@ -1,552 +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]*`. - * - * 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 config is a Google 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. - * - * 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 config from overwriting - * each other. It is strongly suggested that systems make use of the etag in - * the read-modify-write cycle to perform instance config updates in order to - * avoid race conditions: An etag is returned in the response which contains - * instance configs, and systems are expected to put that etag in the request - * to update instance config to ensure that their change will be applied to - * the same version of the instance config. - * If no etag is provided in the call to update instance config, then the - * existing instance config 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 config is being created or updated. If - * false, there are no ongoing operations for the instance config. - * - * Generated from protobuf field bool reconciling = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $reconciling = false; - /** - * Output only. The current instance config state. - * - * Generated from protobuf field .google.spanner.admin.instance.v1.InstanceConfig.State state = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - protected $state = 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]*`. - * @type string $display_name - * The name of this instance configuration as it appears in UIs. - * @type int $config_type - * Output only. Whether this instance config is a Google 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. - * @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 config from overwriting - * each other. It is strongly suggested that systems make use of the etag in - * the read-modify-write cycle to perform instance config updates in order to - * avoid race conditions: An etag is returned in the response which contains - * instance configs, and systems are expected to put that etag in the request - * to update instance config to ensure that their change will be applied to - * the same version of the instance config. - * If no etag is provided in the call to update instance config, then the - * existing instance config 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 config is being created or updated. If - * false, there are no ongoing operations for the instance config. - * @type int $state - * Output only. The current instance config state. - * } - */ - 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]*`. - * - * 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]*`. - * - * 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 config is a Google 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 config is a Google 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. - * - * 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. - * - * 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 config from overwriting - * each other. It is strongly suggested that systems make use of the etag in - * the read-modify-write cycle to perform instance config updates in order to - * avoid race conditions: An etag is returned in the response which contains - * instance configs, and systems are expected to put that etag in the request - * to update instance config to ensure that their change will be applied to - * the same version of the instance config. - * If no etag is provided in the call to update instance config, then the - * existing instance config 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 config from overwriting - * each other. It is strongly suggested that systems make use of the etag in - * the read-modify-write cycle to perform instance config updates in order to - * avoid race conditions: An etag is returned in the response which contains - * instance configs, and systems are expected to put that etag in the request - * to update instance config to ensure that their change will be applied to - * the same version of the instance config. - * If no etag is provided in the call to update instance config, then the - * existing instance config 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 config is being created or updated. If - * false, there are no ongoing operations for the instance config. - * - * 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 config is being created or updated. If - * false, there are no ongoing operations for the instance config. - * - * 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 config state. - * - * 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 config state. - * - * 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; - } - -} - 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 5468265294fe..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 config is still being created. - * - * Generated from protobuf enum CREATING = 1; - */ - const CREATING = 1; - /** - * The instance config 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 c51f5593a52e..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 19500c295351..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/InstancePartition.php +++ /dev/null @@ -1,559 +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. 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]; - */ - 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 may be zero in API responses for instance partitions that are not - * yet in state `READY`. - * @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. 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 may be zero in API responses for instance partitions that are not - * yet in state `READY`. - * - * 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 may be zero in API responses for instance partitions that are not - * yet in state `READY`. - * - * 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. 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]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getReferencingBackups() - { - return $this->referencing_backups; - } - - /** - * 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]; - * @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; - } - - /** - * 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 885b8b76140a..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstanceConfigOperationsRequest.php +++ /dev/null @@ -1,353 +0,0 @@ -google.spanner.admin.instance.v1.ListInstanceConfigOperationsRequest - */ -class ListInstanceConfigOperationsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The project of the instance config 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][google.longrunning.Operation] - * are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata] - * is - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=` \ - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) - * AND` \ - * `(metadata.instance_config.name:custom-config) AND` \ - * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. - * * The instance config 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 config 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 config 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][google.longrunning.Operation] - * are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata] - * is - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=` \ - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) - * AND` \ - * `(metadata.instance_config.name:custom-config) AND` \ - * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. - * * The instance config 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 config 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 config 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][google.longrunning.Operation] - * are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata] - * is - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=` \ - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) - * AND` \ - * `(metadata.instance_config.name:custom-config) AND` \ - * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. - * * The instance config 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][google.longrunning.Operation] - * are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata] - * is - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=` \ - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) - * AND` \ - * `(metadata.instance_config.name:custom-config) AND` \ - * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. - * * The instance config 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 81388a77cec6..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 config [long-running - * operations][google.longrunning.Operation]. Each operation's name will be - * prefixed by the instance config'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 - * [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 config [long-running - * operations][google.longrunning.Operation]. Each operation's name will be - * prefixed by the instance config'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 - * [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 config [long-running - * operations][google.longrunning.Operation]. Each operation's name will be - * prefixed by the instance config'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 instance config [long-running - * operations][google.longrunning.Operation]. Each operation's name will be - * prefixed by the instance config'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 - * [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 a5dfe05b950b..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][google.longrunning.Operation] - * are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] - * is - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=` \ - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) - * AND` \ - * `(metadata.instance_partition.name:custom-instance-partition) AND` \ - * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. - * * The instance partition name contains "custom-instance-partition". - * * The operation started before 2021-03-28T14:50:00Z. - * * The operation resulted in an error. - * - * 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][ListInstancePartitionOperationsResponse.unreachable] 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][google.longrunning.Operation] - * are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] - * is - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=` \ - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) - * AND` \ - * `(metadata.instance_partition.name:custom-instance-partition) AND` \ - * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. - * * The instance partition name contains "custom-instance-partition". - * * The operation started before 2021-03-28T14:50:00Z. - * * The operation resulted in an error. - * @type int $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][ListInstancePartitionOperationsResponse.unreachable] 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][google.longrunning.Operation] - * are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] - * is - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=` \ - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) - * AND` \ - * `(metadata.instance_partition.name:custom-instance-partition) AND` \ - * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. - * * The instance partition name contains "custom-instance-partition". - * * The operation started before 2021-03-28T14:50:00Z. - * * The operation resulted in an error. - * - * 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][google.longrunning.Operation] - * are eligible for filtering: - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] - * is - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * Here are a few examples: - * * `done:true` - The operation is complete. - * * `(metadata.@type=` \ - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) - * AND` \ - * `(metadata.instance_partition.name:custom-instance-partition) AND` \ - * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. - * * The instance partition name contains "custom-instance-partition". - * * The operation started before 2021-03-28T14:50:00Z. - * * The operation resulted in an error. - * - * 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][ListInstancePartitionOperationsResponse.unreachable] 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][ListInstancePartitionOperationsResponse.unreachable] 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 44acc94c32aa..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][google.longrunning.Operation]. Each operation's name will be - * prefixed by the instance partition'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 - * [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][google.longrunning.Operation]. Each operation's name will be - * prefixed by the instance partition'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 - * [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][google.longrunning.Operation]. Each operation's name will be - * prefixed by the instance partition'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 instance partition [long-running - * operations][google.longrunning.Operation]. Each operation's name will be - * prefixed by the instance partition'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 - * [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 aa607b0405c0..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/ListInstancePartitionsRequest.php +++ /dev/null @@ -1,235 +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/`. - * - * 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/`. 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/`. - * @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/`. - * - * 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/`. - * - * 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 17a9ccba92b2..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 instance partitions. - * It includes the names of 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 instance partitions. - * It includes the names of 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 instance partitions. - * It includes the names of 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 instance partitions. - * It includes the names of 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/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/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 634aae3a12c4..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/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 5a543d790623..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 config 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 config 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 config 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 config 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 801f509c8c79..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/proto/src/Google/Cloud/Spanner/Admin/Instance/V1/UpdateInstanceConfigRequest.php +++ /dev/null @@ -1,225 +0,0 @@ -google.spanner.admin.instance.v1.UpdateInstanceConfigRequest - */ -class UpdateInstanceConfigRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. The user instance config to update, which must always include the - * instance config 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 config to update, which must always include the - * instance config 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 config to update, which must always include the - * instance config 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 config to update, which must always include the - * instance config 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 config to update, which must always include the - * instance config 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 8632ada1f4b5..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][google.longrunning.Operation.metadata] field type is - * [CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [Instance][google.spanner.admin.instance.v1.Instance], if successful. - * - * @param 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 c9dec56b8436..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 config. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if - * successful. - * - * Authorization requires `spanner.instanceConfigs.create` permission on - * the resource - * [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.parent]. - * - * @param string $formattedParent The name of the project in which to create the instance config. - * Values are of the form `projects/`. Please see - * {@see InstanceAdminClient::projectName()} for help formatting this field. - * @param string $instanceConfigId The ID of the instance config 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 fff4f05b1fa6..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][google.longrunning.Operation.metadata] field type is - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if - * successful. - * - * @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 2b206018d034..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 c8d25b9dee97..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][google.longrunning.Operation.metadata] field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that have completed/failed/canceled within the last 7 days, - * and pending operations. Operations returned are ordered by - * `operation.metadata.value.start_time` in descending order starting - * from the most recently started operation. - * - * @param string $formattedParent The project of the instance config 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 73a03f5278ef..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_configs.php +++ /dev/null @@ -1,78 +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 19aa6a4c874e..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_partition_operations.php +++ /dev/null @@ -1,91 +0,0 @@ -/instances//instancePartitions//operations/`. - * The long-running operation - * [metadata][google.longrunning.Operation.metadata] field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that have completed/failed/canceled within the last 7 days, - * and pending operations. Operations returned are ordered by - * `operation.metadata.value.start_time` in descending order starting from the - * most recently started operation. - * - * Authorization requires `spanner.instancePartitionOperations.list` - * permission on the resource - * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]. - * - * @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 ca352433324b..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/list_instance_partitions.php +++ /dev/null @@ -1,77 +0,0 @@ -/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/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 ed51a424240f..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance.php +++ /dev/null @@ -1,146 +0,0 @@ -/operations/` and - * can be used to track the instance modification. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [Instance][google.spanner.admin.instance.v1.Instance], if successful. - * - * Authorization requires `spanner.instances.update` permission on - * the resource [name][google.spanner.admin.instance.v1.Instance.name]. - * - * @param 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 a8c280ab3ac9..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 config modification. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if - * successful. - * - * Authorization requires `spanner.instanceConfigs.update` permission on - * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. - * - * 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 c4808d970488..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/samples/V1/InstanceAdminClient/update_instance_partition.php +++ /dev/null @@ -1,156 +0,0 @@ -/operations/` and can be used to - * track the instance partition modification. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if - * successful. - * - * Authorization requires `spanner.instancePartitions.update` permission on - * the resource - * [name][google.spanner.admin.instance.v1.InstancePartition.name]. - * - * @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 c3f32b5e509c..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/Client/InstanceAdminClient.php +++ /dev/null @@ -1,1216 +0,0 @@ - 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. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $options = $options + $this->getDefaultEmulatorConfig(); - $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][google.longrunning.Operation] - * can be used to track the progress of preparing the new - * instance. The instance name is assigned by the caller. If the - * named instance already exists, `CreateInstance` returns - * `ALREADY_EXISTS`. - * - * Immediately upon completion of this request: - * - * * The instance is readable via the API, with all requested attributes - * but no allocated resources. Its state is `CREATING`. - * - * Until completion of the returned operation: - * - * * Cancelling the operation renders the instance immediately unreadable - * via the API. - * * The instance can be deleted. - * * All other attempts to modify the instance are rejected. - * - * Upon completion of the returned operation: - * - * * Billing for all successfully-allocated resources begins (some types - * may have lower than the requested levels). - * * Databases can be created in the instance. - * * The instance's allocated resource levels are readable via the API. - * * The instance's state becomes `READY`. - * - * The returned [long-running operation][google.longrunning.Operation] will - * have a name of the format `/operations/` and - * can be used to track creation of the instance. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [Instance][google.spanner.admin.instance.v1.Instance], if successful. - * - * 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 config and begins preparing it to be used. The - * returned [long-running operation][google.longrunning.Operation] - * can be used to track the progress of preparing the new - * instance config. The instance config name is assigned by the caller. If the - * named instance config already exists, `CreateInstanceConfig` returns - * `ALREADY_EXISTS`. - * - * Immediately after the request returns: - * - * * The instance config is readable via the API, with all requested - * attributes. The instance config's - * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] - * field is set to true. Its state is `CREATING`. - * - * While the operation is pending: - * - * * Cancelling the operation renders the instance config immediately - * unreadable via the API. - * * Except for deleting the creating resource, all other attempts to modify - * the instance config are rejected. - * - * Upon completion of the returned operation: - * - * * Instances can be created using the instance configuration. - * * The instance config's - * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] - * field becomes false. Its state becomes `READY`. - * - * The returned [long-running operation][google.longrunning.Operation] will - * have a name of the format - * `/operations/` and can be used to track - * creation of the instance config. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if - * successful. - * - * Authorization requires `spanner.instanceConfigs.create` permission on - * the resource - * [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.parent]. - * - * 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][google.longrunning.Operation] - * can be used to track the progress of preparing the new instance partition. - * The instance partition name is assigned by the caller. If the named - * instance partition already exists, `CreateInstancePartition` returns - * `ALREADY_EXISTS`. - * - * Immediately upon completion of this request: - * - * * The instance partition is readable via the API, with all requested - * attributes but no allocated resources. Its state is `CREATING`. - * - * Until completion of the returned operation: - * - * * Cancelling the operation renders the instance partition immediately - * unreadable via the API. - * * The instance partition can be deleted. - * * All other attempts to modify the instance partition are rejected. - * - * Upon completion of the returned operation: - * - * * Billing for all successfully-allocated resources begins (some types - * may have lower than the requested levels). - * * Databases can start using this instance partition. - * * The instance partition's allocated resource levels are readable via the - * API. - * * The instance partition's state becomes `READY`. - * - * The returned [long-running operation][google.longrunning.Operation] will - * have a name of the format - * `/operations/` and can be used to - * track creation of the instance partition. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if - * successful. - * - * 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 config. Deletion is only allowed when no - * instances are using the configuration. If any instances are using - * the config, returns `FAILED_PRECONDITION`. - * - * Only user managed configurations can be deleted. - * - * Authorization requires `spanner.instanceConfigs.delete` permission on - * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. - * - * 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 config [long-running - * operations][google.longrunning.Operation] in the given project. An instance - * config operation has a name of the form - * `projects//instanceConfigs//operations/`. - * The long-running operation - * [metadata][google.longrunning.Operation.metadata] field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that have completed/failed/canceled within the last 7 days, - * and pending operations. Operations returned are ordered by - * `operation.metadata.value.start_time` in descending order starting - * from the most recently started operation. - * - * 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. - * - * 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][google.longrunning.Operation] in the given instance. - * An instance partition operation has a name of the form - * `projects//instances//instancePartitions//operations/`. - * The long-running operation - * [metadata][google.longrunning.Operation.metadata] field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that have completed/failed/canceled within the last 7 days, - * and pending operations. Operations returned are ordered by - * `operation.metadata.value.start_time` in descending order starting from the - * most recently started operation. - * - * Authorization requires `spanner.instancePartitionOperations.list` - * permission on the resource - * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]. - * - * 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); - } - - /** - * 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][google.longrunning.Operation] can be used to track the - * progress of updating the instance. If the named instance does not - * exist, returns `NOT_FOUND`. - * - * Immediately upon completion of this request: - * - * * For resource types for which a decrease in the instance's allocation - * has been requested, billing is based on the newly-requested level. - * - * Until completion of the returned operation: - * - * * Cancelling the operation sets its metadata's - * [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time], - * and begins restoring resources to their pre-request values. The - * operation is guaranteed to succeed at undoing all resource changes, - * after which point it terminates with a `CANCELLED` status. - * * All other attempts to modify the instance are rejected. - * * Reading the instance via the API continues to give the pre-request - * resource levels. - * - * Upon completion of the returned operation: - * - * * Billing begins for all successfully-allocated resources (some types - * may have lower than the requested levels). - * * All newly-reserved resources are available for serving the instance's - * tables. - * * The instance's new resource levels are readable via the API. - * - * The returned [long-running operation][google.longrunning.Operation] will - * have a name of the format `/operations/` and - * can be used to track the instance modification. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [Instance][google.spanner.admin.instance.v1.Instance], if successful. - * - * Authorization requires `spanner.instances.update` permission on - * the resource [name][google.spanner.admin.instance.v1.Instance.name]. - * - * 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 config. The returned - * [long-running operation][google.longrunning.Operation] can be used to track - * the progress of updating the instance. If the named instance config does - * not exist, returns `NOT_FOUND`. - * - * Only user managed configurations can be updated. - * - * Immediately after the request returns: - * - * * The instance config's - * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] - * field is set to true. - * - * While the operation is pending: - * - * * Cancelling the operation sets its metadata's - * [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.cancel_time]. - * The operation is guaranteed to succeed at undoing all changes, after - * which point it terminates with a `CANCELLED` status. - * * All other attempts to modify the instance config are rejected. - * * Reading the instance config via the API continues to give the - * pre-request values. - * - * Upon completion of the returned operation: - * - * * Creating instances using the instance configuration uses the new - * values. - * * The instance config's new values are readable via the API. - * * The instance config's - * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] - * field becomes false. - * - * The returned [long-running operation][google.longrunning.Operation] will - * have a name of the format - * `/operations/` and can be used to track - * the instance config modification. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if - * successful. - * - * Authorization requires `spanner.instanceConfigs.update` permission on - * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. - * - * 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][google.longrunning.Operation] can be used to track the - * progress of updating the instance partition. If the named instance - * partition does not exist, returns `NOT_FOUND`. - * - * Immediately upon completion of this request: - * - * * For resource types for which a decrease in the instance partition's - * allocation has been requested, billing is based on the newly-requested - * level. - * - * Until completion of the returned operation: - * - * * Cancelling the operation sets its metadata's - * [cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time], - * and begins restoring resources to their pre-request values. The - * operation is guaranteed to succeed at undoing all resource changes, - * after which point it terminates with a `CANCELLED` status. - * * All other attempts to modify the instance partition are rejected. - * * Reading the instance partition via the API continues to give the - * pre-request resource levels. - * - * Upon completion of the returned operation: - * - * * Billing begins for all successfully-allocated resources (some types - * may have lower than the requested levels). - * * All newly-reserved resources are available for serving the instance - * partition's tables. - * * The instance partition's new resource levels are readable via the API. - * - * The returned [long-running operation][google.longrunning.Operation] will - * have a name of the format - * `/operations/` and can be used to - * track the instance partition modification. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if - * successful. - * - * Authorization requires `spanner.instancePartitions.update` permission on - * the resource - * [name][google.spanner.admin.instance.v1.InstancePartition.name]. - * - * 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 getDefaultEmulatorConfig(): array - { - $emulatorHost = getenv('SPANNER_EMULATOR_HOST'); - if (empty($emulatorHost)) { - return []; - } - - if ($scheme = parse_url($emulatorHost, PHP_URL_SCHEME)) { - $search = $scheme . '://'; - $emulatorHost = str_replace($search, '', $emulatorHost); - } - - return [ - 'apiEndpoint' => $emulatorHost, - 'transportConfig' => [ - 'grpc' => [ - 'stubOpts' => [ - 'credentials' => ChannelCredentials::createInsecure(), - ], - ], - ], - 'credentials' => new InsecureCredentialsWrapper(), - ]; - } -} 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 2c06f15f3c6c..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/Gapic/InstanceAdminGapicClient.php +++ /dev/null @@ -1,2144 +0,0 @@ -projectName('[PROJECT]'); - * $instanceId = 'instance_id'; - * $instance = new Instance(); - * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'createInstance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * Many parameters require resource names to be formatted in a particular way. To - * assist with these names, this class includes a format method for each type of - * name, and additionally a parseName method to extract the individual identifiers - * contained within formatted names that are returned by the API. - * - * @deprecated Please use the new service client {@see \Google\Cloud\Spanner\Admin\Instance\V1\Client\InstanceAdminClient}. - */ -class InstanceAdminGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.spanner.admin.instance.v1.InstanceAdmin'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'spanner.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'spanner.UNIVERSE_DOMAIN'; - - /** The default port of the service. */ - const DEFAULT_SERVICE_PORT = 443; - - /** The name of the code generator, to be included in the agent header. */ - const CODEGEN_NAME = 'gapic'; - - /** The default scopes required by the service. */ - public static $serviceScopes = [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/spanner.admin', - ]; - - private static $instanceNameTemplate; - - private static $instanceConfigNameTemplate; - - private static $instancePartitionNameTemplate; - - private static $projectNameTemplate; - - private static $pathTemplateMap; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/instance_admin_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/instance_admin_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/instance_admin_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/instance_admin_rest_client_config.php', - ], - ], - ]; - } - - private static function getInstanceNameTemplate() - { - if (self::$instanceNameTemplate == null) { - self::$instanceNameTemplate = new PathTemplate('projects/{project}/instances/{instance}'); - } - - return self::$instanceNameTemplate; - } - - private static function getInstanceConfigNameTemplate() - { - if (self::$instanceConfigNameTemplate == null) { - self::$instanceConfigNameTemplate = new PathTemplate('projects/{project}/instanceConfigs/{instance_config}'); - } - - return self::$instanceConfigNameTemplate; - } - - private static function getInstancePartitionNameTemplate() - { - if (self::$instancePartitionNameTemplate == null) { - self::$instancePartitionNameTemplate = new PathTemplate('projects/{project}/instances/{instance}/instancePartitions/{instance_partition}'); - } - - return self::$instancePartitionNameTemplate; - } - - private static function getProjectNameTemplate() - { - if (self::$projectNameTemplate == null) { - self::$projectNameTemplate = new PathTemplate('projects/{project}'); - } - - return self::$projectNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'instance' => self::getInstanceNameTemplate(), - 'instanceConfig' => self::getInstanceConfigNameTemplate(), - 'instancePartition' => self::getInstancePartitionNameTemplate(), - 'project' => self::getProjectNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a instance - * resource. - * - * @param string $project - * @param string $instance - * - * @return string The formatted instance resource. - */ - public static function instanceName($project, $instance) - { - return self::getInstanceNameTemplate()->render([ - 'project' => $project, - 'instance' => $instance, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * instance_config resource. - * - * @param string $project - * @param string $instanceConfig - * - * @return string The formatted instance_config resource. - */ - public static function instanceConfigName($project, $instanceConfig) - { - return self::getInstanceConfigNameTemplate()->render([ - 'project' => $project, - 'instance_config' => $instanceConfig, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a - * instance_partition resource. - * - * @param string $project - * @param string $instance - * @param string $instancePartition - * - * @return string The formatted instance_partition resource. - */ - public static function instancePartitionName($project, $instance, $instancePartition) - { - return self::getInstancePartitionNameTemplate()->render([ - 'project' => $project, - 'instance' => $instance, - 'instance_partition' => $instancePartition, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a project - * resource. - * - * @param string $project - * - * @return string The formatted project resource. - */ - public static function projectName($project) - { - return self::getProjectNameTemplate()->render([ - 'project' => $project, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - instance: projects/{project}/instances/{instance} - * - instanceConfig: projects/{project}/instanceConfigs/{instance_config} - * - instancePartition: projects/{project}/instances/{instance}/instancePartitions/{instance_partition} - * - project: projects/{project} - * - * The optional $template argument can be supplied to specify a particular pattern, - * and must match one of the templates listed above. If no $template argument is - * provided, or if the $template argument does not match one of the templates - * listed, then parseName will check each of the supported templates, and return - * the first match. - * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match - * - * @return array An associative array from name component IDs to component values. - * - * @throws ValidationException If $formattedName could not be matched. - */ - public static function parseName($formattedName, $template = null) - { - $templateMap = self::getPathTemplateMap(); - if ($template) { - if (!isset($templateMap[$template])) { - throw new ValidationException("Template name $template does not exist"); - } - - return $templateMap[$template]->match($formattedName); - } - - foreach ($templateMap as $templateName => $pathTemplate) { - try { - return $pathTemplate->match($formattedName); - } catch (ValidationException $ex) { - // Swallow the exception to continue trying other path templates - } - } - - throw new ValidationException("Input did not match any known format. Input: $formattedName"); - } - - /** - * Return an OperationsClient object with the same endpoint as $this. - * - * @return OperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** - * Resume an existing long running operation that was previously started by a long - * running API method. If $methodName is not provided, or does not match a long - * running API method, then the operation can still be resumed, but the - * OperationResponse object will not deserialize the final response. - * - * @param string $operationName The name of the long running operation - * @param string $methodName The name of the method used to start the operation - * - * @return OperationResponse - */ - public function resumeOperation($operationName, $methodName = null) - { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; - $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); - $operation->reload(); - return $operation; - } - - /** - * Constructor. - * - * @param array $options { - * Optional. Options for configuring the service API wrapper. - * - * @type string $apiEndpoint - * The address of the API remote host. May optionally include the port, formatted - * as ":". Default 'spanner.googleapis.com:443'. - * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials - * The credentials to be used by the client to authorize API calls. This option - * accepts either a path to a credentials file, or a decoded credentials file as a - * PHP array. - * *Advanced usage*: In addition, this option can also accept a pre-constructed - * {@see \Google\Auth\FetchAuthTokenInterface} object or - * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these - * objects are provided, any settings in $credentialsConfig will be ignored. - * @type array $credentialsConfig - * Options used to configure credentials, including auth token caching, for the - * client. For a full list of supporting configuration options, see - * {@see \Google\ApiCore\CredentialsWrapper::build()} . - * @type bool $disableRetries - * Determines whether or not retries defined by the client configuration should be - * disabled. Defaults to `false`. - * @type string|array $clientConfig - * Client method configuration, including retry settings. This option can be either - * a path to a JSON file, or a PHP array containing the decoded JSON data. By - * default this settings points to the default client config file, which is - * provided in the resources folder. - * @type string|TransportInterface $transport - * The transport used for executing network requests. May be either the string - * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. - * *Advanced usage*: Additionally, it is possible to pass in an already - * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note - * that when this object is provided, any settings in $transportConfig, and any - * $apiEndpoint setting, will be ignored. - * @type array $transportConfig - * Configuration options that will be used to construct the transport. Options for - * each supported transport type should be passed in a key for that transport. For - * example: - * $transportConfig = [ - * 'grpc' => [...], - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Creates an instance and begins preparing it to begin serving. The - * returned [long-running operation][google.longrunning.Operation] - * can be used to track the progress of preparing the new - * instance. The instance name is assigned by the caller. If the - * named instance already exists, `CreateInstance` returns - * `ALREADY_EXISTS`. - * - * Immediately upon completion of this request: - * - * * The instance is readable via the API, with all requested attributes - * but no allocated resources. Its state is `CREATING`. - * - * Until completion of the returned operation: - * - * * Cancelling the operation renders the instance immediately unreadable - * via the API. - * * The instance can be deleted. - * * All other attempts to modify the instance are rejected. - * - * Upon completion of the returned operation: - * - * * Billing for all successfully-allocated resources begins (some types - * may have lower than the requested levels). - * * Databases can be created in the instance. - * * The instance's allocated resource levels are readable via the API. - * * The instance's state becomes `READY`. - * - * The returned [long-running operation][google.longrunning.Operation] will - * have a name of the format `/operations/` and - * can be used to track creation of the instance. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [Instance][google.spanner.admin.instance.v1.Instance], if successful. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedParent = $instanceAdminClient->projectName('[PROJECT]'); - * $instanceId = 'instance_id'; - * $instance = new Instance(); - * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceAdminClient->createInstance($formattedParent, $instanceId, $instance); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'createInstance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the project in which to create the instance. Values - * are of the form `projects/`. - * @param string $instanceId Required. The ID of the instance to create. Valid identifiers are of the - * form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 characters in - * length. - * @param Instance $instance Required. The instance to create. The name may be omitted, but if - * specified must be `/instances/`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createInstance($parent, $instanceId, $instance, array $optionalArgs = []) - { - $request = new CreateInstanceRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setInstanceId($instanceId); - $request->setInstance($instance); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CreateInstance', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Creates an instance config and begins preparing it to be used. The - * returned [long-running operation][google.longrunning.Operation] - * can be used to track the progress of preparing the new - * instance config. The instance config name is assigned by the caller. If the - * named instance config already exists, `CreateInstanceConfig` returns - * `ALREADY_EXISTS`. - * - * Immediately after the request returns: - * - * * The instance config is readable via the API, with all requested - * attributes. The instance config's - * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] - * field is set to true. Its state is `CREATING`. - * - * While the operation is pending: - * - * * Cancelling the operation renders the instance config immediately - * unreadable via the API. - * * Except for deleting the creating resource, all other attempts to modify - * the instance config are rejected. - * - * Upon completion of the returned operation: - * - * * Instances can be created using the instance configuration. - * * The instance config's - * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] - * field becomes false. Its state becomes `READY`. - * - * The returned [long-running operation][google.longrunning.Operation] will - * have a name of the format - * `/operations/` and can be used to track - * creation of the instance config. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if - * successful. - * - * Authorization requires `spanner.instanceConfigs.create` permission on - * the resource - * [parent][google.spanner.admin.instance.v1.CreateInstanceConfigRequest.parent]. - * - * 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 config. - * Values are of the form `projects/`. - * @param string $instanceConfigId Required. The ID of the instance config to create. Valid identifiers are - * of the form `custom-[-a-z0-9]*[a-z0-9]` and must be between 2 and 64 - * characters in length. The `custom-` prefix is required to avoid name - * conflicts with Google managed configurations. - * @param InstanceConfig $instanceConfig Required. The InstanceConfig proto of the configuration to create. - * instance_config.name must be - * `/instanceConfigs/`. - * instance_config.base_config must be a Google managed configuration name, - * e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * An option to validate, but not actually execute, a request, - * and provide the same response. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createInstanceConfig($parent, $instanceConfigId, $instanceConfig, array $optionalArgs = []) - { - $request = new CreateInstanceConfigRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setInstanceConfigId($instanceConfigId); - $request->setInstanceConfig($instanceConfig); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CreateInstanceConfig', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Creates an instance partition and begins preparing it to be used. The - * returned [long-running operation][google.longrunning.Operation] - * can be used to track the progress of preparing the new instance partition. - * The instance partition name is assigned by the caller. If the named - * instance partition already exists, `CreateInstancePartition` returns - * `ALREADY_EXISTS`. - * - * Immediately upon completion of this request: - * - * * The instance partition is readable via the API, with all requested - * attributes but no allocated resources. Its state is `CREATING`. - * - * Until completion of the returned operation: - * - * * Cancelling the operation renders the instance partition immediately - * unreadable via the API. - * * The instance partition can be deleted. - * * All other attempts to modify the instance partition are rejected. - * - * Upon completion of the returned operation: - * - * * Billing for all successfully-allocated resources begins (some types - * may have lower than the requested levels). - * * Databases can start using this instance partition. - * * The instance partition's allocated resource levels are readable via the - * API. - * * The instance partition's state becomes `READY`. - * - * The returned [long-running operation][google.longrunning.Operation] will - * have a name of the format - * `/operations/` and can be used to - * track creation of the instance partition. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if - * successful. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedParent = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); - * $instancePartitionId = 'instance_partition_id'; - * $instancePartition = new InstancePartition(); - * $operationResponse = $instanceAdminClient->createInstancePartition($formattedParent, $instancePartitionId, $instancePartition); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceAdminClient->createInstancePartition($formattedParent, $instancePartitionId, $instancePartition); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'createInstancePartition'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the instance in which to create the instance - * partition. Values are of the form - * `projects//instances/`. - * @param string $instancePartitionId Required. The ID of the instance partition to create. Valid identifiers are - * of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64 - * characters in length. - * @param InstancePartition $instancePartition Required. The instance partition to create. The instance_partition.name may - * be omitted, but if specified must be - * `/instancePartitions/`. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function createInstancePartition($parent, $instancePartitionId, $instancePartition, array $optionalArgs = []) - { - $request = new CreateInstancePartitionRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setInstancePartitionId($instancePartitionId); - $request->setInstancePartition($instancePartition); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CreateInstancePartition', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Deletes an instance. - * - * Immediately upon completion of the request: - * - * * Billing ceases for all of the instance's reserved resources. - * - * Soon afterward: - * - * * The instance and *all of its databases* immediately and - * irrevocably disappear from the API. All data in the databases - * is permanently deleted. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedName = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); - * $instanceAdminClient->deleteInstance($formattedName); - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the instance to be deleted. Values are of the form - * `projects//instances/` - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function deleteInstance($name, array $optionalArgs = []) - { - $request = new DeleteInstanceRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DeleteInstance', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Deletes the instance config. Deletion is only allowed when no - * instances are using the configuration. If any instances are using - * the config, returns `FAILED_PRECONDITION`. - * - * Only user managed configurations can be deleted. - * - * Authorization requires `spanner.instanceConfigs.delete` permission on - * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. - * - * 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 config from overwriting each - * other. If not empty, the API - * only deletes the instance config when the etag provided matches the current - * status of the requested instance config. Otherwise, deletes the instance - * config without checking the current status of the requested instance - * config. - * @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 config [long-running - * operations][google.longrunning.Operation] in the given project. An instance - * config operation has a name of the form - * `projects//instanceConfigs//operations/`. - * The long-running operation - * [metadata][google.longrunning.Operation.metadata] field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that have completed/failed/canceled within the last 7 days, - * and pending operations. Operations returned are ordered by - * `operation.metadata.value.start_time` in descending order starting - * from the most recently started operation. - * - * 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 config operations. - * Values are of the form `projects/`. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * An expression that filters the list of returned operations. - * - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * - * The following fields in the [Operation][google.longrunning.Operation] - * are eligible for filtering: - * - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata] - * is - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * - * Here are a few examples: - * - * * `done:true` - The operation is complete. - * * `(metadata.@type=` \ - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) - * AND` \ - * `(metadata.instance_config.name:custom-config) AND` \ - * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [CreateInstanceConfigMetadata][google.spanner.admin.instance.v1.CreateInstanceConfigMetadata]. - * * The instance config name contains "custom-config". - * * The operation started before 2021-03-28T14:50:00Z. - * * The operation resulted in an error. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listInstanceConfigOperations($parent, array $optionalArgs = []) - { - $request = new ListInstanceConfigOperationsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListInstanceConfigOperations', $optionalArgs, ListInstanceConfigOperationsResponse::class, $request); - } - - /** - * Lists the supported instance configurations for a given project. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedParent = $instanceAdminClient->projectName('[PROJECT]'); - * // Iterate over pages of elements - * $pagedResponse = $instanceAdminClient->listInstanceConfigs($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceAdminClient->listInstanceConfigs($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the project for which a list of supported instance - * configurations is requested. Values are of the form - * `projects/`. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listInstanceConfigs($parent, array $optionalArgs = []) - { - $request = new ListInstanceConfigsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListInstanceConfigs', $optionalArgs, ListInstanceConfigsResponse::class, $request); - } - - /** - * Lists instance partition [long-running - * operations][google.longrunning.Operation] in the given instance. - * An instance partition operation has a name of the form - * `projects//instances//instancePartitions//operations/`. - * The long-running operation - * [metadata][google.longrunning.Operation.metadata] field type - * `metadata.type_url` describes the type of the metadata. Operations returned - * include those that have completed/failed/canceled within the last 7 days, - * and pending operations. Operations returned are ordered by - * `operation.metadata.value.start_time` in descending order starting from the - * most recently started operation. - * - * Authorization requires `spanner.instancePartitionOperations.list` - * permission on the resource - * [parent][google.spanner.admin.instance.v1.ListInstancePartitionOperationsRequest.parent]. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedParent = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); - * // Iterate over pages of elements - * $pagedResponse = $instanceAdminClient->listInstancePartitionOperations($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceAdminClient->listInstancePartitionOperations($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The parent instance of the instance partition operations. - * Values are of the form `projects//instances/`. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * Optional. An expression that filters the list of returned operations. - * - * A filter expression consists of a field name, a - * comparison operator, and a value for filtering. - * The value must be a string, a number, or a boolean. The comparison operator - * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`. - * Colon `:` is the contains operator. Filter rules are not case sensitive. - * - * The following fields in the [Operation][google.longrunning.Operation] - * are eligible for filtering: - * - * * `name` - The name of the long-running operation - * * `done` - False if the operation is in progress, else true. - * * `metadata.@type` - the type of metadata. For example, the type string - * for - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata] - * is - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`. - * * `metadata.` - any field in metadata.value. - * `metadata.@type` must be specified first, if filtering on metadata - * fields. - * * `error` - Error associated with the long-running operation. - * * `response.@type` - the type of response. - * * `response.` - any field in response.value. - * - * You can combine multiple expressions by enclosing each expression in - * parentheses. By default, expressions are combined with AND logic. However, - * you can specify AND, OR, and NOT logic explicitly. - * - * Here are a few examples: - * - * * `done:true` - The operation is complete. - * * `(metadata.@type=` \ - * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata) - * AND` \ - * `(metadata.instance_partition.name:custom-instance-partition) AND` \ - * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \ - * `(error:*)` - Return operations where: - * * The operation's metadata type is - * [CreateInstancePartitionMetadata][google.spanner.admin.instance.v1.CreateInstancePartitionMetadata]. - * * The instance partition name contains "custom-instance-partition". - * * The operation started before 2021-03-28T14:50:00Z. - * * The operation resulted in an error. - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type Timestamp $instancePartitionDeadline - * Optional. Deadline used while retrieving metadata for instance partition - * operations. Instance partitions whose operation metadata cannot be - * retrieved within this deadline will be added to - * [unreachable][ListInstancePartitionOperationsResponse.unreachable] in - * [ListInstancePartitionOperationsResponse][google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse]. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listInstancePartitionOperations($parent, array $optionalArgs = []) - { - $request = new ListInstancePartitionOperationsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['instancePartitionDeadline'])) { - $request->setInstancePartitionDeadline($optionalArgs['instancePartitionDeadline']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListInstancePartitionOperations', $optionalArgs, ListInstancePartitionOperationsResponse::class, $request); - } - - /** - * Lists all instance partitions for the given instance. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedParent = $instanceAdminClient->instanceName('[PROJECT]', '[INSTANCE]'); - * // Iterate over pages of elements - * $pagedResponse = $instanceAdminClient->listInstancePartitions($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceAdminClient->listInstancePartitions($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The instance whose instance partitions should be listed. Values - * are of the form `projects//instances/`. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type Timestamp $instancePartitionDeadline - * Optional. Deadline used while retrieving metadata for instance partitions. - * Instance partitions whose metadata cannot be retrieved within this deadline - * will be added to - * [unreachable][google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable] - * in - * [ListInstancePartitionsResponse][google.spanner.admin.instance.v1.ListInstancePartitionsResponse]. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listInstancePartitions($parent, array $optionalArgs = []) - { - $request = new ListInstancePartitionsRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['instancePartitionDeadline'])) { - $request->setInstancePartitionDeadline($optionalArgs['instancePartitionDeadline']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListInstancePartitions', $optionalArgs, ListInstancePartitionsResponse::class, $request); - } - - /** - * Lists all instances in the given project. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $formattedParent = $instanceAdminClient->projectName('[PROJECT]'); - * // Iterate over pages of elements - * $pagedResponse = $instanceAdminClient->listInstances($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceAdminClient->listInstances($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $parent Required. The name of the project for which a list of instances is - * requested. Values are of the form `projects/`. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $filter - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * - * * `name` - * * `display_name` - * * `labels.key` where key is the name of a label - * - * Some examples of using filters are: - * - * * `name:*` --> The instance has a name. - * * `name:Howl` --> The instance's name contains the string "howl". - * * `name:HOWL` --> Equivalent to above. - * * `NAME:howl` --> Equivalent to above. - * * `labels.env:*` --> The instance has the label "env". - * * `labels.env:dev` --> The instance has the label "env" and the value of - * the label contains the string "dev". - * * `name:howl labels.env:dev` --> The instance's name contains "howl" and - * it has the label "env" with its value - * containing "dev". - * @type Timestamp $instanceDeadline - * Deadline used while retrieving metadata for instances. - * Instances whose metadata cannot be retrieved within this deadline will be - * added to - * [unreachable][google.spanner.admin.instance.v1.ListInstancesResponse.unreachable] - * in - * [ListInstancesResponse][google.spanner.admin.instance.v1.ListInstancesResponse]. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listInstances($parent, array $optionalArgs = []) - { - $request = new ListInstancesRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $requestParamHeaders['parent'] = $parent; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['instanceDeadline'])) { - $request->setInstanceDeadline($optionalArgs['instanceDeadline']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListInstances', $optionalArgs, ListInstancesResponse::class, $request); - } - - /** - * Sets the access control policy on an instance resource. Replaces any - * existing policy. - * - * Authorization requires `spanner.instances.setIamPolicy` on - * [resource][google.iam.v1.SetIamPolicyRequest.resource]. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $resource = 'resource'; - * $policy = new Policy(); - * $response = $instanceAdminClient->setIamPolicy($resource, $policy); - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param Policy $policy REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($resource, $policy, array $optionalArgs = []) - { - $request = new SetIamPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPolicy($policy); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('SetIamPolicy', Policy::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns permissions that the caller has on the specified instance resource. - * - * Attempting this RPC on a non-existent Cloud Spanner instance resource will - * result in a NOT_FOUND error if the user has `spanner.instances.list` - * permission on the containing Google Cloud Project. Otherwise returns an - * empty set of permissions. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $resource = 'resource'; - * $permissions = []; - * $response = $instanceAdminClient->testIamPermissions($resource, $permissions); - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param string $resource REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param string[] $permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Iam\V1\TestIamPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($resource, $permissions, array $optionalArgs = []) - { - $request = new TestIamPermissionsRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setPermissions($permissions); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestIamPermissionsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Updates an instance, and begins allocating or releasing resources - * as requested. The returned [long-running - * operation][google.longrunning.Operation] can be used to track the - * progress of updating the instance. If the named instance does not - * exist, returns `NOT_FOUND`. - * - * Immediately upon completion of this request: - * - * * For resource types for which a decrease in the instance's allocation - * has been requested, billing is based on the newly-requested level. - * - * Until completion of the returned operation: - * - * * Cancelling the operation sets its metadata's - * [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time], - * and begins restoring resources to their pre-request values. The - * operation is guaranteed to succeed at undoing all resource changes, - * after which point it terminates with a `CANCELLED` status. - * * All other attempts to modify the instance are rejected. - * * Reading the instance via the API continues to give the pre-request - * resource levels. - * - * Upon completion of the returned operation: - * - * * Billing begins for all successfully-allocated resources (some types - * may have lower than the requested levels). - * * All newly-reserved resources are available for serving the instance's - * tables. - * * The instance's new resource levels are readable via the API. - * - * The returned [long-running operation][google.longrunning.Operation] will - * have a name of the format `/operations/` and - * can be used to track the instance modification. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [Instance][google.spanner.admin.instance.v1.Instance], if successful. - * - * Authorization requires `spanner.instances.update` permission on - * the resource [name][google.spanner.admin.instance.v1.Instance.name]. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $instance = new Instance(); - * $fieldMask = new FieldMask(); - * $operationResponse = $instanceAdminClient->updateInstance($instance, $fieldMask); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceAdminClient->updateInstance($instance, $fieldMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'updateInstance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param Instance $instance Required. The instance to update, which must always include the instance - * name. Otherwise, only fields mentioned in - * [field_mask][google.spanner.admin.instance.v1.UpdateInstanceRequest.field_mask] - * need be included. - * @param FieldMask $fieldMask Required. A mask specifying which fields in - * [Instance][google.spanner.admin.instance.v1.Instance] should be updated. - * The field mask must always be specified; this prevents any future fields in - * [Instance][google.spanner.admin.instance.v1.Instance] from being erased - * accidentally by clients that do not know about them. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateInstance($instance, $fieldMask, array $optionalArgs = []) - { - $request = new UpdateInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setFieldMask($fieldMask); - $requestParamHeaders['instance.name'] = $instance->getName(); - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('UpdateInstance', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Updates an instance config. The returned - * [long-running operation][google.longrunning.Operation] can be used to track - * the progress of updating the instance. If the named instance config does - * not exist, returns `NOT_FOUND`. - * - * Only user managed configurations can be updated. - * - * Immediately after the request returns: - * - * * The instance config's - * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] - * field is set to true. - * - * While the operation is pending: - * - * * Cancelling the operation sets its metadata's - * [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata.cancel_time]. - * The operation is guaranteed to succeed at undoing all changes, after - * which point it terminates with a `CANCELLED` status. - * * All other attempts to modify the instance config are rejected. - * * Reading the instance config via the API continues to give the - * pre-request values. - * - * Upon completion of the returned operation: - * - * * Creating instances using the instance configuration uses the new - * values. - * * The instance config's new values are readable via the API. - * * The instance config's - * [reconciling][google.spanner.admin.instance.v1.InstanceConfig.reconciling] - * field becomes false. - * - * The returned [long-running operation][google.longrunning.Operation] will - * have a name of the format - * `/operations/` and can be used to track - * the instance config modification. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [UpdateInstanceConfigMetadata][google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig], if - * successful. - * - * Authorization requires `spanner.instanceConfigs.update` permission on - * the resource [name][google.spanner.admin.instance.v1.InstanceConfig.name]. - * - * 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 config to update, which must always include the - * instance config name. Otherwise, only fields mentioned in - * [update_mask][google.spanner.admin.instance.v1.UpdateInstanceConfigRequest.update_mask] - * need be included. To prevent conflicts of concurrent updates, - * [etag][google.spanner.admin.instance.v1.InstanceConfig.reconciling] can - * be used. - * @param FieldMask $updateMask Required. A mask specifying which fields in - * [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] should be - * updated. The field mask must always be specified; this prevents any future - * fields in [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] - * from being erased accidentally by clients that do not know about them. Only - * display_name and labels can be updated. - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * An option to validate, but not actually execute, a request, - * and provide the same response. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateInstanceConfig($instanceConfig, $updateMask, array $optionalArgs = []) - { - $request = new UpdateInstanceConfigRequest(); - $requestParamHeaders = []; - $request->setInstanceConfig($instanceConfig); - $request->setUpdateMask($updateMask); - $requestParamHeaders['instance_config.name'] = $instanceConfig->getName(); - if (isset($optionalArgs['validateOnly'])) { - $request->setValidateOnly($optionalArgs['validateOnly']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('UpdateInstanceConfig', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Updates an instance partition, and begins allocating or releasing resources - * as requested. The returned [long-running - * operation][google.longrunning.Operation] can be used to track the - * progress of updating the instance partition. If the named instance - * partition does not exist, returns `NOT_FOUND`. - * - * Immediately upon completion of this request: - * - * * For resource types for which a decrease in the instance partition's - * allocation has been requested, billing is based on the newly-requested - * level. - * - * Until completion of the returned operation: - * - * * Cancelling the operation sets its metadata's - * [cancel_time][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata.cancel_time], - * and begins restoring resources to their pre-request values. The - * operation is guaranteed to succeed at undoing all resource changes, - * after which point it terminates with a `CANCELLED` status. - * * All other attempts to modify the instance partition are rejected. - * * Reading the instance partition via the API continues to give the - * pre-request resource levels. - * - * Upon completion of the returned operation: - * - * * Billing begins for all successfully-allocated resources (some types - * may have lower than the requested levels). - * * All newly-reserved resources are available for serving the instance - * partition's tables. - * * The instance partition's new resource levels are readable via the API. - * - * The returned [long-running operation][google.longrunning.Operation] will - * have a name of the format - * `/operations/` and can be used to - * track the instance partition modification. The - * [metadata][google.longrunning.Operation.metadata] field type is - * [UpdateInstancePartitionMetadata][google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata]. - * The [response][google.longrunning.Operation.response] field type is - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition], if - * successful. - * - * Authorization requires `spanner.instancePartitions.update` permission on - * the resource - * [name][google.spanner.admin.instance.v1.InstancePartition.name]. - * - * Sample code: - * ``` - * $instanceAdminClient = new InstanceAdminClient(); - * try { - * $instancePartition = new InstancePartition(); - * $fieldMask = new FieldMask(); - * $operationResponse = $instanceAdminClient->updateInstancePartition($instancePartition, $fieldMask); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * $result = $operationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceAdminClient->updateInstancePartition($instancePartition, $fieldMask); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceAdminClient->resumeOperation($operationName, 'updateInstancePartition'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceAdminClient->close(); - * } - * ``` - * - * @param InstancePartition $instancePartition Required. The instance partition to update, which must always include the - * instance partition name. Otherwise, only fields mentioned in - * [field_mask][google.spanner.admin.instance.v1.UpdateInstancePartitionRequest.field_mask] - * need be included. - * @param FieldMask $fieldMask Required. A mask specifying which fields in - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] - * should be updated. The field mask must always be specified; this prevents - * any future fields in - * [InstancePartition][google.spanner.admin.instance.v1.InstancePartition] - * from being erased accidentally by clients that do not know about them. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - */ - public function updateInstancePartition($instancePartition, $fieldMask, array $optionalArgs = []) - { - $request = new UpdateInstancePartitionRequest(); - $requestParamHeaders = []; - $request->setInstancePartition($instancePartition); - $request->setFieldMask($fieldMask); - $requestParamHeaders['instance_partition.name'] = $instancePartition->getName(); - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('UpdateInstancePartition', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } -} diff --git a/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', - ], - ], - ], - ], - '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 5016880cb8c3..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/src/V1/resources/instance_admin_rest_client_config.php +++ /dev/null @@ -1,331 +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', - ], - ], - ], - ], - '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 953b7565ee51..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/tests/Unit/V1/Client/InstanceAdminClientTest.php +++ /dev/null @@ -1,2037 +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; - $expectedResponse = new InstanceConfig(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setBaseConfig($baseConfig); - $expectedResponse->setEtag($etag); - $expectedResponse->setReconciling($reconciling); - $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; - $expectedResponse = new InstanceConfig(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setBaseConfig($baseConfig); - $expectedResponse->setEtag($etag); - $expectedResponse->setReconciling($reconciling); - $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 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; - $expectedResponse = new InstanceConfig(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setBaseConfig($baseConfig); - $expectedResponse->setEtag($etag); - $expectedResponse->setReconciling($reconciling); - $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 9a1611ceb073..000000000000 --- a/owl-bot-staging/Spanner/v1/Admin/Instance/v1/tests/Unit/V1/InstanceAdminClientTest.php +++ /dev/null @@ -1,1827 +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; - $expectedResponse = new InstanceConfig(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setBaseConfig($baseConfig); - $expectedResponse->setEtag($etag); - $expectedResponse->setReconciling($reconciling); - $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; - $expectedResponse = new InstanceConfig(); - $expectedResponse->setName($name2); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setBaseConfig($baseConfig); - $expectedResponse->setEtag($etag); - $expectedResponse->setReconciling($reconciling); - $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 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; - $expectedResponse = new InstanceConfig(); - $expectedResponse->setName($name); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setBaseConfig($baseConfig); - $expectedResponse->setEtag($etag); - $expectedResponse->setReconciling($reconciling); - $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 46823eb678dc..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/GPBMetadata/Google/Spanner/V1/CommitResponse.php +++ /dev/null @@ -1,33 +0,0 @@ -internalAddGeneratedFile( - ' -² -\'google/spanner/v1/commit_response.protogoogle.spanner.v1"² -CommitResponse4 -commit_timestamp ( 2.google.protobuf.TimestampC - commit_stats ( 2-.google.spanner.v1.CommitResponse.CommitStats% - CommitStats -mutation_count (B¶ -com.google.spanner.v1BCommitResponseProtoPZ5cloud.google.com/go/spanner/apiv1/spannerpb;spannerpbªGoogle.Cloud.Spanner.V1ÊGoogle\\Cloud\\Spanner\\V1êGoogle::Cloud::Spanner::V1bproto3' - , true); - - static::$is_initialized = true; - } -} - 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 2f63b0c51704ac35eabe39b9dac1ce59ebb6d5c1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1875 zcmbVN%Wl&^6vcfhos>r{LPJzwnpQNGibJSi;kF<`AyfhyNR$P#6iw_&YSppLc-&G@ zzlA+(B*Z7cj^E%5SaLnK$B_~NYBq^7=iE8>+{f%Z@(+EqiW}6WjBsk<-YMpX6#LBM zp6NNb7xw#wnLeQ@!kP`bKn=W*nN-IE&l@cNmC+z{ zcsHP26X6hY$&doTq`1+nzoeX4gcGA7m_{pR8lBoULZ(B40KX9tT9l)Y2*bw@dyZ}5 zfD;a1Yj)7JU7Op)u|I(HUEC*5K!H7u?T4<(ZO_FK;lMR%Wdp}CBkY>*L8`krmC}r| zhs=$Ams92v$JnER$!wo{tO-zEA5bnmi~gx>B-cja>^`o<8g+e4$*+l;sY5r&?Rf9li8L{W)5 z5ADSF$Cf2+eg^$lk;X(et)uTbRQ`A4sf#g2OPW(Vu9YUx-bJ2teJ~~N*V5{EXr5)B zfR-nKAiems{7FIcvWwLRC^t;HzNlcOlE1g6jY-oaKAjM?f@YX^5)`NKG;m5OM@$v8 zsrJGSc!xM4RqvwNsPls2v@Z||2kr4(6;I8*gHx*XYJdZEj^^gWEVsK)g3 z3+gRY$c`NEgtBfAV3sHh0P1-(F9G#03M#-mk=~PeTF+7vyQ`_Zy>B{RXr)kKRR^AY zJBV+?^O5lV-nRVpTTwnwEj7e@p*;~1TJfu)b!tD-6T=WkhI~=rN%=KZifOto4s|^t k>UyWvn-iXFt;_AQ887LPogP_fn-liAK*oFb44onL2hQhW+yDRo 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 c5904d92a6e986818242f4f20afd005295b8d52f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11701 zcmdTKO>7%!bseXP{hS}?YudVQ)%DJnZML-bHd}U!+wQKNxQW{&_Bv^IyBJ1edy>p{ z>~UwtZL+Hf2_!ghT5&*#3(`sm5Fn6{xFK%9B5{CQ#bFPe7S0@yka*wUcl@YPJni zx6`TAd?~e3T1yq?i)$|+s$+HRx}HsKSk{KAXPmayLRy(eSLDw$qXp2?nmVr5_0&Q+ zzpT4jLvyw20z<2=a>YNk<7Ij-j7f9DNHHCl#iXr}Q2 za(y$ku9=RGxVvH3JFU8FSgjOAD7EVP%*!cGlfs^FTPWqtlw_n#1xKN)#g?nvEzPXX z>rUM^+OB1n5j30K&|Obm^vlf4Vp~eiSWnGx9<$k9Ox{enc1QQ`o=Vxe+p$~M8Q+w^ zj`yqjR5exStY*`2E2vVd<>=XLSGq2-AQHK@QO&hl7F8r-9t?5LH1w8xFq~V4ZZ`7z zruN9N?1Q1AblkfJmd-QZd1^eAsKY)^ao!&4=23ZM(fk zq_8w_`3*w^eXh~)V*D27y%{emX^dWgAD7|zeG(p-;s9xfr?&K?E6KA0M{64yOp`JO zd4^1$@~zfcpos;!6-8U8(WKTyI0=B$K1^H0j95A+mf9k(Wf~$d#QK^3b)CAtSd{#F z$PV*wu`1c}R$b}D0ze96x9b_26gy5IU7;FUEFPdciq(Kp(iA=?AQZv04Z0LI6m@^DND{^+R^95f+(Z}!ImVg24QB#*EVmn7jrfrdHEU2U(`1UfNrc=_LkOXu0+_xeBp5v#LrRmNDwcDd28N#GZ+ZPeHV;ZRo0ljUw~yV}t;(PpQ7b*++ikWF9w81FH*WJFvxL;**w>&uC~F{7Nx@YGALW1fge@A1`!W40n_D5 zu~aFp-B<6ftdTpeOxRqEXKpi zXTxxO-muYW^+rY48dAmz#En+n>@;-M*4ubI&>R*VvDw!GWDTH@E^_pWz+QZgAWeO% zk0#I4gVHQ;^e)Zh&qELwf3Bj@S^t9Sh?rKL^{67EZ^JMxK1|yavo{75p`UP?HaW_5 z7^eS|X^5}gFBkeuF#%91RSGfeA|ZmSK$(P}0pL8|gdavdi7wD~{bBM%S}!a2(CM_{V3 zrPn(cn-5J{WMB8!E%f>PfGLe!hnO#Dm|Ve?%GcX+C$Vhwk+Ad7B6XAn|^7z0$PPdQj>sHLt-Xjvp4T}kf}HeIG0Q1@|o!Njsf+p8uP zJC-qNg&MNWoDDKVvN=c0knG4BPqa%hDbx0aI}UhDNHg7 zLH$QS(!utL(1NPgEDL)Gy~RB~jx-|45{xnJNOn)d6y2nW#miPPLTDE%(#3f=+g+mV zH5N{z?qIE{Kfr>=lXmhp=GZ=S_OuZ%`P&GeJNX=hdIIe)lr%)UrUMvRDOHwpOPJat zFkD{BtzagJ!DzWsx>Z~%#D|n04#P>|U92aZZyr6K-a0}&@eo=9pxV-#ILUA@wrE_u z8esfj&eN+Bms2CsQEA%{=HCK*jCOjl+5LSi`OgqUy)9${;Aaea81N?mUY7Pu0PprD z050gBPtB?OkM0(L)eo_+tL2<|7#`87&tn> z(;sV|dB(tUXS5pn7C(HDNf^c1d#BmrbvsHjFp4KXI^AH$!`STU043r?4+m?UV4(hK zEgek%%6W)-DhsO8G%&`L4`9lJ!XRXmXdH0h>B@@~-XR7>t%pfo4a(`~0wnbHNXoyC zLF{v3%;`R3aswUMqUa(f_5p5!Hb`M??0b7MYTL0OOVLhgj0BXVqqjX1NIJNg9lY(K zty6^DgotG~u*IouCuk!y5jf28nLAyg;Q4K;%n*4KqIi~ipl;&)HZjHUs}}^C+*YY>s! zkkfEtsWf*-T`aDw^&Q9Xkk(yVUCdSRyc|MX9`AlFygRpaceQwrwpD)$!Ku8yVYGbV z@C;JgDD5WkMo5&-F9hh%x1mVX+?fNsizc^08Xo08LohDyvarX;>FS}+S_znNyCYuJ z;K#@@Jk>A2Nylj6{UjgRb%9tCj?E4xEE2*NSk9v935@oRX95%@??}iQIL>eQR2%|h z^s2Nyp;?`J{WXZwzCx@tbW_`A(d|p`-linIZ}p6X+?FzwmNNT%h>>1?&3Kut-C-` zc?4X7=jGVQ-D;`pw$)VYn_7zw9$j0f=XGXtX1?S+jQ7yM3g~kyUNWENR$QT92jb^V zlwa%}SS!K0*YM1-L3&~wiN}Q(dUrS?GQ8Uf&lA15`0RHQIG^XYTjWO}3}Y13n`q)m zB|w=yAi@Wd-X6X-Q_Pc<@{^o**Yb_O{{6c{Zz@@OU*yfCZ;C0lley@dV_)=*uP=7T z*4fZS@+l6PncjMMameKWb_3uf(?O$-KyYps<^3nQlX8xJNsN#&^zr(HiFHT0bp)|$ z-RmJL;`c%T-I+W&A0SzGSqk(tD=a+8vFjJcYL;AMtkV0K0kq$}Gq|`zei4E(|6H8} z4Nd$2lDj}}>ID>vUhemp8{`NcL%xrW-7~5WcI+My$@EF7crSR^!vdvOofi+U&X3X1 z-T7Uhp}WhHtDt7wJ3=dO_qd~Q)B~D1t9t`f>W;s~h?8uvWQe60XR8CUyXSdP!)cOu zO`yETxL#9A%rlS3wU0++|CJE=9S+2W04&6DkVRgWw)G{gJ{YO+pqrOnpu&6aF+s}8 zoo673iHosTJc%Zc@1JCDDvCQQlUTjv`8} z@2o&o|Bn!i@UEMr0vwqyNxp-cN(mv{_6MOSxs>F+w+X)_TP^2FZbpIxcjH}9CijAp zKZ@MEqoLCNG6WIX8us)o!{2RQ|^(G{2 zwn%0I81Ds<><1Nm4^j?ll)H@Ql5+bfJh$bjhw(@`|20OnZ!=6efwj8_Mat9?S@``x7t+Ew?q={xP;u zkXJ&<$Dg2^if3oN?~wkI`^u*4ww-Jy^Z4;&;ZWWqCA^H?%+yV*)3{9E0=+kcjXhgQmwM3s`sQA-xPl~l;mjHEL+TG1!6Xfi#c`wS6er{Q^p}) o&6J<3jj#^z)eGJ`!b|)uu%Dl0WL*fgOPV0=FYOoB#j- 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 be467b14b3f65800f51d924335d6c3558e7c7cf9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1977 zcma)7+iu%N5RKGCaK^5!un6i3XtQw=SOHoJa^0e!;}+2+j?gF+BGm;70>p}3$wbLr zf?TFf3;#twArD0#+rP-CBfUrz_nbL%W_IS$58+t|_s9w3ETWRRWcrH8 zGe*KlNZ|;dOq1D+MZ^(7==m(t3F(>Sxj7;I-e7VUp|MCJhZ$rp#N21CIHVl8S})rz z8BrcnM|y(miVuL(fZ+*;k&{tp$Ru^Cq}GXoTH_3Aowknv9G}K9nJg&a4Jd=-N4`dNO2vm$2D4jdx4LHUAU=q z3GTnzttu*gJ*rfei6|to_TdgYcl^Xn(S^~dAEa4?<>y7h{-4PcHY#dEb$hwXQLYy4G(jWkA@zgCAD zCMoz_m30IC_ztwdjYz0)@CBz)& zE-oTnS9QEP(jn}ya~ya}vCk53b#5ZO>b8y;eIM!m1<8Zf=xVUEz3ilTG_>y~u zPHrht=`Gm8r*GlLl+8V!*I-?i4!}m7%jx`Ef!nx_Rt0qGOX}5x994e##_>hs7Kahn znu~Ht(a^&^m8TF+kIG+vS3f;bOG)o4_&8fl`f2-3@y4>$E2~^vxVPR`8yUdl5Ae$FCUGkzMdT&B-g9Qo%!^-h9GDUAq3$(`E->-~ zFY+wULET}$j{{_Rm%i=bKtQOfqNb`NxvJZJ>nQ=r2_!VF~bn)gbSYmk)J>8I<|$v$c)I} zh8=cn*N$w{u|E;LN2qT)AtuCWY=7ulk?pyN5>(g1#cec-NwFKgN9sF56BQaQnUrfN zZiEBZbc`wvt-$spFVF~76bCqp8%4hqx5sH|IJ=LEBaNasCGrSG!4Tigj!=N3Vc;Gx z-88^WyfS9=Nb+r?W@D#U#uw(5?FFKETh(n4R@AFwdt8Fl>&1#|WPZgs2hF$zU+3Z3 zzXr!Y8l4K`u?knEwLb|+)A8^Eq%E(9R}v^uEbKiMrl10aRS2Y<`Xwd#ec;U?Ft0n< z!I#*LI`o39Bndmew|ozq--CQedS{K%DTaPN1KnmQChQm%Y3L5Qi5|T*p1YD}8aHR~ zC_{>YR4xA)3hdf4ft~(GcO^sUxwS6T9rGe&9)|2l$s(}xd(g}(q&aW;Szif zGD=f_`3tqTc96h0^tffJ>X|F zeghCINoo>@k#t3E&Z@2epw&B*R7ujxEZNg+Wl|Z@Om?bL<#ZiH$f4??!b$U%=B&IW#jwrcMsy#x8(B3zk~{-k6lbSEB&0D7zR5sVuvFZ s_dB^dqKP6q6vZ)76wgZCId<{(x8isDa^xI$jOJdGVaSmc+`tXMU#Q)^p8x;= 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 5d54040d9d3b..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/BeginTransactionRequest.php +++ /dev/null @@ -1,188 +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; - - /** - * @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. - * } - */ - 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; - } - -} - 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 41376b808da3..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitRequest.php +++ /dev/null @@ -1,402 +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; - 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. - * } - */ - 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; - } - - /** - * @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 8caa87b03c34..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/CommitResponse.php +++ /dev/null @@ -1,129 +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; - - /** - * 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]. - * } - */ - 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; - } - -} - 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 ce0243d0d79d..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlRequest.php +++ /dev/null @@ -1,275 +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; - - /** - * 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. - * } - */ - 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; - } - -} - 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 4ca50513d3f4..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteBatchDmlResponse.php +++ /dev/null @@ -1,167 +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; - - /** - * 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. - * } - */ - 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; - } - -} - 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 f46ac1170929..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest.php +++ /dev/null @@ -1,702 +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; - - /** - * 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. - * } - */ - 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; - } - -} - 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 c1d1be3f1fa5..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ExecuteSqlRequest/QueryMode.php +++ /dev/null @@ -1,66 +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 both the query plan and the execution statistics along - * with the results. - * - * Generated from protobuf enum PROFILE = 2; - */ - const PROFILE = 2; - - private static $valueToName = [ - self::NORMAL => 'NORMAL', - self::PLAN => 'PLAN', - self::PROFILE => 'PROFILE', - ]; - - 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/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 a33584b6ad41..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/PartialResultSet.php +++ /dev/null @@ -1,505 +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; - - /** - * 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. - * } - */ - 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; - } - -} - 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/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 262ca6a04f1a..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/ResultSet.php +++ /dev/null @@ -1,204 +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; - - /** - * 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]. - * } - */ - 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; - } - -} - 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 fd5d1b31fb0e..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/StructType.php +++ /dev/null @@ -1,87 +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 3dc5882969d2..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Transaction.php +++ /dev/null @@ -1,151 +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; - - /** - * 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"`. - * } - */ - 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; - } - -} - 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; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $read_lock_mode - * Read lock mode for the transaction. - * } - */ - 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; - } - -} - -// 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 0293c37a2320..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/Type.php +++ /dev/null @@ -1,268 +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 6575fb750544..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TypeAnnotationCode.php +++ /dev/null @@ -1,84 +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 21c35fb44bd8..000000000000 --- a/owl-bot-staging/Spanner/v1/proto/src/Google/Cloud/Spanner/V1/TypeCode.php +++ /dev/null @@ -1,180 +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; - - 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', - ]; - - 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 774c2ff9c152..000000000000 --- a/owl-bot-staging/Spanner/v1/src/V1/Client/SpannerClient.php +++ /dev/null @@ -1,806 +0,0 @@ - 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. - * - * @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); - } - - /** 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); - } -} 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 56ba10eb8e15..000000000000 --- a/owl-bot-staging/Spanner/v1/src/V1/Gapic/SpannerGapicClient.php +++ /dev/null @@ -1,1854 +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 RetrySettings|array $retrySettings - * Retry settings to use for this 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']); - } - - $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 RetrySettings|array $retrySettings - * Retry settings to use for this 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']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Commit', CommitResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a new session. A session can be used to perform - * transactions that read and/or modify data in a Cloud Spanner database. - * Sessions are meant to be reused for many consecutive - * transactions. - * - * Sessions can only execute one transaction at a time. To execute - * multiple concurrent read-write/write-only transactions, create - * multiple sessions. Note that standalone reads and queries use a - * transaction internally, and count toward the one transaction - * limit. - * - * Active sessions use additional server resources, so it is a good idea to - * delete idle and unneeded sessions. - * Aside from explicit deletes, Cloud Spanner may delete sessions for which no - * operations are sent for more than an hour. If a session is deleted, - * requests to it return `NOT_FOUND`. - * - * Idle sessions can be kept alive by sending a trivial SQL query - * periodically, e.g., `"SELECT 1"`. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedDatabase = $spannerClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - * $response = $spannerClient->createSession($formattedDatabase); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $database Required. The database in which the new session is created. - * @param array $optionalArgs { - * Optional. - * - * @type Session $session - * Required. The session to create. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\V1\Session - * - * @throws ApiException if the remote call fails - */ - public function createSession($database, array $optionalArgs = []) - { - $request = new CreateSessionRequest(); - $requestParamHeaders = []; - $request->setDatabase($database); - $requestParamHeaders['database'] = $database; - if (isset($optionalArgs['session'])) { - $request->setSession($optionalArgs['session']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('CreateSession', Session::class, $optionalArgs, $request)->wait(); - } - - /** - * Ends a session, releasing server resources associated with it. This will - * asynchronously trigger cancellation of any operations that are running with - * this session. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedName = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $spannerClient->deleteSession($formattedName); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the session to delete. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function deleteSession($name, array $optionalArgs = []) - { - $request = new DeleteSessionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('DeleteSession', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Executes a batch of SQL DML statements. This method allows many statements - * to be run with lower latency than submitting them sequentially with - * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. - * - * Statements are executed in sequential order. A request can succeed even if - * a statement fails. The - * [ExecuteBatchDmlResponse.status][google.spanner.v1.ExecuteBatchDmlResponse.status] - * field in the response provides information about the statement that failed. - * Clients must inspect this field to determine whether an error occurred. - * - * Execution stops after the first failed statement; the remaining statements - * are not executed. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $transaction = new TransactionSelector(); - * $statements = []; - * $seqno = 0; - * $response = $spannerClient->executeBatchDml($formattedSession, $transaction, $statements, $seqno); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $session Required. The session in which the DML statements should be performed. - * @param TransactionSelector $transaction Required. The transaction to use. Must be a read-write transaction. - * - * To protect against replays, single-use transactions are not supported. The - * caller must either supply an existing transaction ID or begin a new - * transaction. - * @param Statement[] $statements Required. The list of statements to execute in this batch. Statements are - * executed serially, such that the effects of statement `i` are visible to - * statement `i+1`. Each statement must be a DML statement. Execution stops at - * the first failed statement; the remaining statements are not executed. - * - * Callers must provide at least one statement. - * @param int $seqno Required. A per-transaction sequence number used to identify this request. - * This field makes each request idempotent such that if the request is - * received multiple times, at most one will succeed. - * - * The sequence number must be monotonically increasing within the - * transaction. If a request arrives for the first time with an out-of-order - * sequence number, the transaction may be aborted. Replays of previously - * handled requests will yield the same response as the first execution. - * @param array $optionalArgs { - * Optional. - * - * @type RequestOptions $requestOptions - * Common options for this request. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\V1\ExecuteBatchDmlResponse - * - * @throws ApiException if the remote call fails - */ - public function executeBatchDml($session, $transaction, $statements, $seqno, array $optionalArgs = []) - { - $request = new ExecuteBatchDmlRequest(); - $requestParamHeaders = []; - $request->setSession($session); - $request->setTransaction($transaction); - $request->setStatements($statements); - $request->setSeqno($seqno); - $requestParamHeaders['session'] = $session; - if (isset($optionalArgs['requestOptions'])) { - $request->setRequestOptions($optionalArgs['requestOptions']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('ExecuteBatchDml', ExecuteBatchDmlResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Executes an SQL statement, returning all results in a single reply. This - * method cannot be used to return a result set larger than 10 MiB; - * if the query yields more data than that, the query fails with - * a `FAILED_PRECONDITION` error. - * - * Operations inside read-write transactions might return `ABORTED`. If - * this occurs, the application should restart the transaction from - * the beginning. See [Transaction][google.spanner.v1.Transaction] for more - * details. - * - * Larger result sets can be fetched in streaming fashion by calling - * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] - * instead. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $sql = 'sql'; - * $response = $spannerClient->executeSql($formattedSession, $sql); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $session Required. The session in which the SQL query should be performed. - * @param string $sql Required. The SQL string. - * @param array $optionalArgs { - * Optional. - * - * @type TransactionSelector $transaction - * The transaction to use. - * - * For queries, if none is provided, the default is a temporary read-only - * transaction with strong concurrency. - * - * Standard DML statements require a read-write transaction. To protect - * against replays, single-use transactions are not supported. The caller - * must either supply an existing transaction ID or begin a new transaction. - * - * Partitioned DML requires an existing Partitioned DML transaction ID. - * @type Struct $params - * Parameter names and values that bind to placeholders in the SQL string. - * - * A parameter placeholder consists of the `@` character followed by the - * parameter name (for example, `@firstName`). Parameter names must conform - * to the naming requirements of identifiers as specified at - * https://cloud.google.com/spanner/docs/lexical#identifiers. - * - * Parameters can appear anywhere that a literal value is expected. The same - * parameter name can be used more than once, for example: - * - * `"WHERE id > @msg_id AND id < @msg_id + 100"` - * - * It is an error to execute a SQL statement with unbound parameters. - * @type array $paramTypes - * It is not always possible for Cloud Spanner to infer the right SQL type - * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in - * [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings. - * - * In these cases, `param_types` can be used to specify the exact - * SQL type for some or all of the SQL statement parameters. See the - * definition of [Type][google.spanner.v1.Type] for more information - * about SQL types. - * @type string $resumeToken - * If this request is resuming a previously interrupted SQL statement - * execution, `resume_token` should be copied from the last - * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the - * interruption. Doing this enables the new SQL statement execution to resume - * where the last one left off. The rest of the request parameters must - * exactly match the request that yielded this token. - * @type int $queryMode - * Used to control the amount of debugging information returned in - * [ResultSetStats][google.spanner.v1.ResultSetStats]. If - * [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is - * set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only - * be set to - * [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL]. - * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryMode} - * @type string $partitionToken - * If present, results will be restricted to the specified partition - * previously created using PartitionQuery(). There must be an exact - * match for the values of fields common to this message and the - * PartitionQueryRequest message used to create this partition_token. - * @type int $seqno - * A per-transaction sequence number used to identify this request. This field - * makes each request idempotent such that if the request is received multiple - * times, at most one will succeed. - * - * The sequence number must be monotonically increasing within the - * transaction. If a request arrives for the first time with an out-of-order - * sequence number, the transaction may be aborted. Replays of previously - * handled requests will yield the same response as the first execution. - * - * Required for DML statements. Ignored for queries. - * @type QueryOptions $queryOptions - * Query optimizer configuration to use for the given query. - * @type RequestOptions $requestOptions - * Common options for this request. - * @type DirectedReadOptions $directedReadOptions - * Directed read options for this request. - * @type bool $dataBoostEnabled - * If this is for a partitioned query and this field is set to `true`, the - * request is executed with Spanner Data Boost independent compute resources. - * - * If the field is set to `true` but the request does not set - * `partition_token`, the API returns an `INVALID_ARGUMENT` error. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\V1\ResultSet - * - * @throws ApiException if the remote call fails - */ - public function executeSql($session, $sql, array $optionalArgs = []) - { - $request = new ExecuteSqlRequest(); - $requestParamHeaders = []; - $request->setSession($session); - $request->setSql($sql); - $requestParamHeaders['session'] = $session; - if (isset($optionalArgs['transaction'])) { - $request->setTransaction($optionalArgs['transaction']); - } - - if (isset($optionalArgs['params'])) { - $request->setParams($optionalArgs['params']); - } - - if (isset($optionalArgs['paramTypes'])) { - $request->setParamTypes($optionalArgs['paramTypes']); - } - - if (isset($optionalArgs['resumeToken'])) { - $request->setResumeToken($optionalArgs['resumeToken']); - } - - if (isset($optionalArgs['queryMode'])) { - $request->setQueryMode($optionalArgs['queryMode']); - } - - if (isset($optionalArgs['partitionToken'])) { - $request->setPartitionToken($optionalArgs['partitionToken']); - } - - if (isset($optionalArgs['seqno'])) { - $request->setSeqno($optionalArgs['seqno']); - } - - if (isset($optionalArgs['queryOptions'])) { - $request->setQueryOptions($optionalArgs['queryOptions']); - } - - if (isset($optionalArgs['requestOptions'])) { - $request->setRequestOptions($optionalArgs['requestOptions']); - } - - if (isset($optionalArgs['directedReadOptions'])) { - $request->setDirectedReadOptions($optionalArgs['directedReadOptions']); - } - - if (isset($optionalArgs['dataBoostEnabled'])) { - $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('ExecuteSql', ResultSet::class, $optionalArgs, $request)->wait(); - } - - /** - * Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the - * result set as a stream. Unlike - * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there is no limit on - * the size of the returned result set. However, no individual row in the - * result set can exceed 100 MiB, and no column value can exceed 10 MiB. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $sql = 'sql'; - * // Read all responses until the stream is complete - * $stream = $spannerClient->executeStreamingSql($formattedSession, $sql); - * foreach ($stream->readAll() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $session Required. The session in which the SQL query should be performed. - * @param string $sql Required. The SQL string. - * @param array $optionalArgs { - * Optional. - * - * @type TransactionSelector $transaction - * The transaction to use. - * - * For queries, if none is provided, the default is a temporary read-only - * transaction with strong concurrency. - * - * Standard DML statements require a read-write transaction. To protect - * against replays, single-use transactions are not supported. The caller - * must either supply an existing transaction ID or begin a new transaction. - * - * Partitioned DML requires an existing Partitioned DML transaction ID. - * @type Struct $params - * Parameter names and values that bind to placeholders in the SQL string. - * - * A parameter placeholder consists of the `@` character followed by the - * parameter name (for example, `@firstName`). Parameter names must conform - * to the naming requirements of identifiers as specified at - * https://cloud.google.com/spanner/docs/lexical#identifiers. - * - * Parameters can appear anywhere that a literal value is expected. The same - * parameter name can be used more than once, for example: - * - * `"WHERE id > @msg_id AND id < @msg_id + 100"` - * - * It is an error to execute a SQL statement with unbound parameters. - * @type array $paramTypes - * It is not always possible for Cloud Spanner to infer the right SQL type - * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in - * [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings. - * - * In these cases, `param_types` can be used to specify the exact - * SQL type for some or all of the SQL statement parameters. See the - * definition of [Type][google.spanner.v1.Type] for more information - * about SQL types. - * @type string $resumeToken - * If this request is resuming a previously interrupted SQL statement - * execution, `resume_token` should be copied from the last - * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the - * interruption. Doing this enables the new SQL statement execution to resume - * where the last one left off. The rest of the request parameters must - * exactly match the request that yielded this token. - * @type int $queryMode - * Used to control the amount of debugging information returned in - * [ResultSetStats][google.spanner.v1.ResultSetStats]. If - * [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is - * set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only - * be set to - * [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL]. - * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryMode} - * @type string $partitionToken - * If present, results will be restricted to the specified partition - * previously created using PartitionQuery(). There must be an exact - * match for the values of fields common to this message and the - * PartitionQueryRequest message used to create this partition_token. - * @type int $seqno - * A per-transaction sequence number used to identify this request. This field - * makes each request idempotent such that if the request is received multiple - * times, at most one will succeed. - * - * The sequence number must be monotonically increasing within the - * transaction. If a request arrives for the first time with an out-of-order - * sequence number, the transaction may be aborted. Replays of previously - * handled requests will yield the same response as the first execution. - * - * Required for DML statements. Ignored for queries. - * @type QueryOptions $queryOptions - * Query optimizer configuration to use for the given query. - * @type RequestOptions $requestOptions - * Common options for this request. - * @type DirectedReadOptions $directedReadOptions - * Directed read options for this request. - * @type bool $dataBoostEnabled - * If this is for a partitioned query and this field is set to `true`, the - * request is executed with Spanner Data Boost independent compute resources. - * - * If the field is set to `true` but the request does not set - * `partition_token`, the API returns an `INVALID_ARGUMENT` error. - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return \Google\ApiCore\ServerStream - * - * @throws ApiException if the remote call fails - */ - public function executeStreamingSql($session, $sql, array $optionalArgs = []) - { - $request = new ExecuteSqlRequest(); - $requestParamHeaders = []; - $request->setSession($session); - $request->setSql($sql); - $requestParamHeaders['session'] = $session; - if (isset($optionalArgs['transaction'])) { - $request->setTransaction($optionalArgs['transaction']); - } - - if (isset($optionalArgs['params'])) { - $request->setParams($optionalArgs['params']); - } - - if (isset($optionalArgs['paramTypes'])) { - $request->setParamTypes($optionalArgs['paramTypes']); - } - - if (isset($optionalArgs['resumeToken'])) { - $request->setResumeToken($optionalArgs['resumeToken']); - } - - if (isset($optionalArgs['queryMode'])) { - $request->setQueryMode($optionalArgs['queryMode']); - } - - if (isset($optionalArgs['partitionToken'])) { - $request->setPartitionToken($optionalArgs['partitionToken']); - } - - if (isset($optionalArgs['seqno'])) { - $request->setSeqno($optionalArgs['seqno']); - } - - if (isset($optionalArgs['queryOptions'])) { - $request->setQueryOptions($optionalArgs['queryOptions']); - } - - if (isset($optionalArgs['requestOptions'])) { - $request->setRequestOptions($optionalArgs['requestOptions']); - } - - if (isset($optionalArgs['directedReadOptions'])) { - $request->setDirectedReadOptions($optionalArgs['directedReadOptions']); - } - - if (isset($optionalArgs['dataBoostEnabled'])) { - $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('ExecuteStreamingSql', PartialResultSet::class, $optionalArgs, $request, Call::SERVER_STREAMING_CALL); - } - - /** - * Gets a session. Returns `NOT_FOUND` if the session does not exist. - * This is mainly useful for determining whether a session is still - * alive. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedName = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $response = $spannerClient->getSession($formattedName); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $name Required. The name of the session to retrieve. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\V1\Session - * - * @throws ApiException if the remote call fails - */ - public function getSession($name, array $optionalArgs = []) - { - $request = new GetSessionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetSession', Session::class, $optionalArgs, $request)->wait(); - } - - /** - * Lists all sessions in a given database. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedDatabase = $spannerClient->databaseName('[PROJECT]', '[INSTANCE]', '[DATABASE]'); - * // Iterate over pages of elements - * $pagedResponse = $spannerClient->listSessions($formattedDatabase); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $spannerClient->listSessions($formattedDatabase); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $database Required. The database in which to list sessions. - * @param array $optionalArgs { - * Optional. - * - * @type int $pageSize - * The maximum number of resources contained in the underlying API - * response. The API may return fewer values in a page, even if - * there are additional values to be retrieved. - * @type string $pageToken - * A page token is used to specify a page of values to be returned. - * If no page token is specified (the default), the first page - * of values will be returned. Any page token used here must have - * been generated by a previous call to the API. - * @type string $filter - * An expression for filtering the results of the request. Filter rules are - * case insensitive. The fields eligible for filtering are: - * - * * `labels.key` where key is the name of a label - * - * Some examples of using filters are: - * - * * `labels.env:*` --> The session has the label "env". - * * `labels.env:dev` --> The session has the label "env" and the value of - * the label contains the string "dev". - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\ApiCore\PagedListResponse - * - * @throws ApiException if the remote call fails - */ - public function listSessions($database, array $optionalArgs = []) - { - $request = new ListSessionsRequest(); - $requestParamHeaders = []; - $request->setDatabase($database); - $requestParamHeaders['database'] = $database; - if (isset($optionalArgs['pageSize'])) { - $request->setPageSize($optionalArgs['pageSize']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListSessions', $optionalArgs, ListSessionsResponse::class, $request); - } - - /** - * Creates a set of partition tokens that can be used to execute a query - * operation in parallel. Each of the returned partition tokens can be used - * by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to - * specify a subset of the query result to read. The same session and - * read-only transaction must be used by the PartitionQueryRequest used to - * create the partition tokens and the ExecuteSqlRequests that use the - * partition tokens. - * - * Partition tokens become invalid when the session used to create them - * is deleted, is idle for too long, begins a new transaction, or becomes too - * old. When any of these happen, it is not possible to resume the query, and - * the whole operation must be restarted from the beginning. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $sql = 'sql'; - * $response = $spannerClient->partitionQuery($formattedSession, $sql); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $session Required. The session used to create the partitions. - * @param string $sql Required. The query request to generate partitions for. The request will - * fail if the query is not root partitionable. For a query to be root - * partitionable, it needs to satisfy a few conditions. For example, if the - * query execution plan contains a distributed union operator, then it must be - * the first operator in the plan. For more information about other - * conditions, see [Read data in - * parallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel). - * - * The query request must not contain DML commands, such as INSERT, UPDATE, or - * DELETE. Use - * [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] with a - * PartitionedDml transaction for large, partition-friendly DML operations. - * @param array $optionalArgs { - * Optional. - * - * @type TransactionSelector $transaction - * Read only snapshot transactions are supported, read/write and single use - * transactions are not. - * @type Struct $params - * Parameter names and values that bind to placeholders in the SQL string. - * - * A parameter placeholder consists of the `@` character followed by the - * parameter name (for example, `@firstName`). Parameter names can contain - * letters, numbers, and underscores. - * - * Parameters can appear anywhere that a literal value is expected. The same - * parameter name can be used more than once, for example: - * - * `"WHERE id > @msg_id AND id < @msg_id + 100"` - * - * It is an error to execute a SQL statement with unbound parameters. - * @type array $paramTypes - * It is not always possible for Cloud Spanner to infer the right SQL type - * from a JSON value. For example, values of type `BYTES` and values - * of type `STRING` both appear in - * [params][google.spanner.v1.PartitionQueryRequest.params] as JSON strings. - * - * In these cases, `param_types` can be used to specify the exact - * SQL type for some or all of the SQL query parameters. See the - * definition of [Type][google.spanner.v1.Type] for more information - * about SQL types. - * @type PartitionOptions $partitionOptions - * Additional options that affect how many partitions are created. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\V1\PartitionResponse - * - * @throws ApiException if the remote call fails - */ - public function partitionQuery($session, $sql, array $optionalArgs = []) - { - $request = new PartitionQueryRequest(); - $requestParamHeaders = []; - $request->setSession($session); - $request->setSql($sql); - $requestParamHeaders['session'] = $session; - if (isset($optionalArgs['transaction'])) { - $request->setTransaction($optionalArgs['transaction']); - } - - if (isset($optionalArgs['params'])) { - $request->setParams($optionalArgs['params']); - } - - if (isset($optionalArgs['paramTypes'])) { - $request->setParamTypes($optionalArgs['paramTypes']); - } - - if (isset($optionalArgs['partitionOptions'])) { - $request->setPartitionOptions($optionalArgs['partitionOptions']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('PartitionQuery', PartitionResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a set of partition tokens that can be used to execute a read - * operation in parallel. Each of the returned partition tokens can be used - * by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a - * subset of the read result to read. The same session and read-only - * transaction must be used by the PartitionReadRequest used to create the - * partition tokens and the ReadRequests that use the partition tokens. There - * are no ordering guarantees on rows returned among the returned partition - * tokens, or even within each individual StreamingRead call issued with a - * partition_token. - * - * Partition tokens become invalid when the session used to create them - * is deleted, is idle for too long, begins a new transaction, or becomes too - * old. When any of these happen, it is not possible to resume the read, and - * the whole operation must be restarted from the beginning. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $table = 'table'; - * $keySet = new KeySet(); - * $response = $spannerClient->partitionRead($formattedSession, $table, $keySet); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $session Required. The session used to create the partitions. - * @param string $table Required. The name of the table in the database to be read. - * @param KeySet $keySet Required. `key_set` identifies the rows to be yielded. `key_set` names the - * primary keys of the rows in - * [table][google.spanner.v1.PartitionReadRequest.table] to be yielded, unless - * [index][google.spanner.v1.PartitionReadRequest.index] is present. If - * [index][google.spanner.v1.PartitionReadRequest.index] is present, then - * [key_set][google.spanner.v1.PartitionReadRequest.key_set] instead names - * index keys in [index][google.spanner.v1.PartitionReadRequest.index]. - * - * It is not an error for the `key_set` to name rows that do not - * exist in the database. Read yields nothing for nonexistent rows. - * @param array $optionalArgs { - * Optional. - * - * @type TransactionSelector $transaction - * Read only snapshot transactions are supported, read/write and single use - * transactions are not. - * @type string $index - * If non-empty, the name of an index on - * [table][google.spanner.v1.PartitionReadRequest.table]. This index is used - * instead of the table primary key when interpreting - * [key_set][google.spanner.v1.PartitionReadRequest.key_set] and sorting - * result rows. See [key_set][google.spanner.v1.PartitionReadRequest.key_set] - * for further information. - * @type string[] $columns - * The columns of [table][google.spanner.v1.PartitionReadRequest.table] to be - * returned for each row matching this request. - * @type PartitionOptions $partitionOptions - * Additional options that affect how many partitions are created. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\V1\PartitionResponse - * - * @throws ApiException if the remote call fails - */ - public function partitionRead($session, $table, $keySet, array $optionalArgs = []) - { - $request = new PartitionReadRequest(); - $requestParamHeaders = []; - $request->setSession($session); - $request->setTable($table); - $request->setKeySet($keySet); - $requestParamHeaders['session'] = $session; - if (isset($optionalArgs['transaction'])) { - $request->setTransaction($optionalArgs['transaction']); - } - - if (isset($optionalArgs['index'])) { - $request->setIndex($optionalArgs['index']); - } - - if (isset($optionalArgs['columns'])) { - $request->setColumns($optionalArgs['columns']); - } - - if (isset($optionalArgs['partitionOptions'])) { - $request->setPartitionOptions($optionalArgs['partitionOptions']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('PartitionRead', PartitionResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Reads rows from the database using key lookups and scans, as a - * simple key/value style alternative to - * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be - * used to return a result set larger than 10 MiB; if the read matches more - * data than that, the read fails with a `FAILED_PRECONDITION` - * error. - * - * Reads inside read-write transactions might return `ABORTED`. If - * this occurs, the application should restart the transaction from - * the beginning. See [Transaction][google.spanner.v1.Transaction] for more - * details. - * - * Larger result sets can be yielded in streaming fashion by calling - * [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $table = 'table'; - * $columns = []; - * $keySet = new KeySet(); - * $response = $spannerClient->read($formattedSession, $table, $columns, $keySet); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $session Required. The session in which the read should be performed. - * @param string $table Required. The name of the table in the database to be read. - * @param string[] $columns Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be - * returned for each row matching this request. - * @param KeySet $keySet Required. `key_set` identifies the rows to be yielded. `key_set` names the - * primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to - * be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present. - * If [index][google.spanner.v1.ReadRequest.index] is present, then - * [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys - * in [index][google.spanner.v1.ReadRequest.index]. - * - * If the [partition_token][google.spanner.v1.ReadRequest.partition_token] - * field is empty, rows are yielded in table primary key order (if - * [index][google.spanner.v1.ReadRequest.index] is empty) or index key order - * (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the - * [partition_token][google.spanner.v1.ReadRequest.partition_token] field is - * not empty, rows will be yielded in an unspecified order. - * - * It is not an error for the `key_set` to name rows that do not - * exist in the database. Read yields nothing for nonexistent rows. - * @param array $optionalArgs { - * Optional. - * - * @type TransactionSelector $transaction - * The transaction to use. If none is provided, the default is a - * temporary read-only transaction with strong concurrency. - * @type string $index - * If non-empty, the name of an index on - * [table][google.spanner.v1.ReadRequest.table]. This index is used instead of - * the table primary key when interpreting - * [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows. - * See [key_set][google.spanner.v1.ReadRequest.key_set] for further - * information. - * @type int $limit - * If greater than zero, only the first `limit` rows are yielded. If `limit` - * is zero, the default is no limit. A limit cannot be specified if - * `partition_token` is set. - * @type string $resumeToken - * If this request is resuming a previously interrupted read, - * `resume_token` should be copied from the last - * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the - * interruption. Doing this enables the new read to resume where the last read - * left off. The rest of the request parameters must exactly match the request - * that yielded this token. - * @type string $partitionToken - * If present, results will be restricted to the specified partition - * previously created using PartitionRead(). There must be an exact - * match for the values of fields common to this message and the - * PartitionReadRequest message used to create this partition_token. - * @type RequestOptions $requestOptions - * Common options for this request. - * @type DirectedReadOptions $directedReadOptions - * Directed read options for this request. - * @type bool $dataBoostEnabled - * If this is for a partitioned read and this field is set to `true`, the - * request is executed with Spanner Data Boost independent compute resources. - * - * If the field is set to `true` but the request does not set - * `partition_token`, the API returns an `INVALID_ARGUMENT` error. - * @type int $orderBy - * Optional. Order for the returned rows. - * - * By default, Spanner will return result rows in primary key order except for - * PartitionRead requests. For applications that do not require rows to be - * returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting - * `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval, - * resulting in lower latencies in certain cases (e.g. bulk point lookups). - * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\OrderBy} - * @type int $lockHint - * Optional. Lock Hint for the request, it can only be used with read-write - * transactions. - * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\LockHint} - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Spanner\V1\ResultSet - * - * @throws ApiException if the remote call fails - */ - public function read($session, $table, $columns, $keySet, array $optionalArgs = []) - { - $request = new ReadRequest(); - $requestParamHeaders = []; - $request->setSession($session); - $request->setTable($table); - $request->setColumns($columns); - $request->setKeySet($keySet); - $requestParamHeaders['session'] = $session; - if (isset($optionalArgs['transaction'])) { - $request->setTransaction($optionalArgs['transaction']); - } - - if (isset($optionalArgs['index'])) { - $request->setIndex($optionalArgs['index']); - } - - if (isset($optionalArgs['limit'])) { - $request->setLimit($optionalArgs['limit']); - } - - if (isset($optionalArgs['resumeToken'])) { - $request->setResumeToken($optionalArgs['resumeToken']); - } - - if (isset($optionalArgs['partitionToken'])) { - $request->setPartitionToken($optionalArgs['partitionToken']); - } - - if (isset($optionalArgs['requestOptions'])) { - $request->setRequestOptions($optionalArgs['requestOptions']); - } - - if (isset($optionalArgs['directedReadOptions'])) { - $request->setDirectedReadOptions($optionalArgs['directedReadOptions']); - } - - if (isset($optionalArgs['dataBoostEnabled'])) { - $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['lockHint'])) { - $request->setLockHint($optionalArgs['lockHint']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Read', ResultSet::class, $optionalArgs, $request)->wait(); - } - - /** - * Rolls back a transaction, releasing any locks it holds. It is a good - * idea to call this for any transaction that includes one or more - * [Read][google.spanner.v1.Spanner.Read] or - * [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and ultimately - * decides not to commit. - * - * `Rollback` returns `OK` if it successfully aborts the transaction, the - * transaction was already aborted, or the transaction is not - * found. `Rollback` never returns `ABORTED`. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $transactionId = '...'; - * $spannerClient->rollback($formattedSession, $transactionId); - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $session Required. The session in which the transaction to roll back is running. - * @param string $transactionId Required. The transaction to roll back. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @throws ApiException if the remote call fails - */ - public function rollback($session, $transactionId, array $optionalArgs = []) - { - $request = new RollbackRequest(); - $requestParamHeaders = []; - $request->setSession($session); - $request->setTransactionId($transactionId); - $requestParamHeaders['session'] = $session; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Rollback', GPBEmpty::class, $optionalArgs, $request)->wait(); - } - - /** - * Like [Read][google.spanner.v1.Spanner.Read], except returns the result set - * as a stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no - * limit on the size of the returned result set. However, no individual row in - * the result set can exceed 100 MiB, and no column value can exceed - * 10 MiB. - * - * Sample code: - * ``` - * $spannerClient = new SpannerClient(); - * try { - * $formattedSession = $spannerClient->sessionName('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]'); - * $table = 'table'; - * $columns = []; - * $keySet = new KeySet(); - * // Read all responses until the stream is complete - * $stream = $spannerClient->streamingRead($formattedSession, $table, $columns, $keySet); - * foreach ($stream->readAll() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $spannerClient->close(); - * } - * ``` - * - * @param string $session Required. The session in which the read should be performed. - * @param string $table Required. The name of the table in the database to be read. - * @param string[] $columns Required. The columns of [table][google.spanner.v1.ReadRequest.table] to be - * returned for each row matching this request. - * @param KeySet $keySet Required. `key_set` identifies the rows to be yielded. `key_set` names the - * primary keys of the rows in [table][google.spanner.v1.ReadRequest.table] to - * be yielded, unless [index][google.spanner.v1.ReadRequest.index] is present. - * If [index][google.spanner.v1.ReadRequest.index] is present, then - * [key_set][google.spanner.v1.ReadRequest.key_set] instead names index keys - * in [index][google.spanner.v1.ReadRequest.index]. - * - * If the [partition_token][google.spanner.v1.ReadRequest.partition_token] - * field is empty, rows are yielded in table primary key order (if - * [index][google.spanner.v1.ReadRequest.index] is empty) or index key order - * (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the - * [partition_token][google.spanner.v1.ReadRequest.partition_token] field is - * not empty, rows will be yielded in an unspecified order. - * - * It is not an error for the `key_set` to name rows that do not - * exist in the database. Read yields nothing for nonexistent rows. - * @param array $optionalArgs { - * Optional. - * - * @type TransactionSelector $transaction - * The transaction to use. If none is provided, the default is a - * temporary read-only transaction with strong concurrency. - * @type string $index - * If non-empty, the name of an index on - * [table][google.spanner.v1.ReadRequest.table]. This index is used instead of - * the table primary key when interpreting - * [key_set][google.spanner.v1.ReadRequest.key_set] and sorting result rows. - * See [key_set][google.spanner.v1.ReadRequest.key_set] for further - * information. - * @type int $limit - * If greater than zero, only the first `limit` rows are yielded. If `limit` - * is zero, the default is no limit. A limit cannot be specified if - * `partition_token` is set. - * @type string $resumeToken - * If this request is resuming a previously interrupted read, - * `resume_token` should be copied from the last - * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the - * interruption. Doing this enables the new read to resume where the last read - * left off. The rest of the request parameters must exactly match the request - * that yielded this token. - * @type string $partitionToken - * If present, results will be restricted to the specified partition - * previously created using PartitionRead(). There must be an exact - * match for the values of fields common to this message and the - * PartitionReadRequest message used to create this partition_token. - * @type RequestOptions $requestOptions - * Common options for this request. - * @type DirectedReadOptions $directedReadOptions - * Directed read options for this request. - * @type bool $dataBoostEnabled - * If this is for a partitioned read and this field is set to `true`, the - * request is executed with Spanner Data Boost independent compute resources. - * - * If the field is set to `true` but the request does not set - * `partition_token`, the API returns an `INVALID_ARGUMENT` error. - * @type int $orderBy - * Optional. Order for the returned rows. - * - * By default, Spanner will return result rows in primary key order except for - * PartitionRead requests. For applications that do not require rows to be - * returned in primary key (`ORDER_BY_PRIMARY_KEY`) order, setting - * `ORDER_BY_NO_ORDER` option allows Spanner to optimize row retrieval, - * resulting in lower latencies in certain cases (e.g. bulk point lookups). - * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\OrderBy} - * @type int $lockHint - * Optional. Lock Hint for the request, it can only be used with read-write - * transactions. - * For allowed values, use constants defined on {@see \Google\Cloud\Spanner\V1\ReadRequest\LockHint} - * @type int $timeoutMillis - * Timeout to use for this call. - * } - * - * @return \Google\ApiCore\ServerStream - * - * @throws ApiException if the remote call fails - */ - public function streamingRead($session, $table, $columns, $keySet, array $optionalArgs = []) - { - $request = new ReadRequest(); - $requestParamHeaders = []; - $request->setSession($session); - $request->setTable($table); - $request->setColumns($columns); - $request->setKeySet($keySet); - $requestParamHeaders['session'] = $session; - if (isset($optionalArgs['transaction'])) { - $request->setTransaction($optionalArgs['transaction']); - } - - if (isset($optionalArgs['index'])) { - $request->setIndex($optionalArgs['index']); - } - - if (isset($optionalArgs['limit'])) { - $request->setLimit($optionalArgs['limit']); - } - - if (isset($optionalArgs['resumeToken'])) { - $request->setResumeToken($optionalArgs['resumeToken']); - } - - if (isset($optionalArgs['partitionToken'])) { - $request->setPartitionToken($optionalArgs['partitionToken']); - } - - if (isset($optionalArgs['requestOptions'])) { - $request->setRequestOptions($optionalArgs['requestOptions']); - } - - if (isset($optionalArgs['directedReadOptions'])) { - $request->setDirectedReadOptions($optionalArgs['directedReadOptions']); - } - - if (isset($optionalArgs['dataBoostEnabled'])) { - $request->setDataBoostEnabled($optionalArgs['dataBoostEnabled']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['lockHint'])) { - $request->setLockHint($optionalArgs['lockHint']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('StreamingRead', PartialResultSet::class, $optionalArgs, $request, Call::SERVER_STREAMING_CALL); - } -} diff --git a/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()); - } -}