From 302461bc1ff76e8e518906fe50319c7d9ac89631 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 2 Mar 2023 17:25:35 -0600 Subject: [PATCH] feat: introduce AlloyDB (#5913) --- AlloyDb/.OwlBot.yaml | 4 + AlloyDb/.gitattributes | 8 + AlloyDb/.github/pull_request_template.md | 24 + AlloyDb/.repo-metadata.json | 7 + AlloyDb/CONTRIBUTING.md | 10 + AlloyDb/LICENSE | 202 ++ AlloyDb/README.md | 45 + AlloyDb/VERSION | 1 + AlloyDb/composer.json | 29 + AlloyDb/metadata/V1/Resources.php | Bin 0 -> 9723 bytes AlloyDb/metadata/V1/Service.php | Bin 0 -> 10970 bytes AlloyDb/metadata/V1Alpha/Resources.php | Bin 0 -> 10902 bytes AlloyDb/metadata/V1Alpha/Service.php | Bin 0 -> 13805 bytes AlloyDb/metadata/V1Beta/Resources.php | Bin 0 -> 10845 bytes AlloyDb/metadata/V1Beta/Service.php | Bin 0 -> 13710 bytes AlloyDb/owlbot.py | 63 + AlloyDb/phpunit.xml.dist | 16 + .../batch_create_instances.php | 123 + .../V1/AlloyDBAdminClient/create_backup.php | 95 + .../V1/AlloyDBAdminClient/create_cluster.php | 95 + .../V1/AlloyDBAdminClient/create_instance.php | 91 + .../V1/AlloyDBAdminClient/delete_backup.php | 76 + .../V1/AlloyDBAdminClient/delete_cluster.php | 76 + .../V1/AlloyDBAdminClient/delete_instance.php | 81 + .../AlloyDBAdminClient/failover_instance.php | 86 + .../V1/AlloyDBAdminClient/get_backup.php | 66 + .../V1/AlloyDBAdminClient/get_cluster.php | 67 + .../V1/AlloyDBAdminClient/get_instance.php | 72 + .../V1/AlloyDBAdminClient/get_location.php | 53 + .../V1/AlloyDBAdminClient/list_backups.php | 71 + .../V1/AlloyDBAdminClient/list_clusters.php | 74 + .../V1/AlloyDBAdminClient/list_instances.php | 76 + .../V1/AlloyDBAdminClient/list_locations.php | 58 + .../list_supported_database_flags.php | 77 + .../AlloyDBAdminClient/restart_instance.php | 85 + .../V1/AlloyDBAdminClient/restore_cluster.php | 97 + .../V1/AlloyDBAdminClient/update_backup.php | 87 + .../V1/AlloyDBAdminClient/update_cluster.php | 86 + .../V1/AlloyDBAdminClient/update_instance.php | 82 + .../batch_create_instances.php | 123 + .../AlloyDBAdminClient/create_backup.php | 95 + .../AlloyDBAdminClient/create_cluster.php | 95 + .../AlloyDBAdminClient/create_instance.php | 91 + .../create_secondary_cluster.php | 96 + .../create_secondary_instance.php | 91 + .../AlloyDBAdminClient/delete_backup.php | 76 + .../AlloyDBAdminClient/delete_cluster.php | 76 + .../AlloyDBAdminClient/delete_instance.php | 81 + .../AlloyDBAdminClient/failover_instance.php | 86 + .../generate_client_certificate.php | 71 + .../V1alpha/AlloyDBAdminClient/get_backup.php | 66 + .../AlloyDBAdminClient/get_cluster.php | 67 + .../get_connection_info.php | 72 + .../AlloyDBAdminClient/get_instance.php | 72 + .../AlloyDBAdminClient/get_location.php | 53 + .../AlloyDBAdminClient/list_backups.php | 71 + .../AlloyDBAdminClient/list_clusters.php | 74 + .../AlloyDBAdminClient/list_instances.php | 76 + .../AlloyDBAdminClient/list_locations.php | 58 + .../list_supported_database_flags.php | 77 + .../AlloyDBAdminClient/promote_cluster.php | 82 + .../AlloyDBAdminClient/restart_instance.php | 85 + .../AlloyDBAdminClient/restore_cluster.php | 97 + .../AlloyDBAdminClient/update_backup.php | 87 + .../AlloyDBAdminClient/update_cluster.php | 86 + .../AlloyDBAdminClient/update_instance.php | 82 + .../batch_create_instances.php | 123 + .../AlloyDBAdminClient/create_backup.php | 95 + .../AlloyDBAdminClient/create_cluster.php | 95 + .../AlloyDBAdminClient/create_instance.php | 91 + .../create_secondary_cluster.php | 96 + .../create_secondary_instance.php | 91 + .../AlloyDBAdminClient/delete_backup.php | 76 + .../AlloyDBAdminClient/delete_cluster.php | 76 + .../AlloyDBAdminClient/delete_instance.php | 81 + .../AlloyDBAdminClient/failover_instance.php | 86 + .../generate_client_certificate.php | 71 + .../V1beta/AlloyDBAdminClient/get_backup.php | 66 + .../V1beta/AlloyDBAdminClient/get_cluster.php | 67 + .../get_connection_info.php | 72 + .../AlloyDBAdminClient/get_instance.php | 72 + .../AlloyDBAdminClient/get_location.php | 53 + .../AlloyDBAdminClient/list_backups.php | 71 + .../AlloyDBAdminClient/list_clusters.php | 74 + .../AlloyDBAdminClient/list_instances.php | 76 + .../AlloyDBAdminClient/list_locations.php | 58 + .../list_supported_database_flags.php | 77 + .../AlloyDBAdminClient/promote_cluster.php | 82 + .../AlloyDBAdminClient/restart_instance.php | 85 + .../AlloyDBAdminClient/restore_cluster.php | 97 + .../AlloyDBAdminClient/update_backup.php | 87 + .../AlloyDBAdminClient/update_cluster.php | 86 + .../AlloyDBAdminClient/update_instance.php | 82 + AlloyDb/src/V1/AlloyDBAdminClient.php | 34 + AlloyDb/src/V1/AutomatedBackupPolicy.php | 392 ++ .../QuantityBasedRetention.php | 69 + .../TimeBasedRetention.php | 79 + .../AutomatedBackupPolicy/WeeklySchedule.php | 127 + AlloyDb/src/V1/Backup.php | 823 +++++ AlloyDb/src/V1/Backup/State.php | 76 + AlloyDb/src/V1/Backup/Type.php | 72 + AlloyDb/src/V1/BackupSource.php | 113 + AlloyDb/src/V1/BatchCreateInstanceStatus.php | 221 ++ .../V1/BatchCreateInstanceStatus/State.php | 95 + .../src/V1/BatchCreateInstancesMetadata.php | 133 + .../src/V1/BatchCreateInstancesRequest.php | 185 + .../src/V1/BatchCreateInstancesResponse.php | 67 + AlloyDb/src/V1/Cluster.php | 1048 ++++++ AlloyDb/src/V1/Cluster/ClusterType.php | 63 + AlloyDb/src/V1/Cluster/PrimaryConfig.php | 74 + AlloyDb/src/V1/Cluster/SecondaryConfig.php | 73 + AlloyDb/src/V1/Cluster/State.php | 123 + AlloyDb/src/V1/CreateBackupRequest.php | 257 ++ AlloyDb/src/V1/CreateClusterRequest.php | 265 ++ AlloyDb/src/V1/CreateInstanceRequest.php | 265 ++ AlloyDb/src/V1/CreateInstanceRequests.php | 71 + AlloyDb/src/V1/DatabaseVersion.php | 61 + AlloyDb/src/V1/DeleteBackupRequest.php | 225 ++ AlloyDb/src/V1/DeleteClusterRequest.php | 259 ++ AlloyDb/src/V1/DeleteInstanceRequest.php | 225 ++ AlloyDb/src/V1/EncryptionConfig.php | 76 + AlloyDb/src/V1/EncryptionInfo.php | 105 + AlloyDb/src/V1/EncryptionInfo/Type.php | 64 + AlloyDb/src/V1/FailoverInstanceRequest.php | 183 + .../src/V1/Gapic/AlloyDBAdminGapicClient.php | 2567 ++++++++++++++ AlloyDb/src/V1/GetBackupRequest.php | 67 + AlloyDb/src/V1/GetClusterRequest.php | 71 + AlloyDb/src/V1/GetInstanceRequest.php | 105 + AlloyDb/src/V1/Instance.php | 966 +++++ AlloyDb/src/V1/Instance/AvailabilityType.php | 66 + AlloyDb/src/V1/Instance/InstanceType.php | 74 + AlloyDb/src/V1/Instance/MachineConfig.php | 68 + AlloyDb/src/V1/Instance/Node.php | 184 + .../Instance/QueryInsightsInstanceConfig.php | 220 ++ AlloyDb/src/V1/Instance/ReadPoolConfig.php | 68 + AlloyDb/src/V1/Instance/State.php | 110 + AlloyDb/src/V1/InstanceView.php | 65 + AlloyDb/src/V1/ListBackupsRequest.php | 207 ++ AlloyDb/src/V1/ListBackupsResponse.php | 135 + AlloyDb/src/V1/ListClustersRequest.php | 219 ++ AlloyDb/src/V1/ListClustersResponse.php | 135 + AlloyDb/src/V1/ListInstancesRequest.php | 227 ++ AlloyDb/src/V1/ListInstancesResponse.php | 135 + .../V1/ListSupportedDatabaseFlagsRequest.php | 159 + .../V1/ListSupportedDatabaseFlagsResponse.php | 101 + AlloyDb/src/V1/MigrationSource.php | 144 + .../MigrationSource/MigrationSourceType.php | 55 + AlloyDb/src/V1/OperationMetadata.php | 349 ++ AlloyDb/src/V1/RestartInstanceRequest.php | 181 + AlloyDb/src/V1/RestoreClusterRequest.php | 308 ++ AlloyDb/src/V1/SslConfig.php | 105 + AlloyDb/src/V1/SslConfig/CaSource.php | 56 + AlloyDb/src/V1/SslConfig/SslMode.php | 73 + AlloyDb/src/V1/SupportedDatabaseFlag.php | 337 ++ .../IntegerRestrictions.php | 176 + .../StringRestrictions.php | 72 + .../V1/SupportedDatabaseFlag/ValueType.php | 78 + AlloyDb/src/V1/UpdateBackupRequest.php | 287 ++ AlloyDb/src/V1/UpdateClusterRequest.php | 291 ++ AlloyDb/src/V1/UpdateInstanceRequest.php | 291 ++ AlloyDb/src/V1/UserPassword.php | 102 + AlloyDb/src/V1/gapic_metadata.json | 128 + .../alloy_db_admin_client_config.json | 154 + .../alloy_db_admin_descriptor_config.php | 188 + .../alloy_db_admin_rest_client_config.php | 322 ++ AlloyDb/src/V1alpha/AlloyDBAdminClient.php | 36 + AlloyDb/src/V1alpha/AutomatedBackupPolicy.php | 392 ++ .../QuantityBasedRetention.php | 69 + .../TimeBasedRetention.php | 79 + .../AutomatedBackupPolicy/WeeklySchedule.php | 127 + AlloyDb/src/V1alpha/Backup.php | 823 +++++ AlloyDb/src/V1alpha/Backup/State.php | 76 + AlloyDb/src/V1alpha/Backup/Type.php | 72 + AlloyDb/src/V1alpha/BackupSource.php | 113 + .../src/V1alpha/BatchCreateInstanceStatus.php | 221 ++ .../BatchCreateInstanceStatus/State.php | 95 + .../V1alpha/BatchCreateInstancesMetadata.php | 133 + .../V1alpha/BatchCreateInstancesRequest.php | 185 + .../V1alpha/BatchCreateInstancesResponse.php | 67 + AlloyDb/src/V1alpha/Cluster.php | 1136 ++++++ AlloyDb/src/V1alpha/Cluster/ClusterType.php | 63 + AlloyDb/src/V1alpha/Cluster/PrimaryConfig.php | 74 + .../src/V1alpha/Cluster/SecondaryConfig.php | 73 + AlloyDb/src/V1alpha/Cluster/State.php | 123 + AlloyDb/src/V1alpha/ConnectionInfo.php | 186 + .../src/V1alpha/ContinuousBackupConfig.php | 176 + AlloyDb/src/V1alpha/ContinuousBackupInfo.php | 168 + .../src/V1alpha/ContinuousBackupSource.php | 119 + AlloyDb/src/V1alpha/CreateBackupRequest.php | 257 ++ AlloyDb/src/V1alpha/CreateClusterRequest.php | 265 ++ AlloyDb/src/V1alpha/CreateInstanceRequest.php | 265 ++ .../src/V1alpha/CreateInstanceRequests.php | 71 + .../V1alpha/CreateSecondaryClusterRequest.php | 263 ++ .../CreateSecondaryInstanceRequest.php | 265 ++ AlloyDb/src/V1alpha/DatabaseVersion.php | 61 + AlloyDb/src/V1alpha/DeleteBackupRequest.php | 225 ++ AlloyDb/src/V1alpha/DeleteClusterRequest.php | 259 ++ AlloyDb/src/V1alpha/DeleteInstanceRequest.php | 225 ++ AlloyDb/src/V1alpha/EncryptionConfig.php | 76 + AlloyDb/src/V1alpha/EncryptionInfo.php | 105 + AlloyDb/src/V1alpha/EncryptionInfo/Type.php | 64 + .../src/V1alpha/FailoverInstanceRequest.php | 183 + .../V1alpha/Gapic/AlloyDBAdminGapicClient.php | 3146 +++++++++++++++++ .../GenerateClientCertificateRequest.php | 240 ++ .../GenerateClientCertificateResponse.php | 105 + AlloyDb/src/V1alpha/GetBackupRequest.php | 67 + AlloyDb/src/V1alpha/GetClusterRequest.php | 71 + .../src/V1alpha/GetConnectionInfoRequest.php | 145 + AlloyDb/src/V1alpha/GetInstanceRequest.php | 105 + AlloyDb/src/V1alpha/Instance.php | 966 +++++ .../src/V1alpha/Instance/AvailabilityType.php | 66 + AlloyDb/src/V1alpha/Instance/InstanceType.php | 74 + .../src/V1alpha/Instance/MachineConfig.php | 68 + AlloyDb/src/V1alpha/Instance/Node.php | 184 + .../Instance/QueryInsightsInstanceConfig.php | 220 ++ .../src/V1alpha/Instance/ReadPoolConfig.php | 68 + AlloyDb/src/V1alpha/Instance/State.php | 110 + AlloyDb/src/V1alpha/InstanceView.php | 65 + AlloyDb/src/V1alpha/ListBackupsRequest.php | 207 ++ AlloyDb/src/V1alpha/ListBackupsResponse.php | 135 + AlloyDb/src/V1alpha/ListClustersRequest.php | 219 ++ AlloyDb/src/V1alpha/ListClustersResponse.php | 135 + AlloyDb/src/V1alpha/ListInstancesRequest.php | 227 ++ AlloyDb/src/V1alpha/ListInstancesResponse.php | 135 + .../ListSupportedDatabaseFlagsRequest.php | 159 + .../ListSupportedDatabaseFlagsResponse.php | 101 + AlloyDb/src/V1alpha/MigrationSource.php | 144 + .../MigrationSource/MigrationSourceType.php | 55 + AlloyDb/src/V1alpha/OperationMetadata.php | 349 ++ AlloyDb/src/V1alpha/PromoteClusterRequest.php | 225 ++ .../src/V1alpha/RestartInstanceRequest.php | 181 + AlloyDb/src/V1alpha/RestoreClusterRequest.php | 344 ++ AlloyDb/src/V1alpha/SslConfig.php | 105 + AlloyDb/src/V1alpha/SslConfig/CaSource.php | 56 + AlloyDb/src/V1alpha/SslConfig/SslMode.php | 73 + AlloyDb/src/V1alpha/SupportedDatabaseFlag.php | 337 ++ .../IntegerRestrictions.php | 176 + .../StringRestrictions.php | 72 + .../SupportedDatabaseFlag/ValueType.php | 78 + AlloyDb/src/V1alpha/UpdateBackupRequest.php | 287 ++ AlloyDb/src/V1alpha/UpdateClusterRequest.php | 291 ++ AlloyDb/src/V1alpha/UpdateInstanceRequest.php | 291 ++ AlloyDb/src/V1alpha/UserPassword.php | 102 + AlloyDb/src/V1alpha/gapic_metadata.json | 153 + .../alloy_db_admin_client_config.json | 179 + .../alloy_db_admin_descriptor_config.php | 218 ++ .../alloy_db_admin_rest_client_config.php | 381 ++ AlloyDb/src/V1beta/AlloyDBAdminClient.php | 36 + AlloyDb/src/V1beta/AutomatedBackupPolicy.php | 392 ++ .../QuantityBasedRetention.php | 69 + .../TimeBasedRetention.php | 79 + .../AutomatedBackupPolicy/WeeklySchedule.php | 127 + AlloyDb/src/V1beta/Backup.php | 823 +++++ AlloyDb/src/V1beta/Backup/State.php | 76 + AlloyDb/src/V1beta/Backup/Type.php | 72 + AlloyDb/src/V1beta/BackupSource.php | 113 + .../src/V1beta/BatchCreateInstanceStatus.php | 221 ++ .../BatchCreateInstanceStatus/State.php | 95 + .../V1beta/BatchCreateInstancesMetadata.php | 133 + .../V1beta/BatchCreateInstancesRequest.php | 185 + .../V1beta/BatchCreateInstancesResponse.php | 67 + AlloyDb/src/V1beta/Cluster.php | 1136 ++++++ AlloyDb/src/V1beta/Cluster/ClusterType.php | 63 + AlloyDb/src/V1beta/Cluster/PrimaryConfig.php | 74 + .../src/V1beta/Cluster/SecondaryConfig.php | 73 + AlloyDb/src/V1beta/Cluster/State.php | 123 + AlloyDb/src/V1beta/ConnectionInfo.php | 186 + AlloyDb/src/V1beta/ContinuousBackupConfig.php | 176 + AlloyDb/src/V1beta/ContinuousBackupInfo.php | 168 + AlloyDb/src/V1beta/ContinuousBackupSource.php | 119 + AlloyDb/src/V1beta/CreateBackupRequest.php | 257 ++ AlloyDb/src/V1beta/CreateClusterRequest.php | 265 ++ AlloyDb/src/V1beta/CreateInstanceRequest.php | 265 ++ AlloyDb/src/V1beta/CreateInstanceRequests.php | 71 + .../V1beta/CreateSecondaryClusterRequest.php | 263 ++ .../V1beta/CreateSecondaryInstanceRequest.php | 265 ++ AlloyDb/src/V1beta/DatabaseVersion.php | 61 + AlloyDb/src/V1beta/DeleteBackupRequest.php | 225 ++ AlloyDb/src/V1beta/DeleteClusterRequest.php | 259 ++ AlloyDb/src/V1beta/DeleteInstanceRequest.php | 225 ++ AlloyDb/src/V1beta/EncryptionConfig.php | 76 + AlloyDb/src/V1beta/EncryptionInfo.php | 105 + AlloyDb/src/V1beta/EncryptionInfo/Type.php | 64 + .../src/V1beta/FailoverInstanceRequest.php | 183 + .../V1beta/Gapic/AlloyDBAdminGapicClient.php | 3146 +++++++++++++++++ .../GenerateClientCertificateRequest.php | 240 ++ .../GenerateClientCertificateResponse.php | 105 + AlloyDb/src/V1beta/GetBackupRequest.php | 67 + AlloyDb/src/V1beta/GetClusterRequest.php | 71 + .../src/V1beta/GetConnectionInfoRequest.php | 145 + AlloyDb/src/V1beta/GetInstanceRequest.php | 105 + AlloyDb/src/V1beta/Instance.php | 966 +++++ .../src/V1beta/Instance/AvailabilityType.php | 66 + AlloyDb/src/V1beta/Instance/InstanceType.php | 74 + AlloyDb/src/V1beta/Instance/MachineConfig.php | 68 + AlloyDb/src/V1beta/Instance/Node.php | 184 + .../Instance/QueryInsightsInstanceConfig.php | 220 ++ .../src/V1beta/Instance/ReadPoolConfig.php | 68 + AlloyDb/src/V1beta/Instance/State.php | 110 + AlloyDb/src/V1beta/InstanceView.php | 65 + AlloyDb/src/V1beta/ListBackupsRequest.php | 207 ++ AlloyDb/src/V1beta/ListBackupsResponse.php | 135 + AlloyDb/src/V1beta/ListClustersRequest.php | 219 ++ AlloyDb/src/V1beta/ListClustersResponse.php | 135 + AlloyDb/src/V1beta/ListInstancesRequest.php | 227 ++ AlloyDb/src/V1beta/ListInstancesResponse.php | 135 + .../ListSupportedDatabaseFlagsRequest.php | 159 + .../ListSupportedDatabaseFlagsResponse.php | 101 + AlloyDb/src/V1beta/MigrationSource.php | 144 + .../MigrationSource/MigrationSourceType.php | 55 + AlloyDb/src/V1beta/OperationMetadata.php | 349 ++ AlloyDb/src/V1beta/PromoteClusterRequest.php | 225 ++ AlloyDb/src/V1beta/RestartInstanceRequest.php | 181 + AlloyDb/src/V1beta/RestoreClusterRequest.php | 344 ++ AlloyDb/src/V1beta/SslConfig.php | 105 + AlloyDb/src/V1beta/SslConfig/CaSource.php | 56 + AlloyDb/src/V1beta/SslConfig/SslMode.php | 73 + AlloyDb/src/V1beta/SupportedDatabaseFlag.php | 337 ++ .../IntegerRestrictions.php | 176 + .../StringRestrictions.php | 72 + .../SupportedDatabaseFlag/ValueType.php | 78 + AlloyDb/src/V1beta/UpdateBackupRequest.php | 287 ++ AlloyDb/src/V1beta/UpdateClusterRequest.php | 291 ++ AlloyDb/src/V1beta/UpdateInstanceRequest.php | 291 ++ AlloyDb/src/V1beta/UserPassword.php | 102 + AlloyDb/src/V1beta/gapic_metadata.json | 153 + .../alloy_db_admin_client_config.json | 179 + .../alloy_db_admin_descriptor_config.php | 218 ++ .../alloy_db_admin_rest_client_config.php | 380 ++ .../tests/Unit/V1/AlloyDBAdminClientTest.php | 2405 +++++++++++++ .../Unit/V1alpha/AlloyDBAdminClientTest.php | 2944 +++++++++++++++ .../Unit/V1beta/AlloyDBAdminClientTest.php | 2944 +++++++++++++++ composer.json | 3 + 333 files changed, 67029 insertions(+) create mode 100644 AlloyDb/.OwlBot.yaml create mode 100644 AlloyDb/.gitattributes create mode 100644 AlloyDb/.github/pull_request_template.md create mode 100644 AlloyDb/.repo-metadata.json create mode 100644 AlloyDb/CONTRIBUTING.md create mode 100644 AlloyDb/LICENSE create mode 100644 AlloyDb/README.md create mode 100644 AlloyDb/VERSION create mode 100644 AlloyDb/composer.json create mode 100644 AlloyDb/metadata/V1/Resources.php create mode 100644 AlloyDb/metadata/V1/Service.php create mode 100644 AlloyDb/metadata/V1Alpha/Resources.php create mode 100644 AlloyDb/metadata/V1Alpha/Service.php create mode 100644 AlloyDb/metadata/V1Beta/Resources.php create mode 100644 AlloyDb/metadata/V1Beta/Service.php create mode 100644 AlloyDb/owlbot.py create mode 100644 AlloyDb/phpunit.xml.dist create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/batch_create_instances.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/create_backup.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/create_cluster.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/create_instance.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/delete_backup.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/delete_cluster.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/delete_instance.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/failover_instance.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/get_backup.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/get_cluster.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/get_instance.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/get_location.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/list_backups.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/list_clusters.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/list_instances.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/list_locations.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/list_supported_database_flags.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/restart_instance.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/restore_cluster.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/update_backup.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/update_cluster.php create mode 100644 AlloyDb/samples/V1/AlloyDBAdminClient/update_instance.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/batch_create_instances.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/create_backup.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/create_cluster.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/create_instance.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/create_secondary_cluster.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/create_secondary_instance.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/delete_backup.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/delete_cluster.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/delete_instance.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/failover_instance.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/generate_client_certificate.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/get_backup.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/get_cluster.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/get_connection_info.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/get_instance.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/get_location.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/list_backups.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/list_clusters.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/list_instances.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/list_locations.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/list_supported_database_flags.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/promote_cluster.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/restart_instance.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/restore_cluster.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/update_backup.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/update_cluster.php create mode 100644 AlloyDb/samples/V1alpha/AlloyDBAdminClient/update_instance.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/batch_create_instances.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/create_backup.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/create_cluster.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/create_instance.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/create_secondary_cluster.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/create_secondary_instance.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/delete_backup.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/delete_cluster.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/delete_instance.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/failover_instance.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/generate_client_certificate.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/get_backup.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/get_cluster.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/get_connection_info.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/get_instance.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/get_location.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/list_backups.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/list_clusters.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/list_instances.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/list_locations.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/list_supported_database_flags.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/promote_cluster.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/restart_instance.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/restore_cluster.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/update_backup.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/update_cluster.php create mode 100644 AlloyDb/samples/V1beta/AlloyDBAdminClient/update_instance.php create mode 100644 AlloyDb/src/V1/AlloyDBAdminClient.php create mode 100644 AlloyDb/src/V1/AutomatedBackupPolicy.php create mode 100644 AlloyDb/src/V1/AutomatedBackupPolicy/QuantityBasedRetention.php create mode 100644 AlloyDb/src/V1/AutomatedBackupPolicy/TimeBasedRetention.php create mode 100644 AlloyDb/src/V1/AutomatedBackupPolicy/WeeklySchedule.php create mode 100644 AlloyDb/src/V1/Backup.php create mode 100644 AlloyDb/src/V1/Backup/State.php create mode 100644 AlloyDb/src/V1/Backup/Type.php create mode 100644 AlloyDb/src/V1/BackupSource.php create mode 100644 AlloyDb/src/V1/BatchCreateInstanceStatus.php create mode 100644 AlloyDb/src/V1/BatchCreateInstanceStatus/State.php create mode 100644 AlloyDb/src/V1/BatchCreateInstancesMetadata.php create mode 100644 AlloyDb/src/V1/BatchCreateInstancesRequest.php create mode 100644 AlloyDb/src/V1/BatchCreateInstancesResponse.php create mode 100644 AlloyDb/src/V1/Cluster.php create mode 100644 AlloyDb/src/V1/Cluster/ClusterType.php create mode 100644 AlloyDb/src/V1/Cluster/PrimaryConfig.php create mode 100644 AlloyDb/src/V1/Cluster/SecondaryConfig.php create mode 100644 AlloyDb/src/V1/Cluster/State.php create mode 100644 AlloyDb/src/V1/CreateBackupRequest.php create mode 100644 AlloyDb/src/V1/CreateClusterRequest.php create mode 100644 AlloyDb/src/V1/CreateInstanceRequest.php create mode 100644 AlloyDb/src/V1/CreateInstanceRequests.php create mode 100644 AlloyDb/src/V1/DatabaseVersion.php create mode 100644 AlloyDb/src/V1/DeleteBackupRequest.php create mode 100644 AlloyDb/src/V1/DeleteClusterRequest.php create mode 100644 AlloyDb/src/V1/DeleteInstanceRequest.php create mode 100644 AlloyDb/src/V1/EncryptionConfig.php create mode 100644 AlloyDb/src/V1/EncryptionInfo.php create mode 100644 AlloyDb/src/V1/EncryptionInfo/Type.php create mode 100644 AlloyDb/src/V1/FailoverInstanceRequest.php create mode 100644 AlloyDb/src/V1/Gapic/AlloyDBAdminGapicClient.php create mode 100644 AlloyDb/src/V1/GetBackupRequest.php create mode 100644 AlloyDb/src/V1/GetClusterRequest.php create mode 100644 AlloyDb/src/V1/GetInstanceRequest.php create mode 100644 AlloyDb/src/V1/Instance.php create mode 100644 AlloyDb/src/V1/Instance/AvailabilityType.php create mode 100644 AlloyDb/src/V1/Instance/InstanceType.php create mode 100644 AlloyDb/src/V1/Instance/MachineConfig.php create mode 100644 AlloyDb/src/V1/Instance/Node.php create mode 100644 AlloyDb/src/V1/Instance/QueryInsightsInstanceConfig.php create mode 100644 AlloyDb/src/V1/Instance/ReadPoolConfig.php create mode 100644 AlloyDb/src/V1/Instance/State.php create mode 100644 AlloyDb/src/V1/InstanceView.php create mode 100644 AlloyDb/src/V1/ListBackupsRequest.php create mode 100644 AlloyDb/src/V1/ListBackupsResponse.php create mode 100644 AlloyDb/src/V1/ListClustersRequest.php create mode 100644 AlloyDb/src/V1/ListClustersResponse.php create mode 100644 AlloyDb/src/V1/ListInstancesRequest.php create mode 100644 AlloyDb/src/V1/ListInstancesResponse.php create mode 100644 AlloyDb/src/V1/ListSupportedDatabaseFlagsRequest.php create mode 100644 AlloyDb/src/V1/ListSupportedDatabaseFlagsResponse.php create mode 100644 AlloyDb/src/V1/MigrationSource.php create mode 100644 AlloyDb/src/V1/MigrationSource/MigrationSourceType.php create mode 100644 AlloyDb/src/V1/OperationMetadata.php create mode 100644 AlloyDb/src/V1/RestartInstanceRequest.php create mode 100644 AlloyDb/src/V1/RestoreClusterRequest.php create mode 100644 AlloyDb/src/V1/SslConfig.php create mode 100644 AlloyDb/src/V1/SslConfig/CaSource.php create mode 100644 AlloyDb/src/V1/SslConfig/SslMode.php create mode 100644 AlloyDb/src/V1/SupportedDatabaseFlag.php create mode 100644 AlloyDb/src/V1/SupportedDatabaseFlag/IntegerRestrictions.php create mode 100644 AlloyDb/src/V1/SupportedDatabaseFlag/StringRestrictions.php create mode 100644 AlloyDb/src/V1/SupportedDatabaseFlag/ValueType.php create mode 100644 AlloyDb/src/V1/UpdateBackupRequest.php create mode 100644 AlloyDb/src/V1/UpdateClusterRequest.php create mode 100644 AlloyDb/src/V1/UpdateInstanceRequest.php create mode 100644 AlloyDb/src/V1/UserPassword.php create mode 100644 AlloyDb/src/V1/gapic_metadata.json create mode 100644 AlloyDb/src/V1/resources/alloy_db_admin_client_config.json create mode 100644 AlloyDb/src/V1/resources/alloy_db_admin_descriptor_config.php create mode 100644 AlloyDb/src/V1/resources/alloy_db_admin_rest_client_config.php create mode 100644 AlloyDb/src/V1alpha/AlloyDBAdminClient.php create mode 100644 AlloyDb/src/V1alpha/AutomatedBackupPolicy.php create mode 100644 AlloyDb/src/V1alpha/AutomatedBackupPolicy/QuantityBasedRetention.php create mode 100644 AlloyDb/src/V1alpha/AutomatedBackupPolicy/TimeBasedRetention.php create mode 100644 AlloyDb/src/V1alpha/AutomatedBackupPolicy/WeeklySchedule.php create mode 100644 AlloyDb/src/V1alpha/Backup.php create mode 100644 AlloyDb/src/V1alpha/Backup/State.php create mode 100644 AlloyDb/src/V1alpha/Backup/Type.php create mode 100644 AlloyDb/src/V1alpha/BackupSource.php create mode 100644 AlloyDb/src/V1alpha/BatchCreateInstanceStatus.php create mode 100644 AlloyDb/src/V1alpha/BatchCreateInstanceStatus/State.php create mode 100644 AlloyDb/src/V1alpha/BatchCreateInstancesMetadata.php create mode 100644 AlloyDb/src/V1alpha/BatchCreateInstancesRequest.php create mode 100644 AlloyDb/src/V1alpha/BatchCreateInstancesResponse.php create mode 100644 AlloyDb/src/V1alpha/Cluster.php create mode 100644 AlloyDb/src/V1alpha/Cluster/ClusterType.php create mode 100644 AlloyDb/src/V1alpha/Cluster/PrimaryConfig.php create mode 100644 AlloyDb/src/V1alpha/Cluster/SecondaryConfig.php create mode 100644 AlloyDb/src/V1alpha/Cluster/State.php create mode 100644 AlloyDb/src/V1alpha/ConnectionInfo.php create mode 100644 AlloyDb/src/V1alpha/ContinuousBackupConfig.php create mode 100644 AlloyDb/src/V1alpha/ContinuousBackupInfo.php create mode 100644 AlloyDb/src/V1alpha/ContinuousBackupSource.php create mode 100644 AlloyDb/src/V1alpha/CreateBackupRequest.php create mode 100644 AlloyDb/src/V1alpha/CreateClusterRequest.php create mode 100644 AlloyDb/src/V1alpha/CreateInstanceRequest.php create mode 100644 AlloyDb/src/V1alpha/CreateInstanceRequests.php create mode 100644 AlloyDb/src/V1alpha/CreateSecondaryClusterRequest.php create mode 100644 AlloyDb/src/V1alpha/CreateSecondaryInstanceRequest.php create mode 100644 AlloyDb/src/V1alpha/DatabaseVersion.php create mode 100644 AlloyDb/src/V1alpha/DeleteBackupRequest.php create mode 100644 AlloyDb/src/V1alpha/DeleteClusterRequest.php create mode 100644 AlloyDb/src/V1alpha/DeleteInstanceRequest.php create mode 100644 AlloyDb/src/V1alpha/EncryptionConfig.php create mode 100644 AlloyDb/src/V1alpha/EncryptionInfo.php create mode 100644 AlloyDb/src/V1alpha/EncryptionInfo/Type.php create mode 100644 AlloyDb/src/V1alpha/FailoverInstanceRequest.php create mode 100644 AlloyDb/src/V1alpha/Gapic/AlloyDBAdminGapicClient.php create mode 100644 AlloyDb/src/V1alpha/GenerateClientCertificateRequest.php create mode 100644 AlloyDb/src/V1alpha/GenerateClientCertificateResponse.php create mode 100644 AlloyDb/src/V1alpha/GetBackupRequest.php create mode 100644 AlloyDb/src/V1alpha/GetClusterRequest.php create mode 100644 AlloyDb/src/V1alpha/GetConnectionInfoRequest.php create mode 100644 AlloyDb/src/V1alpha/GetInstanceRequest.php create mode 100644 AlloyDb/src/V1alpha/Instance.php create mode 100644 AlloyDb/src/V1alpha/Instance/AvailabilityType.php create mode 100644 AlloyDb/src/V1alpha/Instance/InstanceType.php create mode 100644 AlloyDb/src/V1alpha/Instance/MachineConfig.php create mode 100644 AlloyDb/src/V1alpha/Instance/Node.php create mode 100644 AlloyDb/src/V1alpha/Instance/QueryInsightsInstanceConfig.php create mode 100644 AlloyDb/src/V1alpha/Instance/ReadPoolConfig.php create mode 100644 AlloyDb/src/V1alpha/Instance/State.php create mode 100644 AlloyDb/src/V1alpha/InstanceView.php create mode 100644 AlloyDb/src/V1alpha/ListBackupsRequest.php create mode 100644 AlloyDb/src/V1alpha/ListBackupsResponse.php create mode 100644 AlloyDb/src/V1alpha/ListClustersRequest.php create mode 100644 AlloyDb/src/V1alpha/ListClustersResponse.php create mode 100644 AlloyDb/src/V1alpha/ListInstancesRequest.php create mode 100644 AlloyDb/src/V1alpha/ListInstancesResponse.php create mode 100644 AlloyDb/src/V1alpha/ListSupportedDatabaseFlagsRequest.php create mode 100644 AlloyDb/src/V1alpha/ListSupportedDatabaseFlagsResponse.php create mode 100644 AlloyDb/src/V1alpha/MigrationSource.php create mode 100644 AlloyDb/src/V1alpha/MigrationSource/MigrationSourceType.php create mode 100644 AlloyDb/src/V1alpha/OperationMetadata.php create mode 100644 AlloyDb/src/V1alpha/PromoteClusterRequest.php create mode 100644 AlloyDb/src/V1alpha/RestartInstanceRequest.php create mode 100644 AlloyDb/src/V1alpha/RestoreClusterRequest.php create mode 100644 AlloyDb/src/V1alpha/SslConfig.php create mode 100644 AlloyDb/src/V1alpha/SslConfig/CaSource.php create mode 100644 AlloyDb/src/V1alpha/SslConfig/SslMode.php create mode 100644 AlloyDb/src/V1alpha/SupportedDatabaseFlag.php create mode 100644 AlloyDb/src/V1alpha/SupportedDatabaseFlag/IntegerRestrictions.php create mode 100644 AlloyDb/src/V1alpha/SupportedDatabaseFlag/StringRestrictions.php create mode 100644 AlloyDb/src/V1alpha/SupportedDatabaseFlag/ValueType.php create mode 100644 AlloyDb/src/V1alpha/UpdateBackupRequest.php create mode 100644 AlloyDb/src/V1alpha/UpdateClusterRequest.php create mode 100644 AlloyDb/src/V1alpha/UpdateInstanceRequest.php create mode 100644 AlloyDb/src/V1alpha/UserPassword.php create mode 100644 AlloyDb/src/V1alpha/gapic_metadata.json create mode 100644 AlloyDb/src/V1alpha/resources/alloy_db_admin_client_config.json create mode 100644 AlloyDb/src/V1alpha/resources/alloy_db_admin_descriptor_config.php create mode 100644 AlloyDb/src/V1alpha/resources/alloy_db_admin_rest_client_config.php create mode 100644 AlloyDb/src/V1beta/AlloyDBAdminClient.php create mode 100644 AlloyDb/src/V1beta/AutomatedBackupPolicy.php create mode 100644 AlloyDb/src/V1beta/AutomatedBackupPolicy/QuantityBasedRetention.php create mode 100644 AlloyDb/src/V1beta/AutomatedBackupPolicy/TimeBasedRetention.php create mode 100644 AlloyDb/src/V1beta/AutomatedBackupPolicy/WeeklySchedule.php create mode 100644 AlloyDb/src/V1beta/Backup.php create mode 100644 AlloyDb/src/V1beta/Backup/State.php create mode 100644 AlloyDb/src/V1beta/Backup/Type.php create mode 100644 AlloyDb/src/V1beta/BackupSource.php create mode 100644 AlloyDb/src/V1beta/BatchCreateInstanceStatus.php create mode 100644 AlloyDb/src/V1beta/BatchCreateInstanceStatus/State.php create mode 100644 AlloyDb/src/V1beta/BatchCreateInstancesMetadata.php create mode 100644 AlloyDb/src/V1beta/BatchCreateInstancesRequest.php create mode 100644 AlloyDb/src/V1beta/BatchCreateInstancesResponse.php create mode 100644 AlloyDb/src/V1beta/Cluster.php create mode 100644 AlloyDb/src/V1beta/Cluster/ClusterType.php create mode 100644 AlloyDb/src/V1beta/Cluster/PrimaryConfig.php create mode 100644 AlloyDb/src/V1beta/Cluster/SecondaryConfig.php create mode 100644 AlloyDb/src/V1beta/Cluster/State.php create mode 100644 AlloyDb/src/V1beta/ConnectionInfo.php create mode 100644 AlloyDb/src/V1beta/ContinuousBackupConfig.php create mode 100644 AlloyDb/src/V1beta/ContinuousBackupInfo.php create mode 100644 AlloyDb/src/V1beta/ContinuousBackupSource.php create mode 100644 AlloyDb/src/V1beta/CreateBackupRequest.php create mode 100644 AlloyDb/src/V1beta/CreateClusterRequest.php create mode 100644 AlloyDb/src/V1beta/CreateInstanceRequest.php create mode 100644 AlloyDb/src/V1beta/CreateInstanceRequests.php create mode 100644 AlloyDb/src/V1beta/CreateSecondaryClusterRequest.php create mode 100644 AlloyDb/src/V1beta/CreateSecondaryInstanceRequest.php create mode 100644 AlloyDb/src/V1beta/DatabaseVersion.php create mode 100644 AlloyDb/src/V1beta/DeleteBackupRequest.php create mode 100644 AlloyDb/src/V1beta/DeleteClusterRequest.php create mode 100644 AlloyDb/src/V1beta/DeleteInstanceRequest.php create mode 100644 AlloyDb/src/V1beta/EncryptionConfig.php create mode 100644 AlloyDb/src/V1beta/EncryptionInfo.php create mode 100644 AlloyDb/src/V1beta/EncryptionInfo/Type.php create mode 100644 AlloyDb/src/V1beta/FailoverInstanceRequest.php create mode 100644 AlloyDb/src/V1beta/Gapic/AlloyDBAdminGapicClient.php create mode 100644 AlloyDb/src/V1beta/GenerateClientCertificateRequest.php create mode 100644 AlloyDb/src/V1beta/GenerateClientCertificateResponse.php create mode 100644 AlloyDb/src/V1beta/GetBackupRequest.php create mode 100644 AlloyDb/src/V1beta/GetClusterRequest.php create mode 100644 AlloyDb/src/V1beta/GetConnectionInfoRequest.php create mode 100644 AlloyDb/src/V1beta/GetInstanceRequest.php create mode 100644 AlloyDb/src/V1beta/Instance.php create mode 100644 AlloyDb/src/V1beta/Instance/AvailabilityType.php create mode 100644 AlloyDb/src/V1beta/Instance/InstanceType.php create mode 100644 AlloyDb/src/V1beta/Instance/MachineConfig.php create mode 100644 AlloyDb/src/V1beta/Instance/Node.php create mode 100644 AlloyDb/src/V1beta/Instance/QueryInsightsInstanceConfig.php create mode 100644 AlloyDb/src/V1beta/Instance/ReadPoolConfig.php create mode 100644 AlloyDb/src/V1beta/Instance/State.php create mode 100644 AlloyDb/src/V1beta/InstanceView.php create mode 100644 AlloyDb/src/V1beta/ListBackupsRequest.php create mode 100644 AlloyDb/src/V1beta/ListBackupsResponse.php create mode 100644 AlloyDb/src/V1beta/ListClustersRequest.php create mode 100644 AlloyDb/src/V1beta/ListClustersResponse.php create mode 100644 AlloyDb/src/V1beta/ListInstancesRequest.php create mode 100644 AlloyDb/src/V1beta/ListInstancesResponse.php create mode 100644 AlloyDb/src/V1beta/ListSupportedDatabaseFlagsRequest.php create mode 100644 AlloyDb/src/V1beta/ListSupportedDatabaseFlagsResponse.php create mode 100644 AlloyDb/src/V1beta/MigrationSource.php create mode 100644 AlloyDb/src/V1beta/MigrationSource/MigrationSourceType.php create mode 100644 AlloyDb/src/V1beta/OperationMetadata.php create mode 100644 AlloyDb/src/V1beta/PromoteClusterRequest.php create mode 100644 AlloyDb/src/V1beta/RestartInstanceRequest.php create mode 100644 AlloyDb/src/V1beta/RestoreClusterRequest.php create mode 100644 AlloyDb/src/V1beta/SslConfig.php create mode 100644 AlloyDb/src/V1beta/SslConfig/CaSource.php create mode 100644 AlloyDb/src/V1beta/SslConfig/SslMode.php create mode 100644 AlloyDb/src/V1beta/SupportedDatabaseFlag.php create mode 100644 AlloyDb/src/V1beta/SupportedDatabaseFlag/IntegerRestrictions.php create mode 100644 AlloyDb/src/V1beta/SupportedDatabaseFlag/StringRestrictions.php create mode 100644 AlloyDb/src/V1beta/SupportedDatabaseFlag/ValueType.php create mode 100644 AlloyDb/src/V1beta/UpdateBackupRequest.php create mode 100644 AlloyDb/src/V1beta/UpdateClusterRequest.php create mode 100644 AlloyDb/src/V1beta/UpdateInstanceRequest.php create mode 100644 AlloyDb/src/V1beta/UserPassword.php create mode 100644 AlloyDb/src/V1beta/gapic_metadata.json create mode 100644 AlloyDb/src/V1beta/resources/alloy_db_admin_client_config.json create mode 100644 AlloyDb/src/V1beta/resources/alloy_db_admin_descriptor_config.php create mode 100644 AlloyDb/src/V1beta/resources/alloy_db_admin_rest_client_config.php create mode 100644 AlloyDb/tests/Unit/V1/AlloyDBAdminClientTest.php create mode 100644 AlloyDb/tests/Unit/V1alpha/AlloyDBAdminClientTest.php create mode 100644 AlloyDb/tests/Unit/V1beta/AlloyDBAdminClientTest.php diff --git a/AlloyDb/.OwlBot.yaml b/AlloyDb/.OwlBot.yaml new file mode 100644 index 000000000000..c82251c66fd9 --- /dev/null +++ b/AlloyDb/.OwlBot.yaml @@ -0,0 +1,4 @@ +deep-copy-regex: + - source: /google/cloud/alloydb/(v1|v1alpha|v1beta)/.*-php/(.*) + dest: /owl-bot-staging/AlloyDb/$1/$2 +api-name: AlloyDb diff --git a/AlloyDb/.gitattributes b/AlloyDb/.gitattributes new file mode 100644 index 000000000000..9a8480242644 --- /dev/null +++ b/AlloyDb/.gitattributes @@ -0,0 +1,8 @@ +/*.xml.dist export-ignore +/tests export-ignore +/.github export-ignore +/samples export-ignore +/.repo-metadata.json export-ignore +/.OwlBot.yaml export-ignore +/owlbot.py export-ignore +/src/**/gapic_metadata.json export-ignore diff --git a/AlloyDb/.github/pull_request_template.md b/AlloyDb/.github/pull_request_template.md new file mode 100644 index 000000000000..606149f49082 --- /dev/null +++ b/AlloyDb/.github/pull_request_template.md @@ -0,0 +1,24 @@ +**PLEASE READ THIS ENTIRE MESSAGE** + +Hello, and thank you for your contribution! Please note that this repository is +a read-only split of `googleapis/google-cloud-php`. As such, we are +unable to accept pull requests to this repository. + +We welcome your pull request and would be happy to consider it for inclusion in +our library if you follow these steps: + +* Clone the parent client library repository: + +```sh +$ git clone git@github.com:googleapis/google-cloud-php.git +``` + +* Move your changes into the correct location in that library. Library code +belongs in `{clientBase}/src`, and tests in `{clientBase}/tests`. + +* Push the changes in a new branch to a fork, and open a new pull request +[here](https://github.com/googleapis/google-cloud-php). + +Thanks again, and we look forward to seeing your proposed change! + +The Google Cloud PHP team diff --git a/AlloyDb/.repo-metadata.json b/AlloyDb/.repo-metadata.json new file mode 100644 index 000000000000..a2f94ab71c6c --- /dev/null +++ b/AlloyDb/.repo-metadata.json @@ -0,0 +1,7 @@ +{ + "distribution_name": "google/cloud-alloydb", + "release_level": "preview", + "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-alloydb/latest", + "library_type": "GAPIC_AUTO", + "api_shortname": "alloydb" +} diff --git a/AlloyDb/CONTRIBUTING.md b/AlloyDb/CONTRIBUTING.md new file mode 100644 index 000000000000..76ea811cacdb --- /dev/null +++ b/AlloyDb/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. We accept +and review pull requests against the main +[Google Cloud PHP](https://github.com/googleapis/google-cloud-php) +repository, which contains all of our client libraries. You will also need to +sign a Contributor License Agreement. For more details about how to contribute, +see the +[CONTRIBUTING.md](https://github.com/googleapis/google-cloud-php/blob/main/CONTRIBUTING.md) +file in the main Google Cloud PHP repository. diff --git a/AlloyDb/LICENSE b/AlloyDb/LICENSE new file mode 100644 index 000000000000..8f71f43fee3f --- /dev/null +++ b/AlloyDb/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/AlloyDb/README.md b/AlloyDb/README.md new file mode 100644 index 000000000000..18f2ba1e6399 --- /dev/null +++ b/AlloyDb/README.md @@ -0,0 +1,45 @@ +# Google Cloud AlloyDB for PostgreSQL for PHP + +> Idiomatic PHP client for [Google Cloud AlloyDB for PostgreSQL](https://cloud.google.com/alloydb). + +[![Latest Stable Version](https://poser.pugx.org/google/cloud-alloydb/v/stable)](https://packagist.org/packages/google/cloud-alloydb) [![Packagist](https://img.shields.io/packagist/dm/google/cloud-alloydb.svg)](https://packagist.org/packages/google/cloud-alloydb) + +* [API documentation](https://cloud.google.com/php/docs/reference/cloud-alloydb/latest) + +**NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any +support requests, bug reports, or development contributions should be directed to +that project. + +### Installation + +To begin, install the preferred dependency manager for PHP, [Composer](https://getcomposer.org/). + +Now, install this component: + +```sh +$ composer require google/cloud-alloydb +``` + +> Browse the complete list of [Google Cloud APIs](https://cloud.google.com/php/docs/reference) +> for PHP + +This component supports both REST over HTTP/1.1 and gRPC. In order to take advantage of the benefits +offered by gRPC (such as streaming methods) please see our +[gRPC installation guide](https://cloud.google.com/php/grpc). + +### Authentication + +Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information +on authenticating your client. Once authenticated, you'll be ready to start making requests. + +### Sample + +See the [samples directory](samples/) for a canonical list of samples. + +### Version + +This component is considered alpha. As such, it is still a work-in-progress and is more likely to get backwards-incompatible updates. + +### Next Steps + +1. Understand the [official documentation](https://cloud.google.com/alloydb/docs/reference/rest). diff --git a/AlloyDb/VERSION b/AlloyDb/VERSION new file mode 100644 index 000000000000..77d6f4ca2371 --- /dev/null +++ b/AlloyDb/VERSION @@ -0,0 +1 @@ +0.0.0 diff --git a/AlloyDb/composer.json b/AlloyDb/composer.json new file mode 100644 index 000000000000..97a33a1c5019 --- /dev/null +++ b/AlloyDb/composer.json @@ -0,0 +1,29 @@ +{ + "name": "google/cloud-alloydb", + "description": "Google Cloud AlloyDB for PostgreSQL Client for PHP", + "license": "Apache-2.0", + "minimum-stability": "stable", + "autoload": { + "psr-4": { + "Google\\Cloud\\AlloyDb\\": "src", + "GPBMetadata\\Google\\Cloud\\Alloydb\\": "metadata" + } + }, + "extra": { + "component": { + "id": "cloud-alloydb", + "path": "AlloyDb", + "target": "googleapis/google-cloud-php-alloydb" + } + }, + "require": { + "google/gax": "^1.19.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8|^5.0|^8.0" + }, + "suggest": { + "ext-grpc": "Enables use of gRPC, a universal high-performance RPC framework created by Google.", + "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions." + } +} diff --git a/AlloyDb/metadata/V1/Resources.php b/AlloyDb/metadata/V1/Resources.php new file mode 100644 index 0000000000000000000000000000000000000000..00ce0d0afd2310b01fbc0b157c9c37644d40688b GIT binary patch literal 9723 zcmds7&2!tv6%R>S5+5a+hGmPUlbB(gSaBRGW}Gyo?X(~X(M%|kCMhM(aEgK?M4^TV z1^}%n8C^TQ_TF<3y|uk`rnjCt{VOul>BWCSPJM580e*$c|V-DLYH>F(>vfo-`~$1;=c;ohEZCp*@`z%X??olF+0$x5}E zR0^f$TPW&SL%XAAlReAonfhkOw1(YH%`~l}ZhP~^{Y_ivJ)AVt3DDOLbZ4M-^klJ? z+tyvJtGQaM$i!QD5^u>|ytRA(Awb8}94A@#)WG+U#J|C?Z5o}V<7zJcyKOkC(KlQ} zGmY8@`+db9DK7?#u-d&vzx$87e*Bp)YTd#I0(o=n=hJGA=` z*}O@?vH#SXVJ>-Kw6+Z0?B?`+?S*04+3aXlBPH`hJ)@pq$~Q-0i2j0BdihLs&hw`+Ko4=uYZt-!(%f5!vK zz(!b#!SX<~#DnxE_0IrY-ZpyN$r>!iNY^2}Z#k|yuxytL=0ZQnA?XIJ*g8fj9S^f= zbh!rJvoWMor0=wn|DN_L{T=p~7|}7D#PCOzC&*qX8YIyw%?`deR!KJU?*M z=lYRKp^`5&_3I!+M_o((Jxlr=F5`-YFkc^8Gn%|lqJ@8y@4^OiMC>G#qx(5&goVvK&A|FXKicJjsa6XXm^IcQHe>N`z>Q+HS}ZGS zLD`ab%1u?N9{WJ*#xED5Dj9M&3*vbtR@ zOz*n{QNKklm#bgmdeKP!ySnmpr&L#BL3DM=f4i&HOIy#>yc`Rq9>KCVF1r1-yzF_| zq=Q|9E2Ac1MRd1+Ey6W<=voH^^*OEcd^o6C2%|^RS8$oaqj{t{oqfGKG<9Z)Napce zOUzW1{*q~F2qjNmlQdYPSfI8wNAIc#Z+f4cJ-&dh8p+5PR8IjpN1E!Mq9*~#fcQ5< z4b{3wCx*GihEXm!%u}K6#87Lnr1!P9sdw4ATz(S#O&}nB2&-*oP4&>|cdbJfXCj#! z-l$$YPJ5^+mEg+Q+3m2CA75s3eb1Acj{ND->E+JP-4|o0X>}MF#}`pU7!UKJskL>} zi7(+1j%2cPHO}6{G80z%u6>kv4$;XimEOmY>T0&DGVnk%&=A+XAzTcDY1*ag9)hlP z4^|K+9M#%W$-h`kiB9##e$_o1BvAtC6~W)IxbaUjaH4ewuFu{@X%#MY ztYM!+$fd*w5E)yr6oC+iULJL+>kG{s^1~3$20snt00WNj?py@I{>-RB6~2+`zzRQJ z0=d=!go6wx@hJ-t(J+ejxp#h$gFni*;0+J;Ib8V>m#a?wEecC{bLb#1#Te#!pon9a znJ>NLZOaK?8lN76G(4&$h#h#4>&3$u)3Y&G&lC!Js;NIKT6~%j79oV!vSUzLW&>z^GJ1d6GI6fi;hnu zbEedzsq-}-Z^ibc#~mySmnb99*>R6%-t|^?Vv9WC2KDBvEW%2M?>NW%I8OL9y!TXy z|0BFFLX6Tb3d*Vg{CJoto4?fsAs}#`&*&$x)Yo04bkF0!_V8Wiyh(VIQpTaHi{<&w zTj9Nl0AlXfi$_RG+JcDI?^~435%pMMLFN9LrjbW7ELMr<9!X~!^)elNa?%9r^> ze-0}mLsS{@jABzHGyi~$vsKctAXQ;q^S~2vhR_qKD8Xm^3R9MzJKvdcR{8{hxQmGX z64Q~ItHWn6v%%vk6Tc{UC=(pgKw24JV~SdL=1yb;LqtQlb&)?hWcRLSA9)M9&J=w( zSC8kM4Ns7xn)C%k2exrArfHpNnr~iDQ;mypJ#1o$O}IR*|8-dN^^3zaidBh^VRb@{ zbQ{*kmNq8fFzn+|>w+kf$Uy9b@1B7?sow?Q5{m^A(z`}eZcfw7FkGrDa^V@W$_UcY zX0=wsbR#I?du6-Ud=?AgsawutpJu62j4jZwf>Ku4uS*iZ;+9-0qsXFk1y*y_YO~R- z%e5MHUXm_DWLqv(no32kUWa(Tj6@!3{EQ?3=U1zj zw&gla78Ny=e6>=bpTTVVrL4l6bFfbgA!QK=ex-L@XY+gUbiC=&AbjUN9%Dg@Atb&N zPsjB@Ah!&Q94J$NM*dXlV?@T}5tsdc3|o(soFWKBZv{c{2nk_%7=3JlkVwp0=W&WDMv_Ru>ZH?M!E(c3h?X0rAfLek?GT38 zC2}6BVez^cK+ww*c4n7y*j3WS-NjNBInCb0@UXwT;(3%xHb|j)ztevcb`pTReBq)^F}23 zeTPyt^}y&O2aFRPUuC&+E&*|@0?eFDE)Lhdw#g~vZos-aTX*6%M5i_%O+`LFVd9Hr zd5H%g%{YK(AoMGt`fpzq)yJWn0lN?73)5JA2DYDo@~>dUJ6J5RVacvkLB@f&e;zO= z5~9|s)iQFA32YCgD#&}L!{%G?hP;c!L(Y}TrRK9)BOrtMx>}LTNEUF}b)|^4Li`oX ze*01$!mT-6!CQk=eRZ<1X$aIp0^vOpgGl``42wL8{vTxxyh3nhvis0y4T~%W&M%E} zYfNy4pL%g>2?Id%lx$1LjuD0oEHF5xqF6L@doExKN#>_lA%f7xZs(}PNE9PXDWPC~ zDpeXN%@SDfXp~K}1YjzGo#Ry=1D!$=%3}qR%q;E^A&6xD1Nj-{w2{my^lMgr=7AgG zX;@Mw!7au%c0R}o6Q4*}5M&*^ZdKbyE)ojD%@EH9v4o?4J1~$aP>oQ~l(RhTzmY;c zJ%0u@9$tfExzSXpO?`gqWe0{oya_5OSc5O{Oh?|qyA90UC^3ryVA_NE(@u4#5esG2 zmojp!)60I+r{@i3ZC0YdxWyk>)cQN#05paJx>=nr9#u_^fqp*9cNNF%Q~p1IX- z+pD!X$cRE1*3MmQBjRQ2-wX}39O)qgVhx@Z{Ff8=@V4lL#qka)N+IkJuU*8Ps8%0N z4B_ew<4I`>VIc5tWkgdO>c=Ik};zcx%_7Tj0ryIYg*hwb3lrm4gr94^>ZxJUOwsy+M znsR>%!A&gBdb>MadCnoB=G76WMjKxXeEl)+y0TyYucfUi#EAqrq@VH}90(VC~4e+NSCed!}povG-!*Cz`!8e*99doLL3GH)DD| x(`swxrYNhUZt-;7Uc}z6_0b*wyOMkS3!=3$WC)8*Y{8>W*#i)Je8lw;S78qh7ZUwkz5Fg{(*1eX~k3Y)6DF zV~==_Q6=i?M&SN~>&fX^Ac_<@w^$!-X3NRqKZ5shfNg^c1P^&uLWZW>xik z!-qewn_k(pOy4x>=6j&QEwyIUJpyZw%GMfI)i-TRr3>y^RWf@;<$F@u*Bu))zNJby z8`KD3fYO@f6W228r6TdFuIc!;y8)uQzC--Lbo86qE8?|uJF}+Fa*Vou1mrE%cN?Vj z?W*b$zu{Up7;d`3VeqLGVXVAkmhzTmQ!Ch(r|V6fnp?yzT&kPI@_SpeVv_oHf$SRl zrtS8&^ga<`k{D!rD3s(DJt(?vTRU#UvP^5IbkCsy-kYHU|AY0H_ZX0$to z_o$DxTPEa+Z|phA*WP!krA>&4MvR$Qh+loj6ak&z-VWk-1@e0~h&UR5m(f4h(WOL* zji@p;fMk*b)L~TLfGYK;lv9avUlt z=n2V-La^S9g{&RKf)F|w!ZbwW+lT_GI6eX{<71jpb&fe`K&`0*2zD(t@43rBCcE#Q26suv5J_b_~yGL_aR? znVttU&0~L1;sEcvf_WjL}fdhK{Ed>Q7Q=3hEQI z1?@g~2c4)G)kh7d%nKlM>R9fQ^g=sbW(rJtlQmUee5G$9c*&vJqz3B3aA*z(?k$X< zVXn6Jb8seQkTnbV5Bjcv>E3Q*y3%Dvbr7qo#x}*zQ8C z9|M@Z(cL!`gn{qmYROR7LWC!6gu2@3Ei|}qlE;jj#ydoveBVP5*8ZlTDbADfYYC%& zXQk1YDQwrqmDkaTd?LuQyHRPDrrI((AzRw$Or&leet^x}2F_x_R$-HG5y zG)i38cFTL-4)0a)1vJFI5=9Biy`fEIiy9uji3a@xhc;u%?07Cd0i?MCgKohpZ66Ks zmrtR|&8_^_a{0mC&5h-ywUxEy;>0V^mX2>M-z~1)T`e!&Uxw!s3LZs6@Ui&ii4;DL zM%dTzd}4t9ueiLvyhZ;v2o3G+rc;$S>WV7}ov@48~g`iAyqA ze?3tvNAXPSkE5Eob+l|I?23K_s`0LF(@ui7bOGUCYwLI}v4-b7el4cq;mc|MwjJ#vPj%zr zQyrdYKhS9ne&h^L2{L~Z9jmb3Q&zk4k`7{eRH(nb9OPEf1T;4Mtuh;-J!v_|2}7XH zhS2^1XJ%eY!<+SKS2!|rz1#YdMKsL67hOp=b41nBggwc}pb@95utxonRTDU;s(ygK z0HXQE=y?3!NC-dE5Cnv$Ch$FW_QcNby$TroVdQa5&j z3@x^0=pxI|44#k4(8%2qCam^-1!8OLc~4C7(<8vaW4UV`c;jdrEcd7BGXMu(hIz(fgR@BfU z7>%-Zcma(NYrD*r@TfmJ=V)63<1gM^HV^&-G-RN9Rhpxh0elXP(*~?T_4GU#t~KXk z1Nb63BU*5>U9QrDZN1K>%<141JOKUd7!2ylu(1d8=kzhK5}OkZ6fl|)%gdfas%Fis z=6<81<9YfENU@OL-ZL%yp@NRn01?w256{OMxK&JW?9A1K(mc+zTi^WSKR!r7tkd6a zp7J5&EtnO3jZ}RvJD087RX#?~&K<%$mya!<=f$`Z|5!n&Ij_TWu`h25NuXUPhuV!0 zHd;AikOja1F0^FeHw*Oh``Rdrj)nGD^+_d7?dG;NI4HGMp~wgwOM5 zxvl4gP32#xO3(7IqGJ+tL}tQy{X}R0*g><9Ttdy>W1792TVx?2@MRL3zeU4SQnf~N zD%nl9--B+UAz%mHLUIXp+vOoO$Gw(NClON5@^ffPOuK_=D*K%XM|kPC3K|d32yy&z zDlC{#m#;EiKCf{)?x!oWvimZ=1N_qBW+Fj<0v; zqSlPhn&MFJHF@c03K|2-kLWE>bM-p^sd-qgL5%QJPQ zUlI~`C^%akep+rcAENOto`xT(#=~Qa4(t~eOsKBUGjNVab^jUI8>_>lX`+4Tf!~ac z-geQ1x_L~u6^(nc58d>d7|a082i2>)%TCfd)G|iF@dM^I$%KlzOtEF{3oJzYQH+)^ zK-hy`v=q>K!;ht2hf>fYCH3jtdy6e)-fK6RdROrq-3jL~TjA4}X3hFQL8DNO_@?+u zY)}O<5@fd%zov(9buzmE)l#57g5wBhKmjb?B&}i+TbJU*BmJ7zi^X&?sCk~B7R898 zp67p9Av%YK1>6WOhWX2JPO)88Y86YUQiB=$W-iBqfMe=N!dwInTZc`}F#j^lxgC}I z9Vo?#w5w9BVhNSn;Sn^){nS$g^+vFNSI`X2!^jzihxOR3h+iaCywTTM(VO1pUd4Kn z)D9*$p>b1?=`&w?mOm3cTlzSk+4X(L)3e#fj~@%b!L=Ww;qOA{3zsIZIxu&DdkK4m zU&8N=a3v^Cx59C8mvVz%Zro75a*cPu^41PqCfc!s`BH3YD!a3p zS)#Ac@QFnw^Kjvrd{PqEIr)9gVx2p{s&YyOYi^y literal 0 HcmV?d00001 diff --git a/AlloyDb/metadata/V1Alpha/Resources.php b/AlloyDb/metadata/V1Alpha/Resources.php new file mode 100644 index 0000000000000000000000000000000000000000..91399ee3a853f8b438d5e1a80b24dceb41aec943 GIT binary patch literal 10902 zcmds7OLH5?5jMal8YBd*C<=mP3x?&0mL<@F+bpJ)6QN8-iU2#rq)#*tr@Ey#+*GZ*6CV~)v%0Mz1M1K-B`og@92isO~hi^Qmk02 z#d6tv?R6xztzNgGrDAQ%Y8%>m!?1eIb=5Ge!)AT`7Vk2c^4?^5N1Q_mMa=5%Q1m1T1aaTDOcwePDH) z(h|(}@OQ))^Q{G>Ff4Y&mx!O<#Q*7oOIv!IYg?7M9cdK;dzS4e9johb!t~4!@{DvH zmbw}`E)A_((VLtD|MVpUxieB|$&nf49ZJdxzK!t$PK-=D`kOS1F^}iq%E(yyCcO!- zZ{;^DaxGsfD%H|1Y!cq4q$dz| zXMTwmhfA_ipfhWM^gAf)ALYBS#`F>gi5XB4?F7b*^$ab;`dmBQ;e_$sU6^GeS%L5v z3A_r|H%q0>LQcu%HstL>P01BAmFHy=T-Ybwf*YCbYOS=Dt0-G?QQpjD2M74$fAT}1 zY8ygi8?b2GhO%!pxwt~f^~oaeNE7(9g=BQ9KIt(88mhvzhN)60`OaAxWmK-Jj8j~L z1;JU0z)H1RP_|0hQ8kbt#0Z=o^03x%fzQN?iMdl#C zohEh_m)m2XWJ2WYo{GGk!xMAOvALdHWUi-z=ZX1NU_mq0x}i0h)h<5v|Jvu1-ht&h z6RvWgn@#J0xuRh5x;wS&vJ-BEm5OkAz_J_6FGLpEf)g&)*a(s6+cq~1uGi>e4XeST zcVr&f1kiWP8){uM?8pKdcrf|tWVYkawZJ&!Os9JoeF352W0u}V|Ldq-M`4i$1w!+z zy7M^bE)#TUr51*2=^iX$OtBTKrI6w=w-Xu}jpIr!nk1SB>EwA!4sk6`kid(6|cl-RI{D!mI!LMlvQgujWpj65Tu zgJ)Qhlilx&8SQEYqu;QKc}l~E#~ZN3r7Up8H2`6oy=uq2d(Ze6@daH0mgC4@n;2)-$0ZA5BRD zRtwsZAW=!5Lr^tMi&B3ArAsW9ymvN9$$df=st}L`$%mQ^-O$Z;WEp2z&tUZ=a~7&@GSaBdpRguz~Ny(^19eOE1Da2MO_G z%nb4-h94}S;I{vd19f^NP){*?S13b~`m^CkJ;l>`ECxb#36^ysZXT<7WSwH+9w+y~ zjn;mt0HJ-gv8S7w>w+lE29r}9rpqX?#fgOns=#ISrK)3Qh@la4W=hgn1P&$NpX}2- zhVlSCEtBedZLH0GYnd9xZ3^a3A><*9mZ7$748fEe{`8DfxIklrXn9EAgyn;-j;O`Z z6qBkzJhDx}Qr@DAq5?D{As8ciJF>!-bbbaZT>ZL7*_m$IdV9~Y-E+Ch&Sgsd#9Pr* z;(@;y3-_%!B@8?Wikk>2EDsKFq%tM&xO@^7B&WuOV2DYO-ci(M6Wcd-gc1jVzekV~ zWdQ;yx$uneOaQfT2%bqyc4yX@5quVn!}73NUdFOqr-y> z0&tm>wJfvxQ923{tdWgfOgaLq?ziD3q_4v@WjycbZ3vBM0E&v#en`aUt9L{nfi%W2 zr-bzjL4n^~6bcN+e})FU_&+-u;HLnB6Y>9Nu;f}7^Lkj{&KD7;AXqpH0wCm~luM-o z0+t~_FcZgg{De<^9bT1p5Ut4Rd?8Yl2btl}el6?TH$*%T@xFgs`DsqcNq@~?dG<|&&VS<_el;jOPXhV~r) zTL9*Hn({x2xOio0YH8#%4{^=2crc}t!bLKKw?1)w_5wP?(6l^UFc?5v@53xZFjP4Y zCEuD1F9bQW-YXD948VH+)RrKS7ND|$0MSgpC;=C$_ffw9!?by%(s7#Facn+Xj-Y~v z2(n|_0ED5=U(P)(XQ$%Fh03)q03hHIz|P?i00^@KpMpk&z)xg?=ml)N(xKE39mHV- zFlM+Hz`CCHO-Dy;MI8kJ@usQaefY z&3Uakhyo-Ht_a+N*b)H{bN$qGBDI^+=o`y1QDra+@3DB?ux8zc6}pnqM*K815AT_6 zPPY8<^U&=dKb1*q+e0&=Med$GEbw@62kA-1a^uZzzRd`s@i0V6=xe6~DZ4^p!4U0yLm}!)X zx$tbNeJnTO-YMREtP)9&&T3UG4_^O{{vD-5bg8AU-*=zGCD*7#ab1eR&8%FL({eSZ z;DvxH-8UKT`C|+#m#VeRO0KFrco_CY{fjOQtt{q5&xOFF=dp5%K z8Xl+%YuRU9Kt6-g!wU+-A2zlNh&I!IodLR2=$`J_E>s$`5nhk7%XIo>-xn!9(7mgJ z7fjlgci9ko1@3)AaTuNYhu+g4{5Ln*^}Bjn%v&VCg}`u40!fc@kOrikcU>GBU{i&(*PFV;{E zk3G}Ppn>;7BZfY^9^mL$E>7*V+#9pJwqey(V_mdvkhgd`s?XzS$9j0jyXbb0Uuhh; V0ZDnb-WYTHk&Wbc6p!Et;NQ^)XiWeB literal 0 HcmV?d00001 diff --git a/AlloyDb/metadata/V1Alpha/Service.php b/AlloyDb/metadata/V1Alpha/Service.php new file mode 100644 index 0000000000000000000000000000000000000000..37cf40e33c90cbd39100a931de830380e2f2dbb9 GIT binary patch literal 13805 zcmds8No?HK84hPGS$gs!zgV^`+wqvrqNvJDEZcEBj^fN{BvpxG3z8f(!2kqjhLRXl zBujGSD1p%+O^-#3F6pV40$tEkFFh3Kp~u#Tq8m_D=#nl#f!+!fJ>=5~_P@n+4ZXJ^1su?kc*ed%9}qZv&Ru!iH+N8m!$W*$Xy)9kUxWQy*GSMFDVxJz+E?efN(>6`r+^pZSiM{tGE#C-g zZMHT$a(^jkZ+_eMcKcXLh5oAQ-sxlQx(*KKsoQq;wX1fsz6KW6?jT|6BG0_2bBCz3 zTE6`+K%|)TEtc5tQ|Jc`G?hI>;4_T2NW)2yhm#@?Cle?6PO7a#z#;a_BFn_N(2WgZ zq)LNZDJM7;B5=4V@>|pVR&oRr#4e}4z^RSEs7jV^RGjEBPDH~VgpX2-TMoZ}I(}ax zw!v?Ti0Ut9fVRN`IE6s#Q+PtnoIuFQv703lf7+aT`P&kDbXj-3Iiu}DKyz2M&$hup z@N;O;RvnP%xKxlPhpSJ1Sjl}k$ zucDzQXB{}rPmatyQDm$oTTD?fdJ-KqwYNMa#1&zea5d649ZhX+sSQH|R`Zj?@)A0> zs0kqn8C^yPNdAgS2&G6!{)>dp&cXhkwx%^Lv!yz_oF}nwzp_6`QX^HPqPM8Q-#meEfXbg%HCe}|nQG#C7vRNO1wRh0xrJg_KavqldknmccL&hCVb#u9Jf z5tP59?Xrp+FQ5S^K-=t`F*0+tXExYF%em(zc`t`fB{0e;@G=@8m|3ZRWM;O{Cl$$d z8a{@GHOH|WW!v3kWja2O2IwVT5n%BEIIqz~Z5LP20dLnP2NG%W$V`fR2y`C+<@U|BmHD})g{Ar0=p%4QJF+r=v$k||QJGtvhx?-v9!3N3v-bLE z4j)28^fKHZ&6EGt=9lN!$^Q<(@osRTva}4_4B(?^WcAiE{8p-!xmQL9q$pOMhgM{Clu*s_kv7+z^S`(hbXFJq{Y&r4dShpjw z(Qzc&=)j}#9*6uk>%#b4@lbyS9c<9*Uu4C{MPTT5RDimqm)^!A8imr2JzDtXrAXn& zrGdIjL;el)l331-Zq}!8p_RnI$BMRVXpmj!C0iz$B<0+U1>0`{7K>g{SpCJWfO{6X z`sV&2#I3IYG8VU@$okQKtQZa*^}DzuI1pFyPTZ=jDW$Lg+Jl(-z6L-t#zcK_3xf@H|TW_OrS1_%RK^Ea!*&u9ZD{7OO?Bvbz zPbB2e>)7ySPIEkcLvKQrAw0Rmp+2om*;$>((Lr0=R+_F8Zr)r$hnw(lMfA0KA#+N^ zE5G|CMkd4|C0Rq~#jqd&0hj9;bd)|Z0LKbIvPB-tXe@SDf!3{V(&CghK=ZPJ#!36u zGEI%n`j*TMO9-gbxibBf+bIFb@8;1lf374-UHm3G*C59dC3f<0m2E!w9B2KTvJhIQ zAiw`?BOXFU0!<=_P5dcj5yLF!Rx;(4h*M9M`Iq*0yfqA4%vC@nPPxb@9dSQV!E{ zQ<<3QWeGE0x%%F(|Mu0~C4A8zfxp8BE3@DdZ-P0xrKyr(fyq((op^qP)6neX(%Ja8BuOCgPRIzG9x-}aQ7=y zXpE2h{0u|K>Nr7jzmVX38yOhjlw)+1IwPt#DXJIcknS>~Dgy>G&L~S$KEUqA_%nbM zoi(IEic)8U)Z7m#V-PDlY!U*H(oF9CoM;!u2c!79hzQ9UkwuaCs*KpaC{b|BawYJ! ztl(IVb;TSv?k>n$e>u#FoMTiCH6vK|K;koK2mBbA^n^6+s6j0K|pd!dy zKa|i2WFvtDKigf6AyNS&V_!#J-p_e9p9|OyrLlj3S23INSx=E?lv;3~lE}E_Ey)ii z@3KF`*sGl8X-z0&TKu4i?JOGd0VTx84|3>a%$0od7rLvi!?KKm_$G6~*X36q$neTd z+HMcr@nH$(y&O88&>VL0weC_$T9Z*EUt%J;EiXNoNa%@!X{YQDFYZ?^CeHyNIk4Ai z60GCj;1sNs@r@$IDWcT90biY22!IPC&RF|Id^+qM$Hhj|kxD4VE&c?+qut%K92=$1 z2z-}?u&Gcm=s$$@Rv5u6Nu%*DF}~8>w&U~}QNBe{z9NUT+Xu?>2JdNyE2VTb9wo(3 zr~{2t#&ZS$TFOX`Q{>0$Q6oq z20t61O{tz5tfL*23Ez^?Fywx=GcIGeMLp1@s^>v8FQO;+I ztirT{)s%XG`9@jpS(Iho5Z|kuf&4`|kl9i`Ln|g=sT_dz&ht zGIKSs6UJTFpw380TO`1U*~MrK?+Wkd0FTAwZ1BRg8Q~eszNSLD>&d=)3)ugZ&;)Vc z#D=kpZ*+H|&MO7jm-^p;A0<|py77%b-6>(gZ=FZ_{XvxYkAzNj>=ok|yK~%ep+KA> zvM%d6V3h)1?W=@^Z${WxH~V_vH2RA+AcP?L7ILJGjh{-~w%cauYyLUO){)^{o+uMSN!IwhM z*w8eFw?wzA;P2!+rLF+0hxi9X(Btu}73qyK>n(_v$Kjp!P0Rm$2_7fDVB$>LjqCoe z@8`}e(odF(bA*v1YdklK{F9~o;&z>X(!{=Lsx|8HQ4{?v>L0mtY=d%{?oclCEy`t1 n(HMl@kY`WOa8a;%osNi_T0+j=k2vi7=0NAIN)i9#h& zt~3%#q1bpENo}j&Yw6jj?_oTZuiZWV_0T_2r6bvU-=-xdD7UMT?=>rDB&)u zN&-P)Y!yvM@0nU>tDxJhp3!xzUKNLCvpc%uiILu{d?2PJcE)yMg|9K2J+jD038&ZB zhi6YDdb-o^nV+(C6N5wVX={SWEN3JMM`b$6#NGU3?b{OFJmrG)jldcG5@U%mm0kCR4DmVe7prn)JTa zYfB3--N)atKq9ablAUb&>0Nlc zR9vgcjbf#&)+-yeyrMRqR~2=mT(2tm;%ZSTMBk9+V5(56M+3OG2bIeG?MwqcaNi7Qr@1VFCpqq z{0glNS7f6&r&dC_k5JOz%eP>KDJ2dP6QCN}DU25BJgvfdq91H>!sON#Of!irL3Dxu z-h!)ZmCD+>q85}@d1JkyD&>6bd6ncA4M;cOT7IM6sFakNT9V81no<}Z5KR6l2%);& z5fW2i-nKjHp4H~kieys067VQf_*6nFI@5r(2BDUwa+P6v6v?Dd$tSOIHD!#FI?M^i zQVf>r^>wvWDU9oY1QG9xyuMy}hWkcgdGBh<(~V+Hi3U;iCGYK~QY)@LSMzdoD)|uR z-FeXrF6U)e<3^S3GF%*d64FG~``0X7mivyiM@S&2wO;nSRSTo*frMvwf!t>2K($-D zdb{7znK;53*;gDBxuu>lPIbZP@f(s3OXMKbre^DH6+@qHlJ>`@QFp@`#S35WR*&Aamc7!%q7I;*?RA|RFgtOYGBsfD!5LgbM06y7PMot z$R&hcW45C;^^P5zL)#8#KJ(=|`ApXt1I2WD2l1B>89id@L-f0j)^k)AVNe`2&9Xa< zgMKnaCsx_U04?2y1&k%OYHh2ebIjpH#zy0~$~H|BFM@RRu%&wt_0&j3pkP@15c~uk z-+CXGC!eOY2s16KZ}K=Z6TbuDp$$u6m_pyo-7*b*rFHt;KtkEzCxINGHxk;O3q#0T z8GTTNjwF8=dV@6SO<3ybEejp088VGWRa&h5_t>^Mob*x%!lqNpP-_|g#}XSV^|O}Vd^3rP2A<<83-La z!;hTo&Opd$Q&Sl9MitCc88$rGf(0&PfhMj12)pc$Vumb)#fL%c&At1b9Qq42P9qCy~5zl({bpyD3>G*oT9gHeOeMIJJoIg#p% zF&FBOx5QDUhJDCqFhdEV&OCc0bIVu6E`vHza2Y*;1))$J_r-AGC*eMqjrc#neNP}t z89BvcRRF(Oh%xj(`hp-5n2)dQ2QX*q4#NDGF<@u<9y6Wx0!(UcTm z>c0~U6BT07ux6STCHe$I7g!AW_*7z&2Xrh#AqESR>oi+N$1rzdi#WkNUu*#uL;*o% z2}uM$g){!fGn~l~muaaES2Pz$A=Drwg=q>wsn|uvFyp)Ki6K_X0uZLfWn)edlNg`( zeEE2&b~1*z#8{j$8ZcZu!P_q}W@q>IFCd0H5>d~UmDuAo#`B)<9`hbC_hI-O#Y4vs zkTzlYC~p><-ejEbo{94yLX{zEllrtZ488cD&SRNzyzkGEyXaKiCFYBjDiG=RjJ+Xl zR~R>cEpe^4%1Jpdrp56zTo|7N(SkPzU&c@_8UGj-N7zU=;mXh!hX`zj-ne5vBMypZ zAbP|UPry#e-v(fYxj6~5mU=^OjAuY#-0l~T3wJUWGr zWIm5$8pZNjbeet@ly!yunvnozSLNb5lFUjMVKG;!H0q6-T&>dJIq3p~OLDQ?P|9*S zuSDk&-i4~QN~yxgL&-G=4|z|-WU>4@=Bb#aPRMa_ebrjAB-d!M$f&O5E9C!x?{1>GDaHIIVC#PvN5WN;5D6#9)Y-F=b;c8#}v>?H* z9Nf3!fH2x1_-!MAu)OHcVTpgVaoMD5NKG9H!4ESXqpND|HnwH#7-a_nW{;sF!ukRg zxk!w_O9<6(1c^yZaHrLkF(?*K!s4htUc{PPw~taBq}!jtG#wZ^<2lkPD(dn=F+k8w z*3gj$jV{j`CLU_#b?Ic_l zqgovUD^#8cDN~t$9H5;18eHPqU^_iTmTE^gcbr|ej78}kSmqxw<1uY2OQ?I8?c*{j zH(6x$pSW&Wn-CdO02CFe{D_FpR?Wf&$o)F8= z75{&I-uOQp^ce*3g8uY)R6hX)90~eAf(6&On7_l?b+L@t1QEh%!al(jwOXmHBT5-T z0aHn|^&{T&ZFo!GM2I5iitEM3^GP!x)_GAW%j*a$aN9Ly4U6XZE13QIwcLjr$Dj&# z4^rj)up(`Uz=lx6eI%@r{26v9(BYVfRxn>9>`eLGpaLL`x*?YO^Ars2tgG*-ExqR$ z+hmNWsk@qCvZ{`7RoLTkXH%(I!0eonXMYuVE&n_K?;f-1u{HhpKfLvHYh=&KzlLCz zCno=+FpF1@PAq_Y?!l~C77qN|BwQjRAnTFqvggnjMo!4M1^p1jdH~Z5xKLd@l3DSE z6@r?X?j;Cg@Mn#D>NpTE3sHGMz-FdglxhpTdpM}FFjXEaXdI_=9F32c9jLA$0_?;Z zKS8H6S8I>U&#A_7o@%Tc`U!D_q~d7kkFvA&hap1RM-o4@e;Y4psLcZh(H9|$DQ^E* zx6{Aw8VISVTOe@VNecMiNJXEXJ`)`dKEa_Jb1V=gzx3^iVsOBwaY4ZrU4dte@&>j* zF$bmuHv)j^Bj%wSm5q9IDyzPhu}|k;k(NF=t-oussug;5{=j_t-?2eh?{}%;uD6Hd zzto0H0`VZIMCikuKJ}AG>HHgb6B(xJ3_sz;6ptBJq_<&-?pW*~a2lD0H^Wwajehbp zbejj+jmI&m z(;7Af@8`@T=)P>bqF38Zw=8QTcBEd%nd-6xQ+xVXeFLRPyhxbXon!65`S@*YE+3IT zwwxp6-S)9TE7nC_yimLkmnH~NNw<4MTj zjNka=280H}i^KA!yuL9Jd|`bD>p4`+Vf7&@<*X?+ULRUrugDFo56xqKQ7J3Y>FmyH zxed3EapMzJNVxzm^{yJSC z8SUd^@TykojkTImSMT172I9f_0Abs~%lpybtsf82>ZYOZOT%b&v#2~9V|oP-)CIHb zGcKT*N9p0EgV7JG8|#QMbAO(K8(7JAPj^y(DTgTtuRPgRI{a$j#Si&7_v#Ja7}>GB zdxO{t5LXAqQFNQ1dQX1{URz@~1ygytDVUP!reL9&;x`5V=6>B07YX@I!a{QkuM*O2 z#Mi;=oIIOl^x3Rnkj;t#^6vwuzt)!j`jkVkSZsO2YMoO%W R)`V+}Y$U&IcnF68{{|34Pv8Im literal 0 HcmV?d00001 diff --git a/AlloyDb/metadata/V1Beta/Service.php b/AlloyDb/metadata/V1Beta/Service.php new file mode 100644 index 0000000000000000000000000000000000000000..d1a468b5843280b92d630754f91d0dbede68fc96 GIT binary patch literal 13710 zcmds8Pi!1l8Sm`Ij{TfC&TE`(oF>^!TI#szZsR6xy7{~7bzC=p?8a_s(TZVq_t~Ci zJu}SAIyG&es>%%^L|aZs91sF={$p&d$zm zQi+m_H#6UR^Zma6@B3!XU$QrBbUeF2OycMssb{O(S#N`6ZO8Jgn$^fwn`>*t$=0k* z+h`Ccm(7-!vNx7iv-9P})nl;KwVF3Nqp zTSkrK*schf`X+I0y+*PN%cbi;P}e=ZvcNW|%+U=hMZQ7h(&#=raU9e=<$n=RU z-;>flYFmK(LRPZ0Ooai0s4SWuaZJ5YDHFHm7`A6Q%RpKvtP{@{A-ytvLOhmkXRKwX zIgf=x2a^}Fp3@}3r)RSc@tTf#j`2-5xa0q-L

C8d>be? z`P$^b{iUG1`Ayr~9$+bx`E}jBHNe_c1KiEiH|^wWZ`!rW3K&$gi-ehnJbBR&{!pyf zee=HpVPe`hSZcnHqu=Q0MB?~>4{_2Q3ne)bN^(4uOdSyW=(Yi|h8i!ADpN-TH`b_y zYE@yPg5Y3)z!7#RZapDxMFuZP>k8uIg1FJLsJ!J{lps1Hh*-pf(2=hTvk~_N#=L)@ zP{R;6Wi0h?ay*-$enBC@`V^kju^^CQa_m~3#-66&Uj2@O9=>L{-dv;ULNIf0lFv86 zI`A`S*w!5oXGX~?)1#$NeN;^StC+<{r2IJ`5WAa$WRMr@@qRRF>+3{wA?9XMuym-D z{-~&6j1ar-S+|IpNz*;?!)SQTXuwl5JJ>TA;UpTdoH}u|>UL(xzpTEA_J!GWZ3u1z z_#CMT)`8RX^w{j9InG+7z2qdH2hbjqyzXfMrYN_Rsj;T%5WTjcR~rO4O;3-ii)ilx zkus7ZI*oSF%oP?8>LDQY&k8y`2m564mSz9X-gq^3hmy4%nGTRXqMU7&J2V2MwqhI4;8eJWBlYm3z%RB zGzwcl`#nH=$)>2=pq&Q0Vb?Y4m&_=}W~ZbrO2^Fkft$NUKsD6-?n5=qrTC^D{8Mb4 zf2ua>!MC+d!*wC~F_j8z-vexA(jXDo2C#G-HXY_&oWH$j2NZGZJPPz?8Ka>!3u?+B ztM4mla@nyqt^X}v)wj}U5~>j>1l#SSgmzc;+O4Lo@sfwdys_C6(n6xLTdu@btgw>$ z`G@eQQ3gVWXP8Z^>1yHaMwt0L9lPC}zqoDVPkhKJji6yJSM|GK#WYncnvm$Al=oBG zvu!D@@;J+B$MDfEIZf{Hu_d)Hp~*H*MOHhDMh(fnNNbP9YSw49zr6O2f-odDxmsqR zGoj2T<%D|5=~=X6%OJN|?iuf4+VYt%!vgh>;Lbc@$jg$I!IhRlV}_7nTRuFGM&uol z5R(a)hN@IsSWB2T{;HrOZCU^S6se2$M{3f=uR`=W>t3sHA(fjWEpvaQzq1h|eU?&^8|st93MkN?2@Pfu-qR`XKYc^#h1|zZ`-El4`q6MHr_F$=zQU>!b)`u z4RHo0(cYES;_AHi(v6kn`MJd_i}U4)hu}muzC3@Uym(_lo4Yv=_a_uQiiY54`PGRO z-i1ckWw<|)rvEF?Uz=a0|Jwm)x#26t#cQz55Z;5vZZ2Je-&(0ScXeV|{R6~uULi}q zWGo-7L=Hx4?tz0x>z2=To?j9c$=?8Yyhv_`H)z&;Ky|YEWd$9$q8klsi#Q)UZyje0 zDq3-lfU06YErNCDfmIe=WfaH9dr;lb`id93elj@IRtG-D%D|)eaF;TWFQXnh@k@t_q3Hi+)q3gE!GKE@Zpd-$2Zr3v+G3OYvJbERq9mIK44GK_tyx=XG! z^mX4`%Wd9znt5vupX}nTk-H^yUiDoCsc|d`S6xLJS2C^9VHM?CTcd0zs$`>i?B>eq zPZZ=&=wKx8e76cQ)i#DZ3(pM`RSl#3u)@p zP-;|L-TO2?gvM#*4BaW1F}W}ZXtj*f_&D0{@Ln>hYc<-NX*Af}t<^hD!+~TBh6);N z?7~DYvlGe+uG|tv6JojM+N4J9fA+^upj|~e8!nfM^-aUXKUB~z>cOHr>*A+kg&ZUm zhB9@kj}_c<)#BS9{N>%$EPhH(xZmKzlMCPuuYoDL`I&sf0(YfD#{A437*+9c%e|r) zv*2$l2vOVRH*hYNi58(`I?>caz0|=conUm~(q|GFzE@-&VEiWq?dEx3G8!+f5Uu3( zu*4P^ndN*xQr~1uo>Ti4W!)E5I0P^!LCRqD_dg!A)(ZrNxBUgsI&v z&Y(##$@7y68<*nOa(wdXB7oy#)lVghCc&9 z;Xy(VKw;v9fT|sU62`59!-pIIsF$(5osu2F_JJoZ$UqR80D0_aUz8BpR}=>As(RV? zv82#=Ms?+MHsEW6N0py~$I)CP&*g3pj|r4z6@%dz82*&)pAx99c zEcF8gjY0B}FmOIrg8@p3AzAN6z1qQcGEZyq97tOK0AJ$9MXj`xas?S3q- zP-A`cmJ>cGvAmT+`yv{@E{KOe+Ws9=Q4|fj&~uM0@)epN_TacJhQ6Z!?T9s4dM7fU&S9TGhdtsJ9CD z&^jm3SjO?=xHjs90Jj*xMYZgk?jQhZi3FVXfsbZan#OsP&h3$11C$b1@58RxTE++U zGJ|>w=Y6O>%A_jqQMXEhZz*UL5x_8H$mIB&5*oRiQ_M++h57sD|-7ThlY91p^Yzy(PYg1f~nYo?{QzAUT10R49b zO;MkX?Ebp=Vyx$MUnrqo8hE`pDlBnLn2uI9i}kXj_dA8ZH5}?j<1;;AM|ZEMo`_u*?s%)8 zW!RSR^<4c&l@>^m7Frg%`-<;FWfX?|h(X<5|nfXP)Ez0{NadyneoJ`QI49)5K>+ zf!1FBI7N uLP2a$C~$)6Fm!r6>*>e+FCI?v4|)RM|Ih}xQH%KYhf(rxbnc)#2>lnMfe~E* literal 0 HcmV?d00001 diff --git a/AlloyDb/owlbot.py b/AlloyDb/owlbot.py new file mode 100644 index 000000000000..85c4abafc770 --- /dev/null +++ b/AlloyDb/owlbot.py @@ -0,0 +1,63 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This script is used to synthesize generated parts of this library.""" + +import logging +from pathlib import Path +import subprocess + +import synthtool as s +from synthtool.languages import php +from synthtool import _tracked_paths + +logging.basicConfig(level=logging.DEBUG) + +src = Path(f"../{php.STAGING_DIR}/AlloyDb").resolve() +dest = Path().resolve() + +# Added so that we can pass copy_excludes in the owlbot_main() call +_tracked_paths.add(src) + +php.owlbot_main( + src=src, + dest=dest, + copy_excludes=[ + src / "**/[A-Z]*_*.php", + src / "**/*GrpcClient.php" + ] +) + +# remove class_alias code +s.replace( + "src/V*/**/*.php", + r"^// Adding a class alias for backwards compatibility with the previous class name.$" + + "\n" + + r"^class_alias\(.*\);$" + + "\n", + '') + +# format generated clients +subprocess.run([ + 'npm', + 'exec', + '--yes', + '--package=@prettier/plugin-php@^0.16', + '--', + 'prettier', + '**/Gapic/*', + '--write', + '--parser=php', + '--single-quote', + '--print-width=80']) diff --git a/AlloyDb/phpunit.xml.dist b/AlloyDb/phpunit.xml.dist new file mode 100644 index 000000000000..364fa38ee149 --- /dev/null +++ b/AlloyDb/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/batch_create_instances.php b/AlloyDb/samples/V1/AlloyDBAdminClient/batch_create_instances.php new file mode 100644 index 000000000000..54b7f16ec6a5 --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/batch_create_instances.php @@ -0,0 +1,123 @@ +setInstanceType($requestsCreateInstanceRequestsInstanceInstanceType); + $createInstanceRequest = (new CreateInstanceRequest()) + ->setParent($formattedRequestsCreateInstanceRequestsParent) + ->setInstanceId($requestsCreateInstanceRequestsInstanceId) + ->setInstance($requestsCreateInstanceRequestsInstance); + $requestsCreateInstanceRequests = [$createInstanceRequest,]; + $requests = (new CreateInstanceRequests()) + ->setCreateInstanceRequests($requestsCreateInstanceRequests); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->batchCreateInstances($formattedParent, $requests); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var BatchCreateInstancesResponse $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 = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $formattedRequestsCreateInstanceRequestsParent = AlloyDBAdminClient::clusterName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]' + ); + $requestsCreateInstanceRequestsInstanceId = '[INSTANCE_ID]'; + $requestsCreateInstanceRequestsInstanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + + batch_create_instances_sample( + $formattedParent, + $formattedRequestsCreateInstanceRequestsParent, + $requestsCreateInstanceRequestsInstanceId, + $requestsCreateInstanceRequestsInstanceInstanceType + ); +} +// [END alloydb_v1_generated_AlloyDBAdmin_BatchCreateInstances_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/create_backup.php b/AlloyDb/samples/V1/AlloyDBAdminClient/create_backup.php new file mode 100644 index 000000000000..eac36281b2e0 --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/create_backup.php @@ -0,0 +1,95 @@ +/locations//clusters/). Please see + * {@see AlloyDBAdminClient::clusterName()} for help formatting this field. + */ +function create_backup_sample( + string $formattedParent, + string $backupId, + string $formattedBackupClusterName +): void { + // Create a client. + $alloyDBAdminClient = new AlloyDBAdminClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $backup = (new Backup()) + ->setClusterName($formattedBackupClusterName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->createBackup($formattedParent, $backupId, $backup); + $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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]'); + $backupId = '[BACKUP_ID]'; + $formattedBackupClusterName = AlloyDBAdminClient::clusterName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]' + ); + + create_backup_sample($formattedParent, $backupId, $formattedBackupClusterName); +} +// [END alloydb_v1_generated_AlloyDBAdmin_CreateBackup_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/create_cluster.php b/AlloyDb/samples/V1/AlloyDBAdminClient/create_cluster.php new file mode 100644 index 000000000000..811484afd21c --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/create_cluster.php @@ -0,0 +1,95 @@ +setNetwork($formattedClusterNetwork); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->createCluster($formattedParent, $clusterId, $cluster); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Cluster $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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]'); + $clusterId = '[CLUSTER_ID]'; + $formattedClusterNetwork = AlloyDBAdminClient::networkName('[PROJECT]', '[NETWORK]'); + + create_cluster_sample($formattedParent, $clusterId, $formattedClusterNetwork); +} +// [END alloydb_v1_generated_AlloyDBAdmin_CreateCluster_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/create_instance.php b/AlloyDb/samples/V1/AlloyDBAdminClient/create_instance.php new file mode 100644 index 000000000000..f9ce6db41942 --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/create_instance.php @@ -0,0 +1,91 @@ +setInstanceType($instanceInstanceType); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->createInstance($formattedParent, $instanceId, $instance); + $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 = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $instanceId = '[INSTANCE_ID]'; + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + + create_instance_sample($formattedParent, $instanceId, $instanceInstanceType); +} +// [END alloydb_v1_generated_AlloyDBAdmin_CreateInstance_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/delete_backup.php b/AlloyDb/samples/V1/AlloyDBAdminClient/delete_backup.php new file mode 100644 index 000000000000..ab1191b09f2c --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/delete_backup.php @@ -0,0 +1,76 @@ +deleteBackup($formattedName); + $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 +{ + $formattedName = AlloyDBAdminClient::backupName('[PROJECT]', '[LOCATION]', '[BACKUP]'); + + delete_backup_sample($formattedName); +} +// [END alloydb_v1_generated_AlloyDBAdmin_DeleteBackup_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/delete_cluster.php b/AlloyDb/samples/V1/AlloyDBAdminClient/delete_cluster.php new file mode 100644 index 000000000000..a505b3f209ff --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/delete_cluster.php @@ -0,0 +1,76 @@ +deleteCluster($formattedName); + $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 +{ + $formattedName = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + + delete_cluster_sample($formattedName); +} +// [END alloydb_v1_generated_AlloyDBAdmin_DeleteCluster_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/delete_instance.php b/AlloyDb/samples/V1/AlloyDBAdminClient/delete_instance.php new file mode 100644 index 000000000000..b79330535cd1 --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/delete_instance.php @@ -0,0 +1,81 @@ +deleteInstance($formattedName); + $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 +{ + $formattedName = AlloyDBAdminClient::instanceName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]', + '[INSTANCE]' + ); + + delete_instance_sample($formattedName); +} +// [END alloydb_v1_generated_AlloyDBAdmin_DeleteInstance_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/failover_instance.php b/AlloyDb/samples/V1/AlloyDBAdminClient/failover_instance.php new file mode 100644 index 000000000000..d3e8203f18e0 --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/failover_instance.php @@ -0,0 +1,86 @@ +failoverInstance($formattedName); + $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 +{ + $formattedName = AlloyDBAdminClient::instanceName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]', + '[INSTANCE]' + ); + + failover_instance_sample($formattedName); +} +// [END alloydb_v1_generated_AlloyDBAdmin_FailoverInstance_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/get_backup.php b/AlloyDb/samples/V1/AlloyDBAdminClient/get_backup.php new file mode 100644 index 000000000000..696dd9e75bec --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/get_backup.php @@ -0,0 +1,66 @@ +getBackup($formattedName); + 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 = AlloyDBAdminClient::backupName('[PROJECT]', '[LOCATION]', '[BACKUP]'); + + get_backup_sample($formattedName); +} +// [END alloydb_v1_generated_AlloyDBAdmin_GetBackup_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/get_cluster.php b/AlloyDb/samples/V1/AlloyDBAdminClient/get_cluster.php new file mode 100644 index 000000000000..7c93bb381710 --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/get_cluster.php @@ -0,0 +1,67 @@ +getCluster($formattedName); + 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 = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + + get_cluster_sample($formattedName); +} +// [END alloydb_v1_generated_AlloyDBAdmin_GetCluster_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/get_instance.php b/AlloyDb/samples/V1/AlloyDBAdminClient/get_instance.php new file mode 100644 index 000000000000..a7ed1f73a7b3 --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/get_instance.php @@ -0,0 +1,72 @@ +getInstance($formattedName); + 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 = AlloyDBAdminClient::instanceName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]', + '[INSTANCE]' + ); + + get_instance_sample($formattedName); +} +// [END alloydb_v1_generated_AlloyDBAdmin_GetInstance_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/get_location.php b/AlloyDb/samples/V1/AlloyDBAdminClient/get_location.php new file mode 100644 index 000000000000..ea38a99618c4 --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END alloydb_v1_generated_AlloyDBAdmin_GetLocation_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/list_backups.php b/AlloyDb/samples/V1/AlloyDBAdminClient/list_backups.php new file mode 100644 index 000000000000..658b87889a0b --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/list_backups.php @@ -0,0 +1,71 @@ +listBackups($formattedParent); + + /** @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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]'); + + list_backups_sample($formattedParent); +} +// [END alloydb_v1_generated_AlloyDBAdmin_ListBackups_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/list_clusters.php b/AlloyDb/samples/V1/AlloyDBAdminClient/list_clusters.php new file mode 100644 index 000000000000..b4d6b50e6a1d --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/list_clusters.php @@ -0,0 +1,74 @@ +listClusters($formattedParent); + + /** @var Cluster $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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]'); + + list_clusters_sample($formattedParent); +} +// [END alloydb_v1_generated_AlloyDBAdmin_ListClusters_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/list_instances.php b/AlloyDb/samples/V1/AlloyDBAdminClient/list_instances.php new file mode 100644 index 000000000000..8502a2b3447c --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/list_instances.php @@ -0,0 +1,76 @@ +listInstances($formattedParent); + + /** @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 = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + + list_instances_sample($formattedParent); +} +// [END alloydb_v1_generated_AlloyDBAdmin_ListInstances_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/list_locations.php b/AlloyDb/samples/V1/AlloyDBAdminClient/list_locations.php new file mode 100644 index 000000000000..c7eeb6dbbc57 --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $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()); + } +} +// [END alloydb_v1_generated_AlloyDBAdmin_ListLocations_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/list_supported_database_flags.php b/AlloyDb/samples/V1/AlloyDBAdminClient/list_supported_database_flags.php new file mode 100644 index 000000000000..1b92c5850a12 --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/list_supported_database_flags.php @@ -0,0 +1,77 @@ +listSupportedDatabaseFlags($formattedParent); + + /** @var SupportedDatabaseFlag $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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]'); + + list_supported_database_flags_sample($formattedParent); +} +// [END alloydb_v1_generated_AlloyDBAdmin_ListSupportedDatabaseFlags_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/restart_instance.php b/AlloyDb/samples/V1/AlloyDBAdminClient/restart_instance.php new file mode 100644 index 000000000000..d5c4bab7289b --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/restart_instance.php @@ -0,0 +1,85 @@ +restartInstance($formattedName); + $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 +{ + $formattedName = AlloyDBAdminClient::instanceName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]', + '[INSTANCE]' + ); + + restart_instance_sample($formattedName); +} +// [END alloydb_v1_generated_AlloyDBAdmin_RestartInstance_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/restore_cluster.php b/AlloyDb/samples/V1/AlloyDBAdminClient/restore_cluster.php new file mode 100644 index 000000000000..6b4ba9403eaf --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/restore_cluster.php @@ -0,0 +1,97 @@ +setNetwork($formattedClusterNetwork); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->restoreCluster($formattedParent, $clusterId, $cluster); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Cluster $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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]'); + $clusterId = '[CLUSTER_ID]'; + $formattedClusterNetwork = AlloyDBAdminClient::networkName('[PROJECT]', '[NETWORK]'); + + restore_cluster_sample($formattedParent, $clusterId, $formattedClusterNetwork); +} +// [END alloydb_v1_generated_AlloyDBAdmin_RestoreCluster_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/update_backup.php b/AlloyDb/samples/V1/AlloyDBAdminClient/update_backup.php new file mode 100644 index 000000000000..ac9ff3996dfb --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/update_backup.php @@ -0,0 +1,87 @@ +/locations//clusters/). Please see + * {@see AlloyDBAdminClient::clusterName()} for help formatting this field. + */ +function update_backup_sample(string $formattedBackupClusterName): void +{ + // Create a client. + $alloyDBAdminClient = new AlloyDBAdminClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $backup = (new Backup()) + ->setClusterName($formattedBackupClusterName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->updateBackup($backup); + $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 +{ + $formattedBackupClusterName = AlloyDBAdminClient::clusterName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]' + ); + + update_backup_sample($formattedBackupClusterName); +} +// [END alloydb_v1_generated_AlloyDBAdmin_UpdateBackup_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/update_cluster.php b/AlloyDb/samples/V1/AlloyDBAdminClient/update_cluster.php new file mode 100644 index 000000000000..698b13823664 --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/update_cluster.php @@ -0,0 +1,86 @@ +setNetwork($formattedClusterNetwork); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->updateCluster($cluster); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Cluster $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 +{ + $formattedClusterNetwork = AlloyDBAdminClient::networkName('[PROJECT]', '[NETWORK]'); + + update_cluster_sample($formattedClusterNetwork); +} +// [END alloydb_v1_generated_AlloyDBAdmin_UpdateCluster_sync] diff --git a/AlloyDb/samples/V1/AlloyDBAdminClient/update_instance.php b/AlloyDb/samples/V1/AlloyDBAdminClient/update_instance.php new file mode 100644 index 000000000000..52b8835fea86 --- /dev/null +++ b/AlloyDb/samples/V1/AlloyDBAdminClient/update_instance.php @@ -0,0 +1,82 @@ +setInstanceType($instanceInstanceType); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->updateInstance($instance); + $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 +{ + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + + update_instance_sample($instanceInstanceType); +} +// [END alloydb_v1_generated_AlloyDBAdmin_UpdateInstance_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/batch_create_instances.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/batch_create_instances.php new file mode 100644 index 000000000000..6eee1e0b5d34 --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/batch_create_instances.php @@ -0,0 +1,123 @@ +setInstanceType($requestsCreateInstanceRequestsInstanceInstanceType); + $createInstanceRequest = (new CreateInstanceRequest()) + ->setParent($formattedRequestsCreateInstanceRequestsParent) + ->setInstanceId($requestsCreateInstanceRequestsInstanceId) + ->setInstance($requestsCreateInstanceRequestsInstance); + $requestsCreateInstanceRequests = [$createInstanceRequest,]; + $requests = (new CreateInstanceRequests()) + ->setCreateInstanceRequests($requestsCreateInstanceRequests); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->batchCreateInstances($formattedParent, $requests); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var BatchCreateInstancesResponse $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 = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $formattedRequestsCreateInstanceRequestsParent = AlloyDBAdminClient::clusterName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]' + ); + $requestsCreateInstanceRequestsInstanceId = '[INSTANCE_ID]'; + $requestsCreateInstanceRequestsInstanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + + batch_create_instances_sample( + $formattedParent, + $formattedRequestsCreateInstanceRequestsParent, + $requestsCreateInstanceRequestsInstanceId, + $requestsCreateInstanceRequestsInstanceInstanceType + ); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_BatchCreateInstances_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/create_backup.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/create_backup.php new file mode 100644 index 000000000000..7d76db9a710e --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/create_backup.php @@ -0,0 +1,95 @@ +/locations//clusters/). Please see + * {@see AlloyDBAdminClient::clusterName()} for help formatting this field. + */ +function create_backup_sample( + string $formattedParent, + string $backupId, + string $formattedBackupClusterName +): void { + // Create a client. + $alloyDBAdminClient = new AlloyDBAdminClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $backup = (new Backup()) + ->setClusterName($formattedBackupClusterName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->createBackup($formattedParent, $backupId, $backup); + $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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]'); + $backupId = '[BACKUP_ID]'; + $formattedBackupClusterName = AlloyDBAdminClient::clusterName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]' + ); + + create_backup_sample($formattedParent, $backupId, $formattedBackupClusterName); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_CreateBackup_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/create_cluster.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/create_cluster.php new file mode 100644 index 000000000000..037930a744b3 --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/create_cluster.php @@ -0,0 +1,95 @@ +setNetwork($formattedClusterNetwork); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->createCluster($formattedParent, $clusterId, $cluster); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Cluster $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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]'); + $clusterId = '[CLUSTER_ID]'; + $formattedClusterNetwork = AlloyDBAdminClient::networkName('[PROJECT]', '[NETWORK]'); + + create_cluster_sample($formattedParent, $clusterId, $formattedClusterNetwork); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_CreateCluster_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/create_instance.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/create_instance.php new file mode 100644 index 000000000000..e6fe0a81e759 --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/create_instance.php @@ -0,0 +1,91 @@ +setInstanceType($instanceInstanceType); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->createInstance($formattedParent, $instanceId, $instance); + $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 = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $instanceId = '[INSTANCE_ID]'; + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + + create_instance_sample($formattedParent, $instanceId, $instanceInstanceType); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_CreateInstance_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/create_secondary_cluster.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/create_secondary_cluster.php new file mode 100644 index 000000000000..c100e26b234d --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/create_secondary_cluster.php @@ -0,0 +1,96 @@ +setNetwork($formattedClusterNetwork); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->createSecondaryCluster($formattedParent, $clusterId, $cluster); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Cluster $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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]'); + $clusterId = '[CLUSTER_ID]'; + $formattedClusterNetwork = AlloyDBAdminClient::networkName('[PROJECT]', '[NETWORK]'); + + create_secondary_cluster_sample($formattedParent, $clusterId, $formattedClusterNetwork); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_CreateSecondaryCluster_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/create_secondary_instance.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/create_secondary_instance.php new file mode 100644 index 000000000000..3e820205bdae --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/create_secondary_instance.php @@ -0,0 +1,91 @@ +setInstanceType($instanceInstanceType); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->createSecondaryInstance($formattedParent, $instanceId, $instance); + $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 = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $instanceId = '[INSTANCE_ID]'; + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + + create_secondary_instance_sample($formattedParent, $instanceId, $instanceInstanceType); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_CreateSecondaryInstance_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/delete_backup.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/delete_backup.php new file mode 100644 index 000000000000..a2ff825fbd2f --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/delete_backup.php @@ -0,0 +1,76 @@ +deleteBackup($formattedName); + $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 +{ + $formattedName = AlloyDBAdminClient::backupName('[PROJECT]', '[LOCATION]', '[BACKUP]'); + + delete_backup_sample($formattedName); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_DeleteBackup_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/delete_cluster.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/delete_cluster.php new file mode 100644 index 000000000000..c6c523a317f0 --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/delete_cluster.php @@ -0,0 +1,76 @@ +deleteCluster($formattedName); + $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 +{ + $formattedName = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + + delete_cluster_sample($formattedName); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_DeleteCluster_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/delete_instance.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/delete_instance.php new file mode 100644 index 000000000000..24d9fa333d53 --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/delete_instance.php @@ -0,0 +1,81 @@ +deleteInstance($formattedName); + $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 +{ + $formattedName = AlloyDBAdminClient::instanceName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]', + '[INSTANCE]' + ); + + delete_instance_sample($formattedName); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_DeleteInstance_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/failover_instance.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/failover_instance.php new file mode 100644 index 000000000000..8323a7670394 --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/failover_instance.php @@ -0,0 +1,86 @@ +failoverInstance($formattedName); + $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 +{ + $formattedName = AlloyDBAdminClient::instanceName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]', + '[INSTANCE]' + ); + + failover_instance_sample($formattedName); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_FailoverInstance_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/generate_client_certificate.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/generate_client_certificate.php new file mode 100644 index 000000000000..f96ca3700475 --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/generate_client_certificate.php @@ -0,0 +1,71 @@ +generateClientCertificate($formattedParent); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + + generate_client_certificate_sample($formattedParent); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_GenerateClientCertificate_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/get_backup.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/get_backup.php new file mode 100644 index 000000000000..2d91670b9f8b --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/get_backup.php @@ -0,0 +1,66 @@ +getBackup($formattedName); + 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 = AlloyDBAdminClient::backupName('[PROJECT]', '[LOCATION]', '[BACKUP]'); + + get_backup_sample($formattedName); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_GetBackup_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/get_cluster.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/get_cluster.php new file mode 100644 index 000000000000..698c95c92ab1 --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/get_cluster.php @@ -0,0 +1,67 @@ +getCluster($formattedName); + 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 = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + + get_cluster_sample($formattedName); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_GetCluster_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/get_connection_info.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/get_connection_info.php new file mode 100644 index 000000000000..e6258d304278 --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/get_connection_info.php @@ -0,0 +1,72 @@ +getConnectionInfo($formattedParent); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = AlloyDBAdminClient::instanceName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]', + '[INSTANCE]' + ); + + get_connection_info_sample($formattedParent); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_GetConnectionInfo_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/get_instance.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/get_instance.php new file mode 100644 index 000000000000..4d62ee36ca6b --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/get_instance.php @@ -0,0 +1,72 @@ +getInstance($formattedName); + 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 = AlloyDBAdminClient::instanceName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]', + '[INSTANCE]' + ); + + get_instance_sample($formattedName); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_GetInstance_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/get_location.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/get_location.php new file mode 100644 index 000000000000..22d386b5cb08 --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_GetLocation_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/list_backups.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/list_backups.php new file mode 100644 index 000000000000..c5973c3a478c --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/list_backups.php @@ -0,0 +1,71 @@ +listBackups($formattedParent); + + /** @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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]'); + + list_backups_sample($formattedParent); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_ListBackups_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/list_clusters.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/list_clusters.php new file mode 100644 index 000000000000..f788df0033ec --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/list_clusters.php @@ -0,0 +1,74 @@ +listClusters($formattedParent); + + /** @var Cluster $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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]'); + + list_clusters_sample($formattedParent); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_ListClusters_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/list_instances.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/list_instances.php new file mode 100644 index 000000000000..6e7e861adef2 --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/list_instances.php @@ -0,0 +1,76 @@ +listInstances($formattedParent); + + /** @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 = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + + list_instances_sample($formattedParent); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_ListInstances_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/list_locations.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/list_locations.php new file mode 100644 index 000000000000..7d2ef19587be --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $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()); + } +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_ListLocations_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/list_supported_database_flags.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/list_supported_database_flags.php new file mode 100644 index 000000000000..700c6fbe9930 --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/list_supported_database_flags.php @@ -0,0 +1,77 @@ +listSupportedDatabaseFlags($formattedParent); + + /** @var SupportedDatabaseFlag $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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]'); + + list_supported_database_flags_sample($formattedParent); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_ListSupportedDatabaseFlags_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/promote_cluster.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/promote_cluster.php new file mode 100644 index 000000000000..ac3df299e9b9 --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/promote_cluster.php @@ -0,0 +1,82 @@ +promoteCluster($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Cluster $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + + promote_cluster_sample($formattedName); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_PromoteCluster_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/restart_instance.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/restart_instance.php new file mode 100644 index 000000000000..a4a5b4f3d4e1 --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/restart_instance.php @@ -0,0 +1,85 @@ +restartInstance($formattedName); + $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 +{ + $formattedName = AlloyDBAdminClient::instanceName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]', + '[INSTANCE]' + ); + + restart_instance_sample($formattedName); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_RestartInstance_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/restore_cluster.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/restore_cluster.php new file mode 100644 index 000000000000..42d54e3263df --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/restore_cluster.php @@ -0,0 +1,97 @@ +setNetwork($formattedClusterNetwork); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->restoreCluster($formattedParent, $clusterId, $cluster); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Cluster $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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]'); + $clusterId = '[CLUSTER_ID]'; + $formattedClusterNetwork = AlloyDBAdminClient::networkName('[PROJECT]', '[NETWORK]'); + + restore_cluster_sample($formattedParent, $clusterId, $formattedClusterNetwork); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_RestoreCluster_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/update_backup.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/update_backup.php new file mode 100644 index 000000000000..6a7fc040041f --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/update_backup.php @@ -0,0 +1,87 @@ +/locations//clusters/). Please see + * {@see AlloyDBAdminClient::clusterName()} for help formatting this field. + */ +function update_backup_sample(string $formattedBackupClusterName): void +{ + // Create a client. + $alloyDBAdminClient = new AlloyDBAdminClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $backup = (new Backup()) + ->setClusterName($formattedBackupClusterName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->updateBackup($backup); + $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 +{ + $formattedBackupClusterName = AlloyDBAdminClient::clusterName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]' + ); + + update_backup_sample($formattedBackupClusterName); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_UpdateBackup_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/update_cluster.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/update_cluster.php new file mode 100644 index 000000000000..7c6afa024438 --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/update_cluster.php @@ -0,0 +1,86 @@ +setNetwork($formattedClusterNetwork); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->updateCluster($cluster); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Cluster $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 +{ + $formattedClusterNetwork = AlloyDBAdminClient::networkName('[PROJECT]', '[NETWORK]'); + + update_cluster_sample($formattedClusterNetwork); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_UpdateCluster_sync] diff --git a/AlloyDb/samples/V1alpha/AlloyDBAdminClient/update_instance.php b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/update_instance.php new file mode 100644 index 000000000000..b9093e91c94c --- /dev/null +++ b/AlloyDb/samples/V1alpha/AlloyDBAdminClient/update_instance.php @@ -0,0 +1,82 @@ +setInstanceType($instanceInstanceType); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->updateInstance($instance); + $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 +{ + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + + update_instance_sample($instanceInstanceType); +} +// [END alloydb_v1alpha_generated_AlloyDBAdmin_UpdateInstance_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/batch_create_instances.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/batch_create_instances.php new file mode 100644 index 000000000000..52e84d7f74f0 --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/batch_create_instances.php @@ -0,0 +1,123 @@ +setInstanceType($requestsCreateInstanceRequestsInstanceInstanceType); + $createInstanceRequest = (new CreateInstanceRequest()) + ->setParent($formattedRequestsCreateInstanceRequestsParent) + ->setInstanceId($requestsCreateInstanceRequestsInstanceId) + ->setInstance($requestsCreateInstanceRequestsInstance); + $requestsCreateInstanceRequests = [$createInstanceRequest,]; + $requests = (new CreateInstanceRequests()) + ->setCreateInstanceRequests($requestsCreateInstanceRequests); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->batchCreateInstances($formattedParent, $requests); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var BatchCreateInstancesResponse $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 = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $formattedRequestsCreateInstanceRequestsParent = AlloyDBAdminClient::clusterName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]' + ); + $requestsCreateInstanceRequestsInstanceId = '[INSTANCE_ID]'; + $requestsCreateInstanceRequestsInstanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + + batch_create_instances_sample( + $formattedParent, + $formattedRequestsCreateInstanceRequestsParent, + $requestsCreateInstanceRequestsInstanceId, + $requestsCreateInstanceRequestsInstanceInstanceType + ); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_BatchCreateInstances_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/create_backup.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/create_backup.php new file mode 100644 index 000000000000..3fd91fd91d5d --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/create_backup.php @@ -0,0 +1,95 @@ +/locations//clusters/). Please see + * {@see AlloyDBAdminClient::clusterName()} for help formatting this field. + */ +function create_backup_sample( + string $formattedParent, + string $backupId, + string $formattedBackupClusterName +): void { + // Create a client. + $alloyDBAdminClient = new AlloyDBAdminClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $backup = (new Backup()) + ->setClusterName($formattedBackupClusterName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->createBackup($formattedParent, $backupId, $backup); + $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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]'); + $backupId = '[BACKUP_ID]'; + $formattedBackupClusterName = AlloyDBAdminClient::clusterName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]' + ); + + create_backup_sample($formattedParent, $backupId, $formattedBackupClusterName); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_CreateBackup_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/create_cluster.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/create_cluster.php new file mode 100644 index 000000000000..0d197e94d3ba --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/create_cluster.php @@ -0,0 +1,95 @@ +setNetwork($formattedClusterNetwork); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->createCluster($formattedParent, $clusterId, $cluster); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Cluster $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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]'); + $clusterId = '[CLUSTER_ID]'; + $formattedClusterNetwork = AlloyDBAdminClient::networkName('[PROJECT]', '[NETWORK]'); + + create_cluster_sample($formattedParent, $clusterId, $formattedClusterNetwork); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_CreateCluster_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/create_instance.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/create_instance.php new file mode 100644 index 000000000000..32186e925387 --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/create_instance.php @@ -0,0 +1,91 @@ +setInstanceType($instanceInstanceType); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->createInstance($formattedParent, $instanceId, $instance); + $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 = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $instanceId = '[INSTANCE_ID]'; + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + + create_instance_sample($formattedParent, $instanceId, $instanceInstanceType); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_CreateInstance_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/create_secondary_cluster.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/create_secondary_cluster.php new file mode 100644 index 000000000000..e7126f7b63bd --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/create_secondary_cluster.php @@ -0,0 +1,96 @@ +setNetwork($formattedClusterNetwork); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->createSecondaryCluster($formattedParent, $clusterId, $cluster); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Cluster $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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]'); + $clusterId = '[CLUSTER_ID]'; + $formattedClusterNetwork = AlloyDBAdminClient::networkName('[PROJECT]', '[NETWORK]'); + + create_secondary_cluster_sample($formattedParent, $clusterId, $formattedClusterNetwork); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_CreateSecondaryCluster_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/create_secondary_instance.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/create_secondary_instance.php new file mode 100644 index 000000000000..2bf313b63d53 --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/create_secondary_instance.php @@ -0,0 +1,91 @@ +setInstanceType($instanceInstanceType); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->createSecondaryInstance($formattedParent, $instanceId, $instance); + $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 = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $instanceId = '[INSTANCE_ID]'; + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + + create_secondary_instance_sample($formattedParent, $instanceId, $instanceInstanceType); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_CreateSecondaryInstance_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/delete_backup.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/delete_backup.php new file mode 100644 index 000000000000..3f1febc8e724 --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/delete_backup.php @@ -0,0 +1,76 @@ +deleteBackup($formattedName); + $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 +{ + $formattedName = AlloyDBAdminClient::backupName('[PROJECT]', '[LOCATION]', '[BACKUP]'); + + delete_backup_sample($formattedName); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_DeleteBackup_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/delete_cluster.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/delete_cluster.php new file mode 100644 index 000000000000..bb041576705e --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/delete_cluster.php @@ -0,0 +1,76 @@ +deleteCluster($formattedName); + $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 +{ + $formattedName = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + + delete_cluster_sample($formattedName); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_DeleteCluster_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/delete_instance.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/delete_instance.php new file mode 100644 index 000000000000..27305f897086 --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/delete_instance.php @@ -0,0 +1,81 @@ +deleteInstance($formattedName); + $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 +{ + $formattedName = AlloyDBAdminClient::instanceName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]', + '[INSTANCE]' + ); + + delete_instance_sample($formattedName); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_DeleteInstance_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/failover_instance.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/failover_instance.php new file mode 100644 index 000000000000..9ecde842d163 --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/failover_instance.php @@ -0,0 +1,86 @@ +failoverInstance($formattedName); + $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 +{ + $formattedName = AlloyDBAdminClient::instanceName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]', + '[INSTANCE]' + ); + + failover_instance_sample($formattedName); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_FailoverInstance_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/generate_client_certificate.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/generate_client_certificate.php new file mode 100644 index 000000000000..09ef2e6a6cbe --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/generate_client_certificate.php @@ -0,0 +1,71 @@ +generateClientCertificate($formattedParent); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + + generate_client_certificate_sample($formattedParent); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_GenerateClientCertificate_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/get_backup.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/get_backup.php new file mode 100644 index 000000000000..0901823b09ca --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/get_backup.php @@ -0,0 +1,66 @@ +getBackup($formattedName); + 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 = AlloyDBAdminClient::backupName('[PROJECT]', '[LOCATION]', '[BACKUP]'); + + get_backup_sample($formattedName); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_GetBackup_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/get_cluster.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/get_cluster.php new file mode 100644 index 000000000000..460b58f41f1a --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/get_cluster.php @@ -0,0 +1,67 @@ +getCluster($formattedName); + 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 = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + + get_cluster_sample($formattedName); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_GetCluster_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/get_connection_info.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/get_connection_info.php new file mode 100644 index 000000000000..c07d04eb773a --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/get_connection_info.php @@ -0,0 +1,72 @@ +getConnectionInfo($formattedParent); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = AlloyDBAdminClient::instanceName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]', + '[INSTANCE]' + ); + + get_connection_info_sample($formattedParent); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_GetConnectionInfo_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/get_instance.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/get_instance.php new file mode 100644 index 000000000000..80f5f2b589dc --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/get_instance.php @@ -0,0 +1,72 @@ +getInstance($formattedName); + 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 = AlloyDBAdminClient::instanceName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]', + '[INSTANCE]' + ); + + get_instance_sample($formattedName); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_GetInstance_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/get_location.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/get_location.php new file mode 100644 index 000000000000..0fa245f61006 --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_GetLocation_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/list_backups.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/list_backups.php new file mode 100644 index 000000000000..da790b81697b --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/list_backups.php @@ -0,0 +1,71 @@ +listBackups($formattedParent); + + /** @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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]'); + + list_backups_sample($formattedParent); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_ListBackups_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/list_clusters.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/list_clusters.php new file mode 100644 index 000000000000..36a8dd849a7d --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/list_clusters.php @@ -0,0 +1,74 @@ +listClusters($formattedParent); + + /** @var Cluster $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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]'); + + list_clusters_sample($formattedParent); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_ListClusters_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/list_instances.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/list_instances.php new file mode 100644 index 000000000000..5cb79b0b9bea --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/list_instances.php @@ -0,0 +1,76 @@ +listInstances($formattedParent); + + /** @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 = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + + list_instances_sample($formattedParent); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_ListInstances_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/list_locations.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/list_locations.php new file mode 100644 index 000000000000..5b2c4bcc436a --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $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()); + } +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_ListLocations_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/list_supported_database_flags.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/list_supported_database_flags.php new file mode 100644 index 000000000000..ae7059a23efa --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/list_supported_database_flags.php @@ -0,0 +1,77 @@ +listSupportedDatabaseFlags($formattedParent); + + /** @var SupportedDatabaseFlag $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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]'); + + list_supported_database_flags_sample($formattedParent); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_ListSupportedDatabaseFlags_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/promote_cluster.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/promote_cluster.php new file mode 100644 index 000000000000..95e6eef0384e --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/promote_cluster.php @@ -0,0 +1,82 @@ +promoteCluster($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Cluster $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = AlloyDBAdminClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + + promote_cluster_sample($formattedName); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_PromoteCluster_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/restart_instance.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/restart_instance.php new file mode 100644 index 000000000000..768aacdd964f --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/restart_instance.php @@ -0,0 +1,85 @@ +restartInstance($formattedName); + $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 +{ + $formattedName = AlloyDBAdminClient::instanceName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]', + '[INSTANCE]' + ); + + restart_instance_sample($formattedName); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_RestartInstance_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/restore_cluster.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/restore_cluster.php new file mode 100644 index 000000000000..2c38f3b238bf --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/restore_cluster.php @@ -0,0 +1,97 @@ +setNetwork($formattedClusterNetwork); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->restoreCluster($formattedParent, $clusterId, $cluster); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Cluster $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 = AlloyDBAdminClient::locationName('[PROJECT]', '[LOCATION]'); + $clusterId = '[CLUSTER_ID]'; + $formattedClusterNetwork = AlloyDBAdminClient::networkName('[PROJECT]', '[NETWORK]'); + + restore_cluster_sample($formattedParent, $clusterId, $formattedClusterNetwork); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_RestoreCluster_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/update_backup.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/update_backup.php new file mode 100644 index 000000000000..c2f5175ee93a --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/update_backup.php @@ -0,0 +1,87 @@ +/locations//clusters/). Please see + * {@see AlloyDBAdminClient::clusterName()} for help formatting this field. + */ +function update_backup_sample(string $formattedBackupClusterName): void +{ + // Create a client. + $alloyDBAdminClient = new AlloyDBAdminClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $backup = (new Backup()) + ->setClusterName($formattedBackupClusterName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->updateBackup($backup); + $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 +{ + $formattedBackupClusterName = AlloyDBAdminClient::clusterName( + '[PROJECT]', + '[LOCATION]', + '[CLUSTER]' + ); + + update_backup_sample($formattedBackupClusterName); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_UpdateBackup_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/update_cluster.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/update_cluster.php new file mode 100644 index 000000000000..4f1ce12f31fa --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/update_cluster.php @@ -0,0 +1,86 @@ +setNetwork($formattedClusterNetwork); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->updateCluster($cluster); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Cluster $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 +{ + $formattedClusterNetwork = AlloyDBAdminClient::networkName('[PROJECT]', '[NETWORK]'); + + update_cluster_sample($formattedClusterNetwork); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_UpdateCluster_sync] diff --git a/AlloyDb/samples/V1beta/AlloyDBAdminClient/update_instance.php b/AlloyDb/samples/V1beta/AlloyDBAdminClient/update_instance.php new file mode 100644 index 000000000000..e78454363359 --- /dev/null +++ b/AlloyDb/samples/V1beta/AlloyDBAdminClient/update_instance.php @@ -0,0 +1,82 @@ +setInstanceType($instanceInstanceType); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $alloyDBAdminClient->updateInstance($instance); + $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 +{ + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + + update_instance_sample($instanceInstanceType); +} +// [END alloydb_v1beta_generated_AlloyDBAdmin_UpdateInstance_sync] diff --git a/AlloyDb/src/V1/AlloyDBAdminClient.php b/AlloyDb/src/V1/AlloyDBAdminClient.php new file mode 100644 index 000000000000..46b275bf3d44 --- /dev/null +++ b/AlloyDb/src/V1/AlloyDBAdminClient.php @@ -0,0 +1,34 @@ +google.cloud.alloydb.v1.AutomatedBackupPolicy + */ +class AutomatedBackupPolicy extends \Google\Protobuf\Internal\Message +{ + /** + * Whether automated automated backups are enabled. If not set, defaults to + * true. + * + * Generated from protobuf field optional bool enabled = 1; + */ + protected $enabled = null; + /** + * The length of the time window during which a backup can be + * taken. If a backup does not succeed within this time window, it will be + * canceled and considered failed. + * The backup window must be at least 5 minutes long. There is no upper bound + * on the window. If not set, it defaults to 1 hour. + * + * Generated from protobuf field .google.protobuf.Duration backup_window = 3; + */ + protected $backup_window = null; + /** + * Optional. The encryption config can be specified to encrypt the + * backups with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $encryption_config = null; + /** + * The location where the backup will be stored. Currently, the only supported + * option is to store the backup in the same region as the cluster. + * If empty, defaults to the region of the cluster. + * + * Generated from protobuf field string location = 6; + */ + protected $location = ''; + /** + * Labels to apply to backups created using this configuration. + * + * Generated from protobuf field map labels = 7; + */ + private $labels; + protected $schedule; + protected $retention; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AlloyDb\V1\AutomatedBackupPolicy\WeeklySchedule $weekly_schedule + * Weekly schedule for the Backup. + * @type \Google\Cloud\AlloyDb\V1\AutomatedBackupPolicy\TimeBasedRetention $time_based_retention + * Time-based Backup retention policy. + * @type \Google\Cloud\AlloyDb\V1\AutomatedBackupPolicy\QuantityBasedRetention $quantity_based_retention + * Quantity-based Backup retention policy to retain recent backups. + * @type bool $enabled + * Whether automated automated backups are enabled. If not set, defaults to + * true. + * @type \Google\Protobuf\Duration $backup_window + * The length of the time window during which a backup can be + * taken. If a backup does not succeed within this time window, it will be + * canceled and considered failed. + * The backup window must be at least 5 minutes long. There is no upper bound + * on the window. If not set, it defaults to 1 hour. + * @type \Google\Cloud\AlloyDb\V1\EncryptionConfig $encryption_config + * Optional. The encryption config can be specified to encrypt the + * backups with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * @type string $location + * The location where the backup will be stored. Currently, the only supported + * option is to store the backup in the same region as the cluster. + * If empty, defaults to the region of the cluster. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels to apply to backups created using this configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Weekly schedule for the Backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1.AutomatedBackupPolicy.WeeklySchedule weekly_schedule = 2; + * @return \Google\Cloud\AlloyDb\V1\AutomatedBackupPolicy\WeeklySchedule|null + */ + public function getWeeklySchedule() + { + return $this->readOneof(2); + } + + public function hasWeeklySchedule() + { + return $this->hasOneof(2); + } + + /** + * Weekly schedule for the Backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1.AutomatedBackupPolicy.WeeklySchedule weekly_schedule = 2; + * @param \Google\Cloud\AlloyDb\V1\AutomatedBackupPolicy\WeeklySchedule $var + * @return $this + */ + public function setWeeklySchedule($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\AutomatedBackupPolicy\WeeklySchedule::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Time-based Backup retention policy. + * + * Generated from protobuf field .google.cloud.alloydb.v1.AutomatedBackupPolicy.TimeBasedRetention time_based_retention = 4; + * @return \Google\Cloud\AlloyDb\V1\AutomatedBackupPolicy\TimeBasedRetention|null + */ + public function getTimeBasedRetention() + { + return $this->readOneof(4); + } + + public function hasTimeBasedRetention() + { + return $this->hasOneof(4); + } + + /** + * Time-based Backup retention policy. + * + * Generated from protobuf field .google.cloud.alloydb.v1.AutomatedBackupPolicy.TimeBasedRetention time_based_retention = 4; + * @param \Google\Cloud\AlloyDb\V1\AutomatedBackupPolicy\TimeBasedRetention $var + * @return $this + */ + public function setTimeBasedRetention($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\AutomatedBackupPolicy\TimeBasedRetention::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Quantity-based Backup retention policy to retain recent backups. + * + * Generated from protobuf field .google.cloud.alloydb.v1.AutomatedBackupPolicy.QuantityBasedRetention quantity_based_retention = 5; + * @return \Google\Cloud\AlloyDb\V1\AutomatedBackupPolicy\QuantityBasedRetention|null + */ + public function getQuantityBasedRetention() + { + return $this->readOneof(5); + } + + public function hasQuantityBasedRetention() + { + return $this->hasOneof(5); + } + + /** + * Quantity-based Backup retention policy to retain recent backups. + * + * Generated from protobuf field .google.cloud.alloydb.v1.AutomatedBackupPolicy.QuantityBasedRetention quantity_based_retention = 5; + * @param \Google\Cloud\AlloyDb\V1\AutomatedBackupPolicy\QuantityBasedRetention $var + * @return $this + */ + public function setQuantityBasedRetention($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\AutomatedBackupPolicy\QuantityBasedRetention::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Whether automated automated backups are enabled. If not set, defaults to + * true. + * + * Generated from protobuf field optional bool enabled = 1; + * @return bool + */ + public function getEnabled() + { + return isset($this->enabled) ? $this->enabled : false; + } + + public function hasEnabled() + { + return isset($this->enabled); + } + + public function clearEnabled() + { + unset($this->enabled); + } + + /** + * Whether automated automated backups are enabled. If not set, defaults to + * true. + * + * Generated from protobuf field optional bool enabled = 1; + * @param bool $var + * @return $this + */ + public function setEnabled($var) + { + GPBUtil::checkBool($var); + $this->enabled = $var; + + return $this; + } + + /** + * The length of the time window during which a backup can be + * taken. If a backup does not succeed within this time window, it will be + * canceled and considered failed. + * The backup window must be at least 5 minutes long. There is no upper bound + * on the window. If not set, it defaults to 1 hour. + * + * Generated from protobuf field .google.protobuf.Duration backup_window = 3; + * @return \Google\Protobuf\Duration|null + */ + public function getBackupWindow() + { + return $this->backup_window; + } + + public function hasBackupWindow() + { + return isset($this->backup_window); + } + + public function clearBackupWindow() + { + unset($this->backup_window); + } + + /** + * The length of the time window during which a backup can be + * taken. If a backup does not succeed within this time window, it will be + * canceled and considered failed. + * The backup window must be at least 5 minutes long. There is no upper bound + * on the window. If not set, it defaults to 1 hour. + * + * Generated from protobuf field .google.protobuf.Duration backup_window = 3; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setBackupWindow($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->backup_window = $var; + + return $this; + } + + /** + * Optional. The encryption config can be specified to encrypt the + * backups with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\AlloyDb\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 config can be specified to encrypt the + * backups with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\AlloyDb\V1\EncryptionConfig $var + * @return $this + */ + public function setEncryptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\EncryptionConfig::class); + $this->encryption_config = $var; + + return $this; + } + + /** + * The location where the backup will be stored. Currently, the only supported + * option is to store the backup in the same region as the cluster. + * If empty, defaults to the region of the cluster. + * + * Generated from protobuf field string location = 6; + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * The location where the backup will be stored. Currently, the only supported + * option is to store the backup in the same region as the cluster. + * If empty, defaults to the region of the cluster. + * + * Generated from protobuf field string location = 6; + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + + /** + * Labels to apply to backups created using this configuration. + * + * Generated from protobuf field map labels = 7; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels to apply to backups created using this configuration. + * + * 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; + } + + /** + * @return string + */ + public function getSchedule() + { + return $this->whichOneof("schedule"); + } + + /** + * @return string + */ + public function getRetention() + { + return $this->whichOneof("retention"); + } + +} + diff --git a/AlloyDb/src/V1/AutomatedBackupPolicy/QuantityBasedRetention.php b/AlloyDb/src/V1/AutomatedBackupPolicy/QuantityBasedRetention.php new file mode 100644 index 000000000000..d1c12d8552bf --- /dev/null +++ b/AlloyDb/src/V1/AutomatedBackupPolicy/QuantityBasedRetention.php @@ -0,0 +1,69 @@ +google.cloud.alloydb.v1.AutomatedBackupPolicy.QuantityBasedRetention + */ +class QuantityBasedRetention extends \Google\Protobuf\Internal\Message +{ + /** + * The number of backups to retain. + * + * Generated from protobuf field int32 count = 1; + */ + protected $count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $count + * The number of backups to retain. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The number of backups to retain. + * + * Generated from protobuf field int32 count = 1; + * @return int + */ + public function getCount() + { + return $this->count; + } + + /** + * The number of backups to retain. + * + * Generated from protobuf field int32 count = 1; + * @param int $var + * @return $this + */ + public function setCount($var) + { + GPBUtil::checkInt32($var); + $this->count = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1/AutomatedBackupPolicy/TimeBasedRetention.php b/AlloyDb/src/V1/AutomatedBackupPolicy/TimeBasedRetention.php new file mode 100644 index 000000000000..f41538e91ac9 --- /dev/null +++ b/AlloyDb/src/V1/AutomatedBackupPolicy/TimeBasedRetention.php @@ -0,0 +1,79 @@ +google.cloud.alloydb.v1.AutomatedBackupPolicy.TimeBasedRetention + */ +class TimeBasedRetention extends \Google\Protobuf\Internal\Message +{ + /** + * The retention period. + * + * Generated from protobuf field .google.protobuf.Duration retention_period = 1; + */ + protected $retention_period = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $retention_period + * The retention period. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The retention period. + * + * Generated from protobuf field .google.protobuf.Duration retention_period = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getRetentionPeriod() + { + return $this->retention_period; + } + + public function hasRetentionPeriod() + { + return isset($this->retention_period); + } + + public function clearRetentionPeriod() + { + unset($this->retention_period); + } + + /** + * The retention period. + * + * Generated from protobuf field .google.protobuf.Duration retention_period = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setRetentionPeriod($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->retention_period = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1/AutomatedBackupPolicy/WeeklySchedule.php b/AlloyDb/src/V1/AutomatedBackupPolicy/WeeklySchedule.php new file mode 100644 index 000000000000..2c68bf88660e --- /dev/null +++ b/AlloyDb/src/V1/AutomatedBackupPolicy/WeeklySchedule.php @@ -0,0 +1,127 @@ +google.cloud.alloydb.v1.AutomatedBackupPolicy.WeeklySchedule + */ +class WeeklySchedule extends \Google\Protobuf\Internal\Message +{ + /** + * The times during the day to start a backup. The start times are assumed + * to be in UTC and to be an exact hour (e.g., 04:00:00). + * If no start times are provided, a single fixed start time is chosen + * arbitrarily. + * + * Generated from protobuf field repeated .google.type.TimeOfDay start_times = 1; + */ + private $start_times; + /** + * The days of the week to perform a backup. + * If this field is left empty, the default of every day of the week is + * used. + * + * Generated from protobuf field repeated .google.type.DayOfWeek days_of_week = 2; + */ + private $days_of_week; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Type\TimeOfDay>|\Google\Protobuf\Internal\RepeatedField $start_times + * The times during the day to start a backup. The start times are assumed + * to be in UTC and to be an exact hour (e.g., 04:00:00). + * If no start times are provided, a single fixed start time is chosen + * arbitrarily. + * @type array|\Google\Protobuf\Internal\RepeatedField $days_of_week + * The days of the week to perform a backup. + * If this field is left empty, the default of every day of the week is + * used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The times during the day to start a backup. The start times are assumed + * to be in UTC and to be an exact hour (e.g., 04:00:00). + * If no start times are provided, a single fixed start time is chosen + * arbitrarily. + * + * Generated from protobuf field repeated .google.type.TimeOfDay start_times = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStartTimes() + { + return $this->start_times; + } + + /** + * The times during the day to start a backup. The start times are assumed + * to be in UTC and to be an exact hour (e.g., 04:00:00). + * If no start times are provided, a single fixed start time is chosen + * arbitrarily. + * + * Generated from protobuf field repeated .google.type.TimeOfDay start_times = 1; + * @param array<\Google\Type\TimeOfDay>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStartTimes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Type\TimeOfDay::class); + $this->start_times = $arr; + + return $this; + } + + /** + * The days of the week to perform a backup. + * If this field is left empty, the default of every day of the week is + * used. + * + * Generated from protobuf field repeated .google.type.DayOfWeek days_of_week = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDaysOfWeek() + { + return $this->days_of_week; + } + + /** + * The days of the week to perform a backup. + * If this field is left empty, the default of every day of the week is + * used. + * + * Generated from protobuf field repeated .google.type.DayOfWeek days_of_week = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDaysOfWeek($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Type\DayOfWeek::class); + $this->days_of_week = $arr; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1/Backup.php b/AlloyDb/src/V1/Backup.php new file mode 100644 index 000000000000..58a51a2e6d84 --- /dev/null +++ b/AlloyDb/src/V1/Backup.php @@ -0,0 +1,823 @@ +google.cloud.alloydb.v1.Backup + */ +class Backup extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * where the cluster and backup ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the backup resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * User-settable and human-readable display name for the Backup. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. Create time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $delete_time = null; + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 6; + */ + private $labels; + /** + * Output only. The current state of the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Backup.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * The backup type, which suggests the trigger for the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Backup.Type type = 8; + */ + protected $type = 0; + /** + * User-provided description of the backup. + * + * Generated from protobuf field string description = 9; + */ + protected $description = ''; + /** + * Output only. The system-generated UID of the cluster which was used to + * create this resource. + * + * Generated from protobuf field string cluster_uid = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $cluster_uid = ''; + /** + * Required. The full resource name of the backup source cluster + * (e.g., projects//locations//clusters/). + * + * Generated from protobuf field string cluster_name = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $cluster_name = ''; + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation), if + * true, indicates that the service is actively updating the resource. This + * can happen due to user-triggered updates or system actions like failover or + * maintenance. + * + * Generated from protobuf field bool reconciling = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reconciling = false; + /** + * Optional. The encryption config can be specified to encrypt the + * backup with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1.EncryptionConfig encryption_config = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $encryption_config = null; + /** + * Output only. The encryption information for the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1.EncryptionInfo encryption_info = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $encryption_info = null; + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 14; + */ + protected $etag = ''; + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 16; + */ + private $annotations; + /** + * Output only. The size of the backup in bytes. + * + * Generated from protobuf field int64 size_bytes = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $size_bytes = 0; + /** + * Output only. The time at which after the backup is eligible to be garbage + * collected. It is the duration specified by the backup's retention policy, + * added to the backup's create_time. + * + * Generated from protobuf field .google.protobuf.Timestamp expiry_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $expiry_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * where the cluster and backup ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the backup resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region} + * @type string $display_name + * User-settable and human-readable display name for the Backup. + * @type string $uid + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Create time stamp + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Update time stamp + * @type \Google\Protobuf\Timestamp $delete_time + * Output only. Delete time stamp + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels as key value pairs + * @type int $state + * Output only. The current state of the backup. + * @type int $type + * The backup type, which suggests the trigger for the backup. + * @type string $description + * User-provided description of the backup. + * @type string $cluster_uid + * Output only. The system-generated UID of the cluster which was used to + * create this resource. + * @type string $cluster_name + * Required. The full resource name of the backup source cluster + * (e.g., projects//locations//clusters/). + * @type bool $reconciling + * Output only. Reconciling (https://google.aip.dev/128#reconciliation), if + * true, indicates that the service is actively updating the resource. This + * can happen due to user-triggered updates or system actions like failover or + * maintenance. + * @type \Google\Cloud\AlloyDb\V1\EncryptionConfig $encryption_config + * Optional. The encryption config can be specified to encrypt the + * backup with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * @type \Google\Cloud\AlloyDb\V1\EncryptionInfo $encryption_info + * Output only. The encryption information for the backup. + * @type string $etag + * For Resource freshness validation (https://google.aip.dev/154) + * @type array|\Google\Protobuf\Internal\MapField $annotations + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * @type int|string $size_bytes + * Output only. The size of the backup in bytes. + * @type \Google\Protobuf\Timestamp $expiry_time + * Output only. The time at which after the backup is eligible to be garbage + * collected. It is the duration specified by the backup's retention policy, + * added to the backup's create_time. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * where the cluster and backup ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the backup resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region} + * + * 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 backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * where the cluster and backup ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the backup resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region} + * + * 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; + } + + /** + * User-settable and human-readable display name for the Backup. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * User-settable and human-readable display name for the Backup. + * + * 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. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. Create time stamp + * + * 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. Create time stamp + * + * 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. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getDeleteTime() + { + return $this->delete_time; + } + + public function hasDeleteTime() + { + return isset($this->delete_time); + } + + public function clearDeleteTime() + { + unset($this->delete_time); + } + + /** + * Output only. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setDeleteTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->delete_time = $var; + + return $this; + } + + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 6; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 6; + * @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 current state of the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Backup.State state = 7 [(.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.cloud.alloydb.v1.Backup.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1\Backup\State::class); + $this->state = $var; + + return $this; + } + + /** + * The backup type, which suggests the trigger for the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Backup.Type type = 8; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The backup type, which suggests the trigger for the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Backup.Type type = 8; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1\Backup\Type::class); + $this->type = $var; + + return $this; + } + + /** + * User-provided description of the backup. + * + * Generated from protobuf field string description = 9; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User-provided description of the backup. + * + * Generated from protobuf field string description = 9; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. The system-generated UID of the cluster which was used to + * create this resource. + * + * Generated from protobuf field string cluster_uid = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getClusterUid() + { + return $this->cluster_uid; + } + + /** + * Output only. The system-generated UID of the cluster which was used to + * create this resource. + * + * Generated from protobuf field string cluster_uid = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setClusterUid($var) + { + GPBUtil::checkString($var, True); + $this->cluster_uid = $var; + + return $this; + } + + /** + * Required. The full resource name of the backup source cluster + * (e.g., projects//locations//clusters/). + * + * Generated from protobuf field string cluster_name = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getClusterName() + { + return $this->cluster_name; + } + + /** + * Required. The full resource name of the backup source cluster + * (e.g., projects//locations//clusters/). + * + * Generated from protobuf field string cluster_name = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setClusterName($var) + { + GPBUtil::checkString($var, True); + $this->cluster_name = $var; + + return $this; + } + + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation), if + * true, indicates that the service is actively updating the resource. This + * can happen due to user-triggered updates or system actions like failover or + * maintenance. + * + * Generated from protobuf field bool reconciling = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getReconciling() + { + return $this->reconciling; + } + + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation), if + * true, indicates that the service is actively updating the resource. This + * can happen due to user-triggered updates or system actions like failover or + * maintenance. + * + * Generated from protobuf field bool reconciling = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setReconciling($var) + { + GPBUtil::checkBool($var); + $this->reconciling = $var; + + return $this; + } + + /** + * Optional. The encryption config can be specified to encrypt the + * backup with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1.EncryptionConfig encryption_config = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\AlloyDb\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 config can be specified to encrypt the + * backup with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1.EncryptionConfig encryption_config = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\AlloyDb\V1\EncryptionConfig $var + * @return $this + */ + public function setEncryptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\EncryptionConfig::class); + $this->encryption_config = $var; + + return $this; + } + + /** + * Output only. The encryption information for the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1.EncryptionInfo encryption_info = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\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.cloud.alloydb.v1.EncryptionInfo encryption_info = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1\EncryptionInfo $var + * @return $this + */ + public function setEncryptionInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\EncryptionInfo::class); + $this->encryption_info = $var; + + return $this; + } + + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 14; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 14; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 16; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 16; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + + /** + * Output only. The size of the backup in bytes. + * + * Generated from protobuf field int64 size_bytes = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getSizeBytes() + { + return $this->size_bytes; + } + + /** + * Output only. The size of the backup in bytes. + * + * Generated from protobuf field int64 size_bytes = 17 [(.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 time at which after the backup is eligible to be garbage + * collected. It is the duration specified by the backup's retention policy, + * added to the backup's create_time. + * + * Generated from protobuf field .google.protobuf.Timestamp expiry_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExpiryTime() + { + return $this->expiry_time; + } + + public function hasExpiryTime() + { + return isset($this->expiry_time); + } + + public function clearExpiryTime() + { + unset($this->expiry_time); + } + + /** + * Output only. The time at which after the backup is eligible to be garbage + * collected. It is the duration specified by the backup's retention policy, + * added to the backup's create_time. + * + * Generated from protobuf field .google.protobuf.Timestamp expiry_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExpiryTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->expiry_time = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/Backup/State.php b/AlloyDb/src/V1/Backup/State.php new file mode 100644 index 000000000000..5e37812f9476 --- /dev/null +++ b/AlloyDb/src/V1/Backup/State.php @@ -0,0 +1,76 @@ +google.cloud.alloydb.v1.Backup.State + */ +class State +{ + /** + * The state of the backup is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The backup is ready. + * + * Generated from protobuf enum READY = 1; + */ + const READY = 1; + /** + * The backup is creating. + * + * Generated from protobuf enum CREATING = 2; + */ + const CREATING = 2; + /** + * The backup failed. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * The backup is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::READY => 'READY', + self::CREATING => 'CREATING', + self::FAILED => 'FAILED', + self::DELETING => 'DELETING', + ]; + + 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/AlloyDb/src/V1/Backup/Type.php b/AlloyDb/src/V1/Backup/Type.php new file mode 100644 index 000000000000..e0970eac03de --- /dev/null +++ b/AlloyDb/src/V1/Backup/Type.php @@ -0,0 +1,72 @@ +google.cloud.alloydb.v1.Backup.Type + */ +class Type +{ + /** + * Backup Type is unknown. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * ON_DEMAND backups that were triggered by the customer (e.g., not + * AUTOMATED). + * + * Generated from protobuf enum ON_DEMAND = 1; + */ + const ON_DEMAND = 1; + /** + * AUTOMATED backups triggered by the automated backups scheduler pursuant + * to an automated backup policy. + * + * Generated from protobuf enum AUTOMATED = 2; + */ + const AUTOMATED = 2; + /** + * CONTINUOUS backups triggered by the automated backups scheduler + * due to a continuous backup policy. + * + * Generated from protobuf enum CONTINUOUS = 3; + */ + const CONTINUOUS = 3; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::ON_DEMAND => 'ON_DEMAND', + self::AUTOMATED => 'AUTOMATED', + self::CONTINUOUS => 'CONTINUOUS', + ]; + + 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/AlloyDb/src/V1/BackupSource.php b/AlloyDb/src/V1/BackupSource.php new file mode 100644 index 000000000000..1f06b4e463de --- /dev/null +++ b/AlloyDb/src/V1/BackupSource.php @@ -0,0 +1,113 @@ +google.cloud.alloydb.v1.BackupSource + */ +class BackupSource extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The system-generated UID of the backup which was used to + * create this resource. The UID is generated when the backup is created, and + * it is retained until the backup is deleted. + * + * Generated from protobuf field string backup_uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $backup_uid = ''; + /** + * Required. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * + * Generated from protobuf field string backup_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $backup_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $backup_uid + * Output only. The system-generated UID of the backup which was used to + * create this resource. The UID is generated when the backup is created, and + * it is retained until the backup is deleted. + * @type string $backup_name + * Required. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The system-generated UID of the backup which was used to + * create this resource. The UID is generated when the backup is created, and + * it is retained until the backup is deleted. + * + * Generated from protobuf field string backup_uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getBackupUid() + { + return $this->backup_uid; + } + + /** + * Output only. The system-generated UID of the backup which was used to + * create this resource. The UID is generated when the backup is created, and + * it is retained until the backup is deleted. + * + * Generated from protobuf field string backup_uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setBackupUid($var) + { + GPBUtil::checkString($var, True); + $this->backup_uid = $var; + + return $this; + } + + /** + * Required. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * + * Generated from protobuf field string backup_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getBackupName() + { + return $this->backup_name; + } + + /** + * Required. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * + * Generated from protobuf field string backup_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setBackupName($var) + { + GPBUtil::checkString($var, True); + $this->backup_name = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/BatchCreateInstanceStatus.php b/AlloyDb/src/V1/BatchCreateInstanceStatus.php new file mode 100644 index 000000000000..efd28ffbc66b --- /dev/null +++ b/AlloyDb/src/V1/BatchCreateInstanceStatus.php @@ -0,0 +1,221 @@ +google.cloud.alloydb.v1.BatchCreateInstanceStatus + */ +class BatchCreateInstanceStatus extends \Google\Protobuf\Internal\Message +{ + /** + * The current state of an instance involved in the batch create operation. + * Once the operation is complete, the final state of the instances in the + * LRO can be one of: + * 1. ACTIVE, indicating that instances were created successfully + * 2. FAILED, indicating that a particular instance failed creation + * 3. ROLLED_BACK indicating that although the instance was created + * successfully, it had to be rolled back and deleted due to failure in + * other steps of the workflow. + * + * Generated from protobuf field .google.cloud.alloydb.v1.BatchCreateInstanceStatus.State state = 1; + */ + protected $state = 0; + /** + * DEPRECATED - Use the error field instead. + * Error, if any error occurred and is available, during instance creation. + * + * Generated from protobuf field string error_msg = 2; + */ + protected $error_msg = ''; + /** + * The RPC status of the instance creation operation. This field will be + * present if an error happened during the instance creation. + * + * Generated from protobuf field .google.rpc.Status error = 4; + */ + protected $error = null; + /** + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.InstanceType type = 3; + */ + protected $type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * The current state of an instance involved in the batch create operation. + * Once the operation is complete, the final state of the instances in the + * LRO can be one of: + * 1. ACTIVE, indicating that instances were created successfully + * 2. FAILED, indicating that a particular instance failed creation + * 3. ROLLED_BACK indicating that although the instance was created + * successfully, it had to be rolled back and deleted due to failure in + * other steps of the workflow. + * @type string $error_msg + * DEPRECATED - Use the error field instead. + * Error, if any error occurred and is available, during instance creation. + * @type \Google\Rpc\Status $error + * The RPC status of the instance creation operation. This field will be + * present if an error happened during the instance creation. + * @type int $type + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * The current state of an instance involved in the batch create operation. + * Once the operation is complete, the final state of the instances in the + * LRO can be one of: + * 1. ACTIVE, indicating that instances were created successfully + * 2. FAILED, indicating that a particular instance failed creation + * 3. ROLLED_BACK indicating that although the instance was created + * successfully, it had to be rolled back and deleted due to failure in + * other steps of the workflow. + * + * Generated from protobuf field .google.cloud.alloydb.v1.BatchCreateInstanceStatus.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The current state of an instance involved in the batch create operation. + * Once the operation is complete, the final state of the instances in the + * LRO can be one of: + * 1. ACTIVE, indicating that instances were created successfully + * 2. FAILED, indicating that a particular instance failed creation + * 3. ROLLED_BACK indicating that although the instance was created + * successfully, it had to be rolled back and deleted due to failure in + * other steps of the workflow. + * + * Generated from protobuf field .google.cloud.alloydb.v1.BatchCreateInstanceStatus.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1\BatchCreateInstanceStatus\State::class); + $this->state = $var; + + return $this; + } + + /** + * DEPRECATED - Use the error field instead. + * Error, if any error occurred and is available, during instance creation. + * + * Generated from protobuf field string error_msg = 2; + * @return string + */ + public function getErrorMsg() + { + return $this->error_msg; + } + + /** + * DEPRECATED - Use the error field instead. + * Error, if any error occurred and is available, during instance creation. + * + * Generated from protobuf field string error_msg = 2; + * @param string $var + * @return $this + */ + public function setErrorMsg($var) + { + GPBUtil::checkString($var, True); + $this->error_msg = $var; + + return $this; + } + + /** + * The RPC status of the instance creation operation. This field will be + * present if an error happened during the instance creation. + * + * Generated from protobuf field .google.rpc.Status error = 4; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * The RPC status of the instance creation operation. This field will be + * present if an error happened during the instance creation. + * + * Generated from protobuf field .google.rpc.Status error = 4; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.InstanceType type = 3; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.InstanceType type = 3; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1\Instance\InstanceType::class); + $this->type = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/BatchCreateInstanceStatus/State.php b/AlloyDb/src/V1/BatchCreateInstanceStatus/State.php new file mode 100644 index 000000000000..1197165ad623 --- /dev/null +++ b/AlloyDb/src/V1/BatchCreateInstanceStatus/State.php @@ -0,0 +1,95 @@ +google.cloud.alloydb.v1.BatchCreateInstanceStatus.State + */ +class State +{ + /** + * The state of the instance is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Instance is pending creation and has not yet been picked up for + * processsing in the backend. + * + * Generated from protobuf enum PENDING_CREATE = 1; + */ + const PENDING_CREATE = 1; + /** + * The instance is active and running. + * + * Generated from protobuf enum READY = 2; + */ + const READY = 2; + /** + * The instance is being created. + * + * Generated from protobuf enum CREATING = 3; + */ + const CREATING = 3; + /** + * The instance is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + /** + * The creation of the instance failed or a fatal error occurred during + * an operation on the instance or a batch of instances. + * + * Generated from protobuf enum FAILED = 5; + */ + const FAILED = 5; + /** + * The instance was created successfully, but was rolled back and deleted + * due to some other failure during BatchCreateInstances operation. + * + * Generated from protobuf enum ROLLED_BACK = 6; + */ + const ROLLED_BACK = 6; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::PENDING_CREATE => 'PENDING_CREATE', + self::READY => 'READY', + self::CREATING => 'CREATING', + self::DELETING => 'DELETING', + self::FAILED => 'FAILED', + self::ROLLED_BACK => 'ROLLED_BACK', + ]; + + 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/AlloyDb/src/V1/BatchCreateInstancesMetadata.php b/AlloyDb/src/V1/BatchCreateInstancesMetadata.php new file mode 100644 index 000000000000..d2ca5c24c14a --- /dev/null +++ b/AlloyDb/src/V1/BatchCreateInstancesMetadata.php @@ -0,0 +1,133 @@ +google.cloud.alloydb.v1.BatchCreateInstancesMetadata + */ +class BatchCreateInstancesMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The instances being created in the API call. Each string in this list + * is the server defined resource path for target instances in the request + * and for the format of each string, see the comment on the Instance.name + * field. + * + * Generated from protobuf field repeated string instance_targets = 1; + */ + private $instance_targets; + /** + * A map representing state of the instances involved in the + * BatchCreateInstances operation during the operation execution. + * The instance state will be in STATE_UNSPECIFIED state if the instance has + * not yet been picked up for processing. + * The key of the map is the name of the instance resource. + * For the format, see the comment on the Instance.name field. + * + * Generated from protobuf field map instance_statuses = 2; + */ + private $instance_statuses; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $instance_targets + * The instances being created in the API call. Each string in this list + * is the server defined resource path for target instances in the request + * and for the format of each string, see the comment on the Instance.name + * field. + * @type array|\Google\Protobuf\Internal\MapField $instance_statuses + * A map representing state of the instances involved in the + * BatchCreateInstances operation during the operation execution. + * The instance state will be in STATE_UNSPECIFIED state if the instance has + * not yet been picked up for processing. + * The key of the map is the name of the instance resource. + * For the format, see the comment on the Instance.name field. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * The instances being created in the API call. Each string in this list + * is the server defined resource path for target instances in the request + * and for the format of each string, see the comment on the Instance.name + * field. + * + * Generated from protobuf field repeated string instance_targets = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInstanceTargets() + { + return $this->instance_targets; + } + + /** + * The instances being created in the API call. Each string in this list + * is the server defined resource path for target instances in the request + * and for the format of each string, see the comment on the Instance.name + * field. + * + * Generated from protobuf field repeated string instance_targets = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInstanceTargets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->instance_targets = $arr; + + return $this; + } + + /** + * A map representing state of the instances involved in the + * BatchCreateInstances operation during the operation execution. + * The instance state will be in STATE_UNSPECIFIED state if the instance has + * not yet been picked up for processing. + * The key of the map is the name of the instance resource. + * For the format, see the comment on the Instance.name field. + * + * Generated from protobuf field map instance_statuses = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getInstanceStatuses() + { + return $this->instance_statuses; + } + + /** + * A map representing state of the instances involved in the + * BatchCreateInstances operation during the operation execution. + * The instance state will be in STATE_UNSPECIFIED state if the instance has + * not yet been picked up for processing. + * The key of the map is the name of the instance resource. + * For the format, see the comment on the Instance.name field. + * + * Generated from protobuf field map instance_statuses = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setInstanceStatuses($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1\BatchCreateInstanceStatus::class); + $this->instance_statuses = $arr; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/BatchCreateInstancesRequest.php b/AlloyDb/src/V1/BatchCreateInstancesRequest.php new file mode 100644 index 000000000000..5be73ca95737 --- /dev/null +++ b/AlloyDb/src/V1/BatchCreateInstancesRequest.php @@ -0,0 +1,185 @@ +google.cloud.alloydb.v1.BatchCreateInstancesRequest + */ +class BatchCreateInstancesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Resources being created. + * + * Generated from protobuf field .google.cloud.alloydb.v1.CreateInstanceRequests requests = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $requests = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. + * @type \Google\Cloud\AlloyDb\V1\CreateInstanceRequests $requests + * Required. Resources being created. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. + * + * 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 parent resource. + * + * 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. Resources being created. + * + * Generated from protobuf field .google.cloud.alloydb.v1.CreateInstanceRequests requests = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1\CreateInstanceRequests|null + */ + public function getRequests() + { + return $this->requests; + } + + public function hasRequests() + { + return isset($this->requests); + } + + public function clearRequests() + { + unset($this->requests); + } + + /** + * Required. Resources being created. + * + * Generated from protobuf field .google.cloud.alloydb.v1.CreateInstanceRequests requests = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1\CreateInstanceRequests $var + * @return $this + */ + public function setRequests($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\CreateInstanceRequests::class); + $this->requests = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/BatchCreateInstancesResponse.php b/AlloyDb/src/V1/BatchCreateInstancesResponse.php new file mode 100644 index 000000000000..92bd1e0d95be --- /dev/null +++ b/AlloyDb/src/V1/BatchCreateInstancesResponse.php @@ -0,0 +1,67 @@ +google.cloud.alloydb.v1.BatchCreateInstancesResponse + */ +class BatchCreateInstancesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Created instances. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.Instance instances = 1; + */ + private $instances; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\AlloyDb\V1\Instance>|\Google\Protobuf\Internal\RepeatedField $instances + * Created instances. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Created instances. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.Instance instances = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInstances() + { + return $this->instances; + } + + /** + * Created instances. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.Instance instances = 1; + * @param array<\Google\Cloud\AlloyDb\V1\Instance>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInstances($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1\Instance::class); + $this->instances = $arr; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/Cluster.php b/AlloyDb/src/V1/Cluster.php new file mode 100644 index 000000000000..f7a7f07cf07a --- /dev/null +++ b/AlloyDb/src/V1/Cluster.php @@ -0,0 +1,1048 @@ +google.cloud.alloydb.v1.Cluster + */ +class Cluster extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the cluster resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * where the cluster ID segment should satisfy the regex expression + * `[a-z0-9-]+`. For more details see https://google.aip.dev/122. + * The prefix of the cluster resource name is the name of the parent resource: + * * projects/{project}/locations/{region} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * User-settable and human-readable display name for the Cluster. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. Create time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $delete_time = null; + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 7; + */ + private $labels; + /** + * Output only. The current serving state of the cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The type of the cluster. This is an output-only field and it's + * populated at the Cluster creation time or the Cluster promotion + * time. The cluster type is determined by which RPC was used to create + * the cluster (i.e. `CreateCluster` vs. `CreateSecondaryCluster` + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster.ClusterType cluster_type = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $cluster_type = 0; + /** + * Output only. The database engine major version. This is an output-only + * field and it's populated at the Cluster creation time. This field cannot be + * changed after cluster creation. + * + * Generated from protobuf field .google.cloud.alloydb.v1.DatabaseVersion database_version = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $database_version = 0; + /** + * Required. The resource link for the VPC network in which cluster resources + * are created and from which they are accessible via Private IP. The network + * must belong to the same project as the cluster. It is specified in the + * form: "projects/{project_number}/global/networks/{network_id}". This is + * required to create a cluster. It can be updated, but it cannot be removed. + * + * Generated from protobuf field string network = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $network = ''; + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 11; + */ + protected $etag = ''; + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 12; + */ + private $annotations; + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Cluster does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * + * Generated from protobuf field bool reconciling = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reconciling = false; + /** + * Input only. Initial user to setup during cluster creation. Required. + * If used in `RestoreCluster` this is ignored. + * + * Generated from protobuf field .google.cloud.alloydb.v1.UserPassword initial_user = 14 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $initial_user = null; + /** + * The automated backup policy for this cluster. + * If no policy is provided then the default policy will be used. If backups + * are supported for the cluster, the default policy takes one backup a day, + * has a backup window of 1 hour, and retains backups for 14 days. + * For more information on the defaults, consult the + * documentation for the message type. + * + * Generated from protobuf field .google.cloud.alloydb.v1.AutomatedBackupPolicy automated_backup_policy = 17; + */ + protected $automated_backup_policy = null; + /** + * SSL configuration for this AlloyDB Cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1.SslConfig ssl_config = 18; + */ + protected $ssl_config = null; + /** + * Optional. The encryption config can be specified to encrypt the data disks + * and other persistent data resources of a cluster with a + * customer-managed encryption key (CMEK). When this field is not + * specified, the cluster will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1.EncryptionConfig encryption_config = 19 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $encryption_config = null; + /** + * Output only. The encryption information for the cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1.EncryptionInfo encryption_info = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $encryption_info = null; + /** + * Cross Region replication config specific to SECONDARY cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster.SecondaryConfig secondary_config = 22; + */ + protected $secondary_config = null; + /** + * Output only. Cross Region replication config specific to PRIMARY cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster.PrimaryConfig primary_config = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $primary_config = null; + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AlloyDb\V1\BackupSource $backup_source + * Output only. Cluster created from backup. + * @type \Google\Cloud\AlloyDb\V1\MigrationSource $migration_source + * Output only. Cluster created via DMS migration. + * @type string $name + * Output only. The name of the cluster resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * where the cluster ID segment should satisfy the regex expression + * `[a-z0-9-]+`. For more details see https://google.aip.dev/122. + * The prefix of the cluster resource name is the name of the parent resource: + * * projects/{project}/locations/{region} + * @type string $display_name + * User-settable and human-readable display name for the Cluster. + * @type string $uid + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Create time stamp + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Update time stamp + * @type \Google\Protobuf\Timestamp $delete_time + * Output only. Delete time stamp + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels as key value pairs + * @type int $state + * Output only. The current serving state of the cluster. + * @type int $cluster_type + * Output only. The type of the cluster. This is an output-only field and it's + * populated at the Cluster creation time or the Cluster promotion + * time. The cluster type is determined by which RPC was used to create + * the cluster (i.e. `CreateCluster` vs. `CreateSecondaryCluster` + * @type int $database_version + * Output only. The database engine major version. This is an output-only + * field and it's populated at the Cluster creation time. This field cannot be + * changed after cluster creation. + * @type string $network + * Required. The resource link for the VPC network in which cluster resources + * are created and from which they are accessible via Private IP. The network + * must belong to the same project as the cluster. It is specified in the + * form: "projects/{project_number}/global/networks/{network_id}". This is + * required to create a cluster. It can be updated, but it cannot be removed. + * @type string $etag + * For Resource freshness validation (https://google.aip.dev/154) + * @type array|\Google\Protobuf\Internal\MapField $annotations + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * @type bool $reconciling + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Cluster does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * @type \Google\Cloud\AlloyDb\V1\UserPassword $initial_user + * Input only. Initial user to setup during cluster creation. Required. + * If used in `RestoreCluster` this is ignored. + * @type \Google\Cloud\AlloyDb\V1\AutomatedBackupPolicy $automated_backup_policy + * The automated backup policy for this cluster. + * If no policy is provided then the default policy will be used. If backups + * are supported for the cluster, the default policy takes one backup a day, + * has a backup window of 1 hour, and retains backups for 14 days. + * For more information on the defaults, consult the + * documentation for the message type. + * @type \Google\Cloud\AlloyDb\V1\SslConfig $ssl_config + * SSL configuration for this AlloyDB Cluster. + * @type \Google\Cloud\AlloyDb\V1\EncryptionConfig $encryption_config + * Optional. The encryption config can be specified to encrypt the data disks + * and other persistent data resources of a cluster with a + * customer-managed encryption key (CMEK). When this field is not + * specified, the cluster will then use default encryption scheme to + * protect the user data. + * @type \Google\Cloud\AlloyDb\V1\EncryptionInfo $encryption_info + * Output only. The encryption information for the cluster. + * @type \Google\Cloud\AlloyDb\V1\Cluster\SecondaryConfig $secondary_config + * Cross Region replication config specific to SECONDARY cluster. + * @type \Google\Cloud\AlloyDb\V1\Cluster\PrimaryConfig $primary_config + * Output only. Cross Region replication config specific to PRIMARY cluster. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Cluster created from backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1.BackupSource backup_source = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1\BackupSource|null + */ + public function getBackupSource() + { + return $this->readOneof(15); + } + + public function hasBackupSource() + { + return $this->hasOneof(15); + } + + /** + * Output only. Cluster created from backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1.BackupSource backup_source = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1\BackupSource $var + * @return $this + */ + public function setBackupSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\BackupSource::class); + $this->writeOneof(15, $var); + + return $this; + } + + /** + * Output only. Cluster created via DMS migration. + * + * Generated from protobuf field .google.cloud.alloydb.v1.MigrationSource migration_source = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1\MigrationSource|null + */ + public function getMigrationSource() + { + return $this->readOneof(16); + } + + public function hasMigrationSource() + { + return $this->hasOneof(16); + } + + /** + * Output only. Cluster created via DMS migration. + * + * Generated from protobuf field .google.cloud.alloydb.v1.MigrationSource migration_source = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1\MigrationSource $var + * @return $this + */ + public function setMigrationSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\MigrationSource::class); + $this->writeOneof(16, $var); + + return $this; + } + + /** + * Output only. The name of the cluster resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * where the cluster ID segment should satisfy the regex expression + * `[a-z0-9-]+`. For more details see https://google.aip.dev/122. + * The prefix of the cluster resource name is the name of the parent resource: + * * projects/{project}/locations/{region} + * + * 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 cluster resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * where the cluster ID segment should satisfy the regex expression + * `[a-z0-9-]+`. For more details see https://google.aip.dev/122. + * The prefix of the cluster resource name is the name of the parent resource: + * * projects/{project}/locations/{region} + * + * 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; + } + + /** + * User-settable and human-readable display name for the Cluster. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * User-settable and human-readable display name for the Cluster. + * + * 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. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. Create time stamp + * + * 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. Create time stamp + * + * 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. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getDeleteTime() + { + return $this->delete_time; + } + + public function hasDeleteTime() + { + return isset($this->delete_time); + } + + public function clearDeleteTime() + { + unset($this->delete_time); + } + + /** + * Output only. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setDeleteTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->delete_time = $var; + + return $this; + } + + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 7; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels as key value pairs + * + * 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; + } + + /** + * Output only. The current serving state of the cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current serving state of the cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1\Cluster\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The type of the cluster. This is an output-only field and it's + * populated at the Cluster creation time or the Cluster promotion + * time. The cluster type is determined by which RPC was used to create + * the cluster (i.e. `CreateCluster` vs. `CreateSecondaryCluster` + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster.ClusterType cluster_type = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getClusterType() + { + return $this->cluster_type; + } + + /** + * Output only. The type of the cluster. This is an output-only field and it's + * populated at the Cluster creation time or the Cluster promotion + * time. The cluster type is determined by which RPC was used to create + * the cluster (i.e. `CreateCluster` vs. `CreateSecondaryCluster` + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster.ClusterType cluster_type = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setClusterType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1\Cluster\ClusterType::class); + $this->cluster_type = $var; + + return $this; + } + + /** + * Output only. The database engine major version. This is an output-only + * field and it's populated at the Cluster creation time. This field cannot be + * changed after cluster creation. + * + * Generated from protobuf field .google.cloud.alloydb.v1.DatabaseVersion database_version = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getDatabaseVersion() + { + return $this->database_version; + } + + /** + * Output only. The database engine major version. This is an output-only + * field and it's populated at the Cluster creation time. This field cannot be + * changed after cluster creation. + * + * Generated from protobuf field .google.cloud.alloydb.v1.DatabaseVersion database_version = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setDatabaseVersion($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1\DatabaseVersion::class); + $this->database_version = $var; + + return $this; + } + + /** + * Required. The resource link for the VPC network in which cluster resources + * are created and from which they are accessible via Private IP. The network + * must belong to the same project as the cluster. It is specified in the + * form: "projects/{project_number}/global/networks/{network_id}". This is + * required to create a cluster. It can be updated, but it cannot be removed. + * + * Generated from protobuf field string network = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getNetwork() + { + return $this->network; + } + + /** + * Required. The resource link for the VPC network in which cluster resources + * are created and from which they are accessible via Private IP. The network + * must belong to the same project as the cluster. It is specified in the + * form: "projects/{project_number}/global/networks/{network_id}". This is + * required to create a cluster. It can be updated, but it cannot be removed. + * + * Generated from protobuf field string network = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setNetwork($var) + { + GPBUtil::checkString($var, True); + $this->network = $var; + + return $this; + } + + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 11; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 11; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 12; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 12; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Cluster does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * + * Generated from protobuf field bool reconciling = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getReconciling() + { + return $this->reconciling; + } + + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Cluster does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * + * Generated from protobuf field bool reconciling = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setReconciling($var) + { + GPBUtil::checkBool($var); + $this->reconciling = $var; + + return $this; + } + + /** + * Input only. Initial user to setup during cluster creation. Required. + * If used in `RestoreCluster` this is ignored. + * + * Generated from protobuf field .google.cloud.alloydb.v1.UserPassword initial_user = 14 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1\UserPassword|null + */ + public function getInitialUser() + { + return $this->initial_user; + } + + public function hasInitialUser() + { + return isset($this->initial_user); + } + + public function clearInitialUser() + { + unset($this->initial_user); + } + + /** + * Input only. Initial user to setup during cluster creation. Required. + * If used in `RestoreCluster` this is ignored. + * + * Generated from protobuf field .google.cloud.alloydb.v1.UserPassword initial_user = 14 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1\UserPassword $var + * @return $this + */ + public function setInitialUser($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\UserPassword::class); + $this->initial_user = $var; + + return $this; + } + + /** + * The automated backup policy for this cluster. + * If no policy is provided then the default policy will be used. If backups + * are supported for the cluster, the default policy takes one backup a day, + * has a backup window of 1 hour, and retains backups for 14 days. + * For more information on the defaults, consult the + * documentation for the message type. + * + * Generated from protobuf field .google.cloud.alloydb.v1.AutomatedBackupPolicy automated_backup_policy = 17; + * @return \Google\Cloud\AlloyDb\V1\AutomatedBackupPolicy|null + */ + public function getAutomatedBackupPolicy() + { + return $this->automated_backup_policy; + } + + public function hasAutomatedBackupPolicy() + { + return isset($this->automated_backup_policy); + } + + public function clearAutomatedBackupPolicy() + { + unset($this->automated_backup_policy); + } + + /** + * The automated backup policy for this cluster. + * If no policy is provided then the default policy will be used. If backups + * are supported for the cluster, the default policy takes one backup a day, + * has a backup window of 1 hour, and retains backups for 14 days. + * For more information on the defaults, consult the + * documentation for the message type. + * + * Generated from protobuf field .google.cloud.alloydb.v1.AutomatedBackupPolicy automated_backup_policy = 17; + * @param \Google\Cloud\AlloyDb\V1\AutomatedBackupPolicy $var + * @return $this + */ + public function setAutomatedBackupPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\AutomatedBackupPolicy::class); + $this->automated_backup_policy = $var; + + return $this; + } + + /** + * SSL configuration for this AlloyDB Cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1.SslConfig ssl_config = 18; + * @return \Google\Cloud\AlloyDb\V1\SslConfig|null + */ + public function getSslConfig() + { + return $this->ssl_config; + } + + public function hasSslConfig() + { + return isset($this->ssl_config); + } + + public function clearSslConfig() + { + unset($this->ssl_config); + } + + /** + * SSL configuration for this AlloyDB Cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1.SslConfig ssl_config = 18; + * @param \Google\Cloud\AlloyDb\V1\SslConfig $var + * @return $this + */ + public function setSslConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\SslConfig::class); + $this->ssl_config = $var; + + return $this; + } + + /** + * Optional. The encryption config can be specified to encrypt the data disks + * and other persistent data resources of a cluster with a + * customer-managed encryption key (CMEK). When this field is not + * specified, the cluster will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1.EncryptionConfig encryption_config = 19 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\AlloyDb\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 config can be specified to encrypt the data disks + * and other persistent data resources of a cluster with a + * customer-managed encryption key (CMEK). When this field is not + * specified, the cluster will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1.EncryptionConfig encryption_config = 19 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\AlloyDb\V1\EncryptionConfig $var + * @return $this + */ + public function setEncryptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\EncryptionConfig::class); + $this->encryption_config = $var; + + return $this; + } + + /** + * Output only. The encryption information for the cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1.EncryptionInfo encryption_info = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\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 cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1.EncryptionInfo encryption_info = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1\EncryptionInfo $var + * @return $this + */ + public function setEncryptionInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\EncryptionInfo::class); + $this->encryption_info = $var; + + return $this; + } + + /** + * Cross Region replication config specific to SECONDARY cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster.SecondaryConfig secondary_config = 22; + * @return \Google\Cloud\AlloyDb\V1\Cluster\SecondaryConfig|null + */ + public function getSecondaryConfig() + { + return $this->secondary_config; + } + + public function hasSecondaryConfig() + { + return isset($this->secondary_config); + } + + public function clearSecondaryConfig() + { + unset($this->secondary_config); + } + + /** + * Cross Region replication config specific to SECONDARY cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster.SecondaryConfig secondary_config = 22; + * @param \Google\Cloud\AlloyDb\V1\Cluster\SecondaryConfig $var + * @return $this + */ + public function setSecondaryConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\Cluster\SecondaryConfig::class); + $this->secondary_config = $var; + + return $this; + } + + /** + * Output only. Cross Region replication config specific to PRIMARY cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster.PrimaryConfig primary_config = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1\Cluster\PrimaryConfig|null + */ + public function getPrimaryConfig() + { + return $this->primary_config; + } + + public function hasPrimaryConfig() + { + return isset($this->primary_config); + } + + public function clearPrimaryConfig() + { + unset($this->primary_config); + } + + /** + * Output only. Cross Region replication config specific to PRIMARY cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster.PrimaryConfig primary_config = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1\Cluster\PrimaryConfig $var + * @return $this + */ + public function setPrimaryConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\Cluster\PrimaryConfig::class); + $this->primary_config = $var; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/AlloyDb/src/V1/Cluster/ClusterType.php b/AlloyDb/src/V1/Cluster/ClusterType.php new file mode 100644 index 000000000000..956cff0ef2c9 --- /dev/null +++ b/AlloyDb/src/V1/Cluster/ClusterType.php @@ -0,0 +1,63 @@ +google.cloud.alloydb.v1.Cluster.ClusterType + */ +class ClusterType +{ + /** + * The type of the cluster is unknown. + * + * Generated from protobuf enum CLUSTER_TYPE_UNSPECIFIED = 0; + */ + const CLUSTER_TYPE_UNSPECIFIED = 0; + /** + * Primary cluster that support read and write operations. + * + * Generated from protobuf enum PRIMARY = 1; + */ + const PRIMARY = 1; + /** + * Secondary cluster that is replicating from another region. + * This only supports read. + * + * Generated from protobuf enum SECONDARY = 2; + */ + const SECONDARY = 2; + + private static $valueToName = [ + self::CLUSTER_TYPE_UNSPECIFIED => 'CLUSTER_TYPE_UNSPECIFIED', + self::PRIMARY => 'PRIMARY', + self::SECONDARY => 'SECONDARY', + ]; + + 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/AlloyDb/src/V1/Cluster/PrimaryConfig.php b/AlloyDb/src/V1/Cluster/PrimaryConfig.php new file mode 100644 index 000000000000..3642cbd03753 --- /dev/null +++ b/AlloyDb/src/V1/Cluster/PrimaryConfig.php @@ -0,0 +1,74 @@ +google.cloud.alloydb.v1.Cluster.PrimaryConfig + */ +class PrimaryConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Names of the clusters that are replicating from this + * cluster. + * + * Generated from protobuf field repeated string secondary_cluster_names = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $secondary_cluster_names; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $secondary_cluster_names + * Output only. Names of the clusters that are replicating from this + * cluster. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Names of the clusters that are replicating from this + * cluster. + * + * Generated from protobuf field repeated string secondary_cluster_names = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSecondaryClusterNames() + { + return $this->secondary_cluster_names; + } + + /** + * Output only. Names of the clusters that are replicating from this + * cluster. + * + * Generated from protobuf field repeated string secondary_cluster_names = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSecondaryClusterNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->secondary_cluster_names = $arr; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1/Cluster/SecondaryConfig.php b/AlloyDb/src/V1/Cluster/SecondaryConfig.php new file mode 100644 index 000000000000..5df2b3870cdf --- /dev/null +++ b/AlloyDb/src/V1/Cluster/SecondaryConfig.php @@ -0,0 +1,73 @@ +google.cloud.alloydb.v1.Cluster.SecondaryConfig + */ +class SecondaryConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the primary cluster name with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * + * Generated from protobuf field string primary_cluster_name = 1; + */ + protected $primary_cluster_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $primary_cluster_name + * The name of the primary cluster name with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The name of the primary cluster name with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * + * Generated from protobuf field string primary_cluster_name = 1; + * @return string + */ + public function getPrimaryClusterName() + { + return $this->primary_cluster_name; + } + + /** + * The name of the primary cluster name with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * + * Generated from protobuf field string primary_cluster_name = 1; + * @param string $var + * @return $this + */ + public function setPrimaryClusterName($var) + { + GPBUtil::checkString($var, True); + $this->primary_cluster_name = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1/Cluster/State.php b/AlloyDb/src/V1/Cluster/State.php new file mode 100644 index 000000000000..02c45b8c3432 --- /dev/null +++ b/AlloyDb/src/V1/Cluster/State.php @@ -0,0 +1,123 @@ +google.cloud.alloydb.v1.Cluster.State + */ +class State +{ + /** + * The state of the cluster is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The cluster is active and running. + * + * Generated from protobuf enum READY = 1; + */ + const READY = 1; + /** + * The cluster is stopped. All instances in the cluster are stopped. + * Customers can start a stopped cluster at any point and all their + * instances will come back to life with same names and IP resources. In + * this state, customer pays for storage. + * Associated backups could also be present in a stopped cluster. + * + * Generated from protobuf enum STOPPED = 2; + */ + const STOPPED = 2; + /** + * The cluster is empty and has no associated resources. + * All instances, associated storage and backups have been deleted. + * + * Generated from protobuf enum EMPTY = 3; + */ + const PBEMPTY = 3; + /** + * The cluster is being created. + * + * Generated from protobuf enum CREATING = 4; + */ + const CREATING = 4; + /** + * The cluster is being deleted. + * + * Generated from protobuf enum DELETING = 5; + */ + const DELETING = 5; + /** + * The creation of the cluster failed. + * + * Generated from protobuf enum FAILED = 6; + */ + const FAILED = 6; + /** + * The cluster is bootstrapping with data from some other source. + * Direct mutations to the cluster (e.g. adding read pool) are not allowed. + * + * Generated from protobuf enum BOOTSTRAPPING = 7; + */ + const BOOTSTRAPPING = 7; + /** + * The cluster is under maintenance. AlloyDB regularly performs maintenance + * and upgrades on customer clusters. Updates on the cluster are + * not allowed while the cluster is in this state. + * + * Generated from protobuf enum MAINTENANCE = 8; + */ + const MAINTENANCE = 8; + /** + * The cluster is being promoted. + * + * Generated from protobuf enum PROMOTING = 9; + */ + const PROMOTING = 9; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::READY => 'READY', + self::STOPPED => 'STOPPED', + self::PBEMPTY => 'EMPTY', + self::CREATING => 'CREATING', + self::DELETING => 'DELETING', + self::FAILED => 'FAILED', + self::BOOTSTRAPPING => 'BOOTSTRAPPING', + self::MAINTENANCE => 'MAINTENANCE', + self::PROMOTING => 'PROMOTING', + ]; + + 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/AlloyDb/src/V1/CreateBackupRequest.php b/AlloyDb/src/V1/CreateBackupRequest.php new file mode 100644 index 000000000000..c54d0e3de26f --- /dev/null +++ b/AlloyDb/src/V1/CreateBackupRequest.php @@ -0,0 +1,257 @@ +google.cloud.alloydb.v1.CreateBackupRequest + */ +class CreateBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Value for parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. ID of the requesting object. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup_id = ''; + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Value for parent. + * @type string $backup_id + * Required. ID of the requesting object. + * @type \Google\Cloud\AlloyDb\V1\Backup $backup + * Required. The resource being created + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Value for parent. + * + * 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. Value for parent. + * + * 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. ID of the requesting object. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getBackupId() + { + return $this->backup_id; + } + + /** + * Required. ID of the requesting object. + * + * 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 resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1\Backup|null + */ + public function getBackup() + { + return $this->backup; + } + + public function hasBackup() + { + return isset($this->backup); + } + + public function clearBackup() + { + unset($this->backup); + } + + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1\Backup $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\Backup::class); + $this->backup = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/CreateClusterRequest.php b/AlloyDb/src/V1/CreateClusterRequest.php new file mode 100644 index 000000000000..11e398afda20 --- /dev/null +++ b/AlloyDb/src/V1/CreateClusterRequest.php @@ -0,0 +1,265 @@ +google.cloud.alloydb.v1.CreateClusterRequest + */ +class CreateClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. ID of the requesting object. + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster_id = ''; + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * @type string $cluster_id + * Required. ID of the requesting object. + * @type \Google\Cloud\AlloyDb\V1\Cluster $cluster + * Required. The resource being created + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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 parent resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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. ID of the requesting object. + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getClusterId() + { + return $this->cluster_id; + } + + /** + * Required. ID of the requesting object. + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setClusterId($var) + { + GPBUtil::checkString($var, True); + $this->cluster_id = $var; + + return $this; + } + + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1\Cluster|null + */ + public function getCluster() + { + return $this->cluster; + } + + public function hasCluster() + { + return isset($this->cluster); + } + + public function clearCluster() + { + unset($this->cluster); + } + + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1\Cluster $var + * @return $this + */ + public function setCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\Cluster::class); + $this->cluster = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/CreateInstanceRequest.php b/AlloyDb/src/V1/CreateInstanceRequest.php new file mode 100644 index 000000000000..41a58f41a583 --- /dev/null +++ b/AlloyDb/src/V1/CreateInstanceRequest.php @@ -0,0 +1,265 @@ +google.cloud.alloydb.v1.CreateInstanceRequest + */ +class CreateInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. ID of the requesting object. + * + * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance_id = ''; + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * @type string $instance_id + * Required. ID of the requesting object. + * @type \Google\Cloud\AlloyDb\V1\Instance $instance + * Required. The resource being created + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * + * 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 parent resource. For the required format, see the + * comment on the Instance.name field. + * + * 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. ID of the requesting object. + * + * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getInstanceId() + { + return $this->instance_id; + } + + /** + * Required. ID of the requesting object. + * + * 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 resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1\Instance|null + */ + public function getInstance() + { + return $this->instance; + } + + public function hasInstance() + { + return isset($this->instance); + } + + public function clearInstance() + { + unset($this->instance); + } + + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1\Instance $var + * @return $this + */ + public function setInstance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\Instance::class); + $this->instance = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/CreateInstanceRequests.php b/AlloyDb/src/V1/CreateInstanceRequests.php new file mode 100644 index 000000000000..e98a40af9368 --- /dev/null +++ b/AlloyDb/src/V1/CreateInstanceRequests.php @@ -0,0 +1,71 @@ +google.cloud.alloydb.v1.CreateInstanceRequests + */ +class CreateInstanceRequests extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Primary and read replica instances to be created. This list + * should not be empty. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.CreateInstanceRequest create_instance_requests = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $create_instance_requests; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\AlloyDb\V1\CreateInstanceRequest>|\Google\Protobuf\Internal\RepeatedField $create_instance_requests + * Required. Primary and read replica instances to be created. This list + * should not be empty. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Primary and read replica instances to be created. This list + * should not be empty. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.CreateInstanceRequest create_instance_requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCreateInstanceRequests() + { + return $this->create_instance_requests; + } + + /** + * Required. Primary and read replica instances to be created. This list + * should not be empty. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.CreateInstanceRequest create_instance_requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\AlloyDb\V1\CreateInstanceRequest>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCreateInstanceRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1\CreateInstanceRequest::class); + $this->create_instance_requests = $arr; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/DatabaseVersion.php b/AlloyDb/src/V1/DatabaseVersion.php new file mode 100644 index 000000000000..43b351f9d5d9 --- /dev/null +++ b/AlloyDb/src/V1/DatabaseVersion.php @@ -0,0 +1,61 @@ +google.cloud.alloydb.v1.DatabaseVersion + */ +class DatabaseVersion +{ + /** + * This is an unknown database version. + * + * Generated from protobuf enum DATABASE_VERSION_UNSPECIFIED = 0; + */ + const DATABASE_VERSION_UNSPECIFIED = 0; + /** + * DEPRECATED - The database version is Postgres 13. + * + * Generated from protobuf enum POSTGRES_13 = 1 [deprecated = true]; + */ + const POSTGRES_13 = 1; + /** + * The database version is Postgres 14. + * + * Generated from protobuf enum POSTGRES_14 = 2; + */ + const POSTGRES_14 = 2; + + private static $valueToName = [ + self::DATABASE_VERSION_UNSPECIFIED => 'DATABASE_VERSION_UNSPECIFIED', + self::POSTGRES_13 => 'POSTGRES_13', + self::POSTGRES_14 => 'POSTGRES_14', + ]; + + 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/AlloyDb/src/V1/DeleteBackupRequest.php b/AlloyDb/src/V1/DeleteBackupRequest.php new file mode 100644 index 000000000000..5d68de037be2 --- /dev/null +++ b/AlloyDb/src/V1/DeleteBackupRequest.php @@ -0,0 +1,225 @@ +google.cloud.alloydb.v1.DeleteBackupRequest + */ +class DeleteBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the resource. For the required format, see the comment on + * the Backup.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + /** + * Optional. The current etag of the Backup. + * If an etag is provided and does not match the current etag of the Backup, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $etag = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the resource. For the required format, see the comment on + * the Backup.name field. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * @type string $etag + * Optional. The current etag of the Backup. + * If an etag is provided and does not match the current etag of the Backup, + * deletion will be blocked and an ABORTED error will be returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the resource. For the required format, see the comment on + * the Backup.name field. + * + * 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 resource. For the required format, see the comment on + * the Backup.name field. + * + * 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. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Optional. The current etag of the Backup. + * If an etag is provided and does not match the current etag of the Backup, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. The current etag of the Backup. + * If an etag is provided and does not match the current etag of the Backup, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/DeleteClusterRequest.php b/AlloyDb/src/V1/DeleteClusterRequest.php new file mode 100644 index 000000000000..d19885259d98 --- /dev/null +++ b/AlloyDb/src/V1/DeleteClusterRequest.php @@ -0,0 +1,259 @@ +google.cloud.alloydb.v1.DeleteClusterRequest + */ +class DeleteClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $etag = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + /** + * Optional. Whether to cascade delete child instances for given cluster. + * + * Generated from protobuf field bool force = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $force = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $etag + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * @type bool $force + * Optional. Whether to cascade delete child instances for given cluster. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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 resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Optional. Whether to cascade delete child instances for given cluster. + * + * Generated from protobuf field bool force = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * Optional. Whether to cascade delete child instances for given cluster. + * + * Generated from protobuf field bool force = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/DeleteInstanceRequest.php b/AlloyDb/src/V1/DeleteInstanceRequest.php new file mode 100644 index 000000000000..ae509f56ebc4 --- /dev/null +++ b/AlloyDb/src/V1/DeleteInstanceRequest.php @@ -0,0 +1,225 @@ +google.cloud.alloydb.v1.DeleteInstanceRequest + */ +class DeleteInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. The current etag of the Instance. + * If an etag is provided and does not match the current etag of the Instance, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $etag = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $etag + * Optional. The current etag of the Instance. + * If an etag is provided and does not match the current etag of the Instance, + * deletion will be blocked and an ABORTED error will be returned. + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * 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 resource. For the required format, see the + * comment on the Instance.name field. + * + * 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. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. The current etag of the Instance. + * If an etag is provided and does not match the current etag of the Instance, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. The current etag of the Instance. + * If an etag is provided and does not match the current etag of the Instance, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/EncryptionConfig.php b/AlloyDb/src/V1/EncryptionConfig.php new file mode 100644 index 000000000000..20ebb1d0926b --- /dev/null +++ b/AlloyDb/src/V1/EncryptionConfig.php @@ -0,0 +1,76 @@ +google.cloud.alloydb.v1.EncryptionConfig + */ +class EncryptionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The fully-qualified resource name of the KMS key. + * Each Cloud KMS key is regionalized and has the following format: + * projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME] + * + * Generated from protobuf field string kms_key_name = 1; + */ + protected $kms_key_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $kms_key_name + * The fully-qualified resource name of the KMS key. + * Each Cloud KMS key is regionalized and has the following format: + * projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The fully-qualified resource name of the KMS key. + * Each Cloud KMS key is regionalized and has the following format: + * projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME] + * + * Generated from protobuf field string kms_key_name = 1; + * @return string + */ + public function getKmsKeyName() + { + return $this->kms_key_name; + } + + /** + * The fully-qualified resource name of the KMS key. + * Each Cloud KMS key is regionalized and has the following format: + * projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME] + * + * Generated from protobuf field string kms_key_name = 1; + * @param string $var + * @return $this + */ + public function setKmsKeyName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_name = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/EncryptionInfo.php b/AlloyDb/src/V1/EncryptionInfo.php new file mode 100644 index 000000000000..c37bade4f198 --- /dev/null +++ b/AlloyDb/src/V1/EncryptionInfo.php @@ -0,0 +1,105 @@ +google.cloud.alloydb.v1.EncryptionInfo + */ +class EncryptionInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Type of encryption. + * + * Generated from protobuf field .google.cloud.alloydb.v1.EncryptionInfo.Type encryption_type = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $encryption_type = 0; + /** + * Output only. Cloud KMS key versions that are being used to protect the + * database or the backup. + * + * Generated from protobuf field repeated string kms_key_versions = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + private $kms_key_versions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $encryption_type + * Output only. Type of encryption. + * @type array|\Google\Protobuf\Internal\RepeatedField $kms_key_versions + * Output only. Cloud KMS key versions that are being used to protect the + * database or the backup. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Type of encryption. + * + * Generated from protobuf field .google.cloud.alloydb.v1.EncryptionInfo.Type encryption_type = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getEncryptionType() + { + return $this->encryption_type; + } + + /** + * Output only. Type of encryption. + * + * Generated from protobuf field .google.cloud.alloydb.v1.EncryptionInfo.Type encryption_type = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setEncryptionType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1\EncryptionInfo\Type::class); + $this->encryption_type = $var; + + return $this; + } + + /** + * Output only. Cloud KMS key versions that are being used to protect the + * database or the backup. + * + * Generated from protobuf field repeated string kms_key_versions = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getKmsKeyVersions() + { + return $this->kms_key_versions; + } + + /** + * Output only. Cloud KMS key versions that are being used to protect the + * database or the backup. + * + * Generated from protobuf field repeated string kms_key_versions = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setKmsKeyVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->kms_key_versions = $arr; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/EncryptionInfo/Type.php b/AlloyDb/src/V1/EncryptionInfo/Type.php new file mode 100644 index 000000000000..c58838c47e4f --- /dev/null +++ b/AlloyDb/src/V1/EncryptionInfo/Type.php @@ -0,0 +1,64 @@ +google.cloud.alloydb.v1.EncryptionInfo.Type + */ +class Type +{ + /** + * Encryption type not specified. Defaults to GOOGLE_DEFAULT_ENCRYPTION. + * + * 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 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. + * KMS key versions will 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); + } +} + + diff --git a/AlloyDb/src/V1/FailoverInstanceRequest.php b/AlloyDb/src/V1/FailoverInstanceRequest.php new file mode 100644 index 000000000000..d4a6a0c2f1c1 --- /dev/null +++ b/AlloyDb/src/V1/FailoverInstanceRequest.php @@ -0,0 +1,183 @@ +google.cloud.alloydb.v1.FailoverInstanceRequest + */ +class FailoverInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the failover. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the failover. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * 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 resource. For the required format, see the + * comment on the Instance.name field. + * + * 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. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the failover. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the failover. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/Gapic/AlloyDBAdminGapicClient.php b/AlloyDb/src/V1/Gapic/AlloyDBAdminGapicClient.php new file mode 100644 index 000000000000..5bec22d699fe --- /dev/null +++ b/AlloyDb/src/V1/Gapic/AlloyDBAdminGapicClient.php @@ -0,0 +1,2567 @@ +clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $requests = new CreateInstanceRequests(); + * $operationResponse = $alloyDBAdminClient->batchCreateInstances($formattedParent, $requests); + * $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 = $alloyDBAdminClient->batchCreateInstances($formattedParent, $requests); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'batchCreateInstances'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->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. + */ +class AlloyDBAdminGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.alloydb.v1.AlloyDBAdmin'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'alloydb.googleapis.com'; + + /** 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', + ]; + + private static $backupNameTemplate; + + private static $clusterNameTemplate; + + private static $instanceNameTemplate; + + private static $locationNameTemplate; + + private static $networkNameTemplate; + + 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/alloy_db_admin_client_config.json', + 'descriptorsConfigPath' => + __DIR__ . '/../resources/alloy_db_admin_descriptor_config.php', + 'gcpApiConfigPath' => + __DIR__ . '/../resources/alloy_db_admin_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => + __DIR__ . + '/../resources/alloy_db_admin_rest_client_config.php', + ], + ], + ]; + } + + private static function getBackupNameTemplate() + { + if (self::$backupNameTemplate == null) { + self::$backupNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}/backups/{backup}' + ); + } + + return self::$backupNameTemplate; + } + + private static function getClusterNameTemplate() + { + if (self::$clusterNameTemplate == null) { + self::$clusterNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}/clusters/{cluster}' + ); + } + + return self::$clusterNameTemplate; + } + + private static function getInstanceNameTemplate() + { + if (self::$instanceNameTemplate == null) { + self::$instanceNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance}' + ); + } + + return self::$instanceNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}' + ); + } + + return self::$locationNameTemplate; + } + + private static function getNetworkNameTemplate() + { + if (self::$networkNameTemplate == null) { + self::$networkNameTemplate = new PathTemplate( + 'projects/{project}/global/networks/{network}' + ); + } + + return self::$networkNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'backup' => self::getBackupNameTemplate(), + 'cluster' => self::getClusterNameTemplate(), + 'instance' => self::getInstanceNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'network' => self::getNetworkNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a backup + * resource. + * + * @param string $project + * @param string $location + * @param string $backup + * + * @return string The formatted backup resource. + */ + public static function backupName($project, $location, $backup) + { + return self::getBackupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'backup' => $backup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a cluster + * resource. + * + * @param string $project + * @param string $location + * @param string $cluster + * + * @return string The formatted cluster resource. + */ + public static function clusterName($project, $location, $cluster) + { + return self::getClusterNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'cluster' => $cluster, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a instance + * resource. + * + * @param string $project + * @param string $location + * @param string $cluster + * @param string $instance + * + * @return string The formatted instance resource. + */ + public static function instanceName( + $project, + $location, + $cluster, + $instance + ) { + return self::getInstanceNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'cluster' => $cluster, + 'instance' => $instance, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a network + * resource. + * + * @param string $project + * @param string $network + * + * @return string The formatted network resource. + */ + public static function networkName($project, $network) + { + return self::getNetworkNameTemplate()->render([ + 'project' => $project, + 'network' => $network, + ]); + } + + /** + * 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}/locations/{location}/backups/{backup} + * - cluster: projects/{project}/locations/{location}/clusters/{cluster} + * - instance: projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance} + * - location: projects/{project}/locations/{location} + * - network: projects/{project}/global/networks/{network} + * + * 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 'alloydb.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 new instances under the given project, location and cluster. + * There can be only one primary instance in a cluster. If the primary + * instance exists in the cluster as well as this request, then API will + * throw an error. + * The primary instance should exist before any read pool instance is + * created. If the primary instance is a part of the request payload, then + * the API will take care of creating instances in the correct order. + * This method is here to support Google-internal use cases, and is not meant + * for external customers to consume. Please do not start relying on it; its + * behavior is subject to change without notice. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $requests = new CreateInstanceRequests(); + * $operationResponse = $alloyDBAdminClient->batchCreateInstances($formattedParent, $requests); + * $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 = $alloyDBAdminClient->batchCreateInstances($formattedParent, $requests); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'batchCreateInstances'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. + * @param CreateInstanceRequests $requests Required. Resources being created. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 batchCreateInstances( + $parent, + $requests, + array $optionalArgs = [] + ) { + $request = new BatchCreateInstancesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setRequests($requests); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'BatchCreateInstances', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Creates a new Backup in a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->locationName('[PROJECT]', '[LOCATION]'); + * $backupId = 'backup_id'; + * $backup = new Backup(); + * $operationResponse = $alloyDBAdminClient->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 = $alloyDBAdminClient->createBackup($formattedParent, $backupId, $backup); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->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 { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. Value for parent. + * @param string $backupId Required. ID of the requesting object. + * @param Backup $backup Required. The resource being created + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'CreateBackup', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Creates a new Cluster in a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->locationName('[PROJECT]', '[LOCATION]'); + * $clusterId = 'cluster_id'; + * $cluster = new Cluster(); + * $operationResponse = $alloyDBAdminClient->createCluster($formattedParent, $clusterId, $cluster); + * $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 = $alloyDBAdminClient->createCluster($formattedParent, $clusterId, $cluster); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'createCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * @param string $clusterId Required. ID of the requesting object. + * @param Cluster $cluster Required. The resource being created + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * 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\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createCluster( + $parent, + $clusterId, + $cluster, + array $optionalArgs = [] + ) { + $request = new CreateClusterRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setClusterId($clusterId); + $request->setCluster($cluster); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'CreateCluster', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Creates a new Instance in a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $instanceId = 'instance_id'; + * $instance = new Instance(); + * $operationResponse = $alloyDBAdminClient->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 = $alloyDBAdminClient->createInstance($formattedParent, $instanceId, $instance); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->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 { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * @param string $instanceId Required. ID of the requesting object. + * @param Instance $instance Required. The resource being created + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * 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\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; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'CreateInstance', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Deletes a single Backup. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP]'); + * $operationResponse = $alloyDBAdminClient->deleteBackup($formattedName); + * $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 = $alloyDBAdminClient->deleteBackup($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'deleteBackup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the resource. For the required format, see the comment on + * the Backup.name field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * @type string $etag + * Optional. The current etag of the Backup. + * If an etag is provided and does not match the current etag of the Backup, + * deletion will be blocked and an ABORTED error will be 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\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteBackup($name, array $optionalArgs = []) + { + $request = new DeleteBackupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + 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->startOperationsCall( + 'DeleteBackup', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Deletes a single Cluster. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $operationResponse = $alloyDBAdminClient->deleteCluster($formattedName); + * $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 = $alloyDBAdminClient->deleteCluster($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'deleteCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $etag + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * @type bool $force + * Optional. Whether to cascade delete child instances for given cluster. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 deleteCluster($name, array $optionalArgs = []) + { + $request = new DeleteClusterRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['force'])) { + $request->setForce($optionalArgs['force']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'DeleteCluster', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Deletes a single Instance. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + * $operationResponse = $alloyDBAdminClient->deleteInstance($formattedName); + * $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 = $alloyDBAdminClient->deleteInstance($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'deleteInstance'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $etag + * Optional. The current etag of the Instance. + * If an etag is provided and does not match the current etag of the Instance, + * deletion will be blocked and an ABORTED error will be returned. + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 deleteInstance($name, array $optionalArgs = []) + { + $request = new DeleteInstanceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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->startOperationsCall( + 'DeleteInstance', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Forces a Failover for a highly available instance. + * Failover promotes the HA standby instance as the new primary. + * Imperative only. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + * $operationResponse = $alloyDBAdminClient->failoverInstance($formattedName); + * $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 = $alloyDBAdminClient->failoverInstance($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'failoverInstance'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the failover. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 failoverInstance($name, array $optionalArgs = []) + { + $request = new FailoverInstanceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'FailoverInstance', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Gets details of a single Backup. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP]'); + * $response = $alloyDBAdminClient->getBackup($formattedName); + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the resource + * @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\AlloyDb\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 details of a single Cluster. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $response = $alloyDBAdminClient->getCluster($formattedName); + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * @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\AlloyDb\V1\Cluster + * + * @throws ApiException if the remote call fails + */ + public function getCluster($name, array $optionalArgs = []) + { + $request = new GetClusterRequest(); + $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( + 'GetCluster', + Cluster::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Gets details of a single Instance. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + * $response = $alloyDBAdminClient->getInstance($formattedName); + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @param array $optionalArgs { + * Optional. + * + * @type int $view + * The view of the instance to return. + * For allowed values, use constants defined on {@see \Google\Cloud\AlloyDb\V1\InstanceView} + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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\AlloyDb\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['view'])) { + $request->setView($optionalArgs['view']); + } + + $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(); + } + + /** + * Lists Backups in a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $alloyDBAdminClient->listBackups($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $alloyDBAdminClient->listBackups($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. Parent value for ListBackupsRequest + * @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 + * Filtering results + * @type string $orderBy + * Hint for how to order the results + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $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 Clusters in a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $alloyDBAdminClient->listClusters($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $alloyDBAdminClient->listClusters($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with the following format: + * * projects/{project}/locations/- + * @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 + * Optional. Filtering results + * @type string $orderBy + * Optional. Hint for how to order the results + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 listClusters($parent, array $optionalArgs = []) + { + $request = new ListClustersRequest(); + $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['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( + 'ListClusters', + $optionalArgs, + ListClustersResponse::class, + $request + ); + } + + /** + * Lists Instances in a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * // Iterate over pages of elements + * $pagedResponse = $alloyDBAdminClient->listInstances($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $alloyDBAdminClient->listInstances($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with one of the following + * formats: + * * projects/{project}/locations/-/clusters/- + * * projects/{project}/locations/{region}/clusters/- + * @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 + * Optional. Filtering results + * @type string $orderBy + * Optional. Hint for how to order the results + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $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 + ); + } + + /** + * Lists SupportedDatabaseFlags for a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $alloyDBAdminClient->listSupportedDatabaseFlags($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $alloyDBAdminClient->listSupportedDatabaseFlags($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. The required format is: + * * projects/{project}/locations/{location} + * + * Regardless of the parent specified here, as long it is contains a valid + * project and location, the service will return a static list of supported + * flags resources. Note that we do not yet support region-specific + * flags. + * @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 listSupportedDatabaseFlags( + $parent, + array $optionalArgs = [] + ) { + $request = new ListSupportedDatabaseFlagsRequest(); + $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( + 'ListSupportedDatabaseFlags', + $optionalArgs, + ListSupportedDatabaseFlagsResponse::class, + $request + ); + } + + /** + * Restart an Instance in a cluster. + * Imperative only. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + * $operationResponse = $alloyDBAdminClient->restartInstance($formattedName); + * $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 = $alloyDBAdminClient->restartInstance($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'restartInstance'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the restart. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 restartInstance($name, array $optionalArgs = []) + { + $request = new RestartInstanceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'RestartInstance', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Creates a new Cluster in a given project and location, with a volume + * restored from the provided source, either a backup ID or a point-in-time + * and a source cluster. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->locationName('[PROJECT]', '[LOCATION]'); + * $clusterId = 'cluster_id'; + * $cluster = new Cluster(); + * $operationResponse = $alloyDBAdminClient->restoreCluster($formattedParent, $clusterId, $cluster); + * $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 = $alloyDBAdminClient->restoreCluster($formattedParent, $clusterId, $cluster); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'restoreCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * @param string $clusterId Required. ID of the requesting object. + * @param Cluster $cluster Required. The resource being created + * @param array $optionalArgs { + * Optional. + * + * @type BackupSource $backupSource + * Backup source. + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the import + * 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\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function restoreCluster( + $parent, + $clusterId, + $cluster, + array $optionalArgs = [] + ) { + $request = new RestoreClusterRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setClusterId($clusterId); + $request->setCluster($cluster); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['backupSource'])) { + $request->setBackupSource($optionalArgs['backupSource']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'RestoreCluster', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Updates the parameters of a single Backup. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $backup = new Backup(); + * $operationResponse = $alloyDBAdminClient->updateBackup($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 = $alloyDBAdminClient->updateBackup($backup); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'updateBackup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param Backup $backup Required. The resource being updated + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Backup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * @type bool $allowMissing + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new backup is created and `update_mask` is ignored. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 updateBackup($backup, array $optionalArgs = []) + { + $request = new UpdateBackupRequest(); + $requestParamHeaders = []; + $request->setBackup($backup); + $requestParamHeaders['backup.name'] = $backup->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'UpdateBackup', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Updates the parameters of a single Cluster. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $cluster = new Cluster(); + * $operationResponse = $alloyDBAdminClient->updateCluster($cluster); + * $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 = $alloyDBAdminClient->updateCluster($cluster); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'updateCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param Cluster $cluster Required. The resource being updated + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Cluster resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * @type bool $allowMissing + * Optional. If set to true, update succeeds even if cluster is not found. In + * that case, a new cluster is created and `update_mask` is ignored. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 updateCluster($cluster, array $optionalArgs = []) + { + $request = new UpdateClusterRequest(); + $requestParamHeaders = []; + $request->setCluster($cluster); + $requestParamHeaders['cluster.name'] = $cluster->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'UpdateCluster', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Updates the parameters of a single Instance. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $instance = new Instance(); + * $operationResponse = $alloyDBAdminClient->updateInstance($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 = $alloyDBAdminClient->updateInstance($instance); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->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 { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param Instance $instance Required. The resource being updated + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Instance resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * @type bool $allowMissing + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new instance is created and `update_mask` is ignored. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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, array $optionalArgs = []) + { + $request = new UpdateInstanceRequest(); + $requestParamHeaders = []; + $request->setInstance($instance); + $requestParamHeaders['instance.name'] = $instance->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + $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(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $response = $alloyDBAdminClient->getLocation(); + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'GetLocation', + Location::class, + $optionalArgs, + $request, + Call::UNARY_CALL, + 'google.cloud.location.Locations' + )->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $alloyDBAdminClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $alloyDBAdminClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @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 listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + 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( + 'ListLocations', + $optionalArgs, + ListLocationsResponse::class, + $request, + 'google.cloud.location.Locations' + ); + } +} diff --git a/AlloyDb/src/V1/GetBackupRequest.php b/AlloyDb/src/V1/GetBackupRequest.php new file mode 100644 index 000000000000..54b9fa972ac8 --- /dev/null +++ b/AlloyDb/src/V1/GetBackupRequest.php @@ -0,0 +1,67 @@ +google.cloud.alloydb.v1.GetBackupRequest + */ +class GetBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the resource + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the resource + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the resource + * + * 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 resource + * + * 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/AlloyDb/src/V1/GetClusterRequest.php b/AlloyDb/src/V1/GetClusterRequest.php new file mode 100644 index 000000000000..f55dd4640bc3 --- /dev/null +++ b/AlloyDb/src/V1/GetClusterRequest.php @@ -0,0 +1,71 @@ +google.cloud.alloydb.v1.GetClusterRequest + */ +class GetClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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 resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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/AlloyDb/src/V1/GetInstanceRequest.php b/AlloyDb/src/V1/GetInstanceRequest.php new file mode 100644 index 000000000000..afb189bacb8a --- /dev/null +++ b/AlloyDb/src/V1/GetInstanceRequest.php @@ -0,0 +1,105 @@ +google.cloud.alloydb.v1.GetInstanceRequest + */ +class GetInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The view of the instance to return. + * + * Generated from protobuf field .google.cloud.alloydb.v1.InstanceView view = 2; + */ + protected $view = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @type int $view + * The view of the instance to return. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * 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 resource. For the required format, see the + * comment on the Instance.name field. + * + * 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; + } + + /** + * The view of the instance to return. + * + * Generated from protobuf field .google.cloud.alloydb.v1.InstanceView view = 2; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * The view of the instance to return. + * + * Generated from protobuf field .google.cloud.alloydb.v1.InstanceView view = 2; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1\InstanceView::class); + $this->view = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/Instance.php b/AlloyDb/src/V1/Instance.php new file mode 100644 index 000000000000..a27e400092a8 --- /dev/null +++ b/AlloyDb/src/V1/Instance.php @@ -0,0 +1,966 @@ +google.cloud.alloydb.v1.Instance + */ +class Instance extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the instance resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id}/instances/{instance_id} + * where the cluster and instance ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the instance resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * User-settable and human-readable display name for the Instance. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. Create time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $delete_time = null; + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 7; + */ + private $labels; + /** + * Output only. The current serving state of the instance. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Required. The type of the instance. Specified at creation time. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.InstanceType instance_type = 9 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance_type = 0; + /** + * Configurations for the machines that host the underlying + * database engine. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.MachineConfig machine_config = 10; + */ + protected $machine_config = null; + /** + * Availability type of an Instance. + * Defaults to REGIONAL for both primary and read instances. + * Note that primary and read instances can have different availability types. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.AvailabilityType availability_type = 11; + */ + protected $availability_type = 0; + /** + * The Compute Engine zone that the instance should serve from, per + * https://cloud.google.com/compute/docs/regions-zones + * This can ONLY be specified for ZONAL instances. + * If present for a REGIONAL instance, an error will be thrown. + * If this is absent for a ZONAL instance, instance is created in a random + * zone with available capacity. + * + * Generated from protobuf field string gce_zone = 12; + */ + protected $gce_zone = ''; + /** + * Database flags. Set at instance level. + * * They are copied from primary instance on read instance creation. + * * Read instances can set new or override existing flags that are relevant + * for reads, e.g. for enabling columnar cache on a read instance. Flags + * set on read instance may or may not be present on primary. + * This is a list of "key": "value" pairs. + * "key": The name of the flag. These flags are passed at instance setup time, + * so include both server options and system variables for Postgres. Flags are + * specified with underscores, not hyphens. + * "value": The value of the flag. Booleans are set to **on** for true + * and **off** for false. This field must be omitted if the flag + * doesn't take a value. + * + * Generated from protobuf field map database_flags = 13; + */ + private $database_flags; + /** + * Output only. This is set for the read-write VM of the PRIMARY instance + * only. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.Node writable_node = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $writable_node = null; + /** + * Output only. List of available read-only VMs in this instance, including + * the standby for a PRIMARY instance. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.Instance.Node nodes = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $nodes; + /** + * Configuration for query insights. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.QueryInsightsInstanceConfig query_insights_config = 21; + */ + protected $query_insights_config = null; + /** + * Read pool specific config. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.ReadPoolConfig read_pool_config = 14; + */ + protected $read_pool_config = null; + /** + * Output only. The IP address for the Instance. + * This is the connection endpoint for an end-user application. + * + * Generated from protobuf field string ip_address = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $ip_address = ''; + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Instance does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * + * Generated from protobuf field bool reconciling = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reconciling = false; + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 17; + */ + protected $etag = ''; + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 18; + */ + private $annotations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The name of the instance resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id}/instances/{instance_id} + * where the cluster and instance ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the instance resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * @type string $display_name + * User-settable and human-readable display name for the Instance. + * @type string $uid + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Create time stamp + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Update time stamp + * @type \Google\Protobuf\Timestamp $delete_time + * Output only. Delete time stamp + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels as key value pairs + * @type int $state + * Output only. The current serving state of the instance. + * @type int $instance_type + * Required. The type of the instance. Specified at creation time. + * @type \Google\Cloud\AlloyDb\V1\Instance\MachineConfig $machine_config + * Configurations for the machines that host the underlying + * database engine. + * @type int $availability_type + * Availability type of an Instance. + * Defaults to REGIONAL for both primary and read instances. + * Note that primary and read instances can have different availability types. + * @type string $gce_zone + * The Compute Engine zone that the instance should serve from, per + * https://cloud.google.com/compute/docs/regions-zones + * This can ONLY be specified for ZONAL instances. + * If present for a REGIONAL instance, an error will be thrown. + * If this is absent for a ZONAL instance, instance is created in a random + * zone with available capacity. + * @type array|\Google\Protobuf\Internal\MapField $database_flags + * Database flags. Set at instance level. + * * They are copied from primary instance on read instance creation. + * * Read instances can set new or override existing flags that are relevant + * for reads, e.g. for enabling columnar cache on a read instance. Flags + * set on read instance may or may not be present on primary. + * This is a list of "key": "value" pairs. + * "key": The name of the flag. These flags are passed at instance setup time, + * so include both server options and system variables for Postgres. Flags are + * specified with underscores, not hyphens. + * "value": The value of the flag. Booleans are set to **on** for true + * and **off** for false. This field must be omitted if the flag + * doesn't take a value. + * @type \Google\Cloud\AlloyDb\V1\Instance\Node $writable_node + * Output only. This is set for the read-write VM of the PRIMARY instance + * only. + * @type array<\Google\Cloud\AlloyDb\V1\Instance\Node>|\Google\Protobuf\Internal\RepeatedField $nodes + * Output only. List of available read-only VMs in this instance, including + * the standby for a PRIMARY instance. + * @type \Google\Cloud\AlloyDb\V1\Instance\QueryInsightsInstanceConfig $query_insights_config + * Configuration for query insights. + * @type \Google\Cloud\AlloyDb\V1\Instance\ReadPoolConfig $read_pool_config + * Read pool specific config. + * @type string $ip_address + * Output only. The IP address for the Instance. + * This is the connection endpoint for an end-user application. + * @type bool $reconciling + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Instance does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * @type string $etag + * For Resource freshness validation (https://google.aip.dev/154) + * @type array|\Google\Protobuf\Internal\MapField $annotations + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the instance resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id}/instances/{instance_id} + * where the cluster and instance ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the instance resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * + * 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 instance resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id}/instances/{instance_id} + * where the cluster and instance ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the instance resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * + * 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; + } + + /** + * User-settable and human-readable display name for the Instance. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * User-settable and human-readable display name for the Instance. + * + * 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. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. Create time stamp + * + * 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. Create time stamp + * + * 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. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getDeleteTime() + { + return $this->delete_time; + } + + public function hasDeleteTime() + { + return isset($this->delete_time); + } + + public function clearDeleteTime() + { + unset($this->delete_time); + } + + /** + * Output only. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setDeleteTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->delete_time = $var; + + return $this; + } + + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 7; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels as key value pairs + * + * 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; + } + + /** + * Output only. The current serving state of the instance. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current serving state of the instance. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1\Instance\State::class); + $this->state = $var; + + return $this; + } + + /** + * Required. The type of the instance. Specified at creation time. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.InstanceType instance_type = 9 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getInstanceType() + { + return $this->instance_type; + } + + /** + * Required. The type of the instance. Specified at creation time. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.InstanceType instance_type = 9 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setInstanceType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1\Instance\InstanceType::class); + $this->instance_type = $var; + + return $this; + } + + /** + * Configurations for the machines that host the underlying + * database engine. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.MachineConfig machine_config = 10; + * @return \Google\Cloud\AlloyDb\V1\Instance\MachineConfig|null + */ + public function getMachineConfig() + { + return $this->machine_config; + } + + public function hasMachineConfig() + { + return isset($this->machine_config); + } + + public function clearMachineConfig() + { + unset($this->machine_config); + } + + /** + * Configurations for the machines that host the underlying + * database engine. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.MachineConfig machine_config = 10; + * @param \Google\Cloud\AlloyDb\V1\Instance\MachineConfig $var + * @return $this + */ + public function setMachineConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\Instance\MachineConfig::class); + $this->machine_config = $var; + + return $this; + } + + /** + * Availability type of an Instance. + * Defaults to REGIONAL for both primary and read instances. + * Note that primary and read instances can have different availability types. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.AvailabilityType availability_type = 11; + * @return int + */ + public function getAvailabilityType() + { + return $this->availability_type; + } + + /** + * Availability type of an Instance. + * Defaults to REGIONAL for both primary and read instances. + * Note that primary and read instances can have different availability types. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.AvailabilityType availability_type = 11; + * @param int $var + * @return $this + */ + public function setAvailabilityType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1\Instance\AvailabilityType::class); + $this->availability_type = $var; + + return $this; + } + + /** + * The Compute Engine zone that the instance should serve from, per + * https://cloud.google.com/compute/docs/regions-zones + * This can ONLY be specified for ZONAL instances. + * If present for a REGIONAL instance, an error will be thrown. + * If this is absent for a ZONAL instance, instance is created in a random + * zone with available capacity. + * + * Generated from protobuf field string gce_zone = 12; + * @return string + */ + public function getGceZone() + { + return $this->gce_zone; + } + + /** + * The Compute Engine zone that the instance should serve from, per + * https://cloud.google.com/compute/docs/regions-zones + * This can ONLY be specified for ZONAL instances. + * If present for a REGIONAL instance, an error will be thrown. + * If this is absent for a ZONAL instance, instance is created in a random + * zone with available capacity. + * + * Generated from protobuf field string gce_zone = 12; + * @param string $var + * @return $this + */ + public function setGceZone($var) + { + GPBUtil::checkString($var, True); + $this->gce_zone = $var; + + return $this; + } + + /** + * Database flags. Set at instance level. + * * They are copied from primary instance on read instance creation. + * * Read instances can set new or override existing flags that are relevant + * for reads, e.g. for enabling columnar cache on a read instance. Flags + * set on read instance may or may not be present on primary. + * This is a list of "key": "value" pairs. + * "key": The name of the flag. These flags are passed at instance setup time, + * so include both server options and system variables for Postgres. Flags are + * specified with underscores, not hyphens. + * "value": The value of the flag. Booleans are set to **on** for true + * and **off** for false. This field must be omitted if the flag + * doesn't take a value. + * + * Generated from protobuf field map database_flags = 13; + * @return \Google\Protobuf\Internal\MapField + */ + public function getDatabaseFlags() + { + return $this->database_flags; + } + + /** + * Database flags. Set at instance level. + * * They are copied from primary instance on read instance creation. + * * Read instances can set new or override existing flags that are relevant + * for reads, e.g. for enabling columnar cache on a read instance. Flags + * set on read instance may or may not be present on primary. + * This is a list of "key": "value" pairs. + * "key": The name of the flag. These flags are passed at instance setup time, + * so include both server options and system variables for Postgres. Flags are + * specified with underscores, not hyphens. + * "value": The value of the flag. Booleans are set to **on** for true + * and **off** for false. This field must be omitted if the flag + * doesn't take a value. + * + * Generated from protobuf field map database_flags = 13; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setDatabaseFlags($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->database_flags = $arr; + + return $this; + } + + /** + * Output only. This is set for the read-write VM of the PRIMARY instance + * only. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.Node writable_node = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1\Instance\Node|null + */ + public function getWritableNode() + { + return $this->writable_node; + } + + public function hasWritableNode() + { + return isset($this->writable_node); + } + + public function clearWritableNode() + { + unset($this->writable_node); + } + + /** + * Output only. This is set for the read-write VM of the PRIMARY instance + * only. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.Node writable_node = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1\Instance\Node $var + * @return $this + */ + public function setWritableNode($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\Instance\Node::class); + $this->writable_node = $var; + + return $this; + } + + /** + * Output only. List of available read-only VMs in this instance, including + * the standby for a PRIMARY instance. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.Instance.Node nodes = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNodes() + { + return $this->nodes; + } + + /** + * Output only. List of available read-only VMs in this instance, including + * the standby for a PRIMARY instance. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.Instance.Node nodes = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\AlloyDb\V1\Instance\Node>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNodes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1\Instance\Node::class); + $this->nodes = $arr; + + return $this; + } + + /** + * Configuration for query insights. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.QueryInsightsInstanceConfig query_insights_config = 21; + * @return \Google\Cloud\AlloyDb\V1\Instance\QueryInsightsInstanceConfig|null + */ + public function getQueryInsightsConfig() + { + return $this->query_insights_config; + } + + public function hasQueryInsightsConfig() + { + return isset($this->query_insights_config); + } + + public function clearQueryInsightsConfig() + { + unset($this->query_insights_config); + } + + /** + * Configuration for query insights. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.QueryInsightsInstanceConfig query_insights_config = 21; + * @param \Google\Cloud\AlloyDb\V1\Instance\QueryInsightsInstanceConfig $var + * @return $this + */ + public function setQueryInsightsConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\Instance\QueryInsightsInstanceConfig::class); + $this->query_insights_config = $var; + + return $this; + } + + /** + * Read pool specific config. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.ReadPoolConfig read_pool_config = 14; + * @return \Google\Cloud\AlloyDb\V1\Instance\ReadPoolConfig|null + */ + public function getReadPoolConfig() + { + return $this->read_pool_config; + } + + public function hasReadPoolConfig() + { + return isset($this->read_pool_config); + } + + public function clearReadPoolConfig() + { + unset($this->read_pool_config); + } + + /** + * Read pool specific config. + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance.ReadPoolConfig read_pool_config = 14; + * @param \Google\Cloud\AlloyDb\V1\Instance\ReadPoolConfig $var + * @return $this + */ + public function setReadPoolConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\Instance\ReadPoolConfig::class); + $this->read_pool_config = $var; + + return $this; + } + + /** + * Output only. The IP address for the Instance. + * This is the connection endpoint for an end-user application. + * + * Generated from protobuf field string ip_address = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getIpAddress() + { + return $this->ip_address; + } + + /** + * Output only. The IP address for the Instance. + * This is the connection endpoint for an end-user application. + * + * Generated from protobuf field string ip_address = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setIpAddress($var) + { + GPBUtil::checkString($var, True); + $this->ip_address = $var; + + return $this; + } + + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Instance does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * + * Generated from protobuf field bool reconciling = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getReconciling() + { + return $this->reconciling; + } + + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Instance does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * + * Generated from protobuf field bool reconciling = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setReconciling($var) + { + GPBUtil::checkBool($var); + $this->reconciling = $var; + + return $this; + } + + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 17; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 17; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 18; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 18; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/Instance/AvailabilityType.php b/AlloyDb/src/V1/Instance/AvailabilityType.php new file mode 100644 index 000000000000..5941dc7c2a81 --- /dev/null +++ b/AlloyDb/src/V1/Instance/AvailabilityType.php @@ -0,0 +1,66 @@ +ZONAL: The instance serves data from only one zone. + * Outages in that zone affect instance availability. + *
REGIONAL: The instance can serve data from more than one zone + * in a region (it is highly available). + * + * Protobuf type google.cloud.alloydb.v1.Instance.AvailabilityType + */ +class AvailabilityType +{ + /** + * This is an unknown Availability type. + * + * Generated from protobuf enum AVAILABILITY_TYPE_UNSPECIFIED = 0; + */ + const AVAILABILITY_TYPE_UNSPECIFIED = 0; + /** + * Zonal available instance. + * + * Generated from protobuf enum ZONAL = 1; + */ + const ZONAL = 1; + /** + * Regional (or Highly) available instance. + * + * Generated from protobuf enum REGIONAL = 2; + */ + const REGIONAL = 2; + + private static $valueToName = [ + self::AVAILABILITY_TYPE_UNSPECIFIED => 'AVAILABILITY_TYPE_UNSPECIFIED', + self::ZONAL => 'ZONAL', + self::REGIONAL => 'REGIONAL', + ]; + + 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/AlloyDb/src/V1/Instance/InstanceType.php b/AlloyDb/src/V1/Instance/InstanceType.php new file mode 100644 index 000000000000..def293cc079a --- /dev/null +++ b/AlloyDb/src/V1/Instance/InstanceType.php @@ -0,0 +1,74 @@ +google.cloud.alloydb.v1.Instance.InstanceType + */ +class InstanceType +{ + /** + * The type of the instance is unknown. + * + * Generated from protobuf enum INSTANCE_TYPE_UNSPECIFIED = 0; + */ + const INSTANCE_TYPE_UNSPECIFIED = 0; + /** + * PRIMARY instances support read and write operations. + * + * Generated from protobuf enum PRIMARY = 1; + */ + const PRIMARY = 1; + /** + * READ POOL instances support read operations only. Each read pool instance + * consists of one or more homogeneous nodes. + * * Read pool of size 1 can only have zonal availability. + * * Read pools with node count of 2 or more can have regional + * availability (nodes are present in 2 or more zones in a region). + * + * Generated from protobuf enum READ_POOL = 2; + */ + const READ_POOL = 2; + /** + * SECONDARY instances support read operations only. SECONDARY instance + * is a cross-region read replica + * + * Generated from protobuf enum SECONDARY = 3; + */ + const SECONDARY = 3; + + private static $valueToName = [ + self::INSTANCE_TYPE_UNSPECIFIED => 'INSTANCE_TYPE_UNSPECIFIED', + self::PRIMARY => 'PRIMARY', + self::READ_POOL => 'READ_POOL', + self::SECONDARY => 'SECONDARY', + ]; + + 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/AlloyDb/src/V1/Instance/MachineConfig.php b/AlloyDb/src/V1/Instance/MachineConfig.php new file mode 100644 index 000000000000..14ac4218acd1 --- /dev/null +++ b/AlloyDb/src/V1/Instance/MachineConfig.php @@ -0,0 +1,68 @@ +google.cloud.alloydb.v1.Instance.MachineConfig + */ +class MachineConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The number of CPU's in the VM instance. + * + * Generated from protobuf field int32 cpu_count = 1; + */ + protected $cpu_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $cpu_count + * The number of CPU's in the VM instance. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The number of CPU's in the VM instance. + * + * Generated from protobuf field int32 cpu_count = 1; + * @return int + */ + public function getCpuCount() + { + return $this->cpu_count; + } + + /** + * The number of CPU's in the VM instance. + * + * Generated from protobuf field int32 cpu_count = 1; + * @param int $var + * @return $this + */ + public function setCpuCount($var) + { + GPBUtil::checkInt32($var); + $this->cpu_count = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1/Instance/Node.php b/AlloyDb/src/V1/Instance/Node.php new file mode 100644 index 000000000000..d210ba51977d --- /dev/null +++ b/AlloyDb/src/V1/Instance/Node.php @@ -0,0 +1,184 @@ +google.cloud.alloydb.v1.Instance.Node + */ +class Node extends \Google\Protobuf\Internal\Message +{ + /** + * The Compute Engine zone of the VM e.g. "us-central1-b". + * + * Generated from protobuf field string zone_id = 1; + */ + protected $zone_id = ''; + /** + * The identifier of the VM e.g. "test-read-0601-407e52be-ms3l". + * + * Generated from protobuf field string id = 2; + */ + protected $id = ''; + /** + * The private IP address of the VM e.g. "10.57.0.34". + * + * Generated from protobuf field string ip = 3; + */ + protected $ip = ''; + /** + * Determined by state of the compute VM and postgres-service health. + * Compute VM state can have values listed in + * https://cloud.google.com/compute/docs/instances/instance-life-cycle and + * postgres-service health can have values: HEALTHY and UNHEALTHY. + * + * Generated from protobuf field string state = 4; + */ + protected $state = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $zone_id + * The Compute Engine zone of the VM e.g. "us-central1-b". + * @type string $id + * The identifier of the VM e.g. "test-read-0601-407e52be-ms3l". + * @type string $ip + * The private IP address of the VM e.g. "10.57.0.34". + * @type string $state + * Determined by state of the compute VM and postgres-service health. + * Compute VM state can have values listed in + * https://cloud.google.com/compute/docs/instances/instance-life-cycle and + * postgres-service health can have values: HEALTHY and UNHEALTHY. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The Compute Engine zone of the VM e.g. "us-central1-b". + * + * Generated from protobuf field string zone_id = 1; + * @return string + */ + public function getZoneId() + { + return $this->zone_id; + } + + /** + * The Compute Engine zone of the VM e.g. "us-central1-b". + * + * Generated from protobuf field string zone_id = 1; + * @param string $var + * @return $this + */ + public function setZoneId($var) + { + GPBUtil::checkString($var, True); + $this->zone_id = $var; + + return $this; + } + + /** + * The identifier of the VM e.g. "test-read-0601-407e52be-ms3l". + * + * Generated from protobuf field string id = 2; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * The identifier of the VM e.g. "test-read-0601-407e52be-ms3l". + * + * Generated from protobuf field string id = 2; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * The private IP address of the VM e.g. "10.57.0.34". + * + * Generated from protobuf field string ip = 3; + * @return string + */ + public function getIp() + { + return $this->ip; + } + + /** + * The private IP address of the VM e.g. "10.57.0.34". + * + * Generated from protobuf field string ip = 3; + * @param string $var + * @return $this + */ + public function setIp($var) + { + GPBUtil::checkString($var, True); + $this->ip = $var; + + return $this; + } + + /** + * Determined by state of the compute VM and postgres-service health. + * Compute VM state can have values listed in + * https://cloud.google.com/compute/docs/instances/instance-life-cycle and + * postgres-service health can have values: HEALTHY and UNHEALTHY. + * + * Generated from protobuf field string state = 4; + * @return string + */ + public function getState() + { + return $this->state; + } + + /** + * Determined by state of the compute VM and postgres-service health. + * Compute VM state can have values listed in + * https://cloud.google.com/compute/docs/instances/instance-life-cycle and + * postgres-service health can have values: HEALTHY and UNHEALTHY. + * + * Generated from protobuf field string state = 4; + * @param string $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkString($var, True); + $this->state = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1/Instance/QueryInsightsInstanceConfig.php b/AlloyDb/src/V1/Instance/QueryInsightsInstanceConfig.php new file mode 100644 index 000000000000..511b1fb899e2 --- /dev/null +++ b/AlloyDb/src/V1/Instance/QueryInsightsInstanceConfig.php @@ -0,0 +1,220 @@ +google.cloud.alloydb.v1.Instance.QueryInsightsInstanceConfig + */ +class QueryInsightsInstanceConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Record application tags for an instance. + * This flag is turned "on" by default. + * + * Generated from protobuf field optional bool record_application_tags = 2; + */ + protected $record_application_tags = null; + /** + * Record client address for an instance. Client address is PII information. + * This flag is turned "on" by default. + * + * Generated from protobuf field optional bool record_client_address = 3; + */ + protected $record_client_address = null; + /** + * Query string length. The default value is 1024. + * Any integer between 256 and 4500 is considered valid. + * + * Generated from protobuf field uint32 query_string_length = 4; + */ + protected $query_string_length = 0; + /** + * Number of query execution plans captured by Insights per minute + * for all queries combined. The default value is 5. + * Any integer between 0 and 20 is considered valid. + * + * Generated from protobuf field optional uint32 query_plans_per_minute = 5; + */ + protected $query_plans_per_minute = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $record_application_tags + * Record application tags for an instance. + * This flag is turned "on" by default. + * @type bool $record_client_address + * Record client address for an instance. Client address is PII information. + * This flag is turned "on" by default. + * @type int $query_string_length + * Query string length. The default value is 1024. + * Any integer between 256 and 4500 is considered valid. + * @type int $query_plans_per_minute + * Number of query execution plans captured by Insights per minute + * for all queries combined. The default value is 5. + * Any integer between 0 and 20 is considered valid. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Record application tags for an instance. + * This flag is turned "on" by default. + * + * Generated from protobuf field optional bool record_application_tags = 2; + * @return bool + */ + public function getRecordApplicationTags() + { + return isset($this->record_application_tags) ? $this->record_application_tags : false; + } + + public function hasRecordApplicationTags() + { + return isset($this->record_application_tags); + } + + public function clearRecordApplicationTags() + { + unset($this->record_application_tags); + } + + /** + * Record application tags for an instance. + * This flag is turned "on" by default. + * + * Generated from protobuf field optional bool record_application_tags = 2; + * @param bool $var + * @return $this + */ + public function setRecordApplicationTags($var) + { + GPBUtil::checkBool($var); + $this->record_application_tags = $var; + + return $this; + } + + /** + * Record client address for an instance. Client address is PII information. + * This flag is turned "on" by default. + * + * Generated from protobuf field optional bool record_client_address = 3; + * @return bool + */ + public function getRecordClientAddress() + { + return isset($this->record_client_address) ? $this->record_client_address : false; + } + + public function hasRecordClientAddress() + { + return isset($this->record_client_address); + } + + public function clearRecordClientAddress() + { + unset($this->record_client_address); + } + + /** + * Record client address for an instance. Client address is PII information. + * This flag is turned "on" by default. + * + * Generated from protobuf field optional bool record_client_address = 3; + * @param bool $var + * @return $this + */ + public function setRecordClientAddress($var) + { + GPBUtil::checkBool($var); + $this->record_client_address = $var; + + return $this; + } + + /** + * Query string length. The default value is 1024. + * Any integer between 256 and 4500 is considered valid. + * + * Generated from protobuf field uint32 query_string_length = 4; + * @return int + */ + public function getQueryStringLength() + { + return $this->query_string_length; + } + + /** + * Query string length. The default value is 1024. + * Any integer between 256 and 4500 is considered valid. + * + * Generated from protobuf field uint32 query_string_length = 4; + * @param int $var + * @return $this + */ + public function setQueryStringLength($var) + { + GPBUtil::checkUint32($var); + $this->query_string_length = $var; + + return $this; + } + + /** + * Number of query execution plans captured by Insights per minute + * for all queries combined. The default value is 5. + * Any integer between 0 and 20 is considered valid. + * + * Generated from protobuf field optional uint32 query_plans_per_minute = 5; + * @return int + */ + public function getQueryPlansPerMinute() + { + return isset($this->query_plans_per_minute) ? $this->query_plans_per_minute : 0; + } + + public function hasQueryPlansPerMinute() + { + return isset($this->query_plans_per_minute); + } + + public function clearQueryPlansPerMinute() + { + unset($this->query_plans_per_minute); + } + + /** + * Number of query execution plans captured by Insights per minute + * for all queries combined. The default value is 5. + * Any integer between 0 and 20 is considered valid. + * + * Generated from protobuf field optional uint32 query_plans_per_minute = 5; + * @param int $var + * @return $this + */ + public function setQueryPlansPerMinute($var) + { + GPBUtil::checkUint32($var); + $this->query_plans_per_minute = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1/Instance/ReadPoolConfig.php b/AlloyDb/src/V1/Instance/ReadPoolConfig.php new file mode 100644 index 000000000000..f8fb8c303816 --- /dev/null +++ b/AlloyDb/src/V1/Instance/ReadPoolConfig.php @@ -0,0 +1,68 @@ +google.cloud.alloydb.v1.Instance.ReadPoolConfig + */ +class ReadPoolConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Read capacity, i.e. number of nodes in a read pool instance. + * + * Generated from protobuf field int32 node_count = 1; + */ + protected $node_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $node_count + * Read capacity, i.e. number of nodes in a read pool instance. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Read capacity, i.e. number of nodes in a read pool instance. + * + * Generated from protobuf field int32 node_count = 1; + * @return int + */ + public function getNodeCount() + { + return $this->node_count; + } + + /** + * Read capacity, i.e. number of nodes in a read pool instance. + * + * Generated from protobuf field int32 node_count = 1; + * @param int $var + * @return $this + */ + public function setNodeCount($var) + { + GPBUtil::checkInt32($var); + $this->node_count = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1/Instance/State.php b/AlloyDb/src/V1/Instance/State.php new file mode 100644 index 000000000000..4b89e1d247f5 --- /dev/null +++ b/AlloyDb/src/V1/Instance/State.php @@ -0,0 +1,110 @@ +google.cloud.alloydb.v1.Instance.State + */ +class State +{ + /** + * The state of the instance is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The instance is active and running. + * + * Generated from protobuf enum READY = 1; + */ + const READY = 1; + /** + * The instance is stopped. Instance name and IP resources are preserved. + * + * Generated from protobuf enum STOPPED = 2; + */ + const STOPPED = 2; + /** + * The instance is being created. + * + * Generated from protobuf enum CREATING = 3; + */ + const CREATING = 3; + /** + * The instance is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + /** + * The instance is down for maintenance. + * + * Generated from protobuf enum MAINTENANCE = 5; + */ + const MAINTENANCE = 5; + /** + * The creation of the instance failed or a fatal error occurred during + * an operation on the instance. + * Note: Instances in this state would tried to be auto-repaired. And + * Customers should be able to restart, update or delete these instances. + * + * Generated from protobuf enum FAILED = 6; + */ + const FAILED = 6; + /** + * Index 7 is used in the producer apis for ROLLED_BACK state. Keeping that + * index unused in case that state also needs to exposed via consumer apis + * in future. + * The instance has been configured to sync data from some other source. + * + * Generated from protobuf enum BOOTSTRAPPING = 8; + */ + const BOOTSTRAPPING = 8; + /** + * The instance is being promoted. + * + * Generated from protobuf enum PROMOTING = 9; + */ + const PROMOTING = 9; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::READY => 'READY', + self::STOPPED => 'STOPPED', + self::CREATING => 'CREATING', + self::DELETING => 'DELETING', + self::MAINTENANCE => 'MAINTENANCE', + self::FAILED => 'FAILED', + self::BOOTSTRAPPING => 'BOOTSTRAPPING', + self::PROMOTING => 'PROMOTING', + ]; + + 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/AlloyDb/src/V1/InstanceView.php b/AlloyDb/src/V1/InstanceView.php new file mode 100644 index 000000000000..fca8fc5f03aa --- /dev/null +++ b/AlloyDb/src/V1/InstanceView.php @@ -0,0 +1,65 @@ +google.cloud.alloydb.v1.InstanceView + */ +class InstanceView +{ + /** + * INSTANCE_VIEW_UNSPECIFIED Not specified, equivalent to BASIC. + * + * Generated from protobuf enum INSTANCE_VIEW_UNSPECIFIED = 0; + */ + const INSTANCE_VIEW_UNSPECIFIED = 0; + /** + * BASIC server responses for a primary or read instance include all the + * relevant instance details, excluding the details of each node in the + * instance. The default value. + * + * Generated from protobuf enum INSTANCE_VIEW_BASIC = 1; + */ + const INSTANCE_VIEW_BASIC = 1; + /** + * FULL response is equivalent to BASIC for primary instance (for now). + * For read pool instance, this includes details of each node in the pool. + * + * Generated from protobuf enum INSTANCE_VIEW_FULL = 2; + */ + const INSTANCE_VIEW_FULL = 2; + + private static $valueToName = [ + self::INSTANCE_VIEW_UNSPECIFIED => 'INSTANCE_VIEW_UNSPECIFIED', + self::INSTANCE_VIEW_BASIC => 'INSTANCE_VIEW_BASIC', + self::INSTANCE_VIEW_FULL => 'INSTANCE_VIEW_FULL', + ]; + + 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/AlloyDb/src/V1/ListBackupsRequest.php b/AlloyDb/src/V1/ListBackupsRequest.php new file mode 100644 index 000000000000..f72f85fdf488 --- /dev/null +++ b/AlloyDb/src/V1/ListBackupsRequest.php @@ -0,0 +1,207 @@ +google.cloud.alloydb.v1.ListBackupsRequest + */ +class ListBackupsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Parent value for ListBackupsRequest + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Filtering results + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Hint for how to order the results + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Parent value for ListBackupsRequest + * @type int $page_size + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @type string $page_token + * A token identifying a page of results the server should return. + * @type string $filter + * Filtering results + * @type string $order_by + * Hint for how to order the results + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Parent value for ListBackupsRequest + * + * 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. Parent value for ListBackupsRequest + * + * 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; + } + + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * 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; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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; + } + + /** + * Filtering results + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Filtering results + * + * 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; + } + + /** + * Hint for how to order the results + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Hint for how to order the results + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/ListBackupsResponse.php b/AlloyDb/src/V1/ListBackupsResponse.php new file mode 100644 index 000000000000..0b0021d014b6 --- /dev/null +++ b/AlloyDb/src/V1/ListBackupsResponse.php @@ -0,0 +1,135 @@ +google.cloud.alloydb.v1.ListBackupsResponse + */ +class ListBackupsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of Backup + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.Backup backups = 1; + */ + private $backups; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * 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\AlloyDb\V1\Backup>|\Google\Protobuf\Internal\RepeatedField $backups + * The list of Backup + * @type string $next_page_token + * A token identifying a page of results the server should return. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * The list of Backup + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.Backup backups = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBackups() + { + return $this->backups; + } + + /** + * The list of Backup + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.Backup backups = 1; + * @param array<\Google\Cloud\AlloyDb\V1\Backup>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBackups($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1\Backup::class); + $this->backups = $arr; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * 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/AlloyDb/src/V1/ListClustersRequest.php b/AlloyDb/src/V1/ListClustersRequest.php new file mode 100644 index 000000000000..5339c38491a8 --- /dev/null +++ b/AlloyDb/src/V1/ListClustersRequest.php @@ -0,0 +1,219 @@ +google.cloud.alloydb.v1.ListClustersRequest + */ +class ListClustersRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with the following format: + * * projects/{project}/locations/- + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Optional. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with the following format: + * * projects/{project}/locations/- + * @type int $page_size + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @type string $page_token + * A token identifying a page of results the server should return. + * @type string $filter + * Optional. Filtering results + * @type string $order_by + * Optional. Hint for how to order the results + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with the following format: + * * projects/{project}/locations/- + * + * 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 parent resource. For the required format, see the + * comment on the Cluster.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with the following format: + * * projects/{project}/locations/- + * + * 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. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/ListClustersResponse.php b/AlloyDb/src/V1/ListClustersResponse.php new file mode 100644 index 000000000000..8c9c3ba6454c --- /dev/null +++ b/AlloyDb/src/V1/ListClustersResponse.php @@ -0,0 +1,135 @@ +google.cloud.alloydb.v1.ListClustersResponse + */ +class ListClustersResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of Cluster + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.Cluster clusters = 1; + */ + private $clusters; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * 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\AlloyDb\V1\Cluster>|\Google\Protobuf\Internal\RepeatedField $clusters + * The list of Cluster + * @type string $next_page_token + * A token identifying a page of results the server should return. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * The list of Cluster + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.Cluster clusters = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getClusters() + { + return $this->clusters; + } + + /** + * The list of Cluster + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.Cluster clusters = 1; + * @param array<\Google\Cloud\AlloyDb\V1\Cluster>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setClusters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1\Cluster::class); + $this->clusters = $arr; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * 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/AlloyDb/src/V1/ListInstancesRequest.php b/AlloyDb/src/V1/ListInstancesRequest.php new file mode 100644 index 000000000000..55186ca11225 --- /dev/null +++ b/AlloyDb/src/V1/ListInstancesRequest.php @@ -0,0 +1,227 @@ +google.cloud.alloydb.v1.ListInstancesRequest + */ +class ListInstancesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with one of the following + * formats: + * * projects/{project}/locations/-/clusters/- + * * projects/{project}/locations/{region}/clusters/- + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Optional. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with one of the following + * formats: + * * projects/{project}/locations/-/clusters/- + * * projects/{project}/locations/{region}/clusters/- + * @type int $page_size + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @type string $page_token + * A token identifying a page of results the server should return. + * @type string $filter + * Optional. Filtering results + * @type string $order_by + * Optional. Hint for how to order the results + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with one of the following + * formats: + * * projects/{project}/locations/-/clusters/- + * * projects/{project}/locations/{region}/clusters/- + * + * 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 parent resource. For the required format, see the + * comment on the Instance.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with one of the following + * formats: + * * projects/{project}/locations/-/clusters/- + * * projects/{project}/locations/{region}/clusters/- + * + * 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. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/ListInstancesResponse.php b/AlloyDb/src/V1/ListInstancesResponse.php new file mode 100644 index 000000000000..2b869c67528b --- /dev/null +++ b/AlloyDb/src/V1/ListInstancesResponse.php @@ -0,0 +1,135 @@ +google.cloud.alloydb.v1.ListInstancesResponse + */ +class ListInstancesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of Instance + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.Instance instances = 1; + */ + private $instances; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * 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\AlloyDb\V1\Instance>|\Google\Protobuf\Internal\RepeatedField $instances + * The list of Instance + * @type string $next_page_token + * A token identifying a page of results the server should return. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * The list of Instance + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.Instance instances = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInstances() + { + return $this->instances; + } + + /** + * The list of Instance + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.Instance instances = 1; + * @param array<\Google\Cloud\AlloyDb\V1\Instance>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInstances($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1\Instance::class); + $this->instances = $arr; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * 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/AlloyDb/src/V1/ListSupportedDatabaseFlagsRequest.php b/AlloyDb/src/V1/ListSupportedDatabaseFlagsRequest.php new file mode 100644 index 000000000000..ae263e80cdb7 --- /dev/null +++ b/AlloyDb/src/V1/ListSupportedDatabaseFlagsRequest.php @@ -0,0 +1,159 @@ +google.cloud.alloydb.v1.ListSupportedDatabaseFlagsRequest + */ +class ListSupportedDatabaseFlagsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. The required format is: + * * projects/{project}/locations/{location} + * Regardless of the parent specified here, as long it is contains a valid + * project and location, the service will return a static list of supported + * flags resources. Note that we do not yet support region-specific + * flags. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. The required format is: + * * projects/{project}/locations/{location} + * Regardless of the parent specified here, as long it is contains a valid + * project and location, the service will return a static list of supported + * flags resources. Note that we do not yet support region-specific + * flags. + * @type int $page_size + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @type string $page_token + * A token identifying a page of results the server should return. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. The required format is: + * * projects/{project}/locations/{location} + * Regardless of the parent specified here, as long it is contains a valid + * project and location, the service will return a static list of supported + * flags resources. Note that we do not yet support region-specific + * flags. + * + * 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 parent resource. The required format is: + * * projects/{project}/locations/{location} + * Regardless of the parent specified here, as long it is contains a valid + * project and location, the service will return a static list of supported + * flags resources. Note that we do not yet support region-specific + * flags. + * + * 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; + } + + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * 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; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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/AlloyDb/src/V1/ListSupportedDatabaseFlagsResponse.php b/AlloyDb/src/V1/ListSupportedDatabaseFlagsResponse.php new file mode 100644 index 000000000000..8a74ded00784 --- /dev/null +++ b/AlloyDb/src/V1/ListSupportedDatabaseFlagsResponse.php @@ -0,0 +1,101 @@ +google.cloud.alloydb.v1.ListSupportedDatabaseFlagsResponse + */ +class ListSupportedDatabaseFlagsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of SupportedDatabaseFlags. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.SupportedDatabaseFlag supported_database_flags = 1; + */ + private $supported_database_flags; + /** + * A token identifying a page of results the server should return. + * + * 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\AlloyDb\V1\SupportedDatabaseFlag>|\Google\Protobuf\Internal\RepeatedField $supported_database_flags + * The list of SupportedDatabaseFlags. + * @type string $next_page_token + * A token identifying a page of results the server should return. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * The list of SupportedDatabaseFlags. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.SupportedDatabaseFlag supported_database_flags = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSupportedDatabaseFlags() + { + return $this->supported_database_flags; + } + + /** + * The list of SupportedDatabaseFlags. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.SupportedDatabaseFlag supported_database_flags = 1; + * @param array<\Google\Cloud\AlloyDb\V1\SupportedDatabaseFlag>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSupportedDatabaseFlags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1\SupportedDatabaseFlag::class); + $this->supported_database_flags = $arr; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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/AlloyDb/src/V1/MigrationSource.php b/AlloyDb/src/V1/MigrationSource.php new file mode 100644 index 000000000000..d0af051a9d3b --- /dev/null +++ b/AlloyDb/src/V1/MigrationSource.php @@ -0,0 +1,144 @@ +google.cloud.alloydb.v1.MigrationSource + */ +class MigrationSource extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The host and port of the on-premises instance in host:port + * format + * + * Generated from protobuf field string host_port = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $host_port = ''; + /** + * Output only. Place holder for the external source identifier(e.g DMS job + * name) that created the cluster. + * + * Generated from protobuf field string reference_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reference_id = ''; + /** + * Output only. Type of migration source. + * + * Generated from protobuf field .google.cloud.alloydb.v1.MigrationSource.MigrationSourceType source_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $source_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $host_port + * Output only. The host and port of the on-premises instance in host:port + * format + * @type string $reference_id + * Output only. Place holder for the external source identifier(e.g DMS job + * name) that created the cluster. + * @type int $source_type + * Output only. Type of migration source. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The host and port of the on-premises instance in host:port + * format + * + * Generated from protobuf field string host_port = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getHostPort() + { + return $this->host_port; + } + + /** + * Output only. The host and port of the on-premises instance in host:port + * format + * + * Generated from protobuf field string host_port = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setHostPort($var) + { + GPBUtil::checkString($var, True); + $this->host_port = $var; + + return $this; + } + + /** + * Output only. Place holder for the external source identifier(e.g DMS job + * name) that created the cluster. + * + * Generated from protobuf field string reference_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getReferenceId() + { + return $this->reference_id; + } + + /** + * Output only. Place holder for the external source identifier(e.g DMS job + * name) that created the cluster. + * + * Generated from protobuf field string reference_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setReferenceId($var) + { + GPBUtil::checkString($var, True); + $this->reference_id = $var; + + return $this; + } + + /** + * Output only. Type of migration source. + * + * Generated from protobuf field .google.cloud.alloydb.v1.MigrationSource.MigrationSourceType source_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getSourceType() + { + return $this->source_type; + } + + /** + * Output only. Type of migration source. + * + * Generated from protobuf field .google.cloud.alloydb.v1.MigrationSource.MigrationSourceType source_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setSourceType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1\MigrationSource\MigrationSourceType::class); + $this->source_type = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/MigrationSource/MigrationSourceType.php b/AlloyDb/src/V1/MigrationSource/MigrationSourceType.php new file mode 100644 index 000000000000..70b17296000d --- /dev/null +++ b/AlloyDb/src/V1/MigrationSource/MigrationSourceType.php @@ -0,0 +1,55 @@ +google.cloud.alloydb.v1.MigrationSource.MigrationSourceType + */ +class MigrationSourceType +{ + /** + * Migration source is unknown. + * + * Generated from protobuf enum MIGRATION_SOURCE_TYPE_UNSPECIFIED = 0; + */ + const MIGRATION_SOURCE_TYPE_UNSPECIFIED = 0; + /** + * DMS source means the cluster was created via DMS migration job. + * + * Generated from protobuf enum DMS = 1; + */ + const DMS = 1; + + private static $valueToName = [ + self::MIGRATION_SOURCE_TYPE_UNSPECIFIED => 'MIGRATION_SOURCE_TYPE_UNSPECIFIED', + self::DMS => 'DMS', + ]; + + 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/AlloyDb/src/V1/OperationMetadata.php b/AlloyDb/src/V1/OperationMetadata.php new file mode 100644 index 000000000000..ab26ecdaeac8 --- /dev/null +++ b/AlloyDb/src/V1/OperationMetadata.php @@ -0,0 +1,349 @@ +google.cloud.alloydb.v1.OperationMetadata + */ +class OperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $target = ''; + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $verb = ''; + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $status_message = ''; + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $requested_cancellation = false; + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $api_version = ''; + protected $request_specific; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AlloyDb\V1\BatchCreateInstancesMetadata $batch_create_instances_metadata + * Output only. BatchCreateInstances related metadata. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time the operation was created. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time the operation finished running. + * @type string $target + * Output only. Server-defined resource path for the target of the operation. + * @type string $verb + * Output only. Name of the verb executed by the operation. + * @type string $status_message + * Output only. Human-readable status of the operation, if any. + * @type bool $requested_cancellation + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * @type string $api_version + * Output only. API version used to start the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Output only. BatchCreateInstances related metadata. + * + * Generated from protobuf field .google.cloud.alloydb.v1.BatchCreateInstancesMetadata batch_create_instances_metadata = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1\BatchCreateInstancesMetadata|null + */ + public function getBatchCreateInstancesMetadata() + { + return $this->readOneof(8); + } + + public function hasBatchCreateInstancesMetadata() + { + return $this->hasOneof(8); + } + + /** + * Output only. BatchCreateInstances related metadata. + * + * Generated from protobuf field .google.cloud.alloydb.v1.BatchCreateInstancesMetadata batch_create_instances_metadata = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1\BatchCreateInstancesMetadata $var + * @return $this + */ + public function setBatchCreateInstancesMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\BatchCreateInstancesMetadata::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.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 operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.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 the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @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); + } + + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStatusMessage() + { + return $this->status_message; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStatusMessage($var) + { + GPBUtil::checkString($var, True); + $this->status_message = $var; + + return $this; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getRequestedCancellation() + { + return $this->requested_cancellation; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setRequestedCancellation($var) + { + GPBUtil::checkBool($var); + $this->requested_cancellation = $var; + + return $this; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + + /** + * @return string + */ + public function getRequestSpecific() + { + return $this->whichOneof("request_specific"); + } + +} + diff --git a/AlloyDb/src/V1/RestartInstanceRequest.php b/AlloyDb/src/V1/RestartInstanceRequest.php new file mode 100644 index 000000000000..1c5e96393e00 --- /dev/null +++ b/AlloyDb/src/V1/RestartInstanceRequest.php @@ -0,0 +1,181 @@ +google.cloud.alloydb.v1.RestartInstanceRequest + */ +class RestartInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the restart. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the restart. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * 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 resource. For the required format, see the + * comment on the Instance.name field. + * + * 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. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the restart. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the restart. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/RestoreClusterRequest.php b/AlloyDb/src/V1/RestoreClusterRequest.php new file mode 100644 index 000000000000..da566afcf0ee --- /dev/null +++ b/AlloyDb/src/V1/RestoreClusterRequest.php @@ -0,0 +1,308 @@ +google.cloud.alloydb.v1.RestoreClusterRequest + */ +class RestoreClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. ID of the requesting object. + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster_id = ''; + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the import + * request. + * + * Generated from protobuf field bool validate_only = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AlloyDb\V1\BackupSource $backup_source + * Backup source. + * @type string $parent + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * @type string $cluster_id + * Required. ID of the requesting object. + * @type \Google\Cloud\AlloyDb\V1\Cluster $cluster + * Required. The resource being created + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the import + * request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Backup source. + * + * Generated from protobuf field .google.cloud.alloydb.v1.BackupSource backup_source = 4; + * @return \Google\Cloud\AlloyDb\V1\BackupSource|null + */ + public function getBackupSource() + { + return $this->readOneof(4); + } + + public function hasBackupSource() + { + return $this->hasOneof(4); + } + + /** + * Backup source. + * + * Generated from protobuf field .google.cloud.alloydb.v1.BackupSource backup_source = 4; + * @param \Google\Cloud\AlloyDb\V1\BackupSource $var + * @return $this + */ + public function setBackupSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\BackupSource::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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 parent resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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. ID of the requesting object. + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getClusterId() + { + return $this->cluster_id; + } + + /** + * Required. ID of the requesting object. + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setClusterId($var) + { + GPBUtil::checkString($var, True); + $this->cluster_id = $var; + + return $this; + } + + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1\Cluster|null + */ + public function getCluster() + { + return $this->cluster; + } + + public function hasCluster() + { + return isset($this->cluster); + } + + public function clearCluster() + { + unset($this->cluster); + } + + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1\Cluster $var + * @return $this + */ + public function setCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\Cluster::class); + $this->cluster = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the import + * request. + * + * Generated from protobuf field bool validate_only = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the import + * request. + * + * Generated from protobuf field bool validate_only = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/AlloyDb/src/V1/SslConfig.php b/AlloyDb/src/V1/SslConfig.php new file mode 100644 index 000000000000..b742f49f9864 --- /dev/null +++ b/AlloyDb/src/V1/SslConfig.php @@ -0,0 +1,105 @@ +google.cloud.alloydb.v1.SslConfig + */ +class SslConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. SSL mode. Specifies client-server SSL/TLS connection behavior. + * + * Generated from protobuf field .google.cloud.alloydb.v1.SslConfig.SslMode ssl_mode = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $ssl_mode = 0; + /** + * Optional. Certificate Authority (CA) source. Only CA_SOURCE_MANAGED is + * supported currently, and is the default value. + * + * Generated from protobuf field .google.cloud.alloydb.v1.SslConfig.CaSource ca_source = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $ca_source = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $ssl_mode + * Optional. SSL mode. Specifies client-server SSL/TLS connection behavior. + * @type int $ca_source + * Optional. Certificate Authority (CA) source. Only CA_SOURCE_MANAGED is + * supported currently, and is the default value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Optional. SSL mode. Specifies client-server SSL/TLS connection behavior. + * + * Generated from protobuf field .google.cloud.alloydb.v1.SslConfig.SslMode ssl_mode = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getSslMode() + { + return $this->ssl_mode; + } + + /** + * Optional. SSL mode. Specifies client-server SSL/TLS connection behavior. + * + * Generated from protobuf field .google.cloud.alloydb.v1.SslConfig.SslMode ssl_mode = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setSslMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1\SslConfig\SslMode::class); + $this->ssl_mode = $var; + + return $this; + } + + /** + * Optional. Certificate Authority (CA) source. Only CA_SOURCE_MANAGED is + * supported currently, and is the default value. + * + * Generated from protobuf field .google.cloud.alloydb.v1.SslConfig.CaSource ca_source = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getCaSource() + { + return $this->ca_source; + } + + /** + * Optional. Certificate Authority (CA) source. Only CA_SOURCE_MANAGED is + * supported currently, and is the default value. + * + * Generated from protobuf field .google.cloud.alloydb.v1.SslConfig.CaSource ca_source = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setCaSource($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1\SslConfig\CaSource::class); + $this->ca_source = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/SslConfig/CaSource.php b/AlloyDb/src/V1/SslConfig/CaSource.php new file mode 100644 index 000000000000..e5d5f9cb48e4 --- /dev/null +++ b/AlloyDb/src/V1/SslConfig/CaSource.php @@ -0,0 +1,56 @@ +google.cloud.alloydb.v1.SslConfig.CaSource + */ +class CaSource +{ + /** + * Certificate Authority (CA) source not specified. Defaults to + * CA_SOURCE_MANAGED. + * + * Generated from protobuf enum CA_SOURCE_UNSPECIFIED = 0; + */ + const CA_SOURCE_UNSPECIFIED = 0; + /** + * Certificate Authority (CA) managed by the AlloyDB Cluster. + * + * Generated from protobuf enum CA_SOURCE_MANAGED = 1; + */ + const CA_SOURCE_MANAGED = 1; + + private static $valueToName = [ + self::CA_SOURCE_UNSPECIFIED => 'CA_SOURCE_UNSPECIFIED', + self::CA_SOURCE_MANAGED => 'CA_SOURCE_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); + } +} + + diff --git a/AlloyDb/src/V1/SslConfig/SslMode.php b/AlloyDb/src/V1/SslConfig/SslMode.php new file mode 100644 index 000000000000..e53460ee6bc2 --- /dev/null +++ b/AlloyDb/src/V1/SslConfig/SslMode.php @@ -0,0 +1,73 @@ +google.cloud.alloydb.v1.SslConfig.SslMode + */ +class SslMode +{ + /** + * SSL mode not specified. Defaults to SSL_MODE_ALLOW. + * + * Generated from protobuf enum SSL_MODE_UNSPECIFIED = 0; + */ + const SSL_MODE_UNSPECIFIED = 0; + /** + * SSL connections are optional. CA verification not enforced. + * + * Generated from protobuf enum SSL_MODE_ALLOW = 1; + */ + const SSL_MODE_ALLOW = 1; + /** + * SSL connections are required. CA verification not enforced. + * Clients may use locally self-signed certificates (default psql client + * behavior). + * + * Generated from protobuf enum SSL_MODE_REQUIRE = 2; + */ + const SSL_MODE_REQUIRE = 2; + /** + * SSL connections are required. CA verification enforced. + * Clients must have certificates signed by a Cluster CA, e.g. via + * GenerateClientCertificate. + * + * Generated from protobuf enum SSL_MODE_VERIFY_CA = 3; + */ + const SSL_MODE_VERIFY_CA = 3; + + private static $valueToName = [ + self::SSL_MODE_UNSPECIFIED => 'SSL_MODE_UNSPECIFIED', + self::SSL_MODE_ALLOW => 'SSL_MODE_ALLOW', + self::SSL_MODE_REQUIRE => 'SSL_MODE_REQUIRE', + self::SSL_MODE_VERIFY_CA => 'SSL_MODE_VERIFY_CA', + ]; + + 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/AlloyDb/src/V1/SupportedDatabaseFlag.php b/AlloyDb/src/V1/SupportedDatabaseFlag.php new file mode 100644 index 000000000000..09d7ae652977 --- /dev/null +++ b/AlloyDb/src/V1/SupportedDatabaseFlag.php @@ -0,0 +1,337 @@ +google.cloud.alloydb.v1.SupportedDatabaseFlag + */ +class SupportedDatabaseFlag extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the flag resource, following Google Cloud conventions, e.g.: + * * projects/{project}/locations/{location}/flags/{flag} + * This field currently has no semantic meaning. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The name of the database flag, e.g. "max_allowed_packets". + * The is a possibly key for the Instance.database_flags map field. + * + * Generated from protobuf field string flag_name = 2; + */ + protected $flag_name = ''; + /** + * Generated from protobuf field .google.cloud.alloydb.v1.SupportedDatabaseFlag.ValueType value_type = 3; + */ + protected $value_type = 0; + /** + * Whether the database flag accepts multiple values. If true, + * a comma-separated list of stringified values may be specified. + * + * Generated from protobuf field bool accepts_multiple_values = 4; + */ + protected $accepts_multiple_values = false; + /** + * Major database engine versions for which this flag is supported. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.DatabaseVersion supported_db_versions = 5; + */ + private $supported_db_versions; + /** + * Whether setting or updating this flag on an Instance requires a database + * restart. If a flag that requires database restart is set, the backend + * will automatically restart the database (making sure to satisfy any + * availability SLO's). + * + * Generated from protobuf field bool requires_db_restart = 6; + */ + protected $requires_db_restart = false; + protected $restrictions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AlloyDb\V1\SupportedDatabaseFlag\StringRestrictions $string_restrictions + * Restriction on STRING type value. + * @type \Google\Cloud\AlloyDb\V1\SupportedDatabaseFlag\IntegerRestrictions $integer_restrictions + * Restriction on INTEGER type value. + * @type string $name + * The name of the flag resource, following Google Cloud conventions, e.g.: + * * projects/{project}/locations/{location}/flags/{flag} + * This field currently has no semantic meaning. + * @type string $flag_name + * The name of the database flag, e.g. "max_allowed_packets". + * The is a possibly key for the Instance.database_flags map field. + * @type int $value_type + * @type bool $accepts_multiple_values + * Whether the database flag accepts multiple values. If true, + * a comma-separated list of stringified values may be specified. + * @type array|\Google\Protobuf\Internal\RepeatedField $supported_db_versions + * Major database engine versions for which this flag is supported. + * @type bool $requires_db_restart + * Whether setting or updating this flag on an Instance requires a database + * restart. If a flag that requires database restart is set, the backend + * will automatically restart the database (making sure to satisfy any + * availability SLO's). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Restriction on STRING type value. + * + * Generated from protobuf field .google.cloud.alloydb.v1.SupportedDatabaseFlag.StringRestrictions string_restrictions = 7; + * @return \Google\Cloud\AlloyDb\V1\SupportedDatabaseFlag\StringRestrictions|null + */ + public function getStringRestrictions() + { + return $this->readOneof(7); + } + + public function hasStringRestrictions() + { + return $this->hasOneof(7); + } + + /** + * Restriction on STRING type value. + * + * Generated from protobuf field .google.cloud.alloydb.v1.SupportedDatabaseFlag.StringRestrictions string_restrictions = 7; + * @param \Google\Cloud\AlloyDb\V1\SupportedDatabaseFlag\StringRestrictions $var + * @return $this + */ + public function setStringRestrictions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\SupportedDatabaseFlag\StringRestrictions::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * Restriction on INTEGER type value. + * + * Generated from protobuf field .google.cloud.alloydb.v1.SupportedDatabaseFlag.IntegerRestrictions integer_restrictions = 8; + * @return \Google\Cloud\AlloyDb\V1\SupportedDatabaseFlag\IntegerRestrictions|null + */ + public function getIntegerRestrictions() + { + return $this->readOneof(8); + } + + public function hasIntegerRestrictions() + { + return $this->hasOneof(8); + } + + /** + * Restriction on INTEGER type value. + * + * Generated from protobuf field .google.cloud.alloydb.v1.SupportedDatabaseFlag.IntegerRestrictions integer_restrictions = 8; + * @param \Google\Cloud\AlloyDb\V1\SupportedDatabaseFlag\IntegerRestrictions $var + * @return $this + */ + public function setIntegerRestrictions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\SupportedDatabaseFlag\IntegerRestrictions::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * The name of the flag resource, following Google Cloud conventions, e.g.: + * * projects/{project}/locations/{location}/flags/{flag} + * This field currently has no semantic meaning. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the flag resource, following Google Cloud conventions, e.g.: + * * projects/{project}/locations/{location}/flags/{flag} + * This field currently has no semantic meaning. + * + * 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 the database flag, e.g. "max_allowed_packets". + * The is a possibly key for the Instance.database_flags map field. + * + * Generated from protobuf field string flag_name = 2; + * @return string + */ + public function getFlagName() + { + return $this->flag_name; + } + + /** + * The name of the database flag, e.g. "max_allowed_packets". + * The is a possibly key for the Instance.database_flags map field. + * + * Generated from protobuf field string flag_name = 2; + * @param string $var + * @return $this + */ + public function setFlagName($var) + { + GPBUtil::checkString($var, True); + $this->flag_name = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.cloud.alloydb.v1.SupportedDatabaseFlag.ValueType value_type = 3; + * @return int + */ + public function getValueType() + { + return $this->value_type; + } + + /** + * Generated from protobuf field .google.cloud.alloydb.v1.SupportedDatabaseFlag.ValueType value_type = 3; + * @param int $var + * @return $this + */ + public function setValueType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1\SupportedDatabaseFlag\ValueType::class); + $this->value_type = $var; + + return $this; + } + + /** + * Whether the database flag accepts multiple values. If true, + * a comma-separated list of stringified values may be specified. + * + * Generated from protobuf field bool accepts_multiple_values = 4; + * @return bool + */ + public function getAcceptsMultipleValues() + { + return $this->accepts_multiple_values; + } + + /** + * Whether the database flag accepts multiple values. If true, + * a comma-separated list of stringified values may be specified. + * + * Generated from protobuf field bool accepts_multiple_values = 4; + * @param bool $var + * @return $this + */ + public function setAcceptsMultipleValues($var) + { + GPBUtil::checkBool($var); + $this->accepts_multiple_values = $var; + + return $this; + } + + /** + * Major database engine versions for which this flag is supported. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.DatabaseVersion supported_db_versions = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSupportedDbVersions() + { + return $this->supported_db_versions; + } + + /** + * Major database engine versions for which this flag is supported. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1.DatabaseVersion supported_db_versions = 5; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSupportedDbVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\AlloyDb\V1\DatabaseVersion::class); + $this->supported_db_versions = $arr; + + return $this; + } + + /** + * Whether setting or updating this flag on an Instance requires a database + * restart. If a flag that requires database restart is set, the backend + * will automatically restart the database (making sure to satisfy any + * availability SLO's). + * + * Generated from protobuf field bool requires_db_restart = 6; + * @return bool + */ + public function getRequiresDbRestart() + { + return $this->requires_db_restart; + } + + /** + * Whether setting or updating this flag on an Instance requires a database + * restart. If a flag that requires database restart is set, the backend + * will automatically restart the database (making sure to satisfy any + * availability SLO's). + * + * Generated from protobuf field bool requires_db_restart = 6; + * @param bool $var + * @return $this + */ + public function setRequiresDbRestart($var) + { + GPBUtil::checkBool($var); + $this->requires_db_restart = $var; + + return $this; + } + + /** + * @return string + */ + public function getRestrictions() + { + return $this->whichOneof("restrictions"); + } + +} + diff --git a/AlloyDb/src/V1/SupportedDatabaseFlag/IntegerRestrictions.php b/AlloyDb/src/V1/SupportedDatabaseFlag/IntegerRestrictions.php new file mode 100644 index 000000000000..2b8f696c33d9 --- /dev/null +++ b/AlloyDb/src/V1/SupportedDatabaseFlag/IntegerRestrictions.php @@ -0,0 +1,176 @@ +google.cloud.alloydb.v1.SupportedDatabaseFlag.IntegerRestrictions + */ +class IntegerRestrictions extends \Google\Protobuf\Internal\Message +{ + /** + * The minimum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value min_value = 1; + */ + protected $min_value = null; + /** + * The maximum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value max_value = 2; + */ + protected $max_value = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Int64Value $min_value + * The minimum value that can be specified, if applicable. + * @type \Google\Protobuf\Int64Value $max_value + * The maximum value that can be specified, if applicable. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The minimum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value min_value = 1; + * @return \Google\Protobuf\Int64Value|null + */ + public function getMinValue() + { + return $this->min_value; + } + + public function hasMinValue() + { + return isset($this->min_value); + } + + public function clearMinValue() + { + unset($this->min_value); + } + + /** + * Returns the unboxed value from getMinValue() + + * The minimum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value min_value = 1; + * @return int|string|null + */ + public function getMinValueUnwrapped() + { + return $this->readWrapperValue("min_value"); + } + + /** + * The minimum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value min_value = 1; + * @param \Google\Protobuf\Int64Value $var + * @return $this + */ + public function setMinValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Int64Value::class); + $this->min_value = $var; + + return $this; + } + + /** + * Sets the field by wrapping a primitive type in a Google\Protobuf\Int64Value object. + + * The minimum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value min_value = 1; + * @param int|string|null $var + * @return $this + */ + public function setMinValueUnwrapped($var) + { + $this->writeWrapperValue("min_value", $var); + return $this;} + + /** + * The maximum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value max_value = 2; + * @return \Google\Protobuf\Int64Value|null + */ + public function getMaxValue() + { + return $this->max_value; + } + + public function hasMaxValue() + { + return isset($this->max_value); + } + + public function clearMaxValue() + { + unset($this->max_value); + } + + /** + * Returns the unboxed value from getMaxValue() + + * The maximum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value max_value = 2; + * @return int|string|null + */ + public function getMaxValueUnwrapped() + { + return $this->readWrapperValue("max_value"); + } + + /** + * The maximum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value max_value = 2; + * @param \Google\Protobuf\Int64Value $var + * @return $this + */ + public function setMaxValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Int64Value::class); + $this->max_value = $var; + + return $this; + } + + /** + * Sets the field by wrapping a primitive type in a Google\Protobuf\Int64Value object. + + * The maximum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value max_value = 2; + * @param int|string|null $var + * @return $this + */ + public function setMaxValueUnwrapped($var) + { + $this->writeWrapperValue("max_value", $var); + return $this;} + +} + + diff --git a/AlloyDb/src/V1/SupportedDatabaseFlag/StringRestrictions.php b/AlloyDb/src/V1/SupportedDatabaseFlag/StringRestrictions.php new file mode 100644 index 000000000000..8ccf9306f553 --- /dev/null +++ b/AlloyDb/src/V1/SupportedDatabaseFlag/StringRestrictions.php @@ -0,0 +1,72 @@ +google.cloud.alloydb.v1.SupportedDatabaseFlag.StringRestrictions + */ +class StringRestrictions extends \Google\Protobuf\Internal\Message +{ + /** + * The list of allowed values, if bounded. This field will be empty + * if there is a unbounded number of allowed values. + * + * Generated from protobuf field repeated string allowed_values = 1; + */ + private $allowed_values; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $allowed_values + * The list of allowed values, if bounded. This field will be empty + * if there is a unbounded number of allowed values. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The list of allowed values, if bounded. This field will be empty + * if there is a unbounded number of allowed values. + * + * Generated from protobuf field repeated string allowed_values = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAllowedValues() + { + return $this->allowed_values; + } + + /** + * The list of allowed values, if bounded. This field will be empty + * if there is a unbounded number of allowed values. + * + * Generated from protobuf field repeated string allowed_values = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAllowedValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->allowed_values = $arr; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1/SupportedDatabaseFlag/ValueType.php b/AlloyDb/src/V1/SupportedDatabaseFlag/ValueType.php new file mode 100644 index 000000000000..b33b1fd81757 --- /dev/null +++ b/AlloyDb/src/V1/SupportedDatabaseFlag/ValueType.php @@ -0,0 +1,78 @@ +google.cloud.alloydb.v1.SupportedDatabaseFlag.ValueType + */ +class ValueType +{ + /** + * This is an unknown flag type. + * + * Generated from protobuf enum VALUE_TYPE_UNSPECIFIED = 0; + */ + const VALUE_TYPE_UNSPECIFIED = 0; + /** + * String type flag. + * + * Generated from protobuf enum STRING = 1; + */ + const STRING = 1; + /** + * Integer type flag. + * + * Generated from protobuf enum INTEGER = 2; + */ + const INTEGER = 2; + /** + * Float type flag. + * + * Generated from protobuf enum FLOAT = 3; + */ + const FLOAT = 3; + /** + * Denotes that the flag does not accept any values. + * + * Generated from protobuf enum NONE = 4; + */ + const NONE = 4; + + private static $valueToName = [ + self::VALUE_TYPE_UNSPECIFIED => 'VALUE_TYPE_UNSPECIFIED', + self::STRING => 'STRING', + self::INTEGER => 'INTEGER', + self::FLOAT => 'FLOAT', + self::NONE => 'NONE', + ]; + + 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/AlloyDb/src/V1/UpdateBackupRequest.php b/AlloyDb/src/V1/UpdateBackupRequest.php new file mode 100644 index 000000000000..86e4a5fd2425 --- /dev/null +++ b/AlloyDb/src/V1/UpdateBackupRequest.php @@ -0,0 +1,287 @@ +google.cloud.alloydb.v1.UpdateBackupRequest + */ +class UpdateBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Backup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1.Backup backup = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + /** + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new backup is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $allow_missing = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Backup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\AlloyDb\V1\Backup $backup + * Required. The resource being updated + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * @type bool $allow_missing + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new backup is created and `update_mask` is ignored. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Backup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @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); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Backup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1.Backup backup = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1\Backup|null + */ + public function getBackup() + { + return $this->backup; + } + + public function hasBackup() + { + return isset($this->backup); + } + + public function clearBackup() + { + unset($this->backup); + } + + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1.Backup backup = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1\Backup $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\Backup::class); + $this->backup = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new backup is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new backup is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/UpdateClusterRequest.php b/AlloyDb/src/V1/UpdateClusterRequest.php new file mode 100644 index 000000000000..e3f36ab24a49 --- /dev/null +++ b/AlloyDb/src/V1/UpdateClusterRequest.php @@ -0,0 +1,291 @@ +google.cloud.alloydb.v1.UpdateClusterRequest + */ +class UpdateClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Cluster resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + /** + * Optional. If set to true, update succeeds even if cluster is not found. In + * that case, a new cluster is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $allow_missing = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Cluster resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\AlloyDb\V1\Cluster $cluster + * Required. The resource being updated + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * @type bool $allow_missing + * Optional. If set to true, update succeeds even if cluster is not found. In + * that case, a new cluster is created and `update_mask` is ignored. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Cluster resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @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); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Cluster resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1\Cluster|null + */ + public function getCluster() + { + return $this->cluster; + } + + public function hasCluster() + { + return isset($this->cluster); + } + + public function clearCluster() + { + unset($this->cluster); + } + + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1.Cluster cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1\Cluster $var + * @return $this + */ + public function setCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\Cluster::class); + $this->cluster = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Optional. If set to true, update succeeds even if cluster is not found. In + * that case, a new cluster is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * Optional. If set to true, update succeeds even if cluster is not found. In + * that case, a new cluster is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/UpdateInstanceRequest.php b/AlloyDb/src/V1/UpdateInstanceRequest.php new file mode 100644 index 000000000000..ebfb2be3dc20 --- /dev/null +++ b/AlloyDb/src/V1/UpdateInstanceRequest.php @@ -0,0 +1,291 @@ +google.cloud.alloydb.v1.UpdateInstanceRequest + */ +class UpdateInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Instance resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance instance = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + /** + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new instance is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $allow_missing = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Instance resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\AlloyDb\V1\Instance $instance + * Required. The resource being updated + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * @type bool $allow_missing + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new instance is created and `update_mask` is ignored. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Instance resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @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); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Instance resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance instance = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1\Instance|null + */ + public function getInstance() + { + return $this->instance; + } + + public function hasInstance() + { + return isset($this->instance); + } + + public function clearInstance() + { + unset($this->instance); + } + + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1.Instance instance = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1\Instance $var + * @return $this + */ + public function setInstance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\Instance::class); + $this->instance = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new instance is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new instance is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/UserPassword.php b/AlloyDb/src/V1/UserPassword.php new file mode 100644 index 000000000000..6f1de9b58940 --- /dev/null +++ b/AlloyDb/src/V1/UserPassword.php @@ -0,0 +1,102 @@ +google.cloud.alloydb.v1.UserPassword + */ +class UserPassword extends \Google\Protobuf\Internal\Message +{ + /** + * The database username. + * + * Generated from protobuf field string user = 1; + */ + protected $user = ''; + /** + * The initial password for the user. + * + * Generated from protobuf field string password = 2; + */ + protected $password = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $user + * The database username. + * @type string $password + * The initial password for the user. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The database username. + * + * Generated from protobuf field string user = 1; + * @return string + */ + public function getUser() + { + return $this->user; + } + + /** + * The database username. + * + * Generated from protobuf field string user = 1; + * @param string $var + * @return $this + */ + public function setUser($var) + { + GPBUtil::checkString($var, True); + $this->user = $var; + + return $this; + } + + /** + * The initial password for the user. + * + * Generated from protobuf field string password = 2; + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * The initial password for the user. + * + * Generated from protobuf field string password = 2; + * @param string $var + * @return $this + */ + public function setPassword($var) + { + GPBUtil::checkString($var, True); + $this->password = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1/gapic_metadata.json b/AlloyDb/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..03df4a434d83 --- /dev/null +++ b/AlloyDb/src/V1/gapic_metadata.json @@ -0,0 +1,128 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.alloydb.v1", + "libraryPackage": "Google\\Cloud\\AlloyDb\\V1", + "services": { + "AlloyDBAdmin": { + "clients": { + "grpc": { + "libraryClient": "AlloyDBAdminGapicClient", + "rpcs": { + "BatchCreateInstances": { + "methods": [ + "batchCreateInstances" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "CreateCluster": { + "methods": [ + "createCluster" + ] + }, + "CreateInstance": { + "methods": [ + "createInstance" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "DeleteCluster": { + "methods": [ + "deleteCluster" + ] + }, + "DeleteInstance": { + "methods": [ + "deleteInstance" + ] + }, + "FailoverInstance": { + "methods": [ + "failoverInstance" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "GetCluster": { + "methods": [ + "getCluster" + ] + }, + "GetInstance": { + "methods": [ + "getInstance" + ] + }, + "ListBackups": { + "methods": [ + "listBackups" + ] + }, + "ListClusters": { + "methods": [ + "listClusters" + ] + }, + "ListInstances": { + "methods": [ + "listInstances" + ] + }, + "ListSupportedDatabaseFlags": { + "methods": [ + "listSupportedDatabaseFlags" + ] + }, + "RestartInstance": { + "methods": [ + "restartInstance" + ] + }, + "RestoreCluster": { + "methods": [ + "restoreCluster" + ] + }, + "UpdateBackup": { + "methods": [ + "updateBackup" + ] + }, + "UpdateCluster": { + "methods": [ + "updateCluster" + ] + }, + "UpdateInstance": { + "methods": [ + "updateInstance" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/AlloyDb/src/V1/resources/alloy_db_admin_client_config.json b/AlloyDb/src/V1/resources/alloy_db_admin_client_config.json new file mode 100644 index 000000000000..1454724cd981 --- /dev/null +++ b/AlloyDb/src/V1/resources/alloy_db_admin_client_config.json @@ -0,0 +1,154 @@ +{ + "interfaces": { + "google.cloud.alloydb.v1.AlloyDBAdmin": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "no_retry_1_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": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "BatchCreateInstances": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateInstance": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteBackup": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteInstance": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "FailoverInstance": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetBackup": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetCluster": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetInstance": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListBackups": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListClusters": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListInstances": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListSupportedDatabaseFlags": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "RestartInstance": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "RestoreCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateInstance": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/AlloyDb/src/V1/resources/alloy_db_admin_descriptor_config.php b/AlloyDb/src/V1/resources/alloy_db_admin_descriptor_config.php new file mode 100644 index 000000000000..d676bc8c3743 --- /dev/null +++ b/AlloyDb/src/V1/resources/alloy_db_admin_descriptor_config.php @@ -0,0 +1,188 @@ + [ + 'google.cloud.alloydb.v1.AlloyDBAdmin' => [ + 'BatchCreateInstances' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1\BatchCreateInstancesResponse', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateBackup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1\Backup', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1\Cluster', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateInstance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1\Instance', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteBackup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteInstance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'FailoverInstance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1\Instance', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'RestartInstance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1\Instance', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'RestoreCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1\Cluster', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateBackup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1\Backup', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1\Cluster', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateInstance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1\Instance', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'ListBackups' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getBackups', + ], + ], + 'ListClusters' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getClusters', + ], + ], + 'ListInstances' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getInstances', + ], + ], + 'ListSupportedDatabaseFlags' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getSupportedDatabaseFlags', + ], + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + ], + ], + ], +]; diff --git a/AlloyDb/src/V1/resources/alloy_db_admin_rest_client_config.php b/AlloyDb/src/V1/resources/alloy_db_admin_rest_client_config.php new file mode 100644 index 000000000000..a4c53d80a790 --- /dev/null +++ b/AlloyDb/src/V1/resources/alloy_db_admin_rest_client_config.php @@ -0,0 +1,322 @@ + [ + 'google.cloud.alloydb.v1.AlloyDBAdmin' => [ + 'BatchCreateInstances' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/clusters/*}/instances:batchCreate', + 'body' => 'requests', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateBackup' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/backups', + 'body' => 'backup', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'backup_id', + ], + ], + 'CreateCluster' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/clusters', + 'body' => 'cluster', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'cluster_id', + ], + ], + 'CreateInstance' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/clusters/*}/instances', + 'body' => 'instance', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'instance_id', + ], + ], + 'DeleteBackup' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/backups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteCluster' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/clusters/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteInstance' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/clusters/*/instances/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'FailoverInstance' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/clusters/*/instances/*}:failover', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetBackup' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/backups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetCluster' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/clusters/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetInstance' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/clusters/*/instances/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListBackups' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/backups', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListClusters' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/clusters', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListInstances' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/clusters/*}/instances', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListSupportedDatabaseFlags' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/supportedDatabaseFlags', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'RestartInstance' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/clusters/*/instances/*}:restart', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'RestoreCluster' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/clusters:restore', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateBackup' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{backup.name=projects/*/locations/*/backups/*}', + 'body' => 'backup', + 'placeholders' => [ + 'backup.name' => [ + 'getters' => [ + 'getBackup', + 'getName', + ], + ], + ], + ], + 'UpdateCluster' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{cluster.name=projects/*/locations/*/clusters/*}', + 'body' => 'cluster', + 'placeholders' => [ + 'cluster.name' => [ + 'getters' => [ + 'getCluster', + 'getName', + ], + ], + ], + ], + 'UpdateInstance' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{instance.name=projects/*/locations/*/clusters/*/instances/*}', + 'body' => 'instance', + 'placeholders' => [ + 'instance.name' => [ + 'getters' => [ + 'getInstance', + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/AlloyDb/src/V1alpha/AlloyDBAdminClient.php b/AlloyDb/src/V1alpha/AlloyDBAdminClient.php new file mode 100644 index 000000000000..674370c0ea34 --- /dev/null +++ b/AlloyDb/src/V1alpha/AlloyDBAdminClient.php @@ -0,0 +1,36 @@ +google.cloud.alloydb.v1alpha.AutomatedBackupPolicy + */ +class AutomatedBackupPolicy extends \Google\Protobuf\Internal\Message +{ + /** + * Whether automated automated backups are enabled. If not set, defaults to + * true. + * + * Generated from protobuf field optional bool enabled = 1; + */ + protected $enabled = null; + /** + * The length of the time window during which a backup can be + * taken. If a backup does not succeed within this time window, it will be + * canceled and considered failed. + * The backup window must be at least 5 minutes long. There is no upper bound + * on the window. If not set, it defaults to 1 hour. + * + * Generated from protobuf field .google.protobuf.Duration backup_window = 3; + */ + protected $backup_window = null; + /** + * Optional. The encryption config can be specified to encrypt the + * backups with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $encryption_config = null; + /** + * The location where the backup will be stored. Currently, the only supported + * option is to store the backup in the same region as the cluster. + * If empty, defaults to the region of the cluster. + * + * Generated from protobuf field string location = 6; + */ + protected $location = ''; + /** + * Labels to apply to backups created using this configuration. + * + * Generated from protobuf field map labels = 7; + */ + private $labels; + protected $schedule; + protected $retention; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AlloyDb\V1alpha\AutomatedBackupPolicy\WeeklySchedule $weekly_schedule + * Weekly schedule for the Backup. + * @type \Google\Cloud\AlloyDb\V1alpha\AutomatedBackupPolicy\TimeBasedRetention $time_based_retention + * Time-based Backup retention policy. + * @type \Google\Cloud\AlloyDb\V1alpha\AutomatedBackupPolicy\QuantityBasedRetention $quantity_based_retention + * Quantity-based Backup retention policy to retain recent backups. + * @type bool $enabled + * Whether automated automated backups are enabled. If not set, defaults to + * true. + * @type \Google\Protobuf\Duration $backup_window + * The length of the time window during which a backup can be + * taken. If a backup does not succeed within this time window, it will be + * canceled and considered failed. + * The backup window must be at least 5 minutes long. There is no upper bound + * on the window. If not set, it defaults to 1 hour. + * @type \Google\Cloud\AlloyDb\V1alpha\EncryptionConfig $encryption_config + * Optional. The encryption config can be specified to encrypt the + * backups with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * @type string $location + * The location where the backup will be stored. Currently, the only supported + * option is to store the backup in the same region as the cluster. + * If empty, defaults to the region of the cluster. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels to apply to backups created using this configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Weekly schedule for the Backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule weekly_schedule = 2; + * @return \Google\Cloud\AlloyDb\V1alpha\AutomatedBackupPolicy\WeeklySchedule|null + */ + public function getWeeklySchedule() + { + return $this->readOneof(2); + } + + public function hasWeeklySchedule() + { + return $this->hasOneof(2); + } + + /** + * Weekly schedule for the Backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule weekly_schedule = 2; + * @param \Google\Cloud\AlloyDb\V1alpha\AutomatedBackupPolicy\WeeklySchedule $var + * @return $this + */ + public function setWeeklySchedule($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\AutomatedBackupPolicy\WeeklySchedule::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Time-based Backup retention policy. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention time_based_retention = 4; + * @return \Google\Cloud\AlloyDb\V1alpha\AutomatedBackupPolicy\TimeBasedRetention|null + */ + public function getTimeBasedRetention() + { + return $this->readOneof(4); + } + + public function hasTimeBasedRetention() + { + return $this->hasOneof(4); + } + + /** + * Time-based Backup retention policy. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention time_based_retention = 4; + * @param \Google\Cloud\AlloyDb\V1alpha\AutomatedBackupPolicy\TimeBasedRetention $var + * @return $this + */ + public function setTimeBasedRetention($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\AutomatedBackupPolicy\TimeBasedRetention::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Quantity-based Backup retention policy to retain recent backups. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention quantity_based_retention = 5; + * @return \Google\Cloud\AlloyDb\V1alpha\AutomatedBackupPolicy\QuantityBasedRetention|null + */ + public function getQuantityBasedRetention() + { + return $this->readOneof(5); + } + + public function hasQuantityBasedRetention() + { + return $this->hasOneof(5); + } + + /** + * Quantity-based Backup retention policy to retain recent backups. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention quantity_based_retention = 5; + * @param \Google\Cloud\AlloyDb\V1alpha\AutomatedBackupPolicy\QuantityBasedRetention $var + * @return $this + */ + public function setQuantityBasedRetention($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\AutomatedBackupPolicy\QuantityBasedRetention::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Whether automated automated backups are enabled. If not set, defaults to + * true. + * + * Generated from protobuf field optional bool enabled = 1; + * @return bool + */ + public function getEnabled() + { + return isset($this->enabled) ? $this->enabled : false; + } + + public function hasEnabled() + { + return isset($this->enabled); + } + + public function clearEnabled() + { + unset($this->enabled); + } + + /** + * Whether automated automated backups are enabled. If not set, defaults to + * true. + * + * Generated from protobuf field optional bool enabled = 1; + * @param bool $var + * @return $this + */ + public function setEnabled($var) + { + GPBUtil::checkBool($var); + $this->enabled = $var; + + return $this; + } + + /** + * The length of the time window during which a backup can be + * taken. If a backup does not succeed within this time window, it will be + * canceled and considered failed. + * The backup window must be at least 5 minutes long. There is no upper bound + * on the window. If not set, it defaults to 1 hour. + * + * Generated from protobuf field .google.protobuf.Duration backup_window = 3; + * @return \Google\Protobuf\Duration|null + */ + public function getBackupWindow() + { + return $this->backup_window; + } + + public function hasBackupWindow() + { + return isset($this->backup_window); + } + + public function clearBackupWindow() + { + unset($this->backup_window); + } + + /** + * The length of the time window during which a backup can be + * taken. If a backup does not succeed within this time window, it will be + * canceled and considered failed. + * The backup window must be at least 5 minutes long. There is no upper bound + * on the window. If not set, it defaults to 1 hour. + * + * Generated from protobuf field .google.protobuf.Duration backup_window = 3; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setBackupWindow($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->backup_window = $var; + + return $this; + } + + /** + * Optional. The encryption config can be specified to encrypt the + * backups with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\AlloyDb\V1alpha\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 config can be specified to encrypt the + * backups with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\AlloyDb\V1alpha\EncryptionConfig $var + * @return $this + */ + public function setEncryptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\EncryptionConfig::class); + $this->encryption_config = $var; + + return $this; + } + + /** + * The location where the backup will be stored. Currently, the only supported + * option is to store the backup in the same region as the cluster. + * If empty, defaults to the region of the cluster. + * + * Generated from protobuf field string location = 6; + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * The location where the backup will be stored. Currently, the only supported + * option is to store the backup in the same region as the cluster. + * If empty, defaults to the region of the cluster. + * + * Generated from protobuf field string location = 6; + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + + /** + * Labels to apply to backups created using this configuration. + * + * Generated from protobuf field map labels = 7; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels to apply to backups created using this configuration. + * + * 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; + } + + /** + * @return string + */ + public function getSchedule() + { + return $this->whichOneof("schedule"); + } + + /** + * @return string + */ + public function getRetention() + { + return $this->whichOneof("retention"); + } + +} + diff --git a/AlloyDb/src/V1alpha/AutomatedBackupPolicy/QuantityBasedRetention.php b/AlloyDb/src/V1alpha/AutomatedBackupPolicy/QuantityBasedRetention.php new file mode 100644 index 000000000000..acad2d01a8dc --- /dev/null +++ b/AlloyDb/src/V1alpha/AutomatedBackupPolicy/QuantityBasedRetention.php @@ -0,0 +1,69 @@ +google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention + */ +class QuantityBasedRetention extends \Google\Protobuf\Internal\Message +{ + /** + * The number of backups to retain. + * + * Generated from protobuf field int32 count = 1; + */ + protected $count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $count + * The number of backups to retain. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The number of backups to retain. + * + * Generated from protobuf field int32 count = 1; + * @return int + */ + public function getCount() + { + return $this->count; + } + + /** + * The number of backups to retain. + * + * Generated from protobuf field int32 count = 1; + * @param int $var + * @return $this + */ + public function setCount($var) + { + GPBUtil::checkInt32($var); + $this->count = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1alpha/AutomatedBackupPolicy/TimeBasedRetention.php b/AlloyDb/src/V1alpha/AutomatedBackupPolicy/TimeBasedRetention.php new file mode 100644 index 000000000000..22171d8a9175 --- /dev/null +++ b/AlloyDb/src/V1alpha/AutomatedBackupPolicy/TimeBasedRetention.php @@ -0,0 +1,79 @@ +google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention + */ +class TimeBasedRetention extends \Google\Protobuf\Internal\Message +{ + /** + * The retention period. + * + * Generated from protobuf field .google.protobuf.Duration retention_period = 1; + */ + protected $retention_period = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $retention_period + * The retention period. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The retention period. + * + * Generated from protobuf field .google.protobuf.Duration retention_period = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getRetentionPeriod() + { + return $this->retention_period; + } + + public function hasRetentionPeriod() + { + return isset($this->retention_period); + } + + public function clearRetentionPeriod() + { + unset($this->retention_period); + } + + /** + * The retention period. + * + * Generated from protobuf field .google.protobuf.Duration retention_period = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setRetentionPeriod($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->retention_period = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1alpha/AutomatedBackupPolicy/WeeklySchedule.php b/AlloyDb/src/V1alpha/AutomatedBackupPolicy/WeeklySchedule.php new file mode 100644 index 000000000000..81189e8fca18 --- /dev/null +++ b/AlloyDb/src/V1alpha/AutomatedBackupPolicy/WeeklySchedule.php @@ -0,0 +1,127 @@ +google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule + */ +class WeeklySchedule extends \Google\Protobuf\Internal\Message +{ + /** + * The times during the day to start a backup. The start times are assumed + * to be in UTC and to be an exact hour (e.g., 04:00:00). + * If no start times are provided, a single fixed start time is chosen + * arbitrarily. + * + * Generated from protobuf field repeated .google.type.TimeOfDay start_times = 1; + */ + private $start_times; + /** + * The days of the week to perform a backup. + * If this field is left empty, the default of every day of the week is + * used. + * + * Generated from protobuf field repeated .google.type.DayOfWeek days_of_week = 2; + */ + private $days_of_week; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Type\TimeOfDay>|\Google\Protobuf\Internal\RepeatedField $start_times + * The times during the day to start a backup. The start times are assumed + * to be in UTC and to be an exact hour (e.g., 04:00:00). + * If no start times are provided, a single fixed start time is chosen + * arbitrarily. + * @type array|\Google\Protobuf\Internal\RepeatedField $days_of_week + * The days of the week to perform a backup. + * If this field is left empty, the default of every day of the week is + * used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The times during the day to start a backup. The start times are assumed + * to be in UTC and to be an exact hour (e.g., 04:00:00). + * If no start times are provided, a single fixed start time is chosen + * arbitrarily. + * + * Generated from protobuf field repeated .google.type.TimeOfDay start_times = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStartTimes() + { + return $this->start_times; + } + + /** + * The times during the day to start a backup. The start times are assumed + * to be in UTC and to be an exact hour (e.g., 04:00:00). + * If no start times are provided, a single fixed start time is chosen + * arbitrarily. + * + * Generated from protobuf field repeated .google.type.TimeOfDay start_times = 1; + * @param array<\Google\Type\TimeOfDay>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStartTimes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Type\TimeOfDay::class); + $this->start_times = $arr; + + return $this; + } + + /** + * The days of the week to perform a backup. + * If this field is left empty, the default of every day of the week is + * used. + * + * Generated from protobuf field repeated .google.type.DayOfWeek days_of_week = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDaysOfWeek() + { + return $this->days_of_week; + } + + /** + * The days of the week to perform a backup. + * If this field is left empty, the default of every day of the week is + * used. + * + * Generated from protobuf field repeated .google.type.DayOfWeek days_of_week = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDaysOfWeek($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Type\DayOfWeek::class); + $this->days_of_week = $arr; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1alpha/Backup.php b/AlloyDb/src/V1alpha/Backup.php new file mode 100644 index 000000000000..9e43929f52b5 --- /dev/null +++ b/AlloyDb/src/V1alpha/Backup.php @@ -0,0 +1,823 @@ +google.cloud.alloydb.v1alpha.Backup + */ +class Backup extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * where the cluster and backup ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the backup resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * User-settable and human-readable display name for the Backup. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. Create time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $delete_time = null; + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 6; + */ + private $labels; + /** + * Output only. The current state of the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Backup.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * The backup type, which suggests the trigger for the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Backup.Type type = 8; + */ + protected $type = 0; + /** + * User-provided description of the backup. + * + * Generated from protobuf field string description = 9; + */ + protected $description = ''; + /** + * Output only. The system-generated UID of the cluster which was used to + * create this resource. + * + * Generated from protobuf field string cluster_uid = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $cluster_uid = ''; + /** + * Required. The full resource name of the backup source cluster + * (e.g., projects//locations//clusters/). + * + * Generated from protobuf field string cluster_name = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $cluster_name = ''; + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation), if + * true, indicates that the service is actively updating the resource. This + * can happen due to user-triggered updates or system actions like failover or + * maintenance. + * + * Generated from protobuf field bool reconciling = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reconciling = false; + /** + * Optional. The encryption config can be specified to encrypt the + * backup with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $encryption_config = null; + /** + * Output only. The encryption information for the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionInfo encryption_info = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $encryption_info = null; + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 14; + */ + protected $etag = ''; + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 16; + */ + private $annotations; + /** + * Output only. The size of the backup in bytes. + * + * Generated from protobuf field int64 size_bytes = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $size_bytes = 0; + /** + * Output only. The time at which after the backup is eligible to be garbage + * collected. It is the duration specified by the backup's retention policy, + * added to the backup's create_time. + * + * Generated from protobuf field .google.protobuf.Timestamp expiry_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $expiry_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * where the cluster and backup ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the backup resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region} + * @type string $display_name + * User-settable and human-readable display name for the Backup. + * @type string $uid + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Create time stamp + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Update time stamp + * @type \Google\Protobuf\Timestamp $delete_time + * Output only. Delete time stamp + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels as key value pairs + * @type int $state + * Output only. The current state of the backup. + * @type int $type + * The backup type, which suggests the trigger for the backup. + * @type string $description + * User-provided description of the backup. + * @type string $cluster_uid + * Output only. The system-generated UID of the cluster which was used to + * create this resource. + * @type string $cluster_name + * Required. The full resource name of the backup source cluster + * (e.g., projects//locations//clusters/). + * @type bool $reconciling + * Output only. Reconciling (https://google.aip.dev/128#reconciliation), if + * true, indicates that the service is actively updating the resource. This + * can happen due to user-triggered updates or system actions like failover or + * maintenance. + * @type \Google\Cloud\AlloyDb\V1alpha\EncryptionConfig $encryption_config + * Optional. The encryption config can be specified to encrypt the + * backup with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * @type \Google\Cloud\AlloyDb\V1alpha\EncryptionInfo $encryption_info + * Output only. The encryption information for the backup. + * @type string $etag + * For Resource freshness validation (https://google.aip.dev/154) + * @type array|\Google\Protobuf\Internal\MapField $annotations + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * @type int|string $size_bytes + * Output only. The size of the backup in bytes. + * @type \Google\Protobuf\Timestamp $expiry_time + * Output only. The time at which after the backup is eligible to be garbage + * collected. It is the duration specified by the backup's retention policy, + * added to the backup's create_time. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * where the cluster and backup ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the backup resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region} + * + * 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 backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * where the cluster and backup ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the backup resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region} + * + * 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; + } + + /** + * User-settable and human-readable display name for the Backup. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * User-settable and human-readable display name for the Backup. + * + * 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. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. Create time stamp + * + * 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. Create time stamp + * + * 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. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getDeleteTime() + { + return $this->delete_time; + } + + public function hasDeleteTime() + { + return isset($this->delete_time); + } + + public function clearDeleteTime() + { + unset($this->delete_time); + } + + /** + * Output only. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setDeleteTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->delete_time = $var; + + return $this; + } + + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 6; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 6; + * @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 current state of the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Backup.State state = 7 [(.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.cloud.alloydb.v1alpha.Backup.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1alpha\Backup\State::class); + $this->state = $var; + + return $this; + } + + /** + * The backup type, which suggests the trigger for the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Backup.Type type = 8; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The backup type, which suggests the trigger for the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Backup.Type type = 8; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1alpha\Backup\Type::class); + $this->type = $var; + + return $this; + } + + /** + * User-provided description of the backup. + * + * Generated from protobuf field string description = 9; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User-provided description of the backup. + * + * Generated from protobuf field string description = 9; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. The system-generated UID of the cluster which was used to + * create this resource. + * + * Generated from protobuf field string cluster_uid = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getClusterUid() + { + return $this->cluster_uid; + } + + /** + * Output only. The system-generated UID of the cluster which was used to + * create this resource. + * + * Generated from protobuf field string cluster_uid = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setClusterUid($var) + { + GPBUtil::checkString($var, True); + $this->cluster_uid = $var; + + return $this; + } + + /** + * Required. The full resource name of the backup source cluster + * (e.g., projects//locations//clusters/). + * + * Generated from protobuf field string cluster_name = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getClusterName() + { + return $this->cluster_name; + } + + /** + * Required. The full resource name of the backup source cluster + * (e.g., projects//locations//clusters/). + * + * Generated from protobuf field string cluster_name = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setClusterName($var) + { + GPBUtil::checkString($var, True); + $this->cluster_name = $var; + + return $this; + } + + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation), if + * true, indicates that the service is actively updating the resource. This + * can happen due to user-triggered updates or system actions like failover or + * maintenance. + * + * Generated from protobuf field bool reconciling = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getReconciling() + { + return $this->reconciling; + } + + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation), if + * true, indicates that the service is actively updating the resource. This + * can happen due to user-triggered updates or system actions like failover or + * maintenance. + * + * Generated from protobuf field bool reconciling = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setReconciling($var) + { + GPBUtil::checkBool($var); + $this->reconciling = $var; + + return $this; + } + + /** + * Optional. The encryption config can be specified to encrypt the + * backup with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\AlloyDb\V1alpha\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 config can be specified to encrypt the + * backup with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\AlloyDb\V1alpha\EncryptionConfig $var + * @return $this + */ + public function setEncryptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\EncryptionConfig::class); + $this->encryption_config = $var; + + return $this; + } + + /** + * Output only. The encryption information for the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionInfo encryption_info = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1alpha\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.cloud.alloydb.v1alpha.EncryptionInfo encryption_info = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1alpha\EncryptionInfo $var + * @return $this + */ + public function setEncryptionInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\EncryptionInfo::class); + $this->encryption_info = $var; + + return $this; + } + + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 14; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 14; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 16; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 16; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + + /** + * Output only. The size of the backup in bytes. + * + * Generated from protobuf field int64 size_bytes = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getSizeBytes() + { + return $this->size_bytes; + } + + /** + * Output only. The size of the backup in bytes. + * + * Generated from protobuf field int64 size_bytes = 17 [(.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 time at which after the backup is eligible to be garbage + * collected. It is the duration specified by the backup's retention policy, + * added to the backup's create_time. + * + * Generated from protobuf field .google.protobuf.Timestamp expiry_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExpiryTime() + { + return $this->expiry_time; + } + + public function hasExpiryTime() + { + return isset($this->expiry_time); + } + + public function clearExpiryTime() + { + unset($this->expiry_time); + } + + /** + * Output only. The time at which after the backup is eligible to be garbage + * collected. It is the duration specified by the backup's retention policy, + * added to the backup's create_time. + * + * Generated from protobuf field .google.protobuf.Timestamp expiry_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExpiryTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->expiry_time = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/Backup/State.php b/AlloyDb/src/V1alpha/Backup/State.php new file mode 100644 index 000000000000..6bfc2e5b619d --- /dev/null +++ b/AlloyDb/src/V1alpha/Backup/State.php @@ -0,0 +1,76 @@ +google.cloud.alloydb.v1alpha.Backup.State + */ +class State +{ + /** + * The state of the backup is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The backup is ready. + * + * Generated from protobuf enum READY = 1; + */ + const READY = 1; + /** + * The backup is creating. + * + * Generated from protobuf enum CREATING = 2; + */ + const CREATING = 2; + /** + * The backup failed. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * The backup is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::READY => 'READY', + self::CREATING => 'CREATING', + self::FAILED => 'FAILED', + self::DELETING => 'DELETING', + ]; + + 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/AlloyDb/src/V1alpha/Backup/Type.php b/AlloyDb/src/V1alpha/Backup/Type.php new file mode 100644 index 000000000000..d55cc516a091 --- /dev/null +++ b/AlloyDb/src/V1alpha/Backup/Type.php @@ -0,0 +1,72 @@ +google.cloud.alloydb.v1alpha.Backup.Type + */ +class Type +{ + /** + * Backup Type is unknown. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * ON_DEMAND backups that were triggered by the customer (e.g., not + * AUTOMATED). + * + * Generated from protobuf enum ON_DEMAND = 1; + */ + const ON_DEMAND = 1; + /** + * AUTOMATED backups triggered by the automated backups scheduler pursuant + * to an automated backup policy. + * + * Generated from protobuf enum AUTOMATED = 2; + */ + const AUTOMATED = 2; + /** + * CONTINUOUS backups triggered by the automated backups scheduler + * due to a continuous backup policy. + * + * Generated from protobuf enum CONTINUOUS = 3; + */ + const CONTINUOUS = 3; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::ON_DEMAND => 'ON_DEMAND', + self::AUTOMATED => 'AUTOMATED', + self::CONTINUOUS => 'CONTINUOUS', + ]; + + 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/AlloyDb/src/V1alpha/BackupSource.php b/AlloyDb/src/V1alpha/BackupSource.php new file mode 100644 index 000000000000..849d85f34994 --- /dev/null +++ b/AlloyDb/src/V1alpha/BackupSource.php @@ -0,0 +1,113 @@ +google.cloud.alloydb.v1alpha.BackupSource + */ +class BackupSource extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The system-generated UID of the backup which was used to + * create this resource. The UID is generated when the backup is created, and + * it is retained until the backup is deleted. + * + * Generated from protobuf field string backup_uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $backup_uid = ''; + /** + * Required. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * + * Generated from protobuf field string backup_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $backup_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $backup_uid + * Output only. The system-generated UID of the backup which was used to + * create this resource. The UID is generated when the backup is created, and + * it is retained until the backup is deleted. + * @type string $backup_name + * Required. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The system-generated UID of the backup which was used to + * create this resource. The UID is generated when the backup is created, and + * it is retained until the backup is deleted. + * + * Generated from protobuf field string backup_uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getBackupUid() + { + return $this->backup_uid; + } + + /** + * Output only. The system-generated UID of the backup which was used to + * create this resource. The UID is generated when the backup is created, and + * it is retained until the backup is deleted. + * + * Generated from protobuf field string backup_uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setBackupUid($var) + { + GPBUtil::checkString($var, True); + $this->backup_uid = $var; + + return $this; + } + + /** + * Required. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * + * Generated from protobuf field string backup_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getBackupName() + { + return $this->backup_name; + } + + /** + * Required. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * + * Generated from protobuf field string backup_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setBackupName($var) + { + GPBUtil::checkString($var, True); + $this->backup_name = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/BatchCreateInstanceStatus.php b/AlloyDb/src/V1alpha/BatchCreateInstanceStatus.php new file mode 100644 index 000000000000..52ed601803b8 --- /dev/null +++ b/AlloyDb/src/V1alpha/BatchCreateInstanceStatus.php @@ -0,0 +1,221 @@ +google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus + */ +class BatchCreateInstanceStatus extends \Google\Protobuf\Internal\Message +{ + /** + * The current state of an instance involved in the batch create operation. + * Once the operation is complete, the final state of the instances in the + * LRO can be one of: + * 1. ACTIVE, indicating that instances were created successfully + * 2. FAILED, indicating that a particular instance failed creation + * 3. ROLLED_BACK indicating that although the instance was created + * successfully, it had to be rolled back and deleted due to failure in + * other steps of the workflow. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus.State state = 1; + */ + protected $state = 0; + /** + * DEPRECATED - Use the error field instead. + * Error, if any error occurred and is available, during instance creation. + * + * Generated from protobuf field string error_msg = 2; + */ + protected $error_msg = ''; + /** + * The RPC status of the instance creation operation. This field will be + * present if an error happened during the instance creation. + * + * Generated from protobuf field .google.rpc.Status error = 4; + */ + protected $error = null; + /** + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.InstanceType type = 3; + */ + protected $type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * The current state of an instance involved in the batch create operation. + * Once the operation is complete, the final state of the instances in the + * LRO can be one of: + * 1. ACTIVE, indicating that instances were created successfully + * 2. FAILED, indicating that a particular instance failed creation + * 3. ROLLED_BACK indicating that although the instance was created + * successfully, it had to be rolled back and deleted due to failure in + * other steps of the workflow. + * @type string $error_msg + * DEPRECATED - Use the error field instead. + * Error, if any error occurred and is available, during instance creation. + * @type \Google\Rpc\Status $error + * The RPC status of the instance creation operation. This field will be + * present if an error happened during the instance creation. + * @type int $type + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * The current state of an instance involved in the batch create operation. + * Once the operation is complete, the final state of the instances in the + * LRO can be one of: + * 1. ACTIVE, indicating that instances were created successfully + * 2. FAILED, indicating that a particular instance failed creation + * 3. ROLLED_BACK indicating that although the instance was created + * successfully, it had to be rolled back and deleted due to failure in + * other steps of the workflow. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The current state of an instance involved in the batch create operation. + * Once the operation is complete, the final state of the instances in the + * LRO can be one of: + * 1. ACTIVE, indicating that instances were created successfully + * 2. FAILED, indicating that a particular instance failed creation + * 3. ROLLED_BACK indicating that although the instance was created + * successfully, it had to be rolled back and deleted due to failure in + * other steps of the workflow. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1alpha\BatchCreateInstanceStatus\State::class); + $this->state = $var; + + return $this; + } + + /** + * DEPRECATED - Use the error field instead. + * Error, if any error occurred and is available, during instance creation. + * + * Generated from protobuf field string error_msg = 2; + * @return string + */ + public function getErrorMsg() + { + return $this->error_msg; + } + + /** + * DEPRECATED - Use the error field instead. + * Error, if any error occurred and is available, during instance creation. + * + * Generated from protobuf field string error_msg = 2; + * @param string $var + * @return $this + */ + public function setErrorMsg($var) + { + GPBUtil::checkString($var, True); + $this->error_msg = $var; + + return $this; + } + + /** + * The RPC status of the instance creation operation. This field will be + * present if an error happened during the instance creation. + * + * Generated from protobuf field .google.rpc.Status error = 4; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * The RPC status of the instance creation operation. This field will be + * present if an error happened during the instance creation. + * + * Generated from protobuf field .google.rpc.Status error = 4; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.InstanceType type = 3; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.InstanceType type = 3; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1alpha\Instance\InstanceType::class); + $this->type = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/BatchCreateInstanceStatus/State.php b/AlloyDb/src/V1alpha/BatchCreateInstanceStatus/State.php new file mode 100644 index 000000000000..bd632771ec5f --- /dev/null +++ b/AlloyDb/src/V1alpha/BatchCreateInstanceStatus/State.php @@ -0,0 +1,95 @@ +google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus.State + */ +class State +{ + /** + * The state of the instance is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Instance is pending creation and has not yet been picked up for + * processsing in the backend. + * + * Generated from protobuf enum PENDING_CREATE = 1; + */ + const PENDING_CREATE = 1; + /** + * The instance is active and running. + * + * Generated from protobuf enum READY = 2; + */ + const READY = 2; + /** + * The instance is being created. + * + * Generated from protobuf enum CREATING = 3; + */ + const CREATING = 3; + /** + * The instance is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + /** + * The creation of the instance failed or a fatal error occurred during + * an operation on the instance or a batch of instances. + * + * Generated from protobuf enum FAILED = 5; + */ + const FAILED = 5; + /** + * The instance was created successfully, but was rolled back and deleted + * due to some other failure during BatchCreateInstances operation. + * + * Generated from protobuf enum ROLLED_BACK = 6; + */ + const ROLLED_BACK = 6; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::PENDING_CREATE => 'PENDING_CREATE', + self::READY => 'READY', + self::CREATING => 'CREATING', + self::DELETING => 'DELETING', + self::FAILED => 'FAILED', + self::ROLLED_BACK => 'ROLLED_BACK', + ]; + + 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/AlloyDb/src/V1alpha/BatchCreateInstancesMetadata.php b/AlloyDb/src/V1alpha/BatchCreateInstancesMetadata.php new file mode 100644 index 000000000000..0743f28b0823 --- /dev/null +++ b/AlloyDb/src/V1alpha/BatchCreateInstancesMetadata.php @@ -0,0 +1,133 @@ +google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata + */ +class BatchCreateInstancesMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The instances being created in the API call. Each string in this list + * is the server defined resource path for target instances in the request + * and for the format of each string, see the comment on the Instance.name + * field. + * + * Generated from protobuf field repeated string instance_targets = 1; + */ + private $instance_targets; + /** + * A map representing state of the instances involved in the + * BatchCreateInstances operation during the operation execution. + * The instance state will be in STATE_UNSPECIFIED state if the instance has + * not yet been picked up for processing. + * The key of the map is the name of the instance resource. + * For the format, see the comment on the Instance.name field. + * + * Generated from protobuf field map instance_statuses = 2; + */ + private $instance_statuses; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $instance_targets + * The instances being created in the API call. Each string in this list + * is the server defined resource path for target instances in the request + * and for the format of each string, see the comment on the Instance.name + * field. + * @type array|\Google\Protobuf\Internal\MapField $instance_statuses + * A map representing state of the instances involved in the + * BatchCreateInstances operation during the operation execution. + * The instance state will be in STATE_UNSPECIFIED state if the instance has + * not yet been picked up for processing. + * The key of the map is the name of the instance resource. + * For the format, see the comment on the Instance.name field. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * The instances being created in the API call. Each string in this list + * is the server defined resource path for target instances in the request + * and for the format of each string, see the comment on the Instance.name + * field. + * + * Generated from protobuf field repeated string instance_targets = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInstanceTargets() + { + return $this->instance_targets; + } + + /** + * The instances being created in the API call. Each string in this list + * is the server defined resource path for target instances in the request + * and for the format of each string, see the comment on the Instance.name + * field. + * + * Generated from protobuf field repeated string instance_targets = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInstanceTargets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->instance_targets = $arr; + + return $this; + } + + /** + * A map representing state of the instances involved in the + * BatchCreateInstances operation during the operation execution. + * The instance state will be in STATE_UNSPECIFIED state if the instance has + * not yet been picked up for processing. + * The key of the map is the name of the instance resource. + * For the format, see the comment on the Instance.name field. + * + * Generated from protobuf field map instance_statuses = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getInstanceStatuses() + { + return $this->instance_statuses; + } + + /** + * A map representing state of the instances involved in the + * BatchCreateInstances operation during the operation execution. + * The instance state will be in STATE_UNSPECIFIED state if the instance has + * not yet been picked up for processing. + * The key of the map is the name of the instance resource. + * For the format, see the comment on the Instance.name field. + * + * Generated from protobuf field map instance_statuses = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setInstanceStatuses($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1alpha\BatchCreateInstanceStatus::class); + $this->instance_statuses = $arr; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/BatchCreateInstancesRequest.php b/AlloyDb/src/V1alpha/BatchCreateInstancesRequest.php new file mode 100644 index 000000000000..89e196065983 --- /dev/null +++ b/AlloyDb/src/V1alpha/BatchCreateInstancesRequest.php @@ -0,0 +1,185 @@ +google.cloud.alloydb.v1alpha.BatchCreateInstancesRequest + */ +class BatchCreateInstancesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Resources being created. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.CreateInstanceRequests requests = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $requests = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. + * @type \Google\Cloud\AlloyDb\V1alpha\CreateInstanceRequests $requests + * Required. Resources being created. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. + * + * 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 parent resource. + * + * 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. Resources being created. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.CreateInstanceRequests requests = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1alpha\CreateInstanceRequests|null + */ + public function getRequests() + { + return $this->requests; + } + + public function hasRequests() + { + return isset($this->requests); + } + + public function clearRequests() + { + unset($this->requests); + } + + /** + * Required. Resources being created. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.CreateInstanceRequests requests = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1alpha\CreateInstanceRequests $var + * @return $this + */ + public function setRequests($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\CreateInstanceRequests::class); + $this->requests = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/BatchCreateInstancesResponse.php b/AlloyDb/src/V1alpha/BatchCreateInstancesResponse.php new file mode 100644 index 000000000000..7ca68670a4de --- /dev/null +++ b/AlloyDb/src/V1alpha/BatchCreateInstancesResponse.php @@ -0,0 +1,67 @@ +google.cloud.alloydb.v1alpha.BatchCreateInstancesResponse + */ +class BatchCreateInstancesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Created instances. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.Instance instances = 1; + */ + private $instances; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\AlloyDb\V1alpha\Instance>|\Google\Protobuf\Internal\RepeatedField $instances + * Created instances. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Created instances. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.Instance instances = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInstances() + { + return $this->instances; + } + + /** + * Created instances. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.Instance instances = 1; + * @param array<\Google\Cloud\AlloyDb\V1alpha\Instance>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInstances($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1alpha\Instance::class); + $this->instances = $arr; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/Cluster.php b/AlloyDb/src/V1alpha/Cluster.php new file mode 100644 index 000000000000..71473624033e --- /dev/null +++ b/AlloyDb/src/V1alpha/Cluster.php @@ -0,0 +1,1136 @@ +google.cloud.alloydb.v1alpha.Cluster + */ +class Cluster extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the cluster resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * where the cluster ID segment should satisfy the regex expression + * `[a-z0-9-]+`. For more details see https://google.aip.dev/122. + * The prefix of the cluster resource name is the name of the parent resource: + * * projects/{project}/locations/{region} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * User-settable and human-readable display name for the Cluster. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. Create time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $delete_time = null; + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 7; + */ + private $labels; + /** + * Output only. The current serving state of the cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The type of the cluster. This is an output-only field and it's + * populated at the Cluster creation time or the Cluster promotion + * time. The cluster type is determined by which RPC was used to create + * the cluster (i.e. `CreateCluster` vs. `CreateSecondaryCluster` + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster.ClusterType cluster_type = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $cluster_type = 0; + /** + * Output only. The database engine major version. This is an output-only + * field and it's populated at the Cluster creation time. This field cannot be + * changed after cluster creation. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.DatabaseVersion database_version = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $database_version = 0; + /** + * Required. The resource link for the VPC network in which cluster resources + * are created and from which they are accessible via Private IP. The network + * must belong to the same project as the cluster. It is specified in the + * form: "projects/{project_number}/global/networks/{network_id}". This is + * required to create a cluster. It can be updated, but it cannot be removed. + * + * Generated from protobuf field string network = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $network = ''; + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 11; + */ + protected $etag = ''; + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 12; + */ + private $annotations; + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Cluster does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * + * Generated from protobuf field bool reconciling = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reconciling = false; + /** + * Input only. Initial user to setup during cluster creation. Required. + * If used in `RestoreCluster` this is ignored. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.UserPassword initial_user = 14 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $initial_user = null; + /** + * The automated backup policy for this cluster. + * If no policy is provided then the default policy will be used. If backups + * are supported for the cluster, the default policy takes one backup a day, + * has a backup window of 1 hour, and retains backups for 14 days. + * For more information on the defaults, consult the + * documentation for the message type. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy automated_backup_policy = 17; + */ + protected $automated_backup_policy = null; + /** + * SSL configuration for this AlloyDB Cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.SslConfig ssl_config = 18; + */ + protected $ssl_config = null; + /** + * Optional. The encryption config can be specified to encrypt the data disks + * and other persistent data resources of a cluster with a + * customer-managed encryption key (CMEK). When this field is not + * specified, the cluster will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 19 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $encryption_config = null; + /** + * Output only. The encryption information for the cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionInfo encryption_info = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $encryption_info = null; + /** + * Optional. Continuous backup configuration for this cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.ContinuousBackupConfig continuous_backup_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $continuous_backup_config = null; + /** + * Output only. Continuous backup properties for this cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.ContinuousBackupInfo continuous_backup_info = 28 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $continuous_backup_info = null; + /** + * Cross Region replication config specific to SECONDARY cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster.SecondaryConfig secondary_config = 22; + */ + protected $secondary_config = null; + /** + * Output only. Cross Region replication config specific to PRIMARY cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster.PrimaryConfig primary_config = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $primary_config = null; + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AlloyDb\V1alpha\BackupSource $backup_source + * Output only. Cluster created from backup. + * @type \Google\Cloud\AlloyDb\V1alpha\MigrationSource $migration_source + * Output only. Cluster created via DMS migration. + * @type string $name + * Output only. The name of the cluster resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * where the cluster ID segment should satisfy the regex expression + * `[a-z0-9-]+`. For more details see https://google.aip.dev/122. + * The prefix of the cluster resource name is the name of the parent resource: + * * projects/{project}/locations/{region} + * @type string $display_name + * User-settable and human-readable display name for the Cluster. + * @type string $uid + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Create time stamp + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Update time stamp + * @type \Google\Protobuf\Timestamp $delete_time + * Output only. Delete time stamp + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels as key value pairs + * @type int $state + * Output only. The current serving state of the cluster. + * @type int $cluster_type + * Output only. The type of the cluster. This is an output-only field and it's + * populated at the Cluster creation time or the Cluster promotion + * time. The cluster type is determined by which RPC was used to create + * the cluster (i.e. `CreateCluster` vs. `CreateSecondaryCluster` + * @type int $database_version + * Output only. The database engine major version. This is an output-only + * field and it's populated at the Cluster creation time. This field cannot be + * changed after cluster creation. + * @type string $network + * Required. The resource link for the VPC network in which cluster resources + * are created and from which they are accessible via Private IP. The network + * must belong to the same project as the cluster. It is specified in the + * form: "projects/{project_number}/global/networks/{network_id}". This is + * required to create a cluster. It can be updated, but it cannot be removed. + * @type string $etag + * For Resource freshness validation (https://google.aip.dev/154) + * @type array|\Google\Protobuf\Internal\MapField $annotations + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * @type bool $reconciling + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Cluster does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * @type \Google\Cloud\AlloyDb\V1alpha\UserPassword $initial_user + * Input only. Initial user to setup during cluster creation. Required. + * If used in `RestoreCluster` this is ignored. + * @type \Google\Cloud\AlloyDb\V1alpha\AutomatedBackupPolicy $automated_backup_policy + * The automated backup policy for this cluster. + * If no policy is provided then the default policy will be used. If backups + * are supported for the cluster, the default policy takes one backup a day, + * has a backup window of 1 hour, and retains backups for 14 days. + * For more information on the defaults, consult the + * documentation for the message type. + * @type \Google\Cloud\AlloyDb\V1alpha\SslConfig $ssl_config + * SSL configuration for this AlloyDB Cluster. + * @type \Google\Cloud\AlloyDb\V1alpha\EncryptionConfig $encryption_config + * Optional. The encryption config can be specified to encrypt the data disks + * and other persistent data resources of a cluster with a + * customer-managed encryption key (CMEK). When this field is not + * specified, the cluster will then use default encryption scheme to + * protect the user data. + * @type \Google\Cloud\AlloyDb\V1alpha\EncryptionInfo $encryption_info + * Output only. The encryption information for the cluster. + * @type \Google\Cloud\AlloyDb\V1alpha\ContinuousBackupConfig $continuous_backup_config + * Optional. Continuous backup configuration for this cluster. + * @type \Google\Cloud\AlloyDb\V1alpha\ContinuousBackupInfo $continuous_backup_info + * Output only. Continuous backup properties for this cluster. + * @type \Google\Cloud\AlloyDb\V1alpha\Cluster\SecondaryConfig $secondary_config + * Cross Region replication config specific to SECONDARY cluster. + * @type \Google\Cloud\AlloyDb\V1alpha\Cluster\PrimaryConfig $primary_config + * Output only. Cross Region replication config specific to PRIMARY cluster. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Cluster created from backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.BackupSource backup_source = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1alpha\BackupSource|null + */ + public function getBackupSource() + { + return $this->readOneof(15); + } + + public function hasBackupSource() + { + return $this->hasOneof(15); + } + + /** + * Output only. Cluster created from backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.BackupSource backup_source = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1alpha\BackupSource $var + * @return $this + */ + public function setBackupSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\BackupSource::class); + $this->writeOneof(15, $var); + + return $this; + } + + /** + * Output only. Cluster created via DMS migration. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.MigrationSource migration_source = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1alpha\MigrationSource|null + */ + public function getMigrationSource() + { + return $this->readOneof(16); + } + + public function hasMigrationSource() + { + return $this->hasOneof(16); + } + + /** + * Output only. Cluster created via DMS migration. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.MigrationSource migration_source = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1alpha\MigrationSource $var + * @return $this + */ + public function setMigrationSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\MigrationSource::class); + $this->writeOneof(16, $var); + + return $this; + } + + /** + * Output only. The name of the cluster resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * where the cluster ID segment should satisfy the regex expression + * `[a-z0-9-]+`. For more details see https://google.aip.dev/122. + * The prefix of the cluster resource name is the name of the parent resource: + * * projects/{project}/locations/{region} + * + * 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 cluster resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * where the cluster ID segment should satisfy the regex expression + * `[a-z0-9-]+`. For more details see https://google.aip.dev/122. + * The prefix of the cluster resource name is the name of the parent resource: + * * projects/{project}/locations/{region} + * + * 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; + } + + /** + * User-settable and human-readable display name for the Cluster. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * User-settable and human-readable display name for the Cluster. + * + * 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. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. Create time stamp + * + * 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. Create time stamp + * + * 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. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getDeleteTime() + { + return $this->delete_time; + } + + public function hasDeleteTime() + { + return isset($this->delete_time); + } + + public function clearDeleteTime() + { + unset($this->delete_time); + } + + /** + * Output only. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setDeleteTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->delete_time = $var; + + return $this; + } + + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 7; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels as key value pairs + * + * 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; + } + + /** + * Output only. The current serving state of the cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current serving state of the cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1alpha\Cluster\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The type of the cluster. This is an output-only field and it's + * populated at the Cluster creation time or the Cluster promotion + * time. The cluster type is determined by which RPC was used to create + * the cluster (i.e. `CreateCluster` vs. `CreateSecondaryCluster` + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster.ClusterType cluster_type = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getClusterType() + { + return $this->cluster_type; + } + + /** + * Output only. The type of the cluster. This is an output-only field and it's + * populated at the Cluster creation time or the Cluster promotion + * time. The cluster type is determined by which RPC was used to create + * the cluster (i.e. `CreateCluster` vs. `CreateSecondaryCluster` + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster.ClusterType cluster_type = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setClusterType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1alpha\Cluster\ClusterType::class); + $this->cluster_type = $var; + + return $this; + } + + /** + * Output only. The database engine major version. This is an output-only + * field and it's populated at the Cluster creation time. This field cannot be + * changed after cluster creation. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.DatabaseVersion database_version = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getDatabaseVersion() + { + return $this->database_version; + } + + /** + * Output only. The database engine major version. This is an output-only + * field and it's populated at the Cluster creation time. This field cannot be + * changed after cluster creation. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.DatabaseVersion database_version = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setDatabaseVersion($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1alpha\DatabaseVersion::class); + $this->database_version = $var; + + return $this; + } + + /** + * Required. The resource link for the VPC network in which cluster resources + * are created and from which they are accessible via Private IP. The network + * must belong to the same project as the cluster. It is specified in the + * form: "projects/{project_number}/global/networks/{network_id}". This is + * required to create a cluster. It can be updated, but it cannot be removed. + * + * Generated from protobuf field string network = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getNetwork() + { + return $this->network; + } + + /** + * Required. The resource link for the VPC network in which cluster resources + * are created and from which they are accessible via Private IP. The network + * must belong to the same project as the cluster. It is specified in the + * form: "projects/{project_number}/global/networks/{network_id}". This is + * required to create a cluster. It can be updated, but it cannot be removed. + * + * Generated from protobuf field string network = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setNetwork($var) + { + GPBUtil::checkString($var, True); + $this->network = $var; + + return $this; + } + + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 11; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 11; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 12; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 12; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Cluster does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * + * Generated from protobuf field bool reconciling = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getReconciling() + { + return $this->reconciling; + } + + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Cluster does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * + * Generated from protobuf field bool reconciling = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setReconciling($var) + { + GPBUtil::checkBool($var); + $this->reconciling = $var; + + return $this; + } + + /** + * Input only. Initial user to setup during cluster creation. Required. + * If used in `RestoreCluster` this is ignored. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.UserPassword initial_user = 14 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1alpha\UserPassword|null + */ + public function getInitialUser() + { + return $this->initial_user; + } + + public function hasInitialUser() + { + return isset($this->initial_user); + } + + public function clearInitialUser() + { + unset($this->initial_user); + } + + /** + * Input only. Initial user to setup during cluster creation. Required. + * If used in `RestoreCluster` this is ignored. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.UserPassword initial_user = 14 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1alpha\UserPassword $var + * @return $this + */ + public function setInitialUser($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\UserPassword::class); + $this->initial_user = $var; + + return $this; + } + + /** + * The automated backup policy for this cluster. + * If no policy is provided then the default policy will be used. If backups + * are supported for the cluster, the default policy takes one backup a day, + * has a backup window of 1 hour, and retains backups for 14 days. + * For more information on the defaults, consult the + * documentation for the message type. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy automated_backup_policy = 17; + * @return \Google\Cloud\AlloyDb\V1alpha\AutomatedBackupPolicy|null + */ + public function getAutomatedBackupPolicy() + { + return $this->automated_backup_policy; + } + + public function hasAutomatedBackupPolicy() + { + return isset($this->automated_backup_policy); + } + + public function clearAutomatedBackupPolicy() + { + unset($this->automated_backup_policy); + } + + /** + * The automated backup policy for this cluster. + * If no policy is provided then the default policy will be used. If backups + * are supported for the cluster, the default policy takes one backup a day, + * has a backup window of 1 hour, and retains backups for 14 days. + * For more information on the defaults, consult the + * documentation for the message type. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy automated_backup_policy = 17; + * @param \Google\Cloud\AlloyDb\V1alpha\AutomatedBackupPolicy $var + * @return $this + */ + public function setAutomatedBackupPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\AutomatedBackupPolicy::class); + $this->automated_backup_policy = $var; + + return $this; + } + + /** + * SSL configuration for this AlloyDB Cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.SslConfig ssl_config = 18; + * @return \Google\Cloud\AlloyDb\V1alpha\SslConfig|null + */ + public function getSslConfig() + { + return $this->ssl_config; + } + + public function hasSslConfig() + { + return isset($this->ssl_config); + } + + public function clearSslConfig() + { + unset($this->ssl_config); + } + + /** + * SSL configuration for this AlloyDB Cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.SslConfig ssl_config = 18; + * @param \Google\Cloud\AlloyDb\V1alpha\SslConfig $var + * @return $this + */ + public function setSslConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\SslConfig::class); + $this->ssl_config = $var; + + return $this; + } + + /** + * Optional. The encryption config can be specified to encrypt the data disks + * and other persistent data resources of a cluster with a + * customer-managed encryption key (CMEK). When this field is not + * specified, the cluster will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 19 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\AlloyDb\V1alpha\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 config can be specified to encrypt the data disks + * and other persistent data resources of a cluster with a + * customer-managed encryption key (CMEK). When this field is not + * specified, the cluster will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 19 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\AlloyDb\V1alpha\EncryptionConfig $var + * @return $this + */ + public function setEncryptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\EncryptionConfig::class); + $this->encryption_config = $var; + + return $this; + } + + /** + * Output only. The encryption information for the cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionInfo encryption_info = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1alpha\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 cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionInfo encryption_info = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1alpha\EncryptionInfo $var + * @return $this + */ + public function setEncryptionInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\EncryptionInfo::class); + $this->encryption_info = $var; + + return $this; + } + + /** + * Optional. Continuous backup configuration for this cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.ContinuousBackupConfig continuous_backup_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\AlloyDb\V1alpha\ContinuousBackupConfig|null + */ + public function getContinuousBackupConfig() + { + return $this->continuous_backup_config; + } + + public function hasContinuousBackupConfig() + { + return isset($this->continuous_backup_config); + } + + public function clearContinuousBackupConfig() + { + unset($this->continuous_backup_config); + } + + /** + * Optional. Continuous backup configuration for this cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.ContinuousBackupConfig continuous_backup_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\AlloyDb\V1alpha\ContinuousBackupConfig $var + * @return $this + */ + public function setContinuousBackupConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\ContinuousBackupConfig::class); + $this->continuous_backup_config = $var; + + return $this; + } + + /** + * Output only. Continuous backup properties for this cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.ContinuousBackupInfo continuous_backup_info = 28 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1alpha\ContinuousBackupInfo|null + */ + public function getContinuousBackupInfo() + { + return $this->continuous_backup_info; + } + + public function hasContinuousBackupInfo() + { + return isset($this->continuous_backup_info); + } + + public function clearContinuousBackupInfo() + { + unset($this->continuous_backup_info); + } + + /** + * Output only. Continuous backup properties for this cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.ContinuousBackupInfo continuous_backup_info = 28 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1alpha\ContinuousBackupInfo $var + * @return $this + */ + public function setContinuousBackupInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\ContinuousBackupInfo::class); + $this->continuous_backup_info = $var; + + return $this; + } + + /** + * Cross Region replication config specific to SECONDARY cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster.SecondaryConfig secondary_config = 22; + * @return \Google\Cloud\AlloyDb\V1alpha\Cluster\SecondaryConfig|null + */ + public function getSecondaryConfig() + { + return $this->secondary_config; + } + + public function hasSecondaryConfig() + { + return isset($this->secondary_config); + } + + public function clearSecondaryConfig() + { + unset($this->secondary_config); + } + + /** + * Cross Region replication config specific to SECONDARY cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster.SecondaryConfig secondary_config = 22; + * @param \Google\Cloud\AlloyDb\V1alpha\Cluster\SecondaryConfig $var + * @return $this + */ + public function setSecondaryConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\Cluster\SecondaryConfig::class); + $this->secondary_config = $var; + + return $this; + } + + /** + * Output only. Cross Region replication config specific to PRIMARY cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster.PrimaryConfig primary_config = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1alpha\Cluster\PrimaryConfig|null + */ + public function getPrimaryConfig() + { + return $this->primary_config; + } + + public function hasPrimaryConfig() + { + return isset($this->primary_config); + } + + public function clearPrimaryConfig() + { + unset($this->primary_config); + } + + /** + * Output only. Cross Region replication config specific to PRIMARY cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster.PrimaryConfig primary_config = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1alpha\Cluster\PrimaryConfig $var + * @return $this + */ + public function setPrimaryConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\Cluster\PrimaryConfig::class); + $this->primary_config = $var; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/AlloyDb/src/V1alpha/Cluster/ClusterType.php b/AlloyDb/src/V1alpha/Cluster/ClusterType.php new file mode 100644 index 000000000000..52ecdcffa3ec --- /dev/null +++ b/AlloyDb/src/V1alpha/Cluster/ClusterType.php @@ -0,0 +1,63 @@ +google.cloud.alloydb.v1alpha.Cluster.ClusterType + */ +class ClusterType +{ + /** + * The type of the cluster is unknown. + * + * Generated from protobuf enum CLUSTER_TYPE_UNSPECIFIED = 0; + */ + const CLUSTER_TYPE_UNSPECIFIED = 0; + /** + * Primary cluster that support read and write operations. + * + * Generated from protobuf enum PRIMARY = 1; + */ + const PRIMARY = 1; + /** + * Secondary cluster that is replicating from another region. + * This only supports read. + * + * Generated from protobuf enum SECONDARY = 2; + */ + const SECONDARY = 2; + + private static $valueToName = [ + self::CLUSTER_TYPE_UNSPECIFIED => 'CLUSTER_TYPE_UNSPECIFIED', + self::PRIMARY => 'PRIMARY', + self::SECONDARY => 'SECONDARY', + ]; + + 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/AlloyDb/src/V1alpha/Cluster/PrimaryConfig.php b/AlloyDb/src/V1alpha/Cluster/PrimaryConfig.php new file mode 100644 index 000000000000..7ece78da7e47 --- /dev/null +++ b/AlloyDb/src/V1alpha/Cluster/PrimaryConfig.php @@ -0,0 +1,74 @@ +google.cloud.alloydb.v1alpha.Cluster.PrimaryConfig + */ +class PrimaryConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Names of the clusters that are replicating from this + * cluster. + * + * Generated from protobuf field repeated string secondary_cluster_names = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $secondary_cluster_names; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $secondary_cluster_names + * Output only. Names of the clusters that are replicating from this + * cluster. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Names of the clusters that are replicating from this + * cluster. + * + * Generated from protobuf field repeated string secondary_cluster_names = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSecondaryClusterNames() + { + return $this->secondary_cluster_names; + } + + /** + * Output only. Names of the clusters that are replicating from this + * cluster. + * + * Generated from protobuf field repeated string secondary_cluster_names = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSecondaryClusterNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->secondary_cluster_names = $arr; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1alpha/Cluster/SecondaryConfig.php b/AlloyDb/src/V1alpha/Cluster/SecondaryConfig.php new file mode 100644 index 000000000000..9c355759b73e --- /dev/null +++ b/AlloyDb/src/V1alpha/Cluster/SecondaryConfig.php @@ -0,0 +1,73 @@ +google.cloud.alloydb.v1alpha.Cluster.SecondaryConfig + */ +class SecondaryConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the primary cluster name with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * + * Generated from protobuf field string primary_cluster_name = 1; + */ + protected $primary_cluster_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $primary_cluster_name + * The name of the primary cluster name with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The name of the primary cluster name with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * + * Generated from protobuf field string primary_cluster_name = 1; + * @return string + */ + public function getPrimaryClusterName() + { + return $this->primary_cluster_name; + } + + /** + * The name of the primary cluster name with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * + * Generated from protobuf field string primary_cluster_name = 1; + * @param string $var + * @return $this + */ + public function setPrimaryClusterName($var) + { + GPBUtil::checkString($var, True); + $this->primary_cluster_name = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1alpha/Cluster/State.php b/AlloyDb/src/V1alpha/Cluster/State.php new file mode 100644 index 000000000000..04400a6fcdd9 --- /dev/null +++ b/AlloyDb/src/V1alpha/Cluster/State.php @@ -0,0 +1,123 @@ +google.cloud.alloydb.v1alpha.Cluster.State + */ +class State +{ + /** + * The state of the cluster is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The cluster is active and running. + * + * Generated from protobuf enum READY = 1; + */ + const READY = 1; + /** + * The cluster is stopped. All instances in the cluster are stopped. + * Customers can start a stopped cluster at any point and all their + * instances will come back to life with same names and IP resources. In + * this state, customer pays for storage. + * Associated backups could also be present in a stopped cluster. + * + * Generated from protobuf enum STOPPED = 2; + */ + const STOPPED = 2; + /** + * The cluster is empty and has no associated resources. + * All instances, associated storage and backups have been deleted. + * + * Generated from protobuf enum EMPTY = 3; + */ + const PBEMPTY = 3; + /** + * The cluster is being created. + * + * Generated from protobuf enum CREATING = 4; + */ + const CREATING = 4; + /** + * The cluster is being deleted. + * + * Generated from protobuf enum DELETING = 5; + */ + const DELETING = 5; + /** + * The creation of the cluster failed. + * + * Generated from protobuf enum FAILED = 6; + */ + const FAILED = 6; + /** + * The cluster is bootstrapping with data from some other source. + * Direct mutations to the cluster (e.g. adding read pool) are not allowed. + * + * Generated from protobuf enum BOOTSTRAPPING = 7; + */ + const BOOTSTRAPPING = 7; + /** + * The cluster is under maintenance. AlloyDB regularly performs maintenance + * and upgrades on customer clusters. Updates on the cluster are + * not allowed while the cluster is in this state. + * + * Generated from protobuf enum MAINTENANCE = 8; + */ + const MAINTENANCE = 8; + /** + * The cluster is being promoted. + * + * Generated from protobuf enum PROMOTING = 9; + */ + const PROMOTING = 9; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::READY => 'READY', + self::STOPPED => 'STOPPED', + self::PBEMPTY => 'EMPTY', + self::CREATING => 'CREATING', + self::DELETING => 'DELETING', + self::FAILED => 'FAILED', + self::BOOTSTRAPPING => 'BOOTSTRAPPING', + self::MAINTENANCE => 'MAINTENANCE', + self::PROMOTING => 'PROMOTING', + ]; + + 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/AlloyDb/src/V1alpha/ConnectionInfo.php b/AlloyDb/src/V1alpha/ConnectionInfo.php new file mode 100644 index 000000000000..9c70a9bda94f --- /dev/null +++ b/AlloyDb/src/V1alpha/ConnectionInfo.php @@ -0,0 +1,186 @@ +google.cloud.alloydb.v1alpha.ConnectionInfo + */ +class ConnectionInfo extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the ConnectionInfo singleton resource, e.g.: + * projects/{project}/locations/{location}/clusters/*/instances/*/connectionInfo + * This field currently has no semantic meaning. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Output only. The IP address for the Instance. + * This is the connection endpoint for an end-user application. + * + * Generated from protobuf field string ip_address = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $ip_address = ''; + /** + * Output only. The pem-encoded chain that may be used to verify the X.509 + * certificate. Expected to be in issuer-to-root order according to RFC 5246. + * + * Generated from protobuf field repeated string pem_certificate_chain = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $pem_certificate_chain; + /** + * Output only. The unique ID of the Instance. + * + * Generated from protobuf field string instance_uid = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $instance_uid = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the ConnectionInfo singleton resource, e.g.: + * projects/{project}/locations/{location}/clusters/*/instances/*/connectionInfo + * This field currently has no semantic meaning. + * @type string $ip_address + * Output only. The IP address for the Instance. + * This is the connection endpoint for an end-user application. + * @type array|\Google\Protobuf\Internal\RepeatedField $pem_certificate_chain + * Output only. The pem-encoded chain that may be used to verify the X.509 + * certificate. Expected to be in issuer-to-root order according to RFC 5246. + * @type string $instance_uid + * Output only. The unique ID of the Instance. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The name of the ConnectionInfo singleton resource, e.g.: + * projects/{project}/locations/{location}/clusters/*/instances/*/connectionInfo + * This field currently has no semantic meaning. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the ConnectionInfo singleton resource, e.g.: + * projects/{project}/locations/{location}/clusters/*/instances/*/connectionInfo + * This field currently has no semantic meaning. + * + * 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 IP address for the Instance. + * This is the connection endpoint for an end-user application. + * + * Generated from protobuf field string ip_address = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getIpAddress() + { + return $this->ip_address; + } + + /** + * Output only. The IP address for the Instance. + * This is the connection endpoint for an end-user application. + * + * Generated from protobuf field string ip_address = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setIpAddress($var) + { + GPBUtil::checkString($var, True); + $this->ip_address = $var; + + return $this; + } + + /** + * Output only. The pem-encoded chain that may be used to verify the X.509 + * certificate. Expected to be in issuer-to-root order according to RFC 5246. + * + * Generated from protobuf field repeated string pem_certificate_chain = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPemCertificateChain() + { + return $this->pem_certificate_chain; + } + + /** + * Output only. The pem-encoded chain that may be used to verify the X.509 + * certificate. Expected to be in issuer-to-root order according to RFC 5246. + * + * Generated from protobuf field repeated string pem_certificate_chain = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPemCertificateChain($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->pem_certificate_chain = $arr; + + return $this; + } + + /** + * Output only. The unique ID of the Instance. + * + * Generated from protobuf field string instance_uid = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getInstanceUid() + { + return $this->instance_uid; + } + + /** + * Output only. The unique ID of the Instance. + * + * Generated from protobuf field string instance_uid = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setInstanceUid($var) + { + GPBUtil::checkString($var, True); + $this->instance_uid = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/ContinuousBackupConfig.php b/AlloyDb/src/V1alpha/ContinuousBackupConfig.php new file mode 100644 index 000000000000..75d9ac102721 --- /dev/null +++ b/AlloyDb/src/V1alpha/ContinuousBackupConfig.php @@ -0,0 +1,176 @@ +google.cloud.alloydb.v1alpha.ContinuousBackupConfig + */ +class ContinuousBackupConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Whether ContinuousBackup is enabled. + * + * Generated from protobuf field optional bool enabled = 1; + */ + protected $enabled = null; + /** + * The number of days backups and logs will be retained, which determines the + * window of time that data is recoverable for. If not set, it defaults to 14 + * days. + * + * Generated from protobuf field int32 recovery_window_days = 4; + */ + protected $recovery_window_days = 0; + /** + * The encryption config can be specified to encrypt the + * backups with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 3; + */ + protected $encryption_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enabled + * Whether ContinuousBackup is enabled. + * @type int $recovery_window_days + * The number of days backups and logs will be retained, which determines the + * window of time that data is recoverable for. If not set, it defaults to 14 + * days. + * @type \Google\Cloud\AlloyDb\V1alpha\EncryptionConfig $encryption_config + * The encryption config can be specified to encrypt the + * backups with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Whether ContinuousBackup is enabled. + * + * Generated from protobuf field optional bool enabled = 1; + * @return bool + */ + public function getEnabled() + { + return isset($this->enabled) ? $this->enabled : false; + } + + public function hasEnabled() + { + return isset($this->enabled); + } + + public function clearEnabled() + { + unset($this->enabled); + } + + /** + * Whether ContinuousBackup is enabled. + * + * Generated from protobuf field optional bool enabled = 1; + * @param bool $var + * @return $this + */ + public function setEnabled($var) + { + GPBUtil::checkBool($var); + $this->enabled = $var; + + return $this; + } + + /** + * The number of days backups and logs will be retained, which determines the + * window of time that data is recoverable for. If not set, it defaults to 14 + * days. + * + * Generated from protobuf field int32 recovery_window_days = 4; + * @return int + */ + public function getRecoveryWindowDays() + { + return $this->recovery_window_days; + } + + /** + * The number of days backups and logs will be retained, which determines the + * window of time that data is recoverable for. If not set, it defaults to 14 + * days. + * + * Generated from protobuf field int32 recovery_window_days = 4; + * @param int $var + * @return $this + */ + public function setRecoveryWindowDays($var) + { + GPBUtil::checkInt32($var); + $this->recovery_window_days = $var; + + return $this; + } + + /** + * The encryption config can be specified to encrypt the + * backups with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 3; + * @return \Google\Cloud\AlloyDb\V1alpha\EncryptionConfig|null + */ + public function getEncryptionConfig() + { + return $this->encryption_config; + } + + public function hasEncryptionConfig() + { + return isset($this->encryption_config); + } + + public function clearEncryptionConfig() + { + unset($this->encryption_config); + } + + /** + * The encryption config can be specified to encrypt the + * backups with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 3; + * @param \Google\Cloud\AlloyDb\V1alpha\EncryptionConfig $var + * @return $this + */ + public function setEncryptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\EncryptionConfig::class); + $this->encryption_config = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/ContinuousBackupInfo.php b/AlloyDb/src/V1alpha/ContinuousBackupInfo.php new file mode 100644 index 000000000000..b307e1655cdb --- /dev/null +++ b/AlloyDb/src/V1alpha/ContinuousBackupInfo.php @@ -0,0 +1,168 @@ +google.cloud.alloydb.v1alpha.ContinuousBackupInfo + */ +class ContinuousBackupInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The encryption information for the WALs and backups required + * for ContinuousBackup. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionInfo encryption_info = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $encryption_info = null; + /** + * Output only. When ContinuousBackup was most recently enabled. Set to null + * if ContinuousBackup is not enabled. + * + * Generated from protobuf field .google.protobuf.Timestamp enabled_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $enabled_time = null; + /** + * Output only. Days of the week on which a continuous backup is taken. Output + * only field. Ignored if passed into the request. + * + * Generated from protobuf field repeated .google.type.DayOfWeek schedule = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $schedule; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AlloyDb\V1alpha\EncryptionInfo $encryption_info + * Output only. The encryption information for the WALs and backups required + * for ContinuousBackup. + * @type \Google\Protobuf\Timestamp $enabled_time + * Output only. When ContinuousBackup was most recently enabled. Set to null + * if ContinuousBackup is not enabled. + * @type array|\Google\Protobuf\Internal\RepeatedField $schedule + * Output only. Days of the week on which a continuous backup is taken. Output + * only field. Ignored if passed into the request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The encryption information for the WALs and backups required + * for ContinuousBackup. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionInfo encryption_info = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1alpha\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 WALs and backups required + * for ContinuousBackup. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionInfo encryption_info = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1alpha\EncryptionInfo $var + * @return $this + */ + public function setEncryptionInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\EncryptionInfo::class); + $this->encryption_info = $var; + + return $this; + } + + /** + * Output only. When ContinuousBackup was most recently enabled. Set to null + * if ContinuousBackup is not enabled. + * + * Generated from protobuf field .google.protobuf.Timestamp enabled_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEnabledTime() + { + return $this->enabled_time; + } + + public function hasEnabledTime() + { + return isset($this->enabled_time); + } + + public function clearEnabledTime() + { + unset($this->enabled_time); + } + + /** + * Output only. When ContinuousBackup was most recently enabled. Set to null + * if ContinuousBackup is not enabled. + * + * Generated from protobuf field .google.protobuf.Timestamp enabled_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEnabledTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->enabled_time = $var; + + return $this; + } + + /** + * Output only. Days of the week on which a continuous backup is taken. Output + * only field. Ignored if passed into the request. + * + * Generated from protobuf field repeated .google.type.DayOfWeek schedule = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSchedule() + { + return $this->schedule; + } + + /** + * Output only. Days of the week on which a continuous backup is taken. Output + * only field. Ignored if passed into the request. + * + * Generated from protobuf field repeated .google.type.DayOfWeek schedule = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSchedule($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Type\DayOfWeek::class); + $this->schedule = $arr; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/ContinuousBackupSource.php b/AlloyDb/src/V1alpha/ContinuousBackupSource.php new file mode 100644 index 000000000000..81a495e66d86 --- /dev/null +++ b/AlloyDb/src/V1alpha/ContinuousBackupSource.php @@ -0,0 +1,119 @@ +google.cloud.alloydb.v1alpha.ContinuousBackupSource + */ +class ContinuousBackupSource extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The source cluster from which to restore. This cluster must have + * continuous backup enabled for this operation to succeed. For the required + * format, see the comment on the Cluster.name field. + * + * Generated from protobuf field string cluster = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster = ''; + /** + * Required. The point in time to restore to. + * + * Generated from protobuf field .google.protobuf.Timestamp point_in_time = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $point_in_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $cluster + * Required. The source cluster from which to restore. This cluster must have + * continuous backup enabled for this operation to succeed. For the required + * format, see the comment on the Cluster.name field. + * @type \Google\Protobuf\Timestamp $point_in_time + * Required. The point in time to restore to. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The source cluster from which to restore. This cluster must have + * continuous backup enabled for this operation to succeed. For the required + * format, see the comment on the Cluster.name field. + * + * Generated from protobuf field string cluster = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getCluster() + { + return $this->cluster; + } + + /** + * Required. The source cluster from which to restore. This cluster must have + * continuous backup enabled for this operation to succeed. For the required + * format, see the comment on the Cluster.name field. + * + * Generated from protobuf field string cluster = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setCluster($var) + { + GPBUtil::checkString($var, True); + $this->cluster = $var; + + return $this; + } + + /** + * Required. The point in time to restore to. + * + * Generated from protobuf field .google.protobuf.Timestamp point_in_time = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getPointInTime() + { + return $this->point_in_time; + } + + public function hasPointInTime() + { + return isset($this->point_in_time); + } + + public function clearPointInTime() + { + unset($this->point_in_time); + } + + /** + * Required. The point in time to restore to. + * + * Generated from protobuf field .google.protobuf.Timestamp point_in_time = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setPointInTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->point_in_time = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/CreateBackupRequest.php b/AlloyDb/src/V1alpha/CreateBackupRequest.php new file mode 100644 index 000000000000..4820325840a1 --- /dev/null +++ b/AlloyDb/src/V1alpha/CreateBackupRequest.php @@ -0,0 +1,257 @@ +google.cloud.alloydb.v1alpha.CreateBackupRequest + */ +class CreateBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Value for parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. ID of the requesting object. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup_id = ''; + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Value for parent. + * @type string $backup_id + * Required. ID of the requesting object. + * @type \Google\Cloud\AlloyDb\V1alpha\Backup $backup + * Required. The resource being created + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Value for parent. + * + * 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. Value for parent. + * + * 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. ID of the requesting object. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getBackupId() + { + return $this->backup_id; + } + + /** + * Required. ID of the requesting object. + * + * 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 resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1alpha\Backup|null + */ + public function getBackup() + { + return $this->backup; + } + + public function hasBackup() + { + return isset($this->backup); + } + + public function clearBackup() + { + unset($this->backup); + } + + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1alpha\Backup $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\Backup::class); + $this->backup = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/CreateClusterRequest.php b/AlloyDb/src/V1alpha/CreateClusterRequest.php new file mode 100644 index 000000000000..38e1729ab089 --- /dev/null +++ b/AlloyDb/src/V1alpha/CreateClusterRequest.php @@ -0,0 +1,265 @@ +google.cloud.alloydb.v1alpha.CreateClusterRequest + */ +class CreateClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. ID of the requesting object. + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster_id = ''; + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * @type string $cluster_id + * Required. ID of the requesting object. + * @type \Google\Cloud\AlloyDb\V1alpha\Cluster $cluster + * Required. The resource being created + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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 parent resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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. ID of the requesting object. + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getClusterId() + { + return $this->cluster_id; + } + + /** + * Required. ID of the requesting object. + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setClusterId($var) + { + GPBUtil::checkString($var, True); + $this->cluster_id = $var; + + return $this; + } + + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1alpha\Cluster|null + */ + public function getCluster() + { + return $this->cluster; + } + + public function hasCluster() + { + return isset($this->cluster); + } + + public function clearCluster() + { + unset($this->cluster); + } + + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1alpha\Cluster $var + * @return $this + */ + public function setCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\Cluster::class); + $this->cluster = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/CreateInstanceRequest.php b/AlloyDb/src/V1alpha/CreateInstanceRequest.php new file mode 100644 index 000000000000..abfc159d2310 --- /dev/null +++ b/AlloyDb/src/V1alpha/CreateInstanceRequest.php @@ -0,0 +1,265 @@ +google.cloud.alloydb.v1alpha.CreateInstanceRequest + */ +class CreateInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. ID of the requesting object. + * + * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance_id = ''; + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * @type string $instance_id + * Required. ID of the requesting object. + * @type \Google\Cloud\AlloyDb\V1alpha\Instance $instance + * Required. The resource being created + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * + * 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 parent resource. For the required format, see the + * comment on the Instance.name field. + * + * 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. ID of the requesting object. + * + * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getInstanceId() + { + return $this->instance_id; + } + + /** + * Required. ID of the requesting object. + * + * 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 resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1alpha\Instance|null + */ + public function getInstance() + { + return $this->instance; + } + + public function hasInstance() + { + return isset($this->instance); + } + + public function clearInstance() + { + unset($this->instance); + } + + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1alpha\Instance $var + * @return $this + */ + public function setInstance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\Instance::class); + $this->instance = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/CreateInstanceRequests.php b/AlloyDb/src/V1alpha/CreateInstanceRequests.php new file mode 100644 index 000000000000..c54bd2203db5 --- /dev/null +++ b/AlloyDb/src/V1alpha/CreateInstanceRequests.php @@ -0,0 +1,71 @@ +google.cloud.alloydb.v1alpha.CreateInstanceRequests + */ +class CreateInstanceRequests extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Primary and read replica instances to be created. This list + * should not be empty. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.CreateInstanceRequest create_instance_requests = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $create_instance_requests; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\AlloyDb\V1alpha\CreateInstanceRequest>|\Google\Protobuf\Internal\RepeatedField $create_instance_requests + * Required. Primary and read replica instances to be created. This list + * should not be empty. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Primary and read replica instances to be created. This list + * should not be empty. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.CreateInstanceRequest create_instance_requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCreateInstanceRequests() + { + return $this->create_instance_requests; + } + + /** + * Required. Primary and read replica instances to be created. This list + * should not be empty. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.CreateInstanceRequest create_instance_requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\AlloyDb\V1alpha\CreateInstanceRequest>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCreateInstanceRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1alpha\CreateInstanceRequest::class); + $this->create_instance_requests = $arr; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/CreateSecondaryClusterRequest.php b/AlloyDb/src/V1alpha/CreateSecondaryClusterRequest.php new file mode 100644 index 000000000000..710f4a0dd697 --- /dev/null +++ b/AlloyDb/src/V1alpha/CreateSecondaryClusterRequest.php @@ -0,0 +1,263 @@ +google.cloud.alloydb.v1alpha.CreateSecondaryClusterRequest + */ +class CreateSecondaryClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource (the primary cluster). For the + * required format, see the comment on the Cluster.name field. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. ID of the requesting object (the secondary cluster). + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster_id = ''; + /** + * Required. Configuration of the requesting object (the secondary cluster). + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource (the primary cluster). For the + * required format, see the comment on the Cluster.name field. + * @type string $cluster_id + * Required. ID of the requesting object (the secondary cluster). + * @type \Google\Cloud\AlloyDb\V1alpha\Cluster $cluster + * Required. Configuration of the requesting object (the secondary cluster). + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource (the primary cluster). For the + * required format, see the comment on the Cluster.name field. + * + * 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 parent resource (the primary cluster). For the + * required format, see the comment on the Cluster.name field. + * + * 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. ID of the requesting object (the secondary cluster). + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getClusterId() + { + return $this->cluster_id; + } + + /** + * Required. ID of the requesting object (the secondary cluster). + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setClusterId($var) + { + GPBUtil::checkString($var, True); + $this->cluster_id = $var; + + return $this; + } + + /** + * Required. Configuration of the requesting object (the secondary cluster). + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1alpha\Cluster|null + */ + public function getCluster() + { + return $this->cluster; + } + + public function hasCluster() + { + return isset($this->cluster); + } + + public function clearCluster() + { + unset($this->cluster); + } + + /** + * Required. Configuration of the requesting object (the secondary cluster). + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1alpha\Cluster $var + * @return $this + */ + public function setCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\Cluster::class); + $this->cluster = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/CreateSecondaryInstanceRequest.php b/AlloyDb/src/V1alpha/CreateSecondaryInstanceRequest.php new file mode 100644 index 000000000000..853cb6456819 --- /dev/null +++ b/AlloyDb/src/V1alpha/CreateSecondaryInstanceRequest.php @@ -0,0 +1,265 @@ +google.cloud.alloydb.v1alpha.CreateSecondaryInstanceRequest + */ +class CreateSecondaryInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. ID of the requesting object. + * + * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance_id = ''; + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * @type string $instance_id + * Required. ID of the requesting object. + * @type \Google\Cloud\AlloyDb\V1alpha\Instance $instance + * Required. The resource being created + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * + * 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 parent resource. For the required format, see the + * comment on the Instance.name field. + * + * 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. ID of the requesting object. + * + * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getInstanceId() + { + return $this->instance_id; + } + + /** + * Required. ID of the requesting object. + * + * 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 resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1alpha\Instance|null + */ + public function getInstance() + { + return $this->instance; + } + + public function hasInstance() + { + return isset($this->instance); + } + + public function clearInstance() + { + unset($this->instance); + } + + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1alpha\Instance $var + * @return $this + */ + public function setInstance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\Instance::class); + $this->instance = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/DatabaseVersion.php b/AlloyDb/src/V1alpha/DatabaseVersion.php new file mode 100644 index 000000000000..389a6bff45e4 --- /dev/null +++ b/AlloyDb/src/V1alpha/DatabaseVersion.php @@ -0,0 +1,61 @@ +google.cloud.alloydb.v1alpha.DatabaseVersion + */ +class DatabaseVersion +{ + /** + * This is an unknown database version. + * + * Generated from protobuf enum DATABASE_VERSION_UNSPECIFIED = 0; + */ + const DATABASE_VERSION_UNSPECIFIED = 0; + /** + * DEPRECATED - The database version is Postgres 13. + * + * Generated from protobuf enum POSTGRES_13 = 1 [deprecated = true]; + */ + const POSTGRES_13 = 1; + /** + * The database version is Postgres 14. + * + * Generated from protobuf enum POSTGRES_14 = 2; + */ + const POSTGRES_14 = 2; + + private static $valueToName = [ + self::DATABASE_VERSION_UNSPECIFIED => 'DATABASE_VERSION_UNSPECIFIED', + self::POSTGRES_13 => 'POSTGRES_13', + self::POSTGRES_14 => 'POSTGRES_14', + ]; + + 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/AlloyDb/src/V1alpha/DeleteBackupRequest.php b/AlloyDb/src/V1alpha/DeleteBackupRequest.php new file mode 100644 index 000000000000..b8b0c1eb20f9 --- /dev/null +++ b/AlloyDb/src/V1alpha/DeleteBackupRequest.php @@ -0,0 +1,225 @@ +google.cloud.alloydb.v1alpha.DeleteBackupRequest + */ +class DeleteBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the resource. For the required format, see the comment on + * the Backup.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + /** + * Optional. The current etag of the Backup. + * If an etag is provided and does not match the current etag of the Backup, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $etag = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the resource. For the required format, see the comment on + * the Backup.name field. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * @type string $etag + * Optional. The current etag of the Backup. + * If an etag is provided and does not match the current etag of the Backup, + * deletion will be blocked and an ABORTED error will be returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the resource. For the required format, see the comment on + * the Backup.name field. + * + * 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 resource. For the required format, see the comment on + * the Backup.name field. + * + * 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. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Optional. The current etag of the Backup. + * If an etag is provided and does not match the current etag of the Backup, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. The current etag of the Backup. + * If an etag is provided and does not match the current etag of the Backup, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/DeleteClusterRequest.php b/AlloyDb/src/V1alpha/DeleteClusterRequest.php new file mode 100644 index 000000000000..95797925a3af --- /dev/null +++ b/AlloyDb/src/V1alpha/DeleteClusterRequest.php @@ -0,0 +1,259 @@ +google.cloud.alloydb.v1alpha.DeleteClusterRequest + */ +class DeleteClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $etag = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + /** + * Optional. Whether to cascade delete child instances for given cluster. + * + * Generated from protobuf field bool force = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $force = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $etag + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * @type bool $force + * Optional. Whether to cascade delete child instances for given cluster. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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 resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Optional. Whether to cascade delete child instances for given cluster. + * + * Generated from protobuf field bool force = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * Optional. Whether to cascade delete child instances for given cluster. + * + * Generated from protobuf field bool force = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/DeleteInstanceRequest.php b/AlloyDb/src/V1alpha/DeleteInstanceRequest.php new file mode 100644 index 000000000000..48157d8dd4f4 --- /dev/null +++ b/AlloyDb/src/V1alpha/DeleteInstanceRequest.php @@ -0,0 +1,225 @@ +google.cloud.alloydb.v1alpha.DeleteInstanceRequest + */ +class DeleteInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. The current etag of the Instance. + * If an etag is provided and does not match the current etag of the Instance, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $etag = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $etag + * Optional. The current etag of the Instance. + * If an etag is provided and does not match the current etag of the Instance, + * deletion will be blocked and an ABORTED error will be returned. + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * 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 resource. For the required format, see the + * comment on the Instance.name field. + * + * 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. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. The current etag of the Instance. + * If an etag is provided and does not match the current etag of the Instance, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. The current etag of the Instance. + * If an etag is provided and does not match the current etag of the Instance, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/EncryptionConfig.php b/AlloyDb/src/V1alpha/EncryptionConfig.php new file mode 100644 index 000000000000..35dd0478dce4 --- /dev/null +++ b/AlloyDb/src/V1alpha/EncryptionConfig.php @@ -0,0 +1,76 @@ +google.cloud.alloydb.v1alpha.EncryptionConfig + */ +class EncryptionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The fully-qualified resource name of the KMS key. + * Each Cloud KMS key is regionalized and has the following format: + * projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME] + * + * Generated from protobuf field string kms_key_name = 1; + */ + protected $kms_key_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $kms_key_name + * The fully-qualified resource name of the KMS key. + * Each Cloud KMS key is regionalized and has the following format: + * projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The fully-qualified resource name of the KMS key. + * Each Cloud KMS key is regionalized and has the following format: + * projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME] + * + * Generated from protobuf field string kms_key_name = 1; + * @return string + */ + public function getKmsKeyName() + { + return $this->kms_key_name; + } + + /** + * The fully-qualified resource name of the KMS key. + * Each Cloud KMS key is regionalized and has the following format: + * projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME] + * + * Generated from protobuf field string kms_key_name = 1; + * @param string $var + * @return $this + */ + public function setKmsKeyName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_name = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/EncryptionInfo.php b/AlloyDb/src/V1alpha/EncryptionInfo.php new file mode 100644 index 000000000000..7d838620487d --- /dev/null +++ b/AlloyDb/src/V1alpha/EncryptionInfo.php @@ -0,0 +1,105 @@ +google.cloud.alloydb.v1alpha.EncryptionInfo + */ +class EncryptionInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Type of encryption. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionInfo.Type encryption_type = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $encryption_type = 0; + /** + * Output only. Cloud KMS key versions that are being used to protect the + * database or the backup. + * + * Generated from protobuf field repeated string kms_key_versions = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + private $kms_key_versions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $encryption_type + * Output only. Type of encryption. + * @type array|\Google\Protobuf\Internal\RepeatedField $kms_key_versions + * Output only. Cloud KMS key versions that are being used to protect the + * database or the backup. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Type of encryption. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionInfo.Type encryption_type = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getEncryptionType() + { + return $this->encryption_type; + } + + /** + * Output only. Type of encryption. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.EncryptionInfo.Type encryption_type = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setEncryptionType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1alpha\EncryptionInfo\Type::class); + $this->encryption_type = $var; + + return $this; + } + + /** + * Output only. Cloud KMS key versions that are being used to protect the + * database or the backup. + * + * Generated from protobuf field repeated string kms_key_versions = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getKmsKeyVersions() + { + return $this->kms_key_versions; + } + + /** + * Output only. Cloud KMS key versions that are being used to protect the + * database or the backup. + * + * Generated from protobuf field repeated string kms_key_versions = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setKmsKeyVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->kms_key_versions = $arr; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/EncryptionInfo/Type.php b/AlloyDb/src/V1alpha/EncryptionInfo/Type.php new file mode 100644 index 000000000000..d7e1bfe93406 --- /dev/null +++ b/AlloyDb/src/V1alpha/EncryptionInfo/Type.php @@ -0,0 +1,64 @@ +google.cloud.alloydb.v1alpha.EncryptionInfo.Type + */ +class Type +{ + /** + * Encryption type not specified. Defaults to GOOGLE_DEFAULT_ENCRYPTION. + * + * 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 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. + * KMS key versions will 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); + } +} + + diff --git a/AlloyDb/src/V1alpha/FailoverInstanceRequest.php b/AlloyDb/src/V1alpha/FailoverInstanceRequest.php new file mode 100644 index 000000000000..988fd61608e5 --- /dev/null +++ b/AlloyDb/src/V1alpha/FailoverInstanceRequest.php @@ -0,0 +1,183 @@ +google.cloud.alloydb.v1alpha.FailoverInstanceRequest + */ +class FailoverInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the failover. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the failover. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * 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 resource. For the required format, see the + * comment on the Instance.name field. + * + * 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. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the failover. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the failover. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/Gapic/AlloyDBAdminGapicClient.php b/AlloyDb/src/V1alpha/Gapic/AlloyDBAdminGapicClient.php new file mode 100644 index 000000000000..92cba8713103 --- /dev/null +++ b/AlloyDb/src/V1alpha/Gapic/AlloyDBAdminGapicClient.php @@ -0,0 +1,3146 @@ +clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $requests = new CreateInstanceRequests(); + * $operationResponse = $alloyDBAdminClient->batchCreateInstances($formattedParent, $requests); + * $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 = $alloyDBAdminClient->batchCreateInstances($formattedParent, $requests); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'batchCreateInstances'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->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. + * + * @experimental + */ +class AlloyDBAdminGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.alloydb.v1alpha.AlloyDBAdmin'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'alloydb.googleapis.com'; + + /** 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', + ]; + + private static $backupNameTemplate; + + private static $clusterNameTemplate; + + private static $instanceNameTemplate; + + private static $locationNameTemplate; + + private static $networkNameTemplate; + + 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/alloy_db_admin_client_config.json', + 'descriptorsConfigPath' => + __DIR__ . '/../resources/alloy_db_admin_descriptor_config.php', + 'gcpApiConfigPath' => + __DIR__ . '/../resources/alloy_db_admin_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => + __DIR__ . + '/../resources/alloy_db_admin_rest_client_config.php', + ], + ], + ]; + } + + private static function getBackupNameTemplate() + { + if (self::$backupNameTemplate == null) { + self::$backupNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}/backups/{backup}' + ); + } + + return self::$backupNameTemplate; + } + + private static function getClusterNameTemplate() + { + if (self::$clusterNameTemplate == null) { + self::$clusterNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}/clusters/{cluster}' + ); + } + + return self::$clusterNameTemplate; + } + + private static function getInstanceNameTemplate() + { + if (self::$instanceNameTemplate == null) { + self::$instanceNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance}' + ); + } + + return self::$instanceNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}' + ); + } + + return self::$locationNameTemplate; + } + + private static function getNetworkNameTemplate() + { + if (self::$networkNameTemplate == null) { + self::$networkNameTemplate = new PathTemplate( + 'projects/{project}/global/networks/{network}' + ); + } + + return self::$networkNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'backup' => self::getBackupNameTemplate(), + 'cluster' => self::getClusterNameTemplate(), + 'instance' => self::getInstanceNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'network' => self::getNetworkNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a backup + * resource. + * + * @param string $project + * @param string $location + * @param string $backup + * + * @return string The formatted backup resource. + * + * @experimental + */ + public static function backupName($project, $location, $backup) + { + return self::getBackupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'backup' => $backup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a cluster + * resource. + * + * @param string $project + * @param string $location + * @param string $cluster + * + * @return string The formatted cluster resource. + * + * @experimental + */ + public static function clusterName($project, $location, $cluster) + { + return self::getClusterNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'cluster' => $cluster, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a instance + * resource. + * + * @param string $project + * @param string $location + * @param string $cluster + * @param string $instance + * + * @return string The formatted instance resource. + * + * @experimental + */ + public static function instanceName( + $project, + $location, + $cluster, + $instance + ) { + return self::getInstanceNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'cluster' => $cluster, + 'instance' => $instance, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + * + * @experimental + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a network + * resource. + * + * @param string $project + * @param string $network + * + * @return string The formatted network resource. + * + * @experimental + */ + public static function networkName($project, $network) + { + return self::getNetworkNameTemplate()->render([ + 'project' => $project, + 'network' => $network, + ]); + } + + /** + * 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}/locations/{location}/backups/{backup} + * - cluster: projects/{project}/locations/{location}/clusters/{cluster} + * - instance: projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance} + * - location: projects/{project}/locations/{location} + * - network: projects/{project}/global/networks/{network} + * + * 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. + * + * @experimental + */ + 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 + * + * @experimental + */ + 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 + * + * @experimental + */ + 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 'alloydb.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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Creates new instances under the given project, location and cluster. + * There can be only one primary instance in a cluster. If the primary + * instance exists in the cluster as well as this request, then API will + * throw an error. + * The primary instance should exist before any read pool instance is + * created. If the primary instance is a part of the request payload, then + * the API will take care of creating instances in the correct order. + * This method is here to support Google-internal use cases, and is not meant + * for external customers to consume. Please do not start relying on it; its + * behavior is subject to change without notice. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $requests = new CreateInstanceRequests(); + * $operationResponse = $alloyDBAdminClient->batchCreateInstances($formattedParent, $requests); + * $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 = $alloyDBAdminClient->batchCreateInstances($formattedParent, $requests); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'batchCreateInstances'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. + * @param CreateInstanceRequests $requests Required. Resources being created. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function batchCreateInstances( + $parent, + $requests, + array $optionalArgs = [] + ) { + $request = new BatchCreateInstancesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setRequests($requests); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'BatchCreateInstances', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Creates a new Backup in a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->locationName('[PROJECT]', '[LOCATION]'); + * $backupId = 'backup_id'; + * $backup = new Backup(); + * $operationResponse = $alloyDBAdminClient->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 = $alloyDBAdminClient->createBackup($formattedParent, $backupId, $backup); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->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 { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. Value for parent. + * @param string $backupId Required. ID of the requesting object. + * @param Backup $backup Required. The resource being created + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + 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['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'CreateBackup', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Creates a new Cluster in a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->locationName('[PROJECT]', '[LOCATION]'); + * $clusterId = 'cluster_id'; + * $cluster = new Cluster(); + * $operationResponse = $alloyDBAdminClient->createCluster($formattedParent, $clusterId, $cluster); + * $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 = $alloyDBAdminClient->createCluster($formattedParent, $clusterId, $cluster); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'createCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * @param string $clusterId Required. ID of the requesting object. + * @param Cluster $cluster Required. The resource being created + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * 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\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createCluster( + $parent, + $clusterId, + $cluster, + array $optionalArgs = [] + ) { + $request = new CreateClusterRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setClusterId($clusterId); + $request->setCluster($cluster); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'CreateCluster', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Creates a new Instance in a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $instanceId = 'instance_id'; + * $instance = new Instance(); + * $operationResponse = $alloyDBAdminClient->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 = $alloyDBAdminClient->createInstance($formattedParent, $instanceId, $instance); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->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 { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * @param string $instanceId Required. ID of the requesting object. + * @param Instance $instance Required. The resource being created + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * 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\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createInstance( + $parent, + $instanceId, + $instance, + array $optionalArgs = [] + ) { + $request = new CreateInstanceRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setInstanceId($instanceId); + $request->setInstance($instance); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'CreateInstance', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Creates a cluster of type SECONDARY in the given location using + * the primary cluster as the source. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->locationName('[PROJECT]', '[LOCATION]'); + * $clusterId = 'cluster_id'; + * $cluster = new Cluster(); + * $operationResponse = $alloyDBAdminClient->createSecondaryCluster($formattedParent, $clusterId, $cluster); + * $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 = $alloyDBAdminClient->createSecondaryCluster($formattedParent, $clusterId, $cluster); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'createSecondaryCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource (the primary cluster). For the + * required format, see the comment on the Cluster.name field. + * @param string $clusterId Required. ID of the requesting object (the secondary cluster). + * @param Cluster $cluster Required. Configuration of the requesting object (the secondary cluster). + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * 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\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createSecondaryCluster( + $parent, + $clusterId, + $cluster, + array $optionalArgs = [] + ) { + $request = new CreateSecondaryClusterRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setClusterId($clusterId); + $request->setCluster($cluster); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'CreateSecondaryCluster', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Creates a new SECONDARY Instance in a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $instanceId = 'instance_id'; + * $instance = new Instance(); + * $operationResponse = $alloyDBAdminClient->createSecondaryInstance($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 = $alloyDBAdminClient->createSecondaryInstance($formattedParent, $instanceId, $instance); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'createSecondaryInstance'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * @param string $instanceId Required. ID of the requesting object. + * @param Instance $instance Required. The resource being created + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * 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\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createSecondaryInstance( + $parent, + $instanceId, + $instance, + array $optionalArgs = [] + ) { + $request = new CreateSecondaryInstanceRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setInstanceId($instanceId); + $request->setInstance($instance); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'CreateSecondaryInstance', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Deletes a single Backup. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP]'); + * $operationResponse = $alloyDBAdminClient->deleteBackup($formattedName); + * $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 = $alloyDBAdminClient->deleteBackup($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'deleteBackup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the resource. For the required format, see the comment on + * the Backup.name field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * @type string $etag + * Optional. The current etag of the Backup. + * If an etag is provided and does not match the current etag of the Backup, + * deletion will be blocked and an ABORTED error will be 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\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function deleteBackup($name, array $optionalArgs = []) + { + $request = new DeleteBackupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + 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->startOperationsCall( + 'DeleteBackup', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Deletes a single Cluster. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $operationResponse = $alloyDBAdminClient->deleteCluster($formattedName); + * $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 = $alloyDBAdminClient->deleteCluster($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'deleteCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $etag + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * @type bool $force + * Optional. Whether to cascade delete child instances for given cluster. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function deleteCluster($name, array $optionalArgs = []) + { + $request = new DeleteClusterRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['force'])) { + $request->setForce($optionalArgs['force']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'DeleteCluster', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Deletes a single Instance. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + * $operationResponse = $alloyDBAdminClient->deleteInstance($formattedName); + * $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 = $alloyDBAdminClient->deleteInstance($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'deleteInstance'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $etag + * Optional. The current etag of the Instance. + * If an etag is provided and does not match the current etag of the Instance, + * deletion will be blocked and an ABORTED error will be returned. + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function deleteInstance($name, array $optionalArgs = []) + { + $request = new DeleteInstanceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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->startOperationsCall( + 'DeleteInstance', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Forces a Failover for a highly available instance. + * Failover promotes the HA standby instance as the new primary. + * Imperative only. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + * $operationResponse = $alloyDBAdminClient->failoverInstance($formattedName); + * $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 = $alloyDBAdminClient->failoverInstance($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'failoverInstance'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the failover. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function failoverInstance($name, array $optionalArgs = []) + { + $request = new FailoverInstanceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'FailoverInstance', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Generate a client certificate signed by a Cluster CA. + * The sole purpose of this endpoint is to support the Auth Proxy client and + * the endpoint's behavior is subject to change without notice, so do not rely + * on its behavior remaining constant. Future changes will not break the Auth + * Proxy client. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $response = $alloyDBAdminClient->generateClientCertificate($formattedParent); + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. The required format is: + * * projects/{project}/locations/{location}/clusters/{cluster} + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $pemCsr + * Optional. A pem-encoded X.509 certificate signing request (CSR). + * @type Duration $certDuration + * Optional. An optional hint to the endpoint to generate the client + * certificate with the requested duration. The duration can be from 1 hour to + * 24 hours. The endpoint may or may not honor the hint. If the hint is left + * unspecified or is not honored, then the endpoint will pick an appropriate + * default duration. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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\AlloyDb\V1alpha\GenerateClientCertificateResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function generateClientCertificate($parent, array $optionalArgs = []) + { + $request = new GenerateClientCertificateRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['pemCsr'])) { + $request->setPemCsr($optionalArgs['pemCsr']); + } + + if (isset($optionalArgs['certDuration'])) { + $request->setCertDuration($optionalArgs['certDuration']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'GenerateClientCertificate', + GenerateClientCertificateResponse::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Gets details of a single Backup. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP]'); + * $response = $alloyDBAdminClient->getBackup($formattedName); + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the resource + * @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\AlloyDb\V1alpha\Backup + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + 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 details of a single Cluster. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $response = $alloyDBAdminClient->getCluster($formattedName); + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * @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\AlloyDb\V1alpha\Cluster + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getCluster($name, array $optionalArgs = []) + { + $request = new GetClusterRequest(); + $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( + 'GetCluster', + Cluster::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Get instance metadata used for a connection. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + * $response = $alloyDBAdminClient->getConnectionInfo($formattedParent); + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. The required format is: + * projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance} + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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\AlloyDb\V1alpha\ConnectionInfo + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getConnectionInfo($parent, array $optionalArgs = []) + { + $request = new GetConnectionInfoRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'GetConnectionInfo', + ConnectionInfo::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Gets details of a single Instance. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + * $response = $alloyDBAdminClient->getInstance($formattedName); + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @param array $optionalArgs { + * Optional. + * + * @type int $view + * The view of the instance to return. + * For allowed values, use constants defined on {@see \Google\Cloud\AlloyDb\V1alpha\InstanceView} + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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\AlloyDb\V1alpha\Instance + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getInstance($name, array $optionalArgs = []) + { + $request = new GetInstanceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['view'])) { + $request->setView($optionalArgs['view']); + } + + $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(); + } + + /** + * Lists Backups in a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $alloyDBAdminClient->listBackups($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $alloyDBAdminClient->listBackups($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. Parent value for ListBackupsRequest + * @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 + * Filtering results + * @type string $orderBy + * Hint for how to order the results + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function listBackups($parent, array $optionalArgs = []) + { + $request = new ListBackupsRequest(); + $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['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $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 Clusters in a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $alloyDBAdminClient->listClusters($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $alloyDBAdminClient->listClusters($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with the following format: + * * projects/{project}/locations/- + * @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 + * Optional. Filtering results + * @type string $orderBy + * Optional. Hint for how to order the results + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function listClusters($parent, array $optionalArgs = []) + { + $request = new ListClustersRequest(); + $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['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( + 'ListClusters', + $optionalArgs, + ListClustersResponse::class, + $request + ); + } + + /** + * Lists Instances in a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * // Iterate over pages of elements + * $pagedResponse = $alloyDBAdminClient->listInstances($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $alloyDBAdminClient->listInstances($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with one of the following + * formats: + * * projects/{project}/locations/-/clusters/- + * * projects/{project}/locations/{region}/clusters/- + * @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 + * Optional. Filtering results + * @type string $orderBy + * Optional. Hint for how to order the results + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + 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['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $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 + ); + } + + /** + * Lists SupportedDatabaseFlags for a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $alloyDBAdminClient->listSupportedDatabaseFlags($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $alloyDBAdminClient->listSupportedDatabaseFlags($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. The required format is: + * * projects/{project}/locations/{location} + * + * Regardless of the parent specified here, as long it is contains a valid + * project and location, the service will return a static list of supported + * flags resources. Note that we do not yet support region-specific + * flags. + * @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 + * + * @experimental + */ + public function listSupportedDatabaseFlags( + $parent, + array $optionalArgs = [] + ) { + $request = new ListSupportedDatabaseFlagsRequest(); + $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( + 'ListSupportedDatabaseFlags', + $optionalArgs, + ListSupportedDatabaseFlagsResponse::class, + $request + ); + } + + /** + * Promotes a SECONDARY cluster. This turns down replication + * from the PRIMARY cluster and promotes a secondary cluster + * into its own standalone cluster. + * Imperative only. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $operationResponse = $alloyDBAdminClient->promoteCluster($formattedName); + * $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 = $alloyDBAdminClient->promoteCluster($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'promoteCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $etag + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function promoteCluster($name, array $optionalArgs = []) + { + $request = new PromoteClusterRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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->startOperationsCall( + 'PromoteCluster', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Restart an Instance in a cluster. + * Imperative only. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + * $operationResponse = $alloyDBAdminClient->restartInstance($formattedName); + * $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 = $alloyDBAdminClient->restartInstance($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'restartInstance'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the restart. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function restartInstance($name, array $optionalArgs = []) + { + $request = new RestartInstanceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'RestartInstance', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Creates a new Cluster in a given project and location, with a volume + * restored from the provided source, either a backup ID or a point-in-time + * and a source cluster. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->locationName('[PROJECT]', '[LOCATION]'); + * $clusterId = 'cluster_id'; + * $cluster = new Cluster(); + * $operationResponse = $alloyDBAdminClient->restoreCluster($formattedParent, $clusterId, $cluster); + * $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 = $alloyDBAdminClient->restoreCluster($formattedParent, $clusterId, $cluster); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'restoreCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * @param string $clusterId Required. ID of the requesting object. + * @param Cluster $cluster Required. The resource being created + * @param array $optionalArgs { + * Optional. + * + * @type BackupSource $backupSource + * Backup source. + * @type ContinuousBackupSource $continuousBackupSource + * ContinuousBackup source. Continuous backup needs to be enabled in the + * source cluster for this operation to succeed. + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the import + * 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\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function restoreCluster( + $parent, + $clusterId, + $cluster, + array $optionalArgs = [] + ) { + $request = new RestoreClusterRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setClusterId($clusterId); + $request->setCluster($cluster); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['backupSource'])) { + $request->setBackupSource($optionalArgs['backupSource']); + } + + if (isset($optionalArgs['continuousBackupSource'])) { + $request->setContinuousBackupSource( + $optionalArgs['continuousBackupSource'] + ); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'RestoreCluster', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Updates the parameters of a single Backup. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $backup = new Backup(); + * $operationResponse = $alloyDBAdminClient->updateBackup($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 = $alloyDBAdminClient->updateBackup($backup); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'updateBackup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param Backup $backup Required. The resource being updated + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Backup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * @type bool $allowMissing + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new backup is created and `update_mask` is ignored. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function updateBackup($backup, array $optionalArgs = []) + { + $request = new UpdateBackupRequest(); + $requestParamHeaders = []; + $request->setBackup($backup); + $requestParamHeaders['backup.name'] = $backup->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'UpdateBackup', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Updates the parameters of a single Cluster. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $cluster = new Cluster(); + * $operationResponse = $alloyDBAdminClient->updateCluster($cluster); + * $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 = $alloyDBAdminClient->updateCluster($cluster); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'updateCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param Cluster $cluster Required. The resource being updated + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Cluster resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * @type bool $allowMissing + * Optional. If set to true, update succeeds even if cluster is not found. In + * that case, a new cluster is created and `update_mask` is ignored. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function updateCluster($cluster, array $optionalArgs = []) + { + $request = new UpdateClusterRequest(); + $requestParamHeaders = []; + $request->setCluster($cluster); + $requestParamHeaders['cluster.name'] = $cluster->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'UpdateCluster', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Updates the parameters of a single Instance. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $instance = new Instance(); + * $operationResponse = $alloyDBAdminClient->updateInstance($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 = $alloyDBAdminClient->updateInstance($instance); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->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 { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param Instance $instance Required. The resource being updated + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Instance resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * @type bool $allowMissing + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new instance is created and `update_mask` is ignored. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function updateInstance($instance, array $optionalArgs = []) + { + $request = new UpdateInstanceRequest(); + $requestParamHeaders = []; + $request->setInstance($instance); + $requestParamHeaders['instance.name'] = $instance->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + $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(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $response = $alloyDBAdminClient->getLocation(); + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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\Location\Location + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'GetLocation', + Location::class, + $optionalArgs, + $request, + Call::UNARY_CALL, + 'google.cloud.location.Locations' + )->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $alloyDBAdminClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $alloyDBAdminClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @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 + * + * @experimental + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + 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( + 'ListLocations', + $optionalArgs, + ListLocationsResponse::class, + $request, + 'google.cloud.location.Locations' + ); + } +} diff --git a/AlloyDb/src/V1alpha/GenerateClientCertificateRequest.php b/AlloyDb/src/V1alpha/GenerateClientCertificateRequest.php new file mode 100644 index 000000000000..7d3d23653f06 --- /dev/null +++ b/AlloyDb/src/V1alpha/GenerateClientCertificateRequest.php @@ -0,0 +1,240 @@ +google.cloud.alloydb.v1alpha.GenerateClientCertificateRequest + */ +class GenerateClientCertificateRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. The required format is: + * * projects/{project}/locations/{location}/clusters/{cluster} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. A pem-encoded X.509 certificate signing request (CSR). + * + * Generated from protobuf field string pem_csr = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $pem_csr = ''; + /** + * Optional. An optional hint to the endpoint to generate the client + * certificate with the requested duration. The duration can be from 1 hour to + * 24 hours. The endpoint may or may not honor the hint. If the hint is left + * unspecified or is not honored, then the endpoint will pick an appropriate + * default duration. + * + * Generated from protobuf field .google.protobuf.Duration cert_duration = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $cert_duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. The required format is: + * * projects/{project}/locations/{location}/clusters/{cluster} + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $pem_csr + * Optional. A pem-encoded X.509 certificate signing request (CSR). + * @type \Google\Protobuf\Duration $cert_duration + * Optional. An optional hint to the endpoint to generate the client + * certificate with the requested duration. The duration can be from 1 hour to + * 24 hours. The endpoint may or may not honor the hint. If the hint is left + * unspecified or is not honored, then the endpoint will pick an appropriate + * default duration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. The required format is: + * * projects/{project}/locations/{location}/clusters/{cluster} + * + * 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 parent resource. The required format is: + * * projects/{project}/locations/{location}/clusters/{cluster} + * + * 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 optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. A pem-encoded X.509 certificate signing request (CSR). + * + * Generated from protobuf field string pem_csr = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPemCsr() + { + return $this->pem_csr; + } + + /** + * Optional. A pem-encoded X.509 certificate signing request (CSR). + * + * Generated from protobuf field string pem_csr = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPemCsr($var) + { + GPBUtil::checkString($var, True); + $this->pem_csr = $var; + + return $this; + } + + /** + * Optional. An optional hint to the endpoint to generate the client + * certificate with the requested duration. The duration can be from 1 hour to + * 24 hours. The endpoint may or may not honor the hint. If the hint is left + * unspecified or is not honored, then the endpoint will pick an appropriate + * default duration. + * + * Generated from protobuf field .google.protobuf.Duration cert_duration = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Duration|null + */ + public function getCertDuration() + { + return $this->cert_duration; + } + + public function hasCertDuration() + { + return isset($this->cert_duration); + } + + public function clearCertDuration() + { + unset($this->cert_duration); + } + + /** + * Optional. An optional hint to the endpoint to generate the client + * certificate with the requested duration. The duration can be from 1 hour to + * 24 hours. The endpoint may or may not honor the hint. If the hint is left + * unspecified or is not honored, then the endpoint will pick an appropriate + * default duration. + * + * Generated from protobuf field .google.protobuf.Duration cert_duration = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setCertDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->cert_duration = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/GenerateClientCertificateResponse.php b/AlloyDb/src/V1alpha/GenerateClientCertificateResponse.php new file mode 100644 index 000000000000..7ea3c7958fc4 --- /dev/null +++ b/AlloyDb/src/V1alpha/GenerateClientCertificateResponse.php @@ -0,0 +1,105 @@ +google.cloud.alloydb.v1alpha.GenerateClientCertificateResponse + */ +class GenerateClientCertificateResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The pem-encoded, signed X.509 certificate. + * + * Generated from protobuf field string pem_certificate = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $pem_certificate = ''; + /** + * Output only. The pem-encoded chain that may be used to verify the X.509 + * certificate. Expected to be in issuer-to-root order according to RFC 5246. + * + * Generated from protobuf field repeated string pem_certificate_chain = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $pem_certificate_chain; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $pem_certificate + * Output only. The pem-encoded, signed X.509 certificate. + * @type array|\Google\Protobuf\Internal\RepeatedField $pem_certificate_chain + * Output only. The pem-encoded chain that may be used to verify the X.509 + * certificate. Expected to be in issuer-to-root order according to RFC 5246. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The pem-encoded, signed X.509 certificate. + * + * Generated from protobuf field string pem_certificate = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getPemCertificate() + { + return $this->pem_certificate; + } + + /** + * Output only. The pem-encoded, signed X.509 certificate. + * + * Generated from protobuf field string pem_certificate = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setPemCertificate($var) + { + GPBUtil::checkString($var, True); + $this->pem_certificate = $var; + + return $this; + } + + /** + * Output only. The pem-encoded chain that may be used to verify the X.509 + * certificate. Expected to be in issuer-to-root order according to RFC 5246. + * + * Generated from protobuf field repeated string pem_certificate_chain = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPemCertificateChain() + { + return $this->pem_certificate_chain; + } + + /** + * Output only. The pem-encoded chain that may be used to verify the X.509 + * certificate. Expected to be in issuer-to-root order according to RFC 5246. + * + * Generated from protobuf field repeated string pem_certificate_chain = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPemCertificateChain($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->pem_certificate_chain = $arr; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/GetBackupRequest.php b/AlloyDb/src/V1alpha/GetBackupRequest.php new file mode 100644 index 000000000000..41131a0add13 --- /dev/null +++ b/AlloyDb/src/V1alpha/GetBackupRequest.php @@ -0,0 +1,67 @@ +google.cloud.alloydb.v1alpha.GetBackupRequest + */ +class GetBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the resource + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the resource + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the resource + * + * 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 resource + * + * 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/AlloyDb/src/V1alpha/GetClusterRequest.php b/AlloyDb/src/V1alpha/GetClusterRequest.php new file mode 100644 index 000000000000..cceb1be2f425 --- /dev/null +++ b/AlloyDb/src/V1alpha/GetClusterRequest.php @@ -0,0 +1,71 @@ +google.cloud.alloydb.v1alpha.GetClusterRequest + */ +class GetClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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 resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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/AlloyDb/src/V1alpha/GetConnectionInfoRequest.php b/AlloyDb/src/V1alpha/GetConnectionInfoRequest.php new file mode 100644 index 000000000000..9cd7eb1c16c1 --- /dev/null +++ b/AlloyDb/src/V1alpha/GetConnectionInfoRequest.php @@ -0,0 +1,145 @@ +google.cloud.alloydb.v1alpha.GetConnectionInfoRequest + */ +class GetConnectionInfoRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. The required format is: + * projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. The required format is: + * projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance} + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. The required format is: + * projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance} + * + * 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 parent resource. The required format is: + * projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance} + * + * 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 optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/GetInstanceRequest.php b/AlloyDb/src/V1alpha/GetInstanceRequest.php new file mode 100644 index 000000000000..98eaade41c89 --- /dev/null +++ b/AlloyDb/src/V1alpha/GetInstanceRequest.php @@ -0,0 +1,105 @@ +google.cloud.alloydb.v1alpha.GetInstanceRequest + */ +class GetInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The view of the instance to return. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.InstanceView view = 2; + */ + protected $view = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @type int $view + * The view of the instance to return. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * 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 resource. For the required format, see the + * comment on the Instance.name field. + * + * 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; + } + + /** + * The view of the instance to return. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.InstanceView view = 2; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * The view of the instance to return. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.InstanceView view = 2; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1alpha\InstanceView::class); + $this->view = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/Instance.php b/AlloyDb/src/V1alpha/Instance.php new file mode 100644 index 000000000000..822731e444ef --- /dev/null +++ b/AlloyDb/src/V1alpha/Instance.php @@ -0,0 +1,966 @@ +google.cloud.alloydb.v1alpha.Instance + */ +class Instance extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the instance resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id}/instances/{instance_id} + * where the cluster and instance ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the instance resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * User-settable and human-readable display name for the Instance. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. Create time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $delete_time = null; + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 7; + */ + private $labels; + /** + * Output only. The current serving state of the instance. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Required. The type of the instance. Specified at creation time. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.InstanceType instance_type = 9 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance_type = 0; + /** + * Configurations for the machines that host the underlying + * database engine. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.MachineConfig machine_config = 10; + */ + protected $machine_config = null; + /** + * Availability type of an Instance. + * Defaults to REGIONAL for both primary and read instances. + * Note that primary and read instances can have different availability types. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.AvailabilityType availability_type = 11; + */ + protected $availability_type = 0; + /** + * The Compute Engine zone that the instance should serve from, per + * https://cloud.google.com/compute/docs/regions-zones + * This can ONLY be specified for ZONAL instances. + * If present for a REGIONAL instance, an error will be thrown. + * If this is absent for a ZONAL instance, instance is created in a random + * zone with available capacity. + * + * Generated from protobuf field string gce_zone = 12; + */ + protected $gce_zone = ''; + /** + * Database flags. Set at instance level. + * * They are copied from primary instance on read instance creation. + * * Read instances can set new or override existing flags that are relevant + * for reads, e.g. for enabling columnar cache on a read instance. Flags + * set on read instance may or may not be present on primary. + * This is a list of "key": "value" pairs. + * "key": The name of the flag. These flags are passed at instance setup time, + * so include both server options and system variables for Postgres. Flags are + * specified with underscores, not hyphens. + * "value": The value of the flag. Booleans are set to **on** for true + * and **off** for false. This field must be omitted if the flag + * doesn't take a value. + * + * Generated from protobuf field map database_flags = 13; + */ + private $database_flags; + /** + * Output only. This is set for the read-write VM of the PRIMARY instance + * only. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.Node writable_node = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $writable_node = null; + /** + * Output only. List of available read-only VMs in this instance, including + * the standby for a PRIMARY instance. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.Instance.Node nodes = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $nodes; + /** + * Configuration for query insights. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.QueryInsightsInstanceConfig query_insights_config = 21; + */ + protected $query_insights_config = null; + /** + * Read pool specific config. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.ReadPoolConfig read_pool_config = 14; + */ + protected $read_pool_config = null; + /** + * Output only. The IP address for the Instance. + * This is the connection endpoint for an end-user application. + * + * Generated from protobuf field string ip_address = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $ip_address = ''; + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Instance does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * + * Generated from protobuf field bool reconciling = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reconciling = false; + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 17; + */ + protected $etag = ''; + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 18; + */ + private $annotations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The name of the instance resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id}/instances/{instance_id} + * where the cluster and instance ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the instance resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * @type string $display_name + * User-settable and human-readable display name for the Instance. + * @type string $uid + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Create time stamp + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Update time stamp + * @type \Google\Protobuf\Timestamp $delete_time + * Output only. Delete time stamp + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels as key value pairs + * @type int $state + * Output only. The current serving state of the instance. + * @type int $instance_type + * Required. The type of the instance. Specified at creation time. + * @type \Google\Cloud\AlloyDb\V1alpha\Instance\MachineConfig $machine_config + * Configurations for the machines that host the underlying + * database engine. + * @type int $availability_type + * Availability type of an Instance. + * Defaults to REGIONAL for both primary and read instances. + * Note that primary and read instances can have different availability types. + * @type string $gce_zone + * The Compute Engine zone that the instance should serve from, per + * https://cloud.google.com/compute/docs/regions-zones + * This can ONLY be specified for ZONAL instances. + * If present for a REGIONAL instance, an error will be thrown. + * If this is absent for a ZONAL instance, instance is created in a random + * zone with available capacity. + * @type array|\Google\Protobuf\Internal\MapField $database_flags + * Database flags. Set at instance level. + * * They are copied from primary instance on read instance creation. + * * Read instances can set new or override existing flags that are relevant + * for reads, e.g. for enabling columnar cache on a read instance. Flags + * set on read instance may or may not be present on primary. + * This is a list of "key": "value" pairs. + * "key": The name of the flag. These flags are passed at instance setup time, + * so include both server options and system variables for Postgres. Flags are + * specified with underscores, not hyphens. + * "value": The value of the flag. Booleans are set to **on** for true + * and **off** for false. This field must be omitted if the flag + * doesn't take a value. + * @type \Google\Cloud\AlloyDb\V1alpha\Instance\Node $writable_node + * Output only. This is set for the read-write VM of the PRIMARY instance + * only. + * @type array<\Google\Cloud\AlloyDb\V1alpha\Instance\Node>|\Google\Protobuf\Internal\RepeatedField $nodes + * Output only. List of available read-only VMs in this instance, including + * the standby for a PRIMARY instance. + * @type \Google\Cloud\AlloyDb\V1alpha\Instance\QueryInsightsInstanceConfig $query_insights_config + * Configuration for query insights. + * @type \Google\Cloud\AlloyDb\V1alpha\Instance\ReadPoolConfig $read_pool_config + * Read pool specific config. + * @type string $ip_address + * Output only. The IP address for the Instance. + * This is the connection endpoint for an end-user application. + * @type bool $reconciling + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Instance does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * @type string $etag + * For Resource freshness validation (https://google.aip.dev/154) + * @type array|\Google\Protobuf\Internal\MapField $annotations + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the instance resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id}/instances/{instance_id} + * where the cluster and instance ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the instance resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * + * 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 instance resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id}/instances/{instance_id} + * where the cluster and instance ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the instance resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * + * 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; + } + + /** + * User-settable and human-readable display name for the Instance. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * User-settable and human-readable display name for the Instance. + * + * 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. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. Create time stamp + * + * 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. Create time stamp + * + * 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. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getDeleteTime() + { + return $this->delete_time; + } + + public function hasDeleteTime() + { + return isset($this->delete_time); + } + + public function clearDeleteTime() + { + unset($this->delete_time); + } + + /** + * Output only. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setDeleteTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->delete_time = $var; + + return $this; + } + + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 7; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels as key value pairs + * + * 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; + } + + /** + * Output only. The current serving state of the instance. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current serving state of the instance. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1alpha\Instance\State::class); + $this->state = $var; + + return $this; + } + + /** + * Required. The type of the instance. Specified at creation time. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.InstanceType instance_type = 9 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getInstanceType() + { + return $this->instance_type; + } + + /** + * Required. The type of the instance. Specified at creation time. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.InstanceType instance_type = 9 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setInstanceType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1alpha\Instance\InstanceType::class); + $this->instance_type = $var; + + return $this; + } + + /** + * Configurations for the machines that host the underlying + * database engine. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.MachineConfig machine_config = 10; + * @return \Google\Cloud\AlloyDb\V1alpha\Instance\MachineConfig|null + */ + public function getMachineConfig() + { + return $this->machine_config; + } + + public function hasMachineConfig() + { + return isset($this->machine_config); + } + + public function clearMachineConfig() + { + unset($this->machine_config); + } + + /** + * Configurations for the machines that host the underlying + * database engine. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.MachineConfig machine_config = 10; + * @param \Google\Cloud\AlloyDb\V1alpha\Instance\MachineConfig $var + * @return $this + */ + public function setMachineConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\Instance\MachineConfig::class); + $this->machine_config = $var; + + return $this; + } + + /** + * Availability type of an Instance. + * Defaults to REGIONAL for both primary and read instances. + * Note that primary and read instances can have different availability types. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.AvailabilityType availability_type = 11; + * @return int + */ + public function getAvailabilityType() + { + return $this->availability_type; + } + + /** + * Availability type of an Instance. + * Defaults to REGIONAL for both primary and read instances. + * Note that primary and read instances can have different availability types. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.AvailabilityType availability_type = 11; + * @param int $var + * @return $this + */ + public function setAvailabilityType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1alpha\Instance\AvailabilityType::class); + $this->availability_type = $var; + + return $this; + } + + /** + * The Compute Engine zone that the instance should serve from, per + * https://cloud.google.com/compute/docs/regions-zones + * This can ONLY be specified for ZONAL instances. + * If present for a REGIONAL instance, an error will be thrown. + * If this is absent for a ZONAL instance, instance is created in a random + * zone with available capacity. + * + * Generated from protobuf field string gce_zone = 12; + * @return string + */ + public function getGceZone() + { + return $this->gce_zone; + } + + /** + * The Compute Engine zone that the instance should serve from, per + * https://cloud.google.com/compute/docs/regions-zones + * This can ONLY be specified for ZONAL instances. + * If present for a REGIONAL instance, an error will be thrown. + * If this is absent for a ZONAL instance, instance is created in a random + * zone with available capacity. + * + * Generated from protobuf field string gce_zone = 12; + * @param string $var + * @return $this + */ + public function setGceZone($var) + { + GPBUtil::checkString($var, True); + $this->gce_zone = $var; + + return $this; + } + + /** + * Database flags. Set at instance level. + * * They are copied from primary instance on read instance creation. + * * Read instances can set new or override existing flags that are relevant + * for reads, e.g. for enabling columnar cache on a read instance. Flags + * set on read instance may or may not be present on primary. + * This is a list of "key": "value" pairs. + * "key": The name of the flag. These flags are passed at instance setup time, + * so include both server options and system variables for Postgres. Flags are + * specified with underscores, not hyphens. + * "value": The value of the flag. Booleans are set to **on** for true + * and **off** for false. This field must be omitted if the flag + * doesn't take a value. + * + * Generated from protobuf field map database_flags = 13; + * @return \Google\Protobuf\Internal\MapField + */ + public function getDatabaseFlags() + { + return $this->database_flags; + } + + /** + * Database flags. Set at instance level. + * * They are copied from primary instance on read instance creation. + * * Read instances can set new or override existing flags that are relevant + * for reads, e.g. for enabling columnar cache on a read instance. Flags + * set on read instance may or may not be present on primary. + * This is a list of "key": "value" pairs. + * "key": The name of the flag. These flags are passed at instance setup time, + * so include both server options and system variables for Postgres. Flags are + * specified with underscores, not hyphens. + * "value": The value of the flag. Booleans are set to **on** for true + * and **off** for false. This field must be omitted if the flag + * doesn't take a value. + * + * Generated from protobuf field map database_flags = 13; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setDatabaseFlags($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->database_flags = $arr; + + return $this; + } + + /** + * Output only. This is set for the read-write VM of the PRIMARY instance + * only. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.Node writable_node = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1alpha\Instance\Node|null + */ + public function getWritableNode() + { + return $this->writable_node; + } + + public function hasWritableNode() + { + return isset($this->writable_node); + } + + public function clearWritableNode() + { + unset($this->writable_node); + } + + /** + * Output only. This is set for the read-write VM of the PRIMARY instance + * only. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.Node writable_node = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1alpha\Instance\Node $var + * @return $this + */ + public function setWritableNode($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\Instance\Node::class); + $this->writable_node = $var; + + return $this; + } + + /** + * Output only. List of available read-only VMs in this instance, including + * the standby for a PRIMARY instance. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.Instance.Node nodes = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNodes() + { + return $this->nodes; + } + + /** + * Output only. List of available read-only VMs in this instance, including + * the standby for a PRIMARY instance. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.Instance.Node nodes = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\AlloyDb\V1alpha\Instance\Node>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNodes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1alpha\Instance\Node::class); + $this->nodes = $arr; + + return $this; + } + + /** + * Configuration for query insights. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.QueryInsightsInstanceConfig query_insights_config = 21; + * @return \Google\Cloud\AlloyDb\V1alpha\Instance\QueryInsightsInstanceConfig|null + */ + public function getQueryInsightsConfig() + { + return $this->query_insights_config; + } + + public function hasQueryInsightsConfig() + { + return isset($this->query_insights_config); + } + + public function clearQueryInsightsConfig() + { + unset($this->query_insights_config); + } + + /** + * Configuration for query insights. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.QueryInsightsInstanceConfig query_insights_config = 21; + * @param \Google\Cloud\AlloyDb\V1alpha\Instance\QueryInsightsInstanceConfig $var + * @return $this + */ + public function setQueryInsightsConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\Instance\QueryInsightsInstanceConfig::class); + $this->query_insights_config = $var; + + return $this; + } + + /** + * Read pool specific config. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.ReadPoolConfig read_pool_config = 14; + * @return \Google\Cloud\AlloyDb\V1alpha\Instance\ReadPoolConfig|null + */ + public function getReadPoolConfig() + { + return $this->read_pool_config; + } + + public function hasReadPoolConfig() + { + return isset($this->read_pool_config); + } + + public function clearReadPoolConfig() + { + unset($this->read_pool_config); + } + + /** + * Read pool specific config. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance.ReadPoolConfig read_pool_config = 14; + * @param \Google\Cloud\AlloyDb\V1alpha\Instance\ReadPoolConfig $var + * @return $this + */ + public function setReadPoolConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\Instance\ReadPoolConfig::class); + $this->read_pool_config = $var; + + return $this; + } + + /** + * Output only. The IP address for the Instance. + * This is the connection endpoint for an end-user application. + * + * Generated from protobuf field string ip_address = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getIpAddress() + { + return $this->ip_address; + } + + /** + * Output only. The IP address for the Instance. + * This is the connection endpoint for an end-user application. + * + * Generated from protobuf field string ip_address = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setIpAddress($var) + { + GPBUtil::checkString($var, True); + $this->ip_address = $var; + + return $this; + } + + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Instance does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * + * Generated from protobuf field bool reconciling = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getReconciling() + { + return $this->reconciling; + } + + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Instance does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * + * Generated from protobuf field bool reconciling = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setReconciling($var) + { + GPBUtil::checkBool($var); + $this->reconciling = $var; + + return $this; + } + + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 17; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 17; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 18; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 18; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/Instance/AvailabilityType.php b/AlloyDb/src/V1alpha/Instance/AvailabilityType.php new file mode 100644 index 000000000000..4855dc2a7533 --- /dev/null +++ b/AlloyDb/src/V1alpha/Instance/AvailabilityType.php @@ -0,0 +1,66 @@ +ZONAL: The instance serves data from only one zone. + * Outages in that zone affect instance availability. + *
REGIONAL: The instance can serve data from more than one zone + * in a region (it is highly available). + * + * Protobuf type google.cloud.alloydb.v1alpha.Instance.AvailabilityType + */ +class AvailabilityType +{ + /** + * This is an unknown Availability type. + * + * Generated from protobuf enum AVAILABILITY_TYPE_UNSPECIFIED = 0; + */ + const AVAILABILITY_TYPE_UNSPECIFIED = 0; + /** + * Zonal available instance. + * + * Generated from protobuf enum ZONAL = 1; + */ + const ZONAL = 1; + /** + * Regional (or Highly) available instance. + * + * Generated from protobuf enum REGIONAL = 2; + */ + const REGIONAL = 2; + + private static $valueToName = [ + self::AVAILABILITY_TYPE_UNSPECIFIED => 'AVAILABILITY_TYPE_UNSPECIFIED', + self::ZONAL => 'ZONAL', + self::REGIONAL => 'REGIONAL', + ]; + + 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/AlloyDb/src/V1alpha/Instance/InstanceType.php b/AlloyDb/src/V1alpha/Instance/InstanceType.php new file mode 100644 index 000000000000..c608193dbcab --- /dev/null +++ b/AlloyDb/src/V1alpha/Instance/InstanceType.php @@ -0,0 +1,74 @@ +google.cloud.alloydb.v1alpha.Instance.InstanceType + */ +class InstanceType +{ + /** + * The type of the instance is unknown. + * + * Generated from protobuf enum INSTANCE_TYPE_UNSPECIFIED = 0; + */ + const INSTANCE_TYPE_UNSPECIFIED = 0; + /** + * PRIMARY instances support read and write operations. + * + * Generated from protobuf enum PRIMARY = 1; + */ + const PRIMARY = 1; + /** + * READ POOL instances support read operations only. Each read pool instance + * consists of one or more homogeneous nodes. + * * Read pool of size 1 can only have zonal availability. + * * Read pools with node count of 2 or more can have regional + * availability (nodes are present in 2 or more zones in a region). + * + * Generated from protobuf enum READ_POOL = 2; + */ + const READ_POOL = 2; + /** + * SECONDARY instances support read operations only. SECONDARY instance + * is a cross-region read replica + * + * Generated from protobuf enum SECONDARY = 3; + */ + const SECONDARY = 3; + + private static $valueToName = [ + self::INSTANCE_TYPE_UNSPECIFIED => 'INSTANCE_TYPE_UNSPECIFIED', + self::PRIMARY => 'PRIMARY', + self::READ_POOL => 'READ_POOL', + self::SECONDARY => 'SECONDARY', + ]; + + 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/AlloyDb/src/V1alpha/Instance/MachineConfig.php b/AlloyDb/src/V1alpha/Instance/MachineConfig.php new file mode 100644 index 000000000000..2d552841b2a9 --- /dev/null +++ b/AlloyDb/src/V1alpha/Instance/MachineConfig.php @@ -0,0 +1,68 @@ +google.cloud.alloydb.v1alpha.Instance.MachineConfig + */ +class MachineConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The number of CPU's in the VM instance. + * + * Generated from protobuf field int32 cpu_count = 1; + */ + protected $cpu_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $cpu_count + * The number of CPU's in the VM instance. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The number of CPU's in the VM instance. + * + * Generated from protobuf field int32 cpu_count = 1; + * @return int + */ + public function getCpuCount() + { + return $this->cpu_count; + } + + /** + * The number of CPU's in the VM instance. + * + * Generated from protobuf field int32 cpu_count = 1; + * @param int $var + * @return $this + */ + public function setCpuCount($var) + { + GPBUtil::checkInt32($var); + $this->cpu_count = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1alpha/Instance/Node.php b/AlloyDb/src/V1alpha/Instance/Node.php new file mode 100644 index 000000000000..749a37fed732 --- /dev/null +++ b/AlloyDb/src/V1alpha/Instance/Node.php @@ -0,0 +1,184 @@ +google.cloud.alloydb.v1alpha.Instance.Node + */ +class Node extends \Google\Protobuf\Internal\Message +{ + /** + * The Compute Engine zone of the VM e.g. "us-central1-b". + * + * Generated from protobuf field string zone_id = 1; + */ + protected $zone_id = ''; + /** + * The identifier of the VM e.g. "test-read-0601-407e52be-ms3l". + * + * Generated from protobuf field string id = 2; + */ + protected $id = ''; + /** + * The private IP address of the VM e.g. "10.57.0.34". + * + * Generated from protobuf field string ip = 3; + */ + protected $ip = ''; + /** + * Determined by state of the compute VM and postgres-service health. + * Compute VM state can have values listed in + * https://cloud.google.com/compute/docs/instances/instance-life-cycle and + * postgres-service health can have values: HEALTHY and UNHEALTHY. + * + * Generated from protobuf field string state = 4; + */ + protected $state = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $zone_id + * The Compute Engine zone of the VM e.g. "us-central1-b". + * @type string $id + * The identifier of the VM e.g. "test-read-0601-407e52be-ms3l". + * @type string $ip + * The private IP address of the VM e.g. "10.57.0.34". + * @type string $state + * Determined by state of the compute VM and postgres-service health. + * Compute VM state can have values listed in + * https://cloud.google.com/compute/docs/instances/instance-life-cycle and + * postgres-service health can have values: HEALTHY and UNHEALTHY. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The Compute Engine zone of the VM e.g. "us-central1-b". + * + * Generated from protobuf field string zone_id = 1; + * @return string + */ + public function getZoneId() + { + return $this->zone_id; + } + + /** + * The Compute Engine zone of the VM e.g. "us-central1-b". + * + * Generated from protobuf field string zone_id = 1; + * @param string $var + * @return $this + */ + public function setZoneId($var) + { + GPBUtil::checkString($var, True); + $this->zone_id = $var; + + return $this; + } + + /** + * The identifier of the VM e.g. "test-read-0601-407e52be-ms3l". + * + * Generated from protobuf field string id = 2; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * The identifier of the VM e.g. "test-read-0601-407e52be-ms3l". + * + * Generated from protobuf field string id = 2; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * The private IP address of the VM e.g. "10.57.0.34". + * + * Generated from protobuf field string ip = 3; + * @return string + */ + public function getIp() + { + return $this->ip; + } + + /** + * The private IP address of the VM e.g. "10.57.0.34". + * + * Generated from protobuf field string ip = 3; + * @param string $var + * @return $this + */ + public function setIp($var) + { + GPBUtil::checkString($var, True); + $this->ip = $var; + + return $this; + } + + /** + * Determined by state of the compute VM and postgres-service health. + * Compute VM state can have values listed in + * https://cloud.google.com/compute/docs/instances/instance-life-cycle and + * postgres-service health can have values: HEALTHY and UNHEALTHY. + * + * Generated from protobuf field string state = 4; + * @return string + */ + public function getState() + { + return $this->state; + } + + /** + * Determined by state of the compute VM and postgres-service health. + * Compute VM state can have values listed in + * https://cloud.google.com/compute/docs/instances/instance-life-cycle and + * postgres-service health can have values: HEALTHY and UNHEALTHY. + * + * Generated from protobuf field string state = 4; + * @param string $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkString($var, True); + $this->state = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1alpha/Instance/QueryInsightsInstanceConfig.php b/AlloyDb/src/V1alpha/Instance/QueryInsightsInstanceConfig.php new file mode 100644 index 000000000000..ebf1cc5bb0b4 --- /dev/null +++ b/AlloyDb/src/V1alpha/Instance/QueryInsightsInstanceConfig.php @@ -0,0 +1,220 @@ +google.cloud.alloydb.v1alpha.Instance.QueryInsightsInstanceConfig + */ +class QueryInsightsInstanceConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Record application tags for an instance. + * This flag is turned "on" by default. + * + * Generated from protobuf field optional bool record_application_tags = 2; + */ + protected $record_application_tags = null; + /** + * Record client address for an instance. Client address is PII information. + * This flag is turned "on" by default. + * + * Generated from protobuf field optional bool record_client_address = 3; + */ + protected $record_client_address = null; + /** + * Query string length. The default value is 1024. + * Any integer between 256 and 4500 is considered valid. + * + * Generated from protobuf field uint32 query_string_length = 4; + */ + protected $query_string_length = 0; + /** + * Number of query execution plans captured by Insights per minute + * for all queries combined. The default value is 5. + * Any integer between 0 and 20 is considered valid. + * + * Generated from protobuf field optional uint32 query_plans_per_minute = 5; + */ + protected $query_plans_per_minute = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $record_application_tags + * Record application tags for an instance. + * This flag is turned "on" by default. + * @type bool $record_client_address + * Record client address for an instance. Client address is PII information. + * This flag is turned "on" by default. + * @type int $query_string_length + * Query string length. The default value is 1024. + * Any integer between 256 and 4500 is considered valid. + * @type int $query_plans_per_minute + * Number of query execution plans captured by Insights per minute + * for all queries combined. The default value is 5. + * Any integer between 0 and 20 is considered valid. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Record application tags for an instance. + * This flag is turned "on" by default. + * + * Generated from protobuf field optional bool record_application_tags = 2; + * @return bool + */ + public function getRecordApplicationTags() + { + return isset($this->record_application_tags) ? $this->record_application_tags : false; + } + + public function hasRecordApplicationTags() + { + return isset($this->record_application_tags); + } + + public function clearRecordApplicationTags() + { + unset($this->record_application_tags); + } + + /** + * Record application tags for an instance. + * This flag is turned "on" by default. + * + * Generated from protobuf field optional bool record_application_tags = 2; + * @param bool $var + * @return $this + */ + public function setRecordApplicationTags($var) + { + GPBUtil::checkBool($var); + $this->record_application_tags = $var; + + return $this; + } + + /** + * Record client address for an instance. Client address is PII information. + * This flag is turned "on" by default. + * + * Generated from protobuf field optional bool record_client_address = 3; + * @return bool + */ + public function getRecordClientAddress() + { + return isset($this->record_client_address) ? $this->record_client_address : false; + } + + public function hasRecordClientAddress() + { + return isset($this->record_client_address); + } + + public function clearRecordClientAddress() + { + unset($this->record_client_address); + } + + /** + * Record client address for an instance. Client address is PII information. + * This flag is turned "on" by default. + * + * Generated from protobuf field optional bool record_client_address = 3; + * @param bool $var + * @return $this + */ + public function setRecordClientAddress($var) + { + GPBUtil::checkBool($var); + $this->record_client_address = $var; + + return $this; + } + + /** + * Query string length. The default value is 1024. + * Any integer between 256 and 4500 is considered valid. + * + * Generated from protobuf field uint32 query_string_length = 4; + * @return int + */ + public function getQueryStringLength() + { + return $this->query_string_length; + } + + /** + * Query string length. The default value is 1024. + * Any integer between 256 and 4500 is considered valid. + * + * Generated from protobuf field uint32 query_string_length = 4; + * @param int $var + * @return $this + */ + public function setQueryStringLength($var) + { + GPBUtil::checkUint32($var); + $this->query_string_length = $var; + + return $this; + } + + /** + * Number of query execution plans captured by Insights per minute + * for all queries combined. The default value is 5. + * Any integer between 0 and 20 is considered valid. + * + * Generated from protobuf field optional uint32 query_plans_per_minute = 5; + * @return int + */ + public function getQueryPlansPerMinute() + { + return isset($this->query_plans_per_minute) ? $this->query_plans_per_minute : 0; + } + + public function hasQueryPlansPerMinute() + { + return isset($this->query_plans_per_minute); + } + + public function clearQueryPlansPerMinute() + { + unset($this->query_plans_per_minute); + } + + /** + * Number of query execution plans captured by Insights per minute + * for all queries combined. The default value is 5. + * Any integer between 0 and 20 is considered valid. + * + * Generated from protobuf field optional uint32 query_plans_per_minute = 5; + * @param int $var + * @return $this + */ + public function setQueryPlansPerMinute($var) + { + GPBUtil::checkUint32($var); + $this->query_plans_per_minute = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1alpha/Instance/ReadPoolConfig.php b/AlloyDb/src/V1alpha/Instance/ReadPoolConfig.php new file mode 100644 index 000000000000..10f8315f42e2 --- /dev/null +++ b/AlloyDb/src/V1alpha/Instance/ReadPoolConfig.php @@ -0,0 +1,68 @@ +google.cloud.alloydb.v1alpha.Instance.ReadPoolConfig + */ +class ReadPoolConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Read capacity, i.e. number of nodes in a read pool instance. + * + * Generated from protobuf field int32 node_count = 1; + */ + protected $node_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $node_count + * Read capacity, i.e. number of nodes in a read pool instance. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Read capacity, i.e. number of nodes in a read pool instance. + * + * Generated from protobuf field int32 node_count = 1; + * @return int + */ + public function getNodeCount() + { + return $this->node_count; + } + + /** + * Read capacity, i.e. number of nodes in a read pool instance. + * + * Generated from protobuf field int32 node_count = 1; + * @param int $var + * @return $this + */ + public function setNodeCount($var) + { + GPBUtil::checkInt32($var); + $this->node_count = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1alpha/Instance/State.php b/AlloyDb/src/V1alpha/Instance/State.php new file mode 100644 index 000000000000..f4a57862139d --- /dev/null +++ b/AlloyDb/src/V1alpha/Instance/State.php @@ -0,0 +1,110 @@ +google.cloud.alloydb.v1alpha.Instance.State + */ +class State +{ + /** + * The state of the instance is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The instance is active and running. + * + * Generated from protobuf enum READY = 1; + */ + const READY = 1; + /** + * The instance is stopped. Instance name and IP resources are preserved. + * + * Generated from protobuf enum STOPPED = 2; + */ + const STOPPED = 2; + /** + * The instance is being created. + * + * Generated from protobuf enum CREATING = 3; + */ + const CREATING = 3; + /** + * The instance is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + /** + * The instance is down for maintenance. + * + * Generated from protobuf enum MAINTENANCE = 5; + */ + const MAINTENANCE = 5; + /** + * The creation of the instance failed or a fatal error occurred during + * an operation on the instance. + * Note: Instances in this state would tried to be auto-repaired. And + * Customers should be able to restart, update or delete these instances. + * + * Generated from protobuf enum FAILED = 6; + */ + const FAILED = 6; + /** + * Index 7 is used in the producer apis for ROLLED_BACK state. Keeping that + * index unused in case that state also needs to exposed via consumer apis + * in future. + * The instance has been configured to sync data from some other source. + * + * Generated from protobuf enum BOOTSTRAPPING = 8; + */ + const BOOTSTRAPPING = 8; + /** + * The instance is being promoted. + * + * Generated from protobuf enum PROMOTING = 9; + */ + const PROMOTING = 9; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::READY => 'READY', + self::STOPPED => 'STOPPED', + self::CREATING => 'CREATING', + self::DELETING => 'DELETING', + self::MAINTENANCE => 'MAINTENANCE', + self::FAILED => 'FAILED', + self::BOOTSTRAPPING => 'BOOTSTRAPPING', + self::PROMOTING => 'PROMOTING', + ]; + + 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/AlloyDb/src/V1alpha/InstanceView.php b/AlloyDb/src/V1alpha/InstanceView.php new file mode 100644 index 000000000000..823659026d58 --- /dev/null +++ b/AlloyDb/src/V1alpha/InstanceView.php @@ -0,0 +1,65 @@ +google.cloud.alloydb.v1alpha.InstanceView + */ +class InstanceView +{ + /** + * INSTANCE_VIEW_UNSPECIFIED Not specified, equivalent to BASIC. + * + * Generated from protobuf enum INSTANCE_VIEW_UNSPECIFIED = 0; + */ + const INSTANCE_VIEW_UNSPECIFIED = 0; + /** + * BASIC server responses for a primary or read instance include all the + * relevant instance details, excluding the details of each node in the + * instance. The default value. + * + * Generated from protobuf enum INSTANCE_VIEW_BASIC = 1; + */ + const INSTANCE_VIEW_BASIC = 1; + /** + * FULL response is equivalent to BASIC for primary instance (for now). + * For read pool instance, this includes details of each node in the pool. + * + * Generated from protobuf enum INSTANCE_VIEW_FULL = 2; + */ + const INSTANCE_VIEW_FULL = 2; + + private static $valueToName = [ + self::INSTANCE_VIEW_UNSPECIFIED => 'INSTANCE_VIEW_UNSPECIFIED', + self::INSTANCE_VIEW_BASIC => 'INSTANCE_VIEW_BASIC', + self::INSTANCE_VIEW_FULL => 'INSTANCE_VIEW_FULL', + ]; + + 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/AlloyDb/src/V1alpha/ListBackupsRequest.php b/AlloyDb/src/V1alpha/ListBackupsRequest.php new file mode 100644 index 000000000000..4043325e0bef --- /dev/null +++ b/AlloyDb/src/V1alpha/ListBackupsRequest.php @@ -0,0 +1,207 @@ +google.cloud.alloydb.v1alpha.ListBackupsRequest + */ +class ListBackupsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Parent value for ListBackupsRequest + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Filtering results + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Hint for how to order the results + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Parent value for ListBackupsRequest + * @type int $page_size + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @type string $page_token + * A token identifying a page of results the server should return. + * @type string $filter + * Filtering results + * @type string $order_by + * Hint for how to order the results + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Parent value for ListBackupsRequest + * + * 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. Parent value for ListBackupsRequest + * + * 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; + } + + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * 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; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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; + } + + /** + * Filtering results + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Filtering results + * + * 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; + } + + /** + * Hint for how to order the results + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Hint for how to order the results + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/ListBackupsResponse.php b/AlloyDb/src/V1alpha/ListBackupsResponse.php new file mode 100644 index 000000000000..e41b58c193b0 --- /dev/null +++ b/AlloyDb/src/V1alpha/ListBackupsResponse.php @@ -0,0 +1,135 @@ +google.cloud.alloydb.v1alpha.ListBackupsResponse + */ +class ListBackupsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of Backup + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.Backup backups = 1; + */ + private $backups; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * 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\AlloyDb\V1alpha\Backup>|\Google\Protobuf\Internal\RepeatedField $backups + * The list of Backup + * @type string $next_page_token + * A token identifying a page of results the server should return. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * The list of Backup + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.Backup backups = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBackups() + { + return $this->backups; + } + + /** + * The list of Backup + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.Backup backups = 1; + * @param array<\Google\Cloud\AlloyDb\V1alpha\Backup>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBackups($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1alpha\Backup::class); + $this->backups = $arr; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * 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/AlloyDb/src/V1alpha/ListClustersRequest.php b/AlloyDb/src/V1alpha/ListClustersRequest.php new file mode 100644 index 000000000000..693183573339 --- /dev/null +++ b/AlloyDb/src/V1alpha/ListClustersRequest.php @@ -0,0 +1,219 @@ +google.cloud.alloydb.v1alpha.ListClustersRequest + */ +class ListClustersRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with the following format: + * * projects/{project}/locations/- + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Optional. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with the following format: + * * projects/{project}/locations/- + * @type int $page_size + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @type string $page_token + * A token identifying a page of results the server should return. + * @type string $filter + * Optional. Filtering results + * @type string $order_by + * Optional. Hint for how to order the results + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with the following format: + * * projects/{project}/locations/- + * + * 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 parent resource. For the required format, see the + * comment on the Cluster.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with the following format: + * * projects/{project}/locations/- + * + * 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. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/ListClustersResponse.php b/AlloyDb/src/V1alpha/ListClustersResponse.php new file mode 100644 index 000000000000..f64218d54048 --- /dev/null +++ b/AlloyDb/src/V1alpha/ListClustersResponse.php @@ -0,0 +1,135 @@ +google.cloud.alloydb.v1alpha.ListClustersResponse + */ +class ListClustersResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of Cluster + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.Cluster clusters = 1; + */ + private $clusters; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * 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\AlloyDb\V1alpha\Cluster>|\Google\Protobuf\Internal\RepeatedField $clusters + * The list of Cluster + * @type string $next_page_token + * A token identifying a page of results the server should return. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * The list of Cluster + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.Cluster clusters = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getClusters() + { + return $this->clusters; + } + + /** + * The list of Cluster + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.Cluster clusters = 1; + * @param array<\Google\Cloud\AlloyDb\V1alpha\Cluster>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setClusters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1alpha\Cluster::class); + $this->clusters = $arr; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * 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/AlloyDb/src/V1alpha/ListInstancesRequest.php b/AlloyDb/src/V1alpha/ListInstancesRequest.php new file mode 100644 index 000000000000..6393c825a01a --- /dev/null +++ b/AlloyDb/src/V1alpha/ListInstancesRequest.php @@ -0,0 +1,227 @@ +google.cloud.alloydb.v1alpha.ListInstancesRequest + */ +class ListInstancesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with one of the following + * formats: + * * projects/{project}/locations/-/clusters/- + * * projects/{project}/locations/{region}/clusters/- + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Optional. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with one of the following + * formats: + * * projects/{project}/locations/-/clusters/- + * * projects/{project}/locations/{region}/clusters/- + * @type int $page_size + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @type string $page_token + * A token identifying a page of results the server should return. + * @type string $filter + * Optional. Filtering results + * @type string $order_by + * Optional. Hint for how to order the results + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with one of the following + * formats: + * * projects/{project}/locations/-/clusters/- + * * projects/{project}/locations/{region}/clusters/- + * + * 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 parent resource. For the required format, see the + * comment on the Instance.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with one of the following + * formats: + * * projects/{project}/locations/-/clusters/- + * * projects/{project}/locations/{region}/clusters/- + * + * 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. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/ListInstancesResponse.php b/AlloyDb/src/V1alpha/ListInstancesResponse.php new file mode 100644 index 000000000000..5ef3b7494243 --- /dev/null +++ b/AlloyDb/src/V1alpha/ListInstancesResponse.php @@ -0,0 +1,135 @@ +google.cloud.alloydb.v1alpha.ListInstancesResponse + */ +class ListInstancesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of Instance + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.Instance instances = 1; + */ + private $instances; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * 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\AlloyDb\V1alpha\Instance>|\Google\Protobuf\Internal\RepeatedField $instances + * The list of Instance + * @type string $next_page_token + * A token identifying a page of results the server should return. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * The list of Instance + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.Instance instances = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInstances() + { + return $this->instances; + } + + /** + * The list of Instance + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.Instance instances = 1; + * @param array<\Google\Cloud\AlloyDb\V1alpha\Instance>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInstances($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1alpha\Instance::class); + $this->instances = $arr; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * 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/AlloyDb/src/V1alpha/ListSupportedDatabaseFlagsRequest.php b/AlloyDb/src/V1alpha/ListSupportedDatabaseFlagsRequest.php new file mode 100644 index 000000000000..d264b94b533b --- /dev/null +++ b/AlloyDb/src/V1alpha/ListSupportedDatabaseFlagsRequest.php @@ -0,0 +1,159 @@ +google.cloud.alloydb.v1alpha.ListSupportedDatabaseFlagsRequest + */ +class ListSupportedDatabaseFlagsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. The required format is: + * * projects/{project}/locations/{location} + * Regardless of the parent specified here, as long it is contains a valid + * project and location, the service will return a static list of supported + * flags resources. Note that we do not yet support region-specific + * flags. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. The required format is: + * * projects/{project}/locations/{location} + * Regardless of the parent specified here, as long it is contains a valid + * project and location, the service will return a static list of supported + * flags resources. Note that we do not yet support region-specific + * flags. + * @type int $page_size + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @type string $page_token + * A token identifying a page of results the server should return. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. The required format is: + * * projects/{project}/locations/{location} + * Regardless of the parent specified here, as long it is contains a valid + * project and location, the service will return a static list of supported + * flags resources. Note that we do not yet support region-specific + * flags. + * + * 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 parent resource. The required format is: + * * projects/{project}/locations/{location} + * Regardless of the parent specified here, as long it is contains a valid + * project and location, the service will return a static list of supported + * flags resources. Note that we do not yet support region-specific + * flags. + * + * 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; + } + + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * 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; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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/AlloyDb/src/V1alpha/ListSupportedDatabaseFlagsResponse.php b/AlloyDb/src/V1alpha/ListSupportedDatabaseFlagsResponse.php new file mode 100644 index 000000000000..69ac851214b6 --- /dev/null +++ b/AlloyDb/src/V1alpha/ListSupportedDatabaseFlagsResponse.php @@ -0,0 +1,101 @@ +google.cloud.alloydb.v1alpha.ListSupportedDatabaseFlagsResponse + */ +class ListSupportedDatabaseFlagsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of SupportedDatabaseFlags. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.SupportedDatabaseFlag supported_database_flags = 1; + */ + private $supported_database_flags; + /** + * A token identifying a page of results the server should return. + * + * 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\AlloyDb\V1alpha\SupportedDatabaseFlag>|\Google\Protobuf\Internal\RepeatedField $supported_database_flags + * The list of SupportedDatabaseFlags. + * @type string $next_page_token + * A token identifying a page of results the server should return. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * The list of SupportedDatabaseFlags. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.SupportedDatabaseFlag supported_database_flags = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSupportedDatabaseFlags() + { + return $this->supported_database_flags; + } + + /** + * The list of SupportedDatabaseFlags. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.SupportedDatabaseFlag supported_database_flags = 1; + * @param array<\Google\Cloud\AlloyDb\V1alpha\SupportedDatabaseFlag>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSupportedDatabaseFlags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1alpha\SupportedDatabaseFlag::class); + $this->supported_database_flags = $arr; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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/AlloyDb/src/V1alpha/MigrationSource.php b/AlloyDb/src/V1alpha/MigrationSource.php new file mode 100644 index 000000000000..be816a1f56cb --- /dev/null +++ b/AlloyDb/src/V1alpha/MigrationSource.php @@ -0,0 +1,144 @@ +google.cloud.alloydb.v1alpha.MigrationSource + */ +class MigrationSource extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The host and port of the on-premises instance in host:port + * format + * + * Generated from protobuf field string host_port = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $host_port = ''; + /** + * Output only. Place holder for the external source identifier(e.g DMS job + * name) that created the cluster. + * + * Generated from protobuf field string reference_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reference_id = ''; + /** + * Output only. Type of migration source. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.MigrationSource.MigrationSourceType source_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $source_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $host_port + * Output only. The host and port of the on-premises instance in host:port + * format + * @type string $reference_id + * Output only. Place holder for the external source identifier(e.g DMS job + * name) that created the cluster. + * @type int $source_type + * Output only. Type of migration source. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The host and port of the on-premises instance in host:port + * format + * + * Generated from protobuf field string host_port = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getHostPort() + { + return $this->host_port; + } + + /** + * Output only. The host and port of the on-premises instance in host:port + * format + * + * Generated from protobuf field string host_port = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setHostPort($var) + { + GPBUtil::checkString($var, True); + $this->host_port = $var; + + return $this; + } + + /** + * Output only. Place holder for the external source identifier(e.g DMS job + * name) that created the cluster. + * + * Generated from protobuf field string reference_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getReferenceId() + { + return $this->reference_id; + } + + /** + * Output only. Place holder for the external source identifier(e.g DMS job + * name) that created the cluster. + * + * Generated from protobuf field string reference_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setReferenceId($var) + { + GPBUtil::checkString($var, True); + $this->reference_id = $var; + + return $this; + } + + /** + * Output only. Type of migration source. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.MigrationSource.MigrationSourceType source_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getSourceType() + { + return $this->source_type; + } + + /** + * Output only. Type of migration source. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.MigrationSource.MigrationSourceType source_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setSourceType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1alpha\MigrationSource\MigrationSourceType::class); + $this->source_type = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/MigrationSource/MigrationSourceType.php b/AlloyDb/src/V1alpha/MigrationSource/MigrationSourceType.php new file mode 100644 index 000000000000..c740f0df939c --- /dev/null +++ b/AlloyDb/src/V1alpha/MigrationSource/MigrationSourceType.php @@ -0,0 +1,55 @@ +google.cloud.alloydb.v1alpha.MigrationSource.MigrationSourceType + */ +class MigrationSourceType +{ + /** + * Migration source is unknown. + * + * Generated from protobuf enum MIGRATION_SOURCE_TYPE_UNSPECIFIED = 0; + */ + const MIGRATION_SOURCE_TYPE_UNSPECIFIED = 0; + /** + * DMS source means the cluster was created via DMS migration job. + * + * Generated from protobuf enum DMS = 1; + */ + const DMS = 1; + + private static $valueToName = [ + self::MIGRATION_SOURCE_TYPE_UNSPECIFIED => 'MIGRATION_SOURCE_TYPE_UNSPECIFIED', + self::DMS => 'DMS', + ]; + + 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/AlloyDb/src/V1alpha/OperationMetadata.php b/AlloyDb/src/V1alpha/OperationMetadata.php new file mode 100644 index 000000000000..d45e78a3391a --- /dev/null +++ b/AlloyDb/src/V1alpha/OperationMetadata.php @@ -0,0 +1,349 @@ +google.cloud.alloydb.v1alpha.OperationMetadata + */ +class OperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $target = ''; + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $verb = ''; + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $status_message = ''; + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $requested_cancellation = false; + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $api_version = ''; + protected $request_specific; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AlloyDb\V1alpha\BatchCreateInstancesMetadata $batch_create_instances_metadata + * Output only. BatchCreateInstances related metadata. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time the operation was created. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time the operation finished running. + * @type string $target + * Output only. Server-defined resource path for the target of the operation. + * @type string $verb + * Output only. Name of the verb executed by the operation. + * @type string $status_message + * Output only. Human-readable status of the operation, if any. + * @type bool $requested_cancellation + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * @type string $api_version + * Output only. API version used to start the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Output only. BatchCreateInstances related metadata. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata batch_create_instances_metadata = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1alpha\BatchCreateInstancesMetadata|null + */ + public function getBatchCreateInstancesMetadata() + { + return $this->readOneof(8); + } + + public function hasBatchCreateInstancesMetadata() + { + return $this->hasOneof(8); + } + + /** + * Output only. BatchCreateInstances related metadata. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata batch_create_instances_metadata = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1alpha\BatchCreateInstancesMetadata $var + * @return $this + */ + public function setBatchCreateInstancesMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\BatchCreateInstancesMetadata::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.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 operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.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 the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @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); + } + + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStatusMessage() + { + return $this->status_message; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStatusMessage($var) + { + GPBUtil::checkString($var, True); + $this->status_message = $var; + + return $this; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getRequestedCancellation() + { + return $this->requested_cancellation; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setRequestedCancellation($var) + { + GPBUtil::checkBool($var); + $this->requested_cancellation = $var; + + return $this; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + + /** + * @return string + */ + public function getRequestSpecific() + { + return $this->whichOneof("request_specific"); + } + +} + diff --git a/AlloyDb/src/V1alpha/PromoteClusterRequest.php b/AlloyDb/src/V1alpha/PromoteClusterRequest.php new file mode 100644 index 000000000000..6958d1967903 --- /dev/null +++ b/AlloyDb/src/V1alpha/PromoteClusterRequest.php @@ -0,0 +1,225 @@ +google.cloud.alloydb.v1alpha.PromoteClusterRequest + */ +class PromoteClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $etag = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $etag + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field + * + * 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 resource. For the required format, see the + * comment on the Cluster.name field + * + * 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. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/RestartInstanceRequest.php b/AlloyDb/src/V1alpha/RestartInstanceRequest.php new file mode 100644 index 000000000000..459a9f6c3d3c --- /dev/null +++ b/AlloyDb/src/V1alpha/RestartInstanceRequest.php @@ -0,0 +1,181 @@ +google.cloud.alloydb.v1alpha.RestartInstanceRequest + */ +class RestartInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the restart. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the restart. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * 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 resource. For the required format, see the + * comment on the Instance.name field. + * + * 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. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the restart. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the restart. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/RestoreClusterRequest.php b/AlloyDb/src/V1alpha/RestoreClusterRequest.php new file mode 100644 index 000000000000..dcde34c3116f --- /dev/null +++ b/AlloyDb/src/V1alpha/RestoreClusterRequest.php @@ -0,0 +1,344 @@ +google.cloud.alloydb.v1alpha.RestoreClusterRequest + */ +class RestoreClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. ID of the requesting object. + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster_id = ''; + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the import + * request. + * + * Generated from protobuf field bool validate_only = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AlloyDb\V1alpha\BackupSource $backup_source + * Backup source. + * @type \Google\Cloud\AlloyDb\V1alpha\ContinuousBackupSource $continuous_backup_source + * ContinuousBackup source. Continuous backup needs to be enabled in the + * source cluster for this operation to succeed. + * @type string $parent + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * @type string $cluster_id + * Required. ID of the requesting object. + * @type \Google\Cloud\AlloyDb\V1alpha\Cluster $cluster + * Required. The resource being created + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the import + * request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Backup source. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.BackupSource backup_source = 4; + * @return \Google\Cloud\AlloyDb\V1alpha\BackupSource|null + */ + public function getBackupSource() + { + return $this->readOneof(4); + } + + public function hasBackupSource() + { + return $this->hasOneof(4); + } + + /** + * Backup source. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.BackupSource backup_source = 4; + * @param \Google\Cloud\AlloyDb\V1alpha\BackupSource $var + * @return $this + */ + public function setBackupSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\BackupSource::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * ContinuousBackup source. Continuous backup needs to be enabled in the + * source cluster for this operation to succeed. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.ContinuousBackupSource continuous_backup_source = 8; + * @return \Google\Cloud\AlloyDb\V1alpha\ContinuousBackupSource|null + */ + public function getContinuousBackupSource() + { + return $this->readOneof(8); + } + + public function hasContinuousBackupSource() + { + return $this->hasOneof(8); + } + + /** + * ContinuousBackup source. Continuous backup needs to be enabled in the + * source cluster for this operation to succeed. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.ContinuousBackupSource continuous_backup_source = 8; + * @param \Google\Cloud\AlloyDb\V1alpha\ContinuousBackupSource $var + * @return $this + */ + public function setContinuousBackupSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\ContinuousBackupSource::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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 parent resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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. ID of the requesting object. + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getClusterId() + { + return $this->cluster_id; + } + + /** + * Required. ID of the requesting object. + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setClusterId($var) + { + GPBUtil::checkString($var, True); + $this->cluster_id = $var; + + return $this; + } + + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1alpha\Cluster|null + */ + public function getCluster() + { + return $this->cluster; + } + + public function hasCluster() + { + return isset($this->cluster); + } + + public function clearCluster() + { + unset($this->cluster); + } + + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1alpha\Cluster $var + * @return $this + */ + public function setCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\Cluster::class); + $this->cluster = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the import + * request. + * + * Generated from protobuf field bool validate_only = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the import + * request. + * + * Generated from protobuf field bool validate_only = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/AlloyDb/src/V1alpha/SslConfig.php b/AlloyDb/src/V1alpha/SslConfig.php new file mode 100644 index 000000000000..80f84309ec59 --- /dev/null +++ b/AlloyDb/src/V1alpha/SslConfig.php @@ -0,0 +1,105 @@ +google.cloud.alloydb.v1alpha.SslConfig + */ +class SslConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. SSL mode. Specifies client-server SSL/TLS connection behavior. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.SslConfig.SslMode ssl_mode = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $ssl_mode = 0; + /** + * Optional. Certificate Authority (CA) source. Only CA_SOURCE_MANAGED is + * supported currently, and is the default value. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.SslConfig.CaSource ca_source = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $ca_source = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $ssl_mode + * Optional. SSL mode. Specifies client-server SSL/TLS connection behavior. + * @type int $ca_source + * Optional. Certificate Authority (CA) source. Only CA_SOURCE_MANAGED is + * supported currently, and is the default value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Optional. SSL mode. Specifies client-server SSL/TLS connection behavior. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.SslConfig.SslMode ssl_mode = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getSslMode() + { + return $this->ssl_mode; + } + + /** + * Optional. SSL mode. Specifies client-server SSL/TLS connection behavior. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.SslConfig.SslMode ssl_mode = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setSslMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1alpha\SslConfig\SslMode::class); + $this->ssl_mode = $var; + + return $this; + } + + /** + * Optional. Certificate Authority (CA) source. Only CA_SOURCE_MANAGED is + * supported currently, and is the default value. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.SslConfig.CaSource ca_source = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getCaSource() + { + return $this->ca_source; + } + + /** + * Optional. Certificate Authority (CA) source. Only CA_SOURCE_MANAGED is + * supported currently, and is the default value. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.SslConfig.CaSource ca_source = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setCaSource($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1alpha\SslConfig\CaSource::class); + $this->ca_source = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/SslConfig/CaSource.php b/AlloyDb/src/V1alpha/SslConfig/CaSource.php new file mode 100644 index 000000000000..a9e38d61b332 --- /dev/null +++ b/AlloyDb/src/V1alpha/SslConfig/CaSource.php @@ -0,0 +1,56 @@ +google.cloud.alloydb.v1alpha.SslConfig.CaSource + */ +class CaSource +{ + /** + * Certificate Authority (CA) source not specified. Defaults to + * CA_SOURCE_MANAGED. + * + * Generated from protobuf enum CA_SOURCE_UNSPECIFIED = 0; + */ + const CA_SOURCE_UNSPECIFIED = 0; + /** + * Certificate Authority (CA) managed by the AlloyDB Cluster. + * + * Generated from protobuf enum CA_SOURCE_MANAGED = 1; + */ + const CA_SOURCE_MANAGED = 1; + + private static $valueToName = [ + self::CA_SOURCE_UNSPECIFIED => 'CA_SOURCE_UNSPECIFIED', + self::CA_SOURCE_MANAGED => 'CA_SOURCE_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); + } +} + + diff --git a/AlloyDb/src/V1alpha/SslConfig/SslMode.php b/AlloyDb/src/V1alpha/SslConfig/SslMode.php new file mode 100644 index 000000000000..75a3d5a4d16e --- /dev/null +++ b/AlloyDb/src/V1alpha/SslConfig/SslMode.php @@ -0,0 +1,73 @@ +google.cloud.alloydb.v1alpha.SslConfig.SslMode + */ +class SslMode +{ + /** + * SSL mode not specified. Defaults to SSL_MODE_ALLOW. + * + * Generated from protobuf enum SSL_MODE_UNSPECIFIED = 0; + */ + const SSL_MODE_UNSPECIFIED = 0; + /** + * SSL connections are optional. CA verification not enforced. + * + * Generated from protobuf enum SSL_MODE_ALLOW = 1; + */ + const SSL_MODE_ALLOW = 1; + /** + * SSL connections are required. CA verification not enforced. + * Clients may use locally self-signed certificates (default psql client + * behavior). + * + * Generated from protobuf enum SSL_MODE_REQUIRE = 2; + */ + const SSL_MODE_REQUIRE = 2; + /** + * SSL connections are required. CA verification enforced. + * Clients must have certificates signed by a Cluster CA, e.g. via + * GenerateClientCertificate. + * + * Generated from protobuf enum SSL_MODE_VERIFY_CA = 3; + */ + const SSL_MODE_VERIFY_CA = 3; + + private static $valueToName = [ + self::SSL_MODE_UNSPECIFIED => 'SSL_MODE_UNSPECIFIED', + self::SSL_MODE_ALLOW => 'SSL_MODE_ALLOW', + self::SSL_MODE_REQUIRE => 'SSL_MODE_REQUIRE', + self::SSL_MODE_VERIFY_CA => 'SSL_MODE_VERIFY_CA', + ]; + + 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/AlloyDb/src/V1alpha/SupportedDatabaseFlag.php b/AlloyDb/src/V1alpha/SupportedDatabaseFlag.php new file mode 100644 index 000000000000..c9fb2230b3be --- /dev/null +++ b/AlloyDb/src/V1alpha/SupportedDatabaseFlag.php @@ -0,0 +1,337 @@ +google.cloud.alloydb.v1alpha.SupportedDatabaseFlag + */ +class SupportedDatabaseFlag extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the flag resource, following Google Cloud conventions, e.g.: + * * projects/{project}/locations/{location}/flags/{flag} + * This field currently has no semantic meaning. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The name of the database flag, e.g. "max_allowed_packets". + * The is a possibly key for the Instance.database_flags map field. + * + * Generated from protobuf field string flag_name = 2; + */ + protected $flag_name = ''; + /** + * Generated from protobuf field .google.cloud.alloydb.v1alpha.SupportedDatabaseFlag.ValueType value_type = 3; + */ + protected $value_type = 0; + /** + * Whether the database flag accepts multiple values. If true, + * a comma-separated list of stringified values may be specified. + * + * Generated from protobuf field bool accepts_multiple_values = 4; + */ + protected $accepts_multiple_values = false; + /** + * Major database engine versions for which this flag is supported. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.DatabaseVersion supported_db_versions = 5; + */ + private $supported_db_versions; + /** + * Whether setting or updating this flag on an Instance requires a database + * restart. If a flag that requires database restart is set, the backend + * will automatically restart the database (making sure to satisfy any + * availability SLO's). + * + * Generated from protobuf field bool requires_db_restart = 6; + */ + protected $requires_db_restart = false; + protected $restrictions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AlloyDb\V1alpha\SupportedDatabaseFlag\StringRestrictions $string_restrictions + * Restriction on STRING type value. + * @type \Google\Cloud\AlloyDb\V1alpha\SupportedDatabaseFlag\IntegerRestrictions $integer_restrictions + * Restriction on INTEGER type value. + * @type string $name + * The name of the flag resource, following Google Cloud conventions, e.g.: + * * projects/{project}/locations/{location}/flags/{flag} + * This field currently has no semantic meaning. + * @type string $flag_name + * The name of the database flag, e.g. "max_allowed_packets". + * The is a possibly key for the Instance.database_flags map field. + * @type int $value_type + * @type bool $accepts_multiple_values + * Whether the database flag accepts multiple values. If true, + * a comma-separated list of stringified values may be specified. + * @type array|\Google\Protobuf\Internal\RepeatedField $supported_db_versions + * Major database engine versions for which this flag is supported. + * @type bool $requires_db_restart + * Whether setting or updating this flag on an Instance requires a database + * restart. If a flag that requires database restart is set, the backend + * will automatically restart the database (making sure to satisfy any + * availability SLO's). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Restriction on STRING type value. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.SupportedDatabaseFlag.StringRestrictions string_restrictions = 7; + * @return \Google\Cloud\AlloyDb\V1alpha\SupportedDatabaseFlag\StringRestrictions|null + */ + public function getStringRestrictions() + { + return $this->readOneof(7); + } + + public function hasStringRestrictions() + { + return $this->hasOneof(7); + } + + /** + * Restriction on STRING type value. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.SupportedDatabaseFlag.StringRestrictions string_restrictions = 7; + * @param \Google\Cloud\AlloyDb\V1alpha\SupportedDatabaseFlag\StringRestrictions $var + * @return $this + */ + public function setStringRestrictions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\SupportedDatabaseFlag\StringRestrictions::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * Restriction on INTEGER type value. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.SupportedDatabaseFlag.IntegerRestrictions integer_restrictions = 8; + * @return \Google\Cloud\AlloyDb\V1alpha\SupportedDatabaseFlag\IntegerRestrictions|null + */ + public function getIntegerRestrictions() + { + return $this->readOneof(8); + } + + public function hasIntegerRestrictions() + { + return $this->hasOneof(8); + } + + /** + * Restriction on INTEGER type value. + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.SupportedDatabaseFlag.IntegerRestrictions integer_restrictions = 8; + * @param \Google\Cloud\AlloyDb\V1alpha\SupportedDatabaseFlag\IntegerRestrictions $var + * @return $this + */ + public function setIntegerRestrictions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\SupportedDatabaseFlag\IntegerRestrictions::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * The name of the flag resource, following Google Cloud conventions, e.g.: + * * projects/{project}/locations/{location}/flags/{flag} + * This field currently has no semantic meaning. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the flag resource, following Google Cloud conventions, e.g.: + * * projects/{project}/locations/{location}/flags/{flag} + * This field currently has no semantic meaning. + * + * 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 the database flag, e.g. "max_allowed_packets". + * The is a possibly key for the Instance.database_flags map field. + * + * Generated from protobuf field string flag_name = 2; + * @return string + */ + public function getFlagName() + { + return $this->flag_name; + } + + /** + * The name of the database flag, e.g. "max_allowed_packets". + * The is a possibly key for the Instance.database_flags map field. + * + * Generated from protobuf field string flag_name = 2; + * @param string $var + * @return $this + */ + public function setFlagName($var) + { + GPBUtil::checkString($var, True); + $this->flag_name = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.cloud.alloydb.v1alpha.SupportedDatabaseFlag.ValueType value_type = 3; + * @return int + */ + public function getValueType() + { + return $this->value_type; + } + + /** + * Generated from protobuf field .google.cloud.alloydb.v1alpha.SupportedDatabaseFlag.ValueType value_type = 3; + * @param int $var + * @return $this + */ + public function setValueType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1alpha\SupportedDatabaseFlag\ValueType::class); + $this->value_type = $var; + + return $this; + } + + /** + * Whether the database flag accepts multiple values. If true, + * a comma-separated list of stringified values may be specified. + * + * Generated from protobuf field bool accepts_multiple_values = 4; + * @return bool + */ + public function getAcceptsMultipleValues() + { + return $this->accepts_multiple_values; + } + + /** + * Whether the database flag accepts multiple values. If true, + * a comma-separated list of stringified values may be specified. + * + * Generated from protobuf field bool accepts_multiple_values = 4; + * @param bool $var + * @return $this + */ + public function setAcceptsMultipleValues($var) + { + GPBUtil::checkBool($var); + $this->accepts_multiple_values = $var; + + return $this; + } + + /** + * Major database engine versions for which this flag is supported. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.DatabaseVersion supported_db_versions = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSupportedDbVersions() + { + return $this->supported_db_versions; + } + + /** + * Major database engine versions for which this flag is supported. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1alpha.DatabaseVersion supported_db_versions = 5; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSupportedDbVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\AlloyDb\V1alpha\DatabaseVersion::class); + $this->supported_db_versions = $arr; + + return $this; + } + + /** + * Whether setting or updating this flag on an Instance requires a database + * restart. If a flag that requires database restart is set, the backend + * will automatically restart the database (making sure to satisfy any + * availability SLO's). + * + * Generated from protobuf field bool requires_db_restart = 6; + * @return bool + */ + public function getRequiresDbRestart() + { + return $this->requires_db_restart; + } + + /** + * Whether setting or updating this flag on an Instance requires a database + * restart. If a flag that requires database restart is set, the backend + * will automatically restart the database (making sure to satisfy any + * availability SLO's). + * + * Generated from protobuf field bool requires_db_restart = 6; + * @param bool $var + * @return $this + */ + public function setRequiresDbRestart($var) + { + GPBUtil::checkBool($var); + $this->requires_db_restart = $var; + + return $this; + } + + /** + * @return string + */ + public function getRestrictions() + { + return $this->whichOneof("restrictions"); + } + +} + diff --git a/AlloyDb/src/V1alpha/SupportedDatabaseFlag/IntegerRestrictions.php b/AlloyDb/src/V1alpha/SupportedDatabaseFlag/IntegerRestrictions.php new file mode 100644 index 000000000000..e1bf99f7ee28 --- /dev/null +++ b/AlloyDb/src/V1alpha/SupportedDatabaseFlag/IntegerRestrictions.php @@ -0,0 +1,176 @@ +google.cloud.alloydb.v1alpha.SupportedDatabaseFlag.IntegerRestrictions + */ +class IntegerRestrictions extends \Google\Protobuf\Internal\Message +{ + /** + * The minimum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value min_value = 1; + */ + protected $min_value = null; + /** + * The maximum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value max_value = 2; + */ + protected $max_value = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Int64Value $min_value + * The minimum value that can be specified, if applicable. + * @type \Google\Protobuf\Int64Value $max_value + * The maximum value that can be specified, if applicable. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The minimum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value min_value = 1; + * @return \Google\Protobuf\Int64Value|null + */ + public function getMinValue() + { + return $this->min_value; + } + + public function hasMinValue() + { + return isset($this->min_value); + } + + public function clearMinValue() + { + unset($this->min_value); + } + + /** + * Returns the unboxed value from getMinValue() + + * The minimum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value min_value = 1; + * @return int|string|null + */ + public function getMinValueUnwrapped() + { + return $this->readWrapperValue("min_value"); + } + + /** + * The minimum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value min_value = 1; + * @param \Google\Protobuf\Int64Value $var + * @return $this + */ + public function setMinValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Int64Value::class); + $this->min_value = $var; + + return $this; + } + + /** + * Sets the field by wrapping a primitive type in a Google\Protobuf\Int64Value object. + + * The minimum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value min_value = 1; + * @param int|string|null $var + * @return $this + */ + public function setMinValueUnwrapped($var) + { + $this->writeWrapperValue("min_value", $var); + return $this;} + + /** + * The maximum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value max_value = 2; + * @return \Google\Protobuf\Int64Value|null + */ + public function getMaxValue() + { + return $this->max_value; + } + + public function hasMaxValue() + { + return isset($this->max_value); + } + + public function clearMaxValue() + { + unset($this->max_value); + } + + /** + * Returns the unboxed value from getMaxValue() + + * The maximum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value max_value = 2; + * @return int|string|null + */ + public function getMaxValueUnwrapped() + { + return $this->readWrapperValue("max_value"); + } + + /** + * The maximum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value max_value = 2; + * @param \Google\Protobuf\Int64Value $var + * @return $this + */ + public function setMaxValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Int64Value::class); + $this->max_value = $var; + + return $this; + } + + /** + * Sets the field by wrapping a primitive type in a Google\Protobuf\Int64Value object. + + * The maximum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value max_value = 2; + * @param int|string|null $var + * @return $this + */ + public function setMaxValueUnwrapped($var) + { + $this->writeWrapperValue("max_value", $var); + return $this;} + +} + + diff --git a/AlloyDb/src/V1alpha/SupportedDatabaseFlag/StringRestrictions.php b/AlloyDb/src/V1alpha/SupportedDatabaseFlag/StringRestrictions.php new file mode 100644 index 000000000000..574f8dd2e918 --- /dev/null +++ b/AlloyDb/src/V1alpha/SupportedDatabaseFlag/StringRestrictions.php @@ -0,0 +1,72 @@ +google.cloud.alloydb.v1alpha.SupportedDatabaseFlag.StringRestrictions + */ +class StringRestrictions extends \Google\Protobuf\Internal\Message +{ + /** + * The list of allowed values, if bounded. This field will be empty + * if there is a unbounded number of allowed values. + * + * Generated from protobuf field repeated string allowed_values = 1; + */ + private $allowed_values; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $allowed_values + * The list of allowed values, if bounded. This field will be empty + * if there is a unbounded number of allowed values. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The list of allowed values, if bounded. This field will be empty + * if there is a unbounded number of allowed values. + * + * Generated from protobuf field repeated string allowed_values = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAllowedValues() + { + return $this->allowed_values; + } + + /** + * The list of allowed values, if bounded. This field will be empty + * if there is a unbounded number of allowed values. + * + * Generated from protobuf field repeated string allowed_values = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAllowedValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->allowed_values = $arr; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1alpha/SupportedDatabaseFlag/ValueType.php b/AlloyDb/src/V1alpha/SupportedDatabaseFlag/ValueType.php new file mode 100644 index 000000000000..15d662a40902 --- /dev/null +++ b/AlloyDb/src/V1alpha/SupportedDatabaseFlag/ValueType.php @@ -0,0 +1,78 @@ +google.cloud.alloydb.v1alpha.SupportedDatabaseFlag.ValueType + */ +class ValueType +{ + /** + * This is an unknown flag type. + * + * Generated from protobuf enum VALUE_TYPE_UNSPECIFIED = 0; + */ + const VALUE_TYPE_UNSPECIFIED = 0; + /** + * String type flag. + * + * Generated from protobuf enum STRING = 1; + */ + const STRING = 1; + /** + * Integer type flag. + * + * Generated from protobuf enum INTEGER = 2; + */ + const INTEGER = 2; + /** + * Float type flag. + * + * Generated from protobuf enum FLOAT = 3; + */ + const FLOAT = 3; + /** + * Denotes that the flag does not accept any values. + * + * Generated from protobuf enum NONE = 4; + */ + const NONE = 4; + + private static $valueToName = [ + self::VALUE_TYPE_UNSPECIFIED => 'VALUE_TYPE_UNSPECIFIED', + self::STRING => 'STRING', + self::INTEGER => 'INTEGER', + self::FLOAT => 'FLOAT', + self::NONE => 'NONE', + ]; + + 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/AlloyDb/src/V1alpha/UpdateBackupRequest.php b/AlloyDb/src/V1alpha/UpdateBackupRequest.php new file mode 100644 index 000000000000..8c09730c698a --- /dev/null +++ b/AlloyDb/src/V1alpha/UpdateBackupRequest.php @@ -0,0 +1,287 @@ +google.cloud.alloydb.v1alpha.UpdateBackupRequest + */ +class UpdateBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Backup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Backup backup = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + /** + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new backup is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $allow_missing = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Backup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\AlloyDb\V1alpha\Backup $backup + * Required. The resource being updated + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * @type bool $allow_missing + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new backup is created and `update_mask` is ignored. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Backup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @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); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Backup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Backup backup = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1alpha\Backup|null + */ + public function getBackup() + { + return $this->backup; + } + + public function hasBackup() + { + return isset($this->backup); + } + + public function clearBackup() + { + unset($this->backup); + } + + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Backup backup = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1alpha\Backup $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\Backup::class); + $this->backup = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new backup is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new backup is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/UpdateClusterRequest.php b/AlloyDb/src/V1alpha/UpdateClusterRequest.php new file mode 100644 index 000000000000..1a665c7123cd --- /dev/null +++ b/AlloyDb/src/V1alpha/UpdateClusterRequest.php @@ -0,0 +1,291 @@ +google.cloud.alloydb.v1alpha.UpdateClusterRequest + */ +class UpdateClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Cluster resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + /** + * Optional. If set to true, update succeeds even if cluster is not found. In + * that case, a new cluster is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $allow_missing = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Cluster resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\AlloyDb\V1alpha\Cluster $cluster + * Required. The resource being updated + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * @type bool $allow_missing + * Optional. If set to true, update succeeds even if cluster is not found. In + * that case, a new cluster is created and `update_mask` is ignored. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Cluster resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @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); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Cluster resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1alpha\Cluster|null + */ + public function getCluster() + { + return $this->cluster; + } + + public function hasCluster() + { + return isset($this->cluster); + } + + public function clearCluster() + { + unset($this->cluster); + } + + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Cluster cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1alpha\Cluster $var + * @return $this + */ + public function setCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\Cluster::class); + $this->cluster = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Optional. If set to true, update succeeds even if cluster is not found. In + * that case, a new cluster is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * Optional. If set to true, update succeeds even if cluster is not found. In + * that case, a new cluster is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/UpdateInstanceRequest.php b/AlloyDb/src/V1alpha/UpdateInstanceRequest.php new file mode 100644 index 000000000000..c777ca05973d --- /dev/null +++ b/AlloyDb/src/V1alpha/UpdateInstanceRequest.php @@ -0,0 +1,291 @@ +google.cloud.alloydb.v1alpha.UpdateInstanceRequest + */ +class UpdateInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Instance resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance instance = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + /** + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new instance is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $allow_missing = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Instance resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\AlloyDb\V1alpha\Instance $instance + * Required. The resource being updated + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * @type bool $allow_missing + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new instance is created and `update_mask` is ignored. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Service::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Instance resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @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); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Instance resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance instance = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1alpha\Instance|null + */ + public function getInstance() + { + return $this->instance; + } + + public function hasInstance() + { + return isset($this->instance); + } + + public function clearInstance() + { + unset($this->instance); + } + + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1alpha.Instance instance = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1alpha\Instance $var + * @return $this + */ + public function setInstance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1alpha\Instance::class); + $this->instance = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new instance is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new instance is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/UserPassword.php b/AlloyDb/src/V1alpha/UserPassword.php new file mode 100644 index 000000000000..62343abaae0d --- /dev/null +++ b/AlloyDb/src/V1alpha/UserPassword.php @@ -0,0 +1,102 @@ +google.cloud.alloydb.v1alpha.UserPassword + */ +class UserPassword extends \Google\Protobuf\Internal\Message +{ + /** + * The database username. + * + * Generated from protobuf field string user = 1; + */ + protected $user = ''; + /** + * The initial password for the user. + * + * Generated from protobuf field string password = 2; + */ + protected $password = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $user + * The database username. + * @type string $password + * The initial password for the user. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The database username. + * + * Generated from protobuf field string user = 1; + * @return string + */ + public function getUser() + { + return $this->user; + } + + /** + * The database username. + * + * Generated from protobuf field string user = 1; + * @param string $var + * @return $this + */ + public function setUser($var) + { + GPBUtil::checkString($var, True); + $this->user = $var; + + return $this; + } + + /** + * The initial password for the user. + * + * Generated from protobuf field string password = 2; + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * The initial password for the user. + * + * Generated from protobuf field string password = 2; + * @param string $var + * @return $this + */ + public function setPassword($var) + { + GPBUtil::checkString($var, True); + $this->password = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1alpha/gapic_metadata.json b/AlloyDb/src/V1alpha/gapic_metadata.json new file mode 100644 index 000000000000..055809e73bc3 --- /dev/null +++ b/AlloyDb/src/V1alpha/gapic_metadata.json @@ -0,0 +1,153 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.alloydb.v1alpha", + "libraryPackage": "Google\\Cloud\\AlloyDb\\V1alpha", + "services": { + "AlloyDBAdmin": { + "clients": { + "grpc": { + "libraryClient": "AlloyDBAdminGapicClient", + "rpcs": { + "BatchCreateInstances": { + "methods": [ + "batchCreateInstances" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "CreateCluster": { + "methods": [ + "createCluster" + ] + }, + "CreateInstance": { + "methods": [ + "createInstance" + ] + }, + "CreateSecondaryCluster": { + "methods": [ + "createSecondaryCluster" + ] + }, + "CreateSecondaryInstance": { + "methods": [ + "createSecondaryInstance" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "DeleteCluster": { + "methods": [ + "deleteCluster" + ] + }, + "DeleteInstance": { + "methods": [ + "deleteInstance" + ] + }, + "FailoverInstance": { + "methods": [ + "failoverInstance" + ] + }, + "GenerateClientCertificate": { + "methods": [ + "generateClientCertificate" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "GetCluster": { + "methods": [ + "getCluster" + ] + }, + "GetConnectionInfo": { + "methods": [ + "getConnectionInfo" + ] + }, + "GetInstance": { + "methods": [ + "getInstance" + ] + }, + "ListBackups": { + "methods": [ + "listBackups" + ] + }, + "ListClusters": { + "methods": [ + "listClusters" + ] + }, + "ListInstances": { + "methods": [ + "listInstances" + ] + }, + "ListSupportedDatabaseFlags": { + "methods": [ + "listSupportedDatabaseFlags" + ] + }, + "PromoteCluster": { + "methods": [ + "promoteCluster" + ] + }, + "RestartInstance": { + "methods": [ + "restartInstance" + ] + }, + "RestoreCluster": { + "methods": [ + "restoreCluster" + ] + }, + "UpdateBackup": { + "methods": [ + "updateBackup" + ] + }, + "UpdateCluster": { + "methods": [ + "updateCluster" + ] + }, + "UpdateInstance": { + "methods": [ + "updateInstance" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/AlloyDb/src/V1alpha/resources/alloy_db_admin_client_config.json b/AlloyDb/src/V1alpha/resources/alloy_db_admin_client_config.json new file mode 100644 index 000000000000..82bd999f6daf --- /dev/null +++ b/AlloyDb/src/V1alpha/resources/alloy_db_admin_client_config.json @@ -0,0 +1,179 @@ +{ + "interfaces": { + "google.cloud.alloydb.v1alpha.AlloyDBAdmin": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "no_retry_1_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": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "BatchCreateInstances": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateInstance": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateSecondaryCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateSecondaryInstance": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteBackup": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteInstance": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "FailoverInstance": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GenerateClientCertificate": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetBackup": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetCluster": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetConnectionInfo": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetInstance": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListBackups": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListClusters": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListInstances": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListSupportedDatabaseFlags": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "PromoteCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "RestartInstance": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "RestoreCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateInstance": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/AlloyDb/src/V1alpha/resources/alloy_db_admin_descriptor_config.php b/AlloyDb/src/V1alpha/resources/alloy_db_admin_descriptor_config.php new file mode 100644 index 000000000000..120e043bb2ca --- /dev/null +++ b/AlloyDb/src/V1alpha/resources/alloy_db_admin_descriptor_config.php @@ -0,0 +1,218 @@ + [ + 'google.cloud.alloydb.v1alpha.AlloyDBAdmin' => [ + 'BatchCreateInstances' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1alpha\BatchCreateInstancesResponse', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateBackup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1alpha\Backup', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1alpha\Cluster', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateInstance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1alpha\Instance', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateSecondaryCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1alpha\Cluster', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateSecondaryInstance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1alpha\Instance', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteBackup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteInstance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'FailoverInstance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1alpha\Instance', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'PromoteCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1alpha\Cluster', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'RestartInstance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1alpha\Instance', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'RestoreCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1alpha\Cluster', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateBackup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1alpha\Backup', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1alpha\Cluster', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateInstance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1alpha\Instance', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1alpha\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'ListBackups' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getBackups', + ], + ], + 'ListClusters' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getClusters', + ], + ], + 'ListInstances' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getInstances', + ], + ], + 'ListSupportedDatabaseFlags' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getSupportedDatabaseFlags', + ], + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + ], + ], + ], +]; diff --git a/AlloyDb/src/V1alpha/resources/alloy_db_admin_rest_client_config.php b/AlloyDb/src/V1alpha/resources/alloy_db_admin_rest_client_config.php new file mode 100644 index 000000000000..bdb6b5d6e94a --- /dev/null +++ b/AlloyDb/src/V1alpha/resources/alloy_db_admin_rest_client_config.php @@ -0,0 +1,381 @@ + [ + 'google.cloud.alloydb.v1alpha.AlloyDBAdmin' => [ + 'BatchCreateInstances' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*/clusters/*}/instances:batchCreate', + 'body' => 'requests', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateBackup' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*}/backups', + 'body' => 'backup', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'backup_id', + ], + ], + 'CreateCluster' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*}/clusters', + 'body' => 'cluster', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'cluster_id', + ], + ], + 'CreateInstance' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*/clusters/*}/instances', + 'body' => 'instance', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'instance_id', + ], + ], + 'CreateSecondaryCluster' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*}/clusters:createsecondary', + 'body' => 'cluster', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateSecondaryInstance' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*/clusters/*}/instances:createsecondary', + 'body' => 'instance', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteBackup' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/backups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteCluster' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/clusters/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteInstance' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/clusters/*/instances/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'FailoverInstance' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/clusters/*/instances/*}:failover', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GenerateClientCertificate' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*/clusters/*}:generateClientCertificate', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetBackup' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/backups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetCluster' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/clusters/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetConnectionInfo' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*/clusters/*/instances/*}/connectionInfo', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetInstance' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/clusters/*/instances/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListBackups' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*}/backups', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListClusters' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*}/clusters', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListInstances' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*/clusters/*}/instances', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListSupportedDatabaseFlags' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*}/supportedDatabaseFlags', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'PromoteCluster' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/clusters/*}:promote', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'RestartInstance' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/clusters/*/instances/*}:restart', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'RestoreCluster' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{parent=projects/*/locations/*}/clusters:restore', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateBackup' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1alpha/{backup.name=projects/*/locations/*/backups/*}', + 'body' => 'backup', + 'placeholders' => [ + 'backup.name' => [ + 'getters' => [ + 'getBackup', + 'getName', + ], + ], + ], + ], + 'UpdateCluster' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1alpha/{cluster.name=projects/*/locations/*/clusters/*}', + 'body' => 'cluster', + 'placeholders' => [ + 'cluster.name' => [ + 'getters' => [ + 'getCluster', + 'getName', + ], + ], + ], + ], + 'UpdateInstance' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1alpha/{instance.name=projects/*/locations/*/clusters/*/instances/*}', + 'body' => 'instance', + 'placeholders' => [ + 'instance.name' => [ + 'getters' => [ + 'getInstance', + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1alpha/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/AlloyDb/src/V1beta/AlloyDBAdminClient.php b/AlloyDb/src/V1beta/AlloyDBAdminClient.php new file mode 100644 index 000000000000..00f0245964d6 --- /dev/null +++ b/AlloyDb/src/V1beta/AlloyDBAdminClient.php @@ -0,0 +1,36 @@ +google.cloud.alloydb.v1beta.AutomatedBackupPolicy + */ +class AutomatedBackupPolicy extends \Google\Protobuf\Internal\Message +{ + /** + * Whether automated automated backups are enabled. If not set, defaults to + * true. + * + * Generated from protobuf field optional bool enabled = 1; + */ + protected $enabled = null; + /** + * The length of the time window during which a backup can be + * taken. If a backup does not succeed within this time window, it will be + * canceled and considered failed. + * The backup window must be at least 5 minutes long. There is no upper bound + * on the window. If not set, it defaults to 1 hour. + * + * Generated from protobuf field .google.protobuf.Duration backup_window = 3; + */ + protected $backup_window = null; + /** + * Optional. The encryption config can be specified to encrypt the + * backups with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $encryption_config = null; + /** + * The location where the backup will be stored. Currently, the only supported + * option is to store the backup in the same region as the cluster. + * If empty, defaults to the region of the cluster. + * + * Generated from protobuf field string location = 6; + */ + protected $location = ''; + /** + * Labels to apply to backups created using this configuration. + * + * Generated from protobuf field map labels = 7; + */ + private $labels; + protected $schedule; + protected $retention; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AlloyDb\V1beta\AutomatedBackupPolicy\WeeklySchedule $weekly_schedule + * Weekly schedule for the Backup. + * @type \Google\Cloud\AlloyDb\V1beta\AutomatedBackupPolicy\TimeBasedRetention $time_based_retention + * Time-based Backup retention policy. + * @type \Google\Cloud\AlloyDb\V1beta\AutomatedBackupPolicy\QuantityBasedRetention $quantity_based_retention + * Quantity-based Backup retention policy to retain recent backups. + * @type bool $enabled + * Whether automated automated backups are enabled. If not set, defaults to + * true. + * @type \Google\Protobuf\Duration $backup_window + * The length of the time window during which a backup can be + * taken. If a backup does not succeed within this time window, it will be + * canceled and considered failed. + * The backup window must be at least 5 minutes long. There is no upper bound + * on the window. If not set, it defaults to 1 hour. + * @type \Google\Cloud\AlloyDb\V1beta\EncryptionConfig $encryption_config + * Optional. The encryption config can be specified to encrypt the + * backups with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * @type string $location + * The location where the backup will be stored. Currently, the only supported + * option is to store the backup in the same region as the cluster. + * If empty, defaults to the region of the cluster. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels to apply to backups created using this configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Weekly schedule for the Backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.AutomatedBackupPolicy.WeeklySchedule weekly_schedule = 2; + * @return \Google\Cloud\AlloyDb\V1beta\AutomatedBackupPolicy\WeeklySchedule|null + */ + public function getWeeklySchedule() + { + return $this->readOneof(2); + } + + public function hasWeeklySchedule() + { + return $this->hasOneof(2); + } + + /** + * Weekly schedule for the Backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.AutomatedBackupPolicy.WeeklySchedule weekly_schedule = 2; + * @param \Google\Cloud\AlloyDb\V1beta\AutomatedBackupPolicy\WeeklySchedule $var + * @return $this + */ + public function setWeeklySchedule($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\AutomatedBackupPolicy\WeeklySchedule::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Time-based Backup retention policy. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.AutomatedBackupPolicy.TimeBasedRetention time_based_retention = 4; + * @return \Google\Cloud\AlloyDb\V1beta\AutomatedBackupPolicy\TimeBasedRetention|null + */ + public function getTimeBasedRetention() + { + return $this->readOneof(4); + } + + public function hasTimeBasedRetention() + { + return $this->hasOneof(4); + } + + /** + * Time-based Backup retention policy. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.AutomatedBackupPolicy.TimeBasedRetention time_based_retention = 4; + * @param \Google\Cloud\AlloyDb\V1beta\AutomatedBackupPolicy\TimeBasedRetention $var + * @return $this + */ + public function setTimeBasedRetention($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\AutomatedBackupPolicy\TimeBasedRetention::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Quantity-based Backup retention policy to retain recent backups. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.AutomatedBackupPolicy.QuantityBasedRetention quantity_based_retention = 5; + * @return \Google\Cloud\AlloyDb\V1beta\AutomatedBackupPolicy\QuantityBasedRetention|null + */ + public function getQuantityBasedRetention() + { + return $this->readOneof(5); + } + + public function hasQuantityBasedRetention() + { + return $this->hasOneof(5); + } + + /** + * Quantity-based Backup retention policy to retain recent backups. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.AutomatedBackupPolicy.QuantityBasedRetention quantity_based_retention = 5; + * @param \Google\Cloud\AlloyDb\V1beta\AutomatedBackupPolicy\QuantityBasedRetention $var + * @return $this + */ + public function setQuantityBasedRetention($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\AutomatedBackupPolicy\QuantityBasedRetention::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Whether automated automated backups are enabled. If not set, defaults to + * true. + * + * Generated from protobuf field optional bool enabled = 1; + * @return bool + */ + public function getEnabled() + { + return isset($this->enabled) ? $this->enabled : false; + } + + public function hasEnabled() + { + return isset($this->enabled); + } + + public function clearEnabled() + { + unset($this->enabled); + } + + /** + * Whether automated automated backups are enabled. If not set, defaults to + * true. + * + * Generated from protobuf field optional bool enabled = 1; + * @param bool $var + * @return $this + */ + public function setEnabled($var) + { + GPBUtil::checkBool($var); + $this->enabled = $var; + + return $this; + } + + /** + * The length of the time window during which a backup can be + * taken. If a backup does not succeed within this time window, it will be + * canceled and considered failed. + * The backup window must be at least 5 minutes long. There is no upper bound + * on the window. If not set, it defaults to 1 hour. + * + * Generated from protobuf field .google.protobuf.Duration backup_window = 3; + * @return \Google\Protobuf\Duration|null + */ + public function getBackupWindow() + { + return $this->backup_window; + } + + public function hasBackupWindow() + { + return isset($this->backup_window); + } + + public function clearBackupWindow() + { + unset($this->backup_window); + } + + /** + * The length of the time window during which a backup can be + * taken. If a backup does not succeed within this time window, it will be + * canceled and considered failed. + * The backup window must be at least 5 minutes long. There is no upper bound + * on the window. If not set, it defaults to 1 hour. + * + * Generated from protobuf field .google.protobuf.Duration backup_window = 3; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setBackupWindow($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->backup_window = $var; + + return $this; + } + + /** + * Optional. The encryption config can be specified to encrypt the + * backups with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\AlloyDb\V1beta\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 config can be specified to encrypt the + * backups with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\AlloyDb\V1beta\EncryptionConfig $var + * @return $this + */ + public function setEncryptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\EncryptionConfig::class); + $this->encryption_config = $var; + + return $this; + } + + /** + * The location where the backup will be stored. Currently, the only supported + * option is to store the backup in the same region as the cluster. + * If empty, defaults to the region of the cluster. + * + * Generated from protobuf field string location = 6; + * @return string + */ + public function getLocation() + { + return $this->location; + } + + /** + * The location where the backup will be stored. Currently, the only supported + * option is to store the backup in the same region as the cluster. + * If empty, defaults to the region of the cluster. + * + * Generated from protobuf field string location = 6; + * @param string $var + * @return $this + */ + public function setLocation($var) + { + GPBUtil::checkString($var, True); + $this->location = $var; + + return $this; + } + + /** + * Labels to apply to backups created using this configuration. + * + * Generated from protobuf field map labels = 7; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels to apply to backups created using this configuration. + * + * 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; + } + + /** + * @return string + */ + public function getSchedule() + { + return $this->whichOneof("schedule"); + } + + /** + * @return string + */ + public function getRetention() + { + return $this->whichOneof("retention"); + } + +} + diff --git a/AlloyDb/src/V1beta/AutomatedBackupPolicy/QuantityBasedRetention.php b/AlloyDb/src/V1beta/AutomatedBackupPolicy/QuantityBasedRetention.php new file mode 100644 index 000000000000..a99f342d9188 --- /dev/null +++ b/AlloyDb/src/V1beta/AutomatedBackupPolicy/QuantityBasedRetention.php @@ -0,0 +1,69 @@ +google.cloud.alloydb.v1beta.AutomatedBackupPolicy.QuantityBasedRetention + */ +class QuantityBasedRetention extends \Google\Protobuf\Internal\Message +{ + /** + * The number of backups to retain. + * + * Generated from protobuf field int32 count = 1; + */ + protected $count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $count + * The number of backups to retain. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The number of backups to retain. + * + * Generated from protobuf field int32 count = 1; + * @return int + */ + public function getCount() + { + return $this->count; + } + + /** + * The number of backups to retain. + * + * Generated from protobuf field int32 count = 1; + * @param int $var + * @return $this + */ + public function setCount($var) + { + GPBUtil::checkInt32($var); + $this->count = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1beta/AutomatedBackupPolicy/TimeBasedRetention.php b/AlloyDb/src/V1beta/AutomatedBackupPolicy/TimeBasedRetention.php new file mode 100644 index 000000000000..4ae4e7358283 --- /dev/null +++ b/AlloyDb/src/V1beta/AutomatedBackupPolicy/TimeBasedRetention.php @@ -0,0 +1,79 @@ +google.cloud.alloydb.v1beta.AutomatedBackupPolicy.TimeBasedRetention + */ +class TimeBasedRetention extends \Google\Protobuf\Internal\Message +{ + /** + * The retention period. + * + * Generated from protobuf field .google.protobuf.Duration retention_period = 1; + */ + protected $retention_period = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $retention_period + * The retention period. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The retention period. + * + * Generated from protobuf field .google.protobuf.Duration retention_period = 1; + * @return \Google\Protobuf\Duration|null + */ + public function getRetentionPeriod() + { + return $this->retention_period; + } + + public function hasRetentionPeriod() + { + return isset($this->retention_period); + } + + public function clearRetentionPeriod() + { + unset($this->retention_period); + } + + /** + * The retention period. + * + * Generated from protobuf field .google.protobuf.Duration retention_period = 1; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setRetentionPeriod($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->retention_period = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1beta/AutomatedBackupPolicy/WeeklySchedule.php b/AlloyDb/src/V1beta/AutomatedBackupPolicy/WeeklySchedule.php new file mode 100644 index 000000000000..c9696c669acd --- /dev/null +++ b/AlloyDb/src/V1beta/AutomatedBackupPolicy/WeeklySchedule.php @@ -0,0 +1,127 @@ +google.cloud.alloydb.v1beta.AutomatedBackupPolicy.WeeklySchedule + */ +class WeeklySchedule extends \Google\Protobuf\Internal\Message +{ + /** + * The times during the day to start a backup. The start times are assumed + * to be in UTC and to be an exact hour (e.g., 04:00:00). + * If no start times are provided, a single fixed start time is chosen + * arbitrarily. + * + * Generated from protobuf field repeated .google.type.TimeOfDay start_times = 1; + */ + private $start_times; + /** + * The days of the week to perform a backup. + * If this field is left empty, the default of every day of the week is + * used. + * + * Generated from protobuf field repeated .google.type.DayOfWeek days_of_week = 2; + */ + private $days_of_week; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Type\TimeOfDay>|\Google\Protobuf\Internal\RepeatedField $start_times + * The times during the day to start a backup. The start times are assumed + * to be in UTC and to be an exact hour (e.g., 04:00:00). + * If no start times are provided, a single fixed start time is chosen + * arbitrarily. + * @type array|\Google\Protobuf\Internal\RepeatedField $days_of_week + * The days of the week to perform a backup. + * If this field is left empty, the default of every day of the week is + * used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The times during the day to start a backup. The start times are assumed + * to be in UTC and to be an exact hour (e.g., 04:00:00). + * If no start times are provided, a single fixed start time is chosen + * arbitrarily. + * + * Generated from protobuf field repeated .google.type.TimeOfDay start_times = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getStartTimes() + { + return $this->start_times; + } + + /** + * The times during the day to start a backup. The start times are assumed + * to be in UTC and to be an exact hour (e.g., 04:00:00). + * If no start times are provided, a single fixed start time is chosen + * arbitrarily. + * + * Generated from protobuf field repeated .google.type.TimeOfDay start_times = 1; + * @param array<\Google\Type\TimeOfDay>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setStartTimes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Type\TimeOfDay::class); + $this->start_times = $arr; + + return $this; + } + + /** + * The days of the week to perform a backup. + * If this field is left empty, the default of every day of the week is + * used. + * + * Generated from protobuf field repeated .google.type.DayOfWeek days_of_week = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDaysOfWeek() + { + return $this->days_of_week; + } + + /** + * The days of the week to perform a backup. + * If this field is left empty, the default of every day of the week is + * used. + * + * Generated from protobuf field repeated .google.type.DayOfWeek days_of_week = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDaysOfWeek($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Type\DayOfWeek::class); + $this->days_of_week = $arr; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1beta/Backup.php b/AlloyDb/src/V1beta/Backup.php new file mode 100644 index 000000000000..90a00b3d1708 --- /dev/null +++ b/AlloyDb/src/V1beta/Backup.php @@ -0,0 +1,823 @@ +google.cloud.alloydb.v1beta.Backup + */ +class Backup extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * where the cluster and backup ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the backup resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * User-settable and human-readable display name for the Backup. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. Create time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $delete_time = null; + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 6; + */ + private $labels; + /** + * Output only. The current state of the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Backup.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * The backup type, which suggests the trigger for the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Backup.Type type = 8; + */ + protected $type = 0; + /** + * User-provided description of the backup. + * + * Generated from protobuf field string description = 9; + */ + protected $description = ''; + /** + * Output only. The system-generated UID of the cluster which was used to + * create this resource. + * + * Generated from protobuf field string cluster_uid = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $cluster_uid = ''; + /** + * Required. The full resource name of the backup source cluster + * (e.g., projects//locations//clusters/). + * + * Generated from protobuf field string cluster_name = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $cluster_name = ''; + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation), if + * true, indicates that the service is actively updating the resource. This + * can happen due to user-triggered updates or system actions like failover or + * maintenance. + * + * Generated from protobuf field bool reconciling = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reconciling = false; + /** + * Optional. The encryption config can be specified to encrypt the + * backup with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionConfig encryption_config = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $encryption_config = null; + /** + * Output only. The encryption information for the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionInfo encryption_info = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $encryption_info = null; + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 14; + */ + protected $etag = ''; + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 16; + */ + private $annotations; + /** + * Output only. The size of the backup in bytes. + * + * Generated from protobuf field int64 size_bytes = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $size_bytes = 0; + /** + * Output only. The time at which after the backup is eligible to be garbage + * collected. It is the duration specified by the backup's retention policy, + * added to the backup's create_time. + * + * Generated from protobuf field .google.protobuf.Timestamp expiry_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $expiry_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * where the cluster and backup ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the backup resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region} + * @type string $display_name + * User-settable and human-readable display name for the Backup. + * @type string $uid + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Create time stamp + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Update time stamp + * @type \Google\Protobuf\Timestamp $delete_time + * Output only. Delete time stamp + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels as key value pairs + * @type int $state + * Output only. The current state of the backup. + * @type int $type + * The backup type, which suggests the trigger for the backup. + * @type string $description + * User-provided description of the backup. + * @type string $cluster_uid + * Output only. The system-generated UID of the cluster which was used to + * create this resource. + * @type string $cluster_name + * Required. The full resource name of the backup source cluster + * (e.g., projects//locations//clusters/). + * @type bool $reconciling + * Output only. Reconciling (https://google.aip.dev/128#reconciliation), if + * true, indicates that the service is actively updating the resource. This + * can happen due to user-triggered updates or system actions like failover or + * maintenance. + * @type \Google\Cloud\AlloyDb\V1beta\EncryptionConfig $encryption_config + * Optional. The encryption config can be specified to encrypt the + * backup with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * @type \Google\Cloud\AlloyDb\V1beta\EncryptionInfo $encryption_info + * Output only. The encryption information for the backup. + * @type string $etag + * For Resource freshness validation (https://google.aip.dev/154) + * @type array|\Google\Protobuf\Internal\MapField $annotations + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * @type int|string $size_bytes + * Output only. The size of the backup in bytes. + * @type \Google\Protobuf\Timestamp $expiry_time + * Output only. The time at which after the backup is eligible to be garbage + * collected. It is the duration specified by the backup's retention policy, + * added to the backup's create_time. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * where the cluster and backup ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the backup resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region} + * + * 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 backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * where the cluster and backup ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the backup resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region} + * + * 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; + } + + /** + * User-settable and human-readable display name for the Backup. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * User-settable and human-readable display name for the Backup. + * + * 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. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. Create time stamp + * + * 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. Create time stamp + * + * 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. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getDeleteTime() + { + return $this->delete_time; + } + + public function hasDeleteTime() + { + return isset($this->delete_time); + } + + public function clearDeleteTime() + { + unset($this->delete_time); + } + + /** + * Output only. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setDeleteTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->delete_time = $var; + + return $this; + } + + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 6; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 6; + * @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 current state of the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Backup.State state = 7 [(.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.cloud.alloydb.v1beta.Backup.State state = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1beta\Backup\State::class); + $this->state = $var; + + return $this; + } + + /** + * The backup type, which suggests the trigger for the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Backup.Type type = 8; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The backup type, which suggests the trigger for the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Backup.Type type = 8; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1beta\Backup\Type::class); + $this->type = $var; + + return $this; + } + + /** + * User-provided description of the backup. + * + * Generated from protobuf field string description = 9; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * User-provided description of the backup. + * + * Generated from protobuf field string description = 9; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. The system-generated UID of the cluster which was used to + * create this resource. + * + * Generated from protobuf field string cluster_uid = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getClusterUid() + { + return $this->cluster_uid; + } + + /** + * Output only. The system-generated UID of the cluster which was used to + * create this resource. + * + * Generated from protobuf field string cluster_uid = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setClusterUid($var) + { + GPBUtil::checkString($var, True); + $this->cluster_uid = $var; + + return $this; + } + + /** + * Required. The full resource name of the backup source cluster + * (e.g., projects//locations//clusters/). + * + * Generated from protobuf field string cluster_name = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getClusterName() + { + return $this->cluster_name; + } + + /** + * Required. The full resource name of the backup source cluster + * (e.g., projects//locations//clusters/). + * + * Generated from protobuf field string cluster_name = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setClusterName($var) + { + GPBUtil::checkString($var, True); + $this->cluster_name = $var; + + return $this; + } + + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation), if + * true, indicates that the service is actively updating the resource. This + * can happen due to user-triggered updates or system actions like failover or + * maintenance. + * + * Generated from protobuf field bool reconciling = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getReconciling() + { + return $this->reconciling; + } + + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation), if + * true, indicates that the service is actively updating the resource. This + * can happen due to user-triggered updates or system actions like failover or + * maintenance. + * + * Generated from protobuf field bool reconciling = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setReconciling($var) + { + GPBUtil::checkBool($var); + $this->reconciling = $var; + + return $this; + } + + /** + * Optional. The encryption config can be specified to encrypt the + * backup with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionConfig encryption_config = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\AlloyDb\V1beta\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 config can be specified to encrypt the + * backup with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionConfig encryption_config = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\AlloyDb\V1beta\EncryptionConfig $var + * @return $this + */ + public function setEncryptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\EncryptionConfig::class); + $this->encryption_config = $var; + + return $this; + } + + /** + * Output only. The encryption information for the backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionInfo encryption_info = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1beta\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.cloud.alloydb.v1beta.EncryptionInfo encryption_info = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1beta\EncryptionInfo $var + * @return $this + */ + public function setEncryptionInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\EncryptionInfo::class); + $this->encryption_info = $var; + + return $this; + } + + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 14; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 14; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 16; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 16; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + + /** + * Output only. The size of the backup in bytes. + * + * Generated from protobuf field int64 size_bytes = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getSizeBytes() + { + return $this->size_bytes; + } + + /** + * Output only. The size of the backup in bytes. + * + * Generated from protobuf field int64 size_bytes = 17 [(.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 time at which after the backup is eligible to be garbage + * collected. It is the duration specified by the backup's retention policy, + * added to the backup's create_time. + * + * Generated from protobuf field .google.protobuf.Timestamp expiry_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getExpiryTime() + { + return $this->expiry_time; + } + + public function hasExpiryTime() + { + return isset($this->expiry_time); + } + + public function clearExpiryTime() + { + unset($this->expiry_time); + } + + /** + * Output only. The time at which after the backup is eligible to be garbage + * collected. It is the duration specified by the backup's retention policy, + * added to the backup's create_time. + * + * Generated from protobuf field .google.protobuf.Timestamp expiry_time = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setExpiryTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->expiry_time = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/Backup/State.php b/AlloyDb/src/V1beta/Backup/State.php new file mode 100644 index 000000000000..0350afb590de --- /dev/null +++ b/AlloyDb/src/V1beta/Backup/State.php @@ -0,0 +1,76 @@ +google.cloud.alloydb.v1beta.Backup.State + */ +class State +{ + /** + * The state of the backup is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The backup is ready. + * + * Generated from protobuf enum READY = 1; + */ + const READY = 1; + /** + * The backup is creating. + * + * Generated from protobuf enum CREATING = 2; + */ + const CREATING = 2; + /** + * The backup failed. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + /** + * The backup is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::READY => 'READY', + self::CREATING => 'CREATING', + self::FAILED => 'FAILED', + self::DELETING => 'DELETING', + ]; + + 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/AlloyDb/src/V1beta/Backup/Type.php b/AlloyDb/src/V1beta/Backup/Type.php new file mode 100644 index 000000000000..13f462e9e453 --- /dev/null +++ b/AlloyDb/src/V1beta/Backup/Type.php @@ -0,0 +1,72 @@ +google.cloud.alloydb.v1beta.Backup.Type + */ +class Type +{ + /** + * Backup Type is unknown. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * ON_DEMAND backups that were triggered by the customer (e.g., not + * AUTOMATED). + * + * Generated from protobuf enum ON_DEMAND = 1; + */ + const ON_DEMAND = 1; + /** + * AUTOMATED backups triggered by the automated backups scheduler pursuant + * to an automated backup policy. + * + * Generated from protobuf enum AUTOMATED = 2; + */ + const AUTOMATED = 2; + /** + * CONTINUOUS backups triggered by the automated backups scheduler + * due to a continuous backup policy. + * + * Generated from protobuf enum CONTINUOUS = 3; + */ + const CONTINUOUS = 3; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::ON_DEMAND => 'ON_DEMAND', + self::AUTOMATED => 'AUTOMATED', + self::CONTINUOUS => 'CONTINUOUS', + ]; + + 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/AlloyDb/src/V1beta/BackupSource.php b/AlloyDb/src/V1beta/BackupSource.php new file mode 100644 index 000000000000..cd85e48f7c60 --- /dev/null +++ b/AlloyDb/src/V1beta/BackupSource.php @@ -0,0 +1,113 @@ +google.cloud.alloydb.v1beta.BackupSource + */ +class BackupSource extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The system-generated UID of the backup which was used to + * create this resource. The UID is generated when the backup is created, and + * it is retained until the backup is deleted. + * + * Generated from protobuf field string backup_uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $backup_uid = ''; + /** + * Required. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * + * Generated from protobuf field string backup_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $backup_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $backup_uid + * Output only. The system-generated UID of the backup which was used to + * create this resource. The UID is generated when the backup is created, and + * it is retained until the backup is deleted. + * @type string $backup_name + * Required. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The system-generated UID of the backup which was used to + * create this resource. The UID is generated when the backup is created, and + * it is retained until the backup is deleted. + * + * Generated from protobuf field string backup_uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getBackupUid() + { + return $this->backup_uid; + } + + /** + * Output only. The system-generated UID of the backup which was used to + * create this resource. The UID is generated when the backup is created, and + * it is retained until the backup is deleted. + * + * Generated from protobuf field string backup_uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setBackupUid($var) + { + GPBUtil::checkString($var, True); + $this->backup_uid = $var; + + return $this; + } + + /** + * Required. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * + * Generated from protobuf field string backup_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getBackupName() + { + return $this->backup_name; + } + + /** + * Required. The name of the backup resource with the format: + * * projects/{project}/locations/{region}/backups/{backup_id} + * + * Generated from protobuf field string backup_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setBackupName($var) + { + GPBUtil::checkString($var, True); + $this->backup_name = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/BatchCreateInstanceStatus.php b/AlloyDb/src/V1beta/BatchCreateInstanceStatus.php new file mode 100644 index 000000000000..8f5aef1eeac6 --- /dev/null +++ b/AlloyDb/src/V1beta/BatchCreateInstanceStatus.php @@ -0,0 +1,221 @@ +google.cloud.alloydb.v1beta.BatchCreateInstanceStatus + */ +class BatchCreateInstanceStatus extends \Google\Protobuf\Internal\Message +{ + /** + * The current state of an instance involved in the batch create operation. + * Once the operation is complete, the final state of the instances in the + * LRO can be one of: + * 1. ACTIVE, indicating that instances were created successfully + * 2. FAILED, indicating that a particular instance failed creation + * 3. ROLLED_BACK indicating that although the instance was created + * successfully, it had to be rolled back and deleted due to failure in + * other steps of the workflow. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.BatchCreateInstanceStatus.State state = 1; + */ + protected $state = 0; + /** + * DEPRECATED - Use the error field instead. + * Error, if any error occurred and is available, during instance creation. + * + * Generated from protobuf field string error_msg = 2; + */ + protected $error_msg = ''; + /** + * The RPC status of the instance creation operation. This field will be + * present if an error happened during the instance creation. + * + * Generated from protobuf field .google.rpc.Status error = 4; + */ + protected $error = null; + /** + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.InstanceType type = 3; + */ + protected $type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * The current state of an instance involved in the batch create operation. + * Once the operation is complete, the final state of the instances in the + * LRO can be one of: + * 1. ACTIVE, indicating that instances were created successfully + * 2. FAILED, indicating that a particular instance failed creation + * 3. ROLLED_BACK indicating that although the instance was created + * successfully, it had to be rolled back and deleted due to failure in + * other steps of the workflow. + * @type string $error_msg + * DEPRECATED - Use the error field instead. + * Error, if any error occurred and is available, during instance creation. + * @type \Google\Rpc\Status $error + * The RPC status of the instance creation operation. This field will be + * present if an error happened during the instance creation. + * @type int $type + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * The current state of an instance involved in the batch create operation. + * Once the operation is complete, the final state of the instances in the + * LRO can be one of: + * 1. ACTIVE, indicating that instances were created successfully + * 2. FAILED, indicating that a particular instance failed creation + * 3. ROLLED_BACK indicating that although the instance was created + * successfully, it had to be rolled back and deleted due to failure in + * other steps of the workflow. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.BatchCreateInstanceStatus.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The current state of an instance involved in the batch create operation. + * Once the operation is complete, the final state of the instances in the + * LRO can be one of: + * 1. ACTIVE, indicating that instances were created successfully + * 2. FAILED, indicating that a particular instance failed creation + * 3. ROLLED_BACK indicating that although the instance was created + * successfully, it had to be rolled back and deleted due to failure in + * other steps of the workflow. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.BatchCreateInstanceStatus.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1beta\BatchCreateInstanceStatus\State::class); + $this->state = $var; + + return $this; + } + + /** + * DEPRECATED - Use the error field instead. + * Error, if any error occurred and is available, during instance creation. + * + * Generated from protobuf field string error_msg = 2; + * @return string + */ + public function getErrorMsg() + { + return $this->error_msg; + } + + /** + * DEPRECATED - Use the error field instead. + * Error, if any error occurred and is available, during instance creation. + * + * Generated from protobuf field string error_msg = 2; + * @param string $var + * @return $this + */ + public function setErrorMsg($var) + { + GPBUtil::checkString($var, True); + $this->error_msg = $var; + + return $this; + } + + /** + * The RPC status of the instance creation operation. This field will be + * present if an error happened during the instance creation. + * + * Generated from protobuf field .google.rpc.Status error = 4; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * The RPC status of the instance creation operation. This field will be + * present if an error happened during the instance creation. + * + * Generated from protobuf field .google.rpc.Status error = 4; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.InstanceType type = 3; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.InstanceType type = 3; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1beta\Instance\InstanceType::class); + $this->type = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/BatchCreateInstanceStatus/State.php b/AlloyDb/src/V1beta/BatchCreateInstanceStatus/State.php new file mode 100644 index 000000000000..1a197815ce5c --- /dev/null +++ b/AlloyDb/src/V1beta/BatchCreateInstanceStatus/State.php @@ -0,0 +1,95 @@ +google.cloud.alloydb.v1beta.BatchCreateInstanceStatus.State + */ +class State +{ + /** + * The state of the instance is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Instance is pending creation and has not yet been picked up for + * processsing in the backend. + * + * Generated from protobuf enum PENDING_CREATE = 1; + */ + const PENDING_CREATE = 1; + /** + * The instance is active and running. + * + * Generated from protobuf enum READY = 2; + */ + const READY = 2; + /** + * The instance is being created. + * + * Generated from protobuf enum CREATING = 3; + */ + const CREATING = 3; + /** + * The instance is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + /** + * The creation of the instance failed or a fatal error occurred during + * an operation on the instance or a batch of instances. + * + * Generated from protobuf enum FAILED = 5; + */ + const FAILED = 5; + /** + * The instance was created successfully, but was rolled back and deleted + * due to some other failure during BatchCreateInstances operation. + * + * Generated from protobuf enum ROLLED_BACK = 6; + */ + const ROLLED_BACK = 6; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::PENDING_CREATE => 'PENDING_CREATE', + self::READY => 'READY', + self::CREATING => 'CREATING', + self::DELETING => 'DELETING', + self::FAILED => 'FAILED', + self::ROLLED_BACK => 'ROLLED_BACK', + ]; + + 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/AlloyDb/src/V1beta/BatchCreateInstancesMetadata.php b/AlloyDb/src/V1beta/BatchCreateInstancesMetadata.php new file mode 100644 index 000000000000..9d7f3146a240 --- /dev/null +++ b/AlloyDb/src/V1beta/BatchCreateInstancesMetadata.php @@ -0,0 +1,133 @@ +google.cloud.alloydb.v1beta.BatchCreateInstancesMetadata + */ +class BatchCreateInstancesMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The instances being created in the API call. Each string in this list + * is the server defined resource path for target instances in the request + * and for the format of each string, see the comment on the Instance.name + * field. + * + * Generated from protobuf field repeated string instance_targets = 1; + */ + private $instance_targets; + /** + * A map representing state of the instances involved in the + * BatchCreateInstances operation during the operation execution. + * The instance state will be in STATE_UNSPECIFIED state if the instance has + * not yet been picked up for processing. + * The key of the map is the name of the instance resource. + * For the format, see the comment on the Instance.name field. + * + * Generated from protobuf field map instance_statuses = 2; + */ + private $instance_statuses; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $instance_targets + * The instances being created in the API call. Each string in this list + * is the server defined resource path for target instances in the request + * and for the format of each string, see the comment on the Instance.name + * field. + * @type array|\Google\Protobuf\Internal\MapField $instance_statuses + * A map representing state of the instances involved in the + * BatchCreateInstances operation during the operation execution. + * The instance state will be in STATE_UNSPECIFIED state if the instance has + * not yet been picked up for processing. + * The key of the map is the name of the instance resource. + * For the format, see the comment on the Instance.name field. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * The instances being created in the API call. Each string in this list + * is the server defined resource path for target instances in the request + * and for the format of each string, see the comment on the Instance.name + * field. + * + * Generated from protobuf field repeated string instance_targets = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInstanceTargets() + { + return $this->instance_targets; + } + + /** + * The instances being created in the API call. Each string in this list + * is the server defined resource path for target instances in the request + * and for the format of each string, see the comment on the Instance.name + * field. + * + * Generated from protobuf field repeated string instance_targets = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInstanceTargets($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->instance_targets = $arr; + + return $this; + } + + /** + * A map representing state of the instances involved in the + * BatchCreateInstances operation during the operation execution. + * The instance state will be in STATE_UNSPECIFIED state if the instance has + * not yet been picked up for processing. + * The key of the map is the name of the instance resource. + * For the format, see the comment on the Instance.name field. + * + * Generated from protobuf field map instance_statuses = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getInstanceStatuses() + { + return $this->instance_statuses; + } + + /** + * A map representing state of the instances involved in the + * BatchCreateInstances operation during the operation execution. + * The instance state will be in STATE_UNSPECIFIED state if the instance has + * not yet been picked up for processing. + * The key of the map is the name of the instance resource. + * For the format, see the comment on the Instance.name field. + * + * Generated from protobuf field map instance_statuses = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setInstanceStatuses($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1beta\BatchCreateInstanceStatus::class); + $this->instance_statuses = $arr; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/BatchCreateInstancesRequest.php b/AlloyDb/src/V1beta/BatchCreateInstancesRequest.php new file mode 100644 index 000000000000..413efcf08245 --- /dev/null +++ b/AlloyDb/src/V1beta/BatchCreateInstancesRequest.php @@ -0,0 +1,185 @@ +google.cloud.alloydb.v1beta.BatchCreateInstancesRequest + */ +class BatchCreateInstancesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Resources being created. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.CreateInstanceRequests requests = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $requests = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. + * @type \Google\Cloud\AlloyDb\V1beta\CreateInstanceRequests $requests + * Required. Resources being created. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. + * + * 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 parent resource. + * + * 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. Resources being created. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.CreateInstanceRequests requests = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1beta\CreateInstanceRequests|null + */ + public function getRequests() + { + return $this->requests; + } + + public function hasRequests() + { + return isset($this->requests); + } + + public function clearRequests() + { + unset($this->requests); + } + + /** + * Required. Resources being created. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.CreateInstanceRequests requests = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1beta\CreateInstanceRequests $var + * @return $this + */ + public function setRequests($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\CreateInstanceRequests::class); + $this->requests = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/BatchCreateInstancesResponse.php b/AlloyDb/src/V1beta/BatchCreateInstancesResponse.php new file mode 100644 index 000000000000..b518af308ff1 --- /dev/null +++ b/AlloyDb/src/V1beta/BatchCreateInstancesResponse.php @@ -0,0 +1,67 @@ +google.cloud.alloydb.v1beta.BatchCreateInstancesResponse + */ +class BatchCreateInstancesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Created instances. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.Instance instances = 1; + */ + private $instances; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\AlloyDb\V1beta\Instance>|\Google\Protobuf\Internal\RepeatedField $instances + * Created instances. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Created instances. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.Instance instances = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInstances() + { + return $this->instances; + } + + /** + * Created instances. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.Instance instances = 1; + * @param array<\Google\Cloud\AlloyDb\V1beta\Instance>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInstances($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1beta\Instance::class); + $this->instances = $arr; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/Cluster.php b/AlloyDb/src/V1beta/Cluster.php new file mode 100644 index 000000000000..18784953ed36 --- /dev/null +++ b/AlloyDb/src/V1beta/Cluster.php @@ -0,0 +1,1136 @@ +google.cloud.alloydb.v1beta.Cluster + */ +class Cluster extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the cluster resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * where the cluster ID segment should satisfy the regex expression + * `[a-z0-9-]+`. For more details see https://google.aip.dev/122. + * The prefix of the cluster resource name is the name of the parent resource: + * * projects/{project}/locations/{region} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * User-settable and human-readable display name for the Cluster. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. Create time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $delete_time = null; + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 7; + */ + private $labels; + /** + * Output only. The current serving state of the cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Output only. The type of the cluster. This is an output-only field and it's + * populated at the Cluster creation time or the Cluster promotion + * time. The cluster type is determined by which RPC was used to create + * the cluster (i.e. `CreateCluster` vs. `CreateSecondaryCluster` + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster.ClusterType cluster_type = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $cluster_type = 0; + /** + * Output only. The database engine major version. This is an output-only + * field and it's populated at the Cluster creation time. This field cannot be + * changed after cluster creation. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.DatabaseVersion database_version = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $database_version = 0; + /** + * Required. The resource link for the VPC network in which cluster resources + * are created and from which they are accessible via Private IP. The network + * must belong to the same project as the cluster. It is specified in the + * form: "projects/{project_number}/global/networks/{network_id}". This is + * required to create a cluster. It can be updated, but it cannot be removed. + * + * Generated from protobuf field string network = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $network = ''; + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 11; + */ + protected $etag = ''; + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 12; + */ + private $annotations; + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Cluster does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * + * Generated from protobuf field bool reconciling = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reconciling = false; + /** + * Input only. Initial user to setup during cluster creation. Required. + * If used in `RestoreCluster` this is ignored. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.UserPassword initial_user = 14 [(.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $initial_user = null; + /** + * The automated backup policy for this cluster. + * If no policy is provided then the default policy will be used. If backups + * are supported for the cluster, the default policy takes one backup a day, + * has a backup window of 1 hour, and retains backups for 14 days. + * For more information on the defaults, consult the + * documentation for the message type. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.AutomatedBackupPolicy automated_backup_policy = 17; + */ + protected $automated_backup_policy = null; + /** + * SSL configuration for this AlloyDB Cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.SslConfig ssl_config = 18; + */ + protected $ssl_config = null; + /** + * Optional. The encryption config can be specified to encrypt the data disks + * and other persistent data resources of a cluster with a + * customer-managed encryption key (CMEK). When this field is not + * specified, the cluster will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionConfig encryption_config = 19 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $encryption_config = null; + /** + * Output only. The encryption information for the cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionInfo encryption_info = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $encryption_info = null; + /** + * Optional. Continuous backup configuration for this cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.ContinuousBackupConfig continuous_backup_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $continuous_backup_config = null; + /** + * Output only. Continuous backup properties for this cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.ContinuousBackupInfo continuous_backup_info = 28 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $continuous_backup_info = null; + /** + * Cross Region replication config specific to SECONDARY cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster.SecondaryConfig secondary_config = 22; + */ + protected $secondary_config = null; + /** + * Output only. Cross Region replication config specific to PRIMARY cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster.PrimaryConfig primary_config = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $primary_config = null; + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AlloyDb\V1beta\BackupSource $backup_source + * Output only. Cluster created from backup. + * @type \Google\Cloud\AlloyDb\V1beta\MigrationSource $migration_source + * Output only. Cluster created via DMS migration. + * @type string $name + * Output only. The name of the cluster resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * where the cluster ID segment should satisfy the regex expression + * `[a-z0-9-]+`. For more details see https://google.aip.dev/122. + * The prefix of the cluster resource name is the name of the parent resource: + * * projects/{project}/locations/{region} + * @type string $display_name + * User-settable and human-readable display name for the Cluster. + * @type string $uid + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Create time stamp + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Update time stamp + * @type \Google\Protobuf\Timestamp $delete_time + * Output only. Delete time stamp + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels as key value pairs + * @type int $state + * Output only. The current serving state of the cluster. + * @type int $cluster_type + * Output only. The type of the cluster. This is an output-only field and it's + * populated at the Cluster creation time or the Cluster promotion + * time. The cluster type is determined by which RPC was used to create + * the cluster (i.e. `CreateCluster` vs. `CreateSecondaryCluster` + * @type int $database_version + * Output only. The database engine major version. This is an output-only + * field and it's populated at the Cluster creation time. This field cannot be + * changed after cluster creation. + * @type string $network + * Required. The resource link for the VPC network in which cluster resources + * are created and from which they are accessible via Private IP. The network + * must belong to the same project as the cluster. It is specified in the + * form: "projects/{project_number}/global/networks/{network_id}". This is + * required to create a cluster. It can be updated, but it cannot be removed. + * @type string $etag + * For Resource freshness validation (https://google.aip.dev/154) + * @type array|\Google\Protobuf\Internal\MapField $annotations + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * @type bool $reconciling + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Cluster does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * @type \Google\Cloud\AlloyDb\V1beta\UserPassword $initial_user + * Input only. Initial user to setup during cluster creation. Required. + * If used in `RestoreCluster` this is ignored. + * @type \Google\Cloud\AlloyDb\V1beta\AutomatedBackupPolicy $automated_backup_policy + * The automated backup policy for this cluster. + * If no policy is provided then the default policy will be used. If backups + * are supported for the cluster, the default policy takes one backup a day, + * has a backup window of 1 hour, and retains backups for 14 days. + * For more information on the defaults, consult the + * documentation for the message type. + * @type \Google\Cloud\AlloyDb\V1beta\SslConfig $ssl_config + * SSL configuration for this AlloyDB Cluster. + * @type \Google\Cloud\AlloyDb\V1beta\EncryptionConfig $encryption_config + * Optional. The encryption config can be specified to encrypt the data disks + * and other persistent data resources of a cluster with a + * customer-managed encryption key (CMEK). When this field is not + * specified, the cluster will then use default encryption scheme to + * protect the user data. + * @type \Google\Cloud\AlloyDb\V1beta\EncryptionInfo $encryption_info + * Output only. The encryption information for the cluster. + * @type \Google\Cloud\AlloyDb\V1beta\ContinuousBackupConfig $continuous_backup_config + * Optional. Continuous backup configuration for this cluster. + * @type \Google\Cloud\AlloyDb\V1beta\ContinuousBackupInfo $continuous_backup_info + * Output only. Continuous backup properties for this cluster. + * @type \Google\Cloud\AlloyDb\V1beta\Cluster\SecondaryConfig $secondary_config + * Cross Region replication config specific to SECONDARY cluster. + * @type \Google\Cloud\AlloyDb\V1beta\Cluster\PrimaryConfig $primary_config + * Output only. Cross Region replication config specific to PRIMARY cluster. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Cluster created from backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.BackupSource backup_source = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1beta\BackupSource|null + */ + public function getBackupSource() + { + return $this->readOneof(15); + } + + public function hasBackupSource() + { + return $this->hasOneof(15); + } + + /** + * Output only. Cluster created from backup. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.BackupSource backup_source = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1beta\BackupSource $var + * @return $this + */ + public function setBackupSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\BackupSource::class); + $this->writeOneof(15, $var); + + return $this; + } + + /** + * Output only. Cluster created via DMS migration. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.MigrationSource migration_source = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1beta\MigrationSource|null + */ + public function getMigrationSource() + { + return $this->readOneof(16); + } + + public function hasMigrationSource() + { + return $this->hasOneof(16); + } + + /** + * Output only. Cluster created via DMS migration. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.MigrationSource migration_source = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1beta\MigrationSource $var + * @return $this + */ + public function setMigrationSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\MigrationSource::class); + $this->writeOneof(16, $var); + + return $this; + } + + /** + * Output only. The name of the cluster resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * where the cluster ID segment should satisfy the regex expression + * `[a-z0-9-]+`. For more details see https://google.aip.dev/122. + * The prefix of the cluster resource name is the name of the parent resource: + * * projects/{project}/locations/{region} + * + * 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 cluster resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * where the cluster ID segment should satisfy the regex expression + * `[a-z0-9-]+`. For more details see https://google.aip.dev/122. + * The prefix of the cluster resource name is the name of the parent resource: + * * projects/{project}/locations/{region} + * + * 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; + } + + /** + * User-settable and human-readable display name for the Cluster. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * User-settable and human-readable display name for the Cluster. + * + * 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. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. Create time stamp + * + * 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. Create time stamp + * + * 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. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getDeleteTime() + { + return $this->delete_time; + } + + public function hasDeleteTime() + { + return isset($this->delete_time); + } + + public function clearDeleteTime() + { + unset($this->delete_time); + } + + /** + * Output only. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setDeleteTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->delete_time = $var; + + return $this; + } + + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 7; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels as key value pairs + * + * 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; + } + + /** + * Output only. The current serving state of the cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current serving state of the cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1beta\Cluster\State::class); + $this->state = $var; + + return $this; + } + + /** + * Output only. The type of the cluster. This is an output-only field and it's + * populated at the Cluster creation time or the Cluster promotion + * time. The cluster type is determined by which RPC was used to create + * the cluster (i.e. `CreateCluster` vs. `CreateSecondaryCluster` + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster.ClusterType cluster_type = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getClusterType() + { + return $this->cluster_type; + } + + /** + * Output only. The type of the cluster. This is an output-only field and it's + * populated at the Cluster creation time or the Cluster promotion + * time. The cluster type is determined by which RPC was used to create + * the cluster (i.e. `CreateCluster` vs. `CreateSecondaryCluster` + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster.ClusterType cluster_type = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setClusterType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1beta\Cluster\ClusterType::class); + $this->cluster_type = $var; + + return $this; + } + + /** + * Output only. The database engine major version. This is an output-only + * field and it's populated at the Cluster creation time. This field cannot be + * changed after cluster creation. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.DatabaseVersion database_version = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getDatabaseVersion() + { + return $this->database_version; + } + + /** + * Output only. The database engine major version. This is an output-only + * field and it's populated at the Cluster creation time. This field cannot be + * changed after cluster creation. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.DatabaseVersion database_version = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setDatabaseVersion($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1beta\DatabaseVersion::class); + $this->database_version = $var; + + return $this; + } + + /** + * Required. The resource link for the VPC network in which cluster resources + * are created and from which they are accessible via Private IP. The network + * must belong to the same project as the cluster. It is specified in the + * form: "projects/{project_number}/global/networks/{network_id}". This is + * required to create a cluster. It can be updated, but it cannot be removed. + * + * Generated from protobuf field string network = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getNetwork() + { + return $this->network; + } + + /** + * Required. The resource link for the VPC network in which cluster resources + * are created and from which they are accessible via Private IP. The network + * must belong to the same project as the cluster. It is specified in the + * form: "projects/{project_number}/global/networks/{network_id}". This is + * required to create a cluster. It can be updated, but it cannot be removed. + * + * Generated from protobuf field string network = 10 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setNetwork($var) + { + GPBUtil::checkString($var, True); + $this->network = $var; + + return $this; + } + + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 11; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 11; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 12; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 12; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Cluster does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * + * Generated from protobuf field bool reconciling = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getReconciling() + { + return $this->reconciling; + } + + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Cluster does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * + * Generated from protobuf field bool reconciling = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setReconciling($var) + { + GPBUtil::checkBool($var); + $this->reconciling = $var; + + return $this; + } + + /** + * Input only. Initial user to setup during cluster creation. Required. + * If used in `RestoreCluster` this is ignored. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.UserPassword initial_user = 14 [(.google.api.field_behavior) = INPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1beta\UserPassword|null + */ + public function getInitialUser() + { + return $this->initial_user; + } + + public function hasInitialUser() + { + return isset($this->initial_user); + } + + public function clearInitialUser() + { + unset($this->initial_user); + } + + /** + * Input only. Initial user to setup during cluster creation. Required. + * If used in `RestoreCluster` this is ignored. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.UserPassword initial_user = 14 [(.google.api.field_behavior) = INPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1beta\UserPassword $var + * @return $this + */ + public function setInitialUser($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\UserPassword::class); + $this->initial_user = $var; + + return $this; + } + + /** + * The automated backup policy for this cluster. + * If no policy is provided then the default policy will be used. If backups + * are supported for the cluster, the default policy takes one backup a day, + * has a backup window of 1 hour, and retains backups for 14 days. + * For more information on the defaults, consult the + * documentation for the message type. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.AutomatedBackupPolicy automated_backup_policy = 17; + * @return \Google\Cloud\AlloyDb\V1beta\AutomatedBackupPolicy|null + */ + public function getAutomatedBackupPolicy() + { + return $this->automated_backup_policy; + } + + public function hasAutomatedBackupPolicy() + { + return isset($this->automated_backup_policy); + } + + public function clearAutomatedBackupPolicy() + { + unset($this->automated_backup_policy); + } + + /** + * The automated backup policy for this cluster. + * If no policy is provided then the default policy will be used. If backups + * are supported for the cluster, the default policy takes one backup a day, + * has a backup window of 1 hour, and retains backups for 14 days. + * For more information on the defaults, consult the + * documentation for the message type. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.AutomatedBackupPolicy automated_backup_policy = 17; + * @param \Google\Cloud\AlloyDb\V1beta\AutomatedBackupPolicy $var + * @return $this + */ + public function setAutomatedBackupPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\AutomatedBackupPolicy::class); + $this->automated_backup_policy = $var; + + return $this; + } + + /** + * SSL configuration for this AlloyDB Cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.SslConfig ssl_config = 18; + * @return \Google\Cloud\AlloyDb\V1beta\SslConfig|null + */ + public function getSslConfig() + { + return $this->ssl_config; + } + + public function hasSslConfig() + { + return isset($this->ssl_config); + } + + public function clearSslConfig() + { + unset($this->ssl_config); + } + + /** + * SSL configuration for this AlloyDB Cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.SslConfig ssl_config = 18; + * @param \Google\Cloud\AlloyDb\V1beta\SslConfig $var + * @return $this + */ + public function setSslConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\SslConfig::class); + $this->ssl_config = $var; + + return $this; + } + + /** + * Optional. The encryption config can be specified to encrypt the data disks + * and other persistent data resources of a cluster with a + * customer-managed encryption key (CMEK). When this field is not + * specified, the cluster will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionConfig encryption_config = 19 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\AlloyDb\V1beta\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 config can be specified to encrypt the data disks + * and other persistent data resources of a cluster with a + * customer-managed encryption key (CMEK). When this field is not + * specified, the cluster will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionConfig encryption_config = 19 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\AlloyDb\V1beta\EncryptionConfig $var + * @return $this + */ + public function setEncryptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\EncryptionConfig::class); + $this->encryption_config = $var; + + return $this; + } + + /** + * Output only. The encryption information for the cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionInfo encryption_info = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1beta\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 cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionInfo encryption_info = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1beta\EncryptionInfo $var + * @return $this + */ + public function setEncryptionInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\EncryptionInfo::class); + $this->encryption_info = $var; + + return $this; + } + + /** + * Optional. Continuous backup configuration for this cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.ContinuousBackupConfig continuous_backup_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\AlloyDb\V1beta\ContinuousBackupConfig|null + */ + public function getContinuousBackupConfig() + { + return $this->continuous_backup_config; + } + + public function hasContinuousBackupConfig() + { + return isset($this->continuous_backup_config); + } + + public function clearContinuousBackupConfig() + { + unset($this->continuous_backup_config); + } + + /** + * Optional. Continuous backup configuration for this cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.ContinuousBackupConfig continuous_backup_config = 27 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\AlloyDb\V1beta\ContinuousBackupConfig $var + * @return $this + */ + public function setContinuousBackupConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\ContinuousBackupConfig::class); + $this->continuous_backup_config = $var; + + return $this; + } + + /** + * Output only. Continuous backup properties for this cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.ContinuousBackupInfo continuous_backup_info = 28 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1beta\ContinuousBackupInfo|null + */ + public function getContinuousBackupInfo() + { + return $this->continuous_backup_info; + } + + public function hasContinuousBackupInfo() + { + return isset($this->continuous_backup_info); + } + + public function clearContinuousBackupInfo() + { + unset($this->continuous_backup_info); + } + + /** + * Output only. Continuous backup properties for this cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.ContinuousBackupInfo continuous_backup_info = 28 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1beta\ContinuousBackupInfo $var + * @return $this + */ + public function setContinuousBackupInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\ContinuousBackupInfo::class); + $this->continuous_backup_info = $var; + + return $this; + } + + /** + * Cross Region replication config specific to SECONDARY cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster.SecondaryConfig secondary_config = 22; + * @return \Google\Cloud\AlloyDb\V1beta\Cluster\SecondaryConfig|null + */ + public function getSecondaryConfig() + { + return $this->secondary_config; + } + + public function hasSecondaryConfig() + { + return isset($this->secondary_config); + } + + public function clearSecondaryConfig() + { + unset($this->secondary_config); + } + + /** + * Cross Region replication config specific to SECONDARY cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster.SecondaryConfig secondary_config = 22; + * @param \Google\Cloud\AlloyDb\V1beta\Cluster\SecondaryConfig $var + * @return $this + */ + public function setSecondaryConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\Cluster\SecondaryConfig::class); + $this->secondary_config = $var; + + return $this; + } + + /** + * Output only. Cross Region replication config specific to PRIMARY cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster.PrimaryConfig primary_config = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1beta\Cluster\PrimaryConfig|null + */ + public function getPrimaryConfig() + { + return $this->primary_config; + } + + public function hasPrimaryConfig() + { + return isset($this->primary_config); + } + + public function clearPrimaryConfig() + { + unset($this->primary_config); + } + + /** + * Output only. Cross Region replication config specific to PRIMARY cluster. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster.PrimaryConfig primary_config = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1beta\Cluster\PrimaryConfig $var + * @return $this + */ + public function setPrimaryConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\Cluster\PrimaryConfig::class); + $this->primary_config = $var; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/AlloyDb/src/V1beta/Cluster/ClusterType.php b/AlloyDb/src/V1beta/Cluster/ClusterType.php new file mode 100644 index 000000000000..8c73f64d507a --- /dev/null +++ b/AlloyDb/src/V1beta/Cluster/ClusterType.php @@ -0,0 +1,63 @@ +google.cloud.alloydb.v1beta.Cluster.ClusterType + */ +class ClusterType +{ + /** + * The type of the cluster is unknown. + * + * Generated from protobuf enum CLUSTER_TYPE_UNSPECIFIED = 0; + */ + const CLUSTER_TYPE_UNSPECIFIED = 0; + /** + * Primary cluster that support read and write operations. + * + * Generated from protobuf enum PRIMARY = 1; + */ + const PRIMARY = 1; + /** + * Secondary cluster that is replicating from another region. + * This only supports read. + * + * Generated from protobuf enum SECONDARY = 2; + */ + const SECONDARY = 2; + + private static $valueToName = [ + self::CLUSTER_TYPE_UNSPECIFIED => 'CLUSTER_TYPE_UNSPECIFIED', + self::PRIMARY => 'PRIMARY', + self::SECONDARY => 'SECONDARY', + ]; + + 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/AlloyDb/src/V1beta/Cluster/PrimaryConfig.php b/AlloyDb/src/V1beta/Cluster/PrimaryConfig.php new file mode 100644 index 000000000000..2574a2d3d383 --- /dev/null +++ b/AlloyDb/src/V1beta/Cluster/PrimaryConfig.php @@ -0,0 +1,74 @@ +google.cloud.alloydb.v1beta.Cluster.PrimaryConfig + */ +class PrimaryConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Names of the clusters that are replicating from this + * cluster. + * + * Generated from protobuf field repeated string secondary_cluster_names = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $secondary_cluster_names; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $secondary_cluster_names + * Output only. Names of the clusters that are replicating from this + * cluster. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Names of the clusters that are replicating from this + * cluster. + * + * Generated from protobuf field repeated string secondary_cluster_names = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSecondaryClusterNames() + { + return $this->secondary_cluster_names; + } + + /** + * Output only. Names of the clusters that are replicating from this + * cluster. + * + * Generated from protobuf field repeated string secondary_cluster_names = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSecondaryClusterNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->secondary_cluster_names = $arr; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1beta/Cluster/SecondaryConfig.php b/AlloyDb/src/V1beta/Cluster/SecondaryConfig.php new file mode 100644 index 000000000000..7480996fe18c --- /dev/null +++ b/AlloyDb/src/V1beta/Cluster/SecondaryConfig.php @@ -0,0 +1,73 @@ +google.cloud.alloydb.v1beta.Cluster.SecondaryConfig + */ +class SecondaryConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the primary cluster name with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * + * Generated from protobuf field string primary_cluster_name = 1; + */ + protected $primary_cluster_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $primary_cluster_name + * The name of the primary cluster name with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The name of the primary cluster name with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * + * Generated from protobuf field string primary_cluster_name = 1; + * @return string + */ + public function getPrimaryClusterName() + { + return $this->primary_cluster_name; + } + + /** + * The name of the primary cluster name with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * + * Generated from protobuf field string primary_cluster_name = 1; + * @param string $var + * @return $this + */ + public function setPrimaryClusterName($var) + { + GPBUtil::checkString($var, True); + $this->primary_cluster_name = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1beta/Cluster/State.php b/AlloyDb/src/V1beta/Cluster/State.php new file mode 100644 index 000000000000..754aca337e30 --- /dev/null +++ b/AlloyDb/src/V1beta/Cluster/State.php @@ -0,0 +1,123 @@ +google.cloud.alloydb.v1beta.Cluster.State + */ +class State +{ + /** + * The state of the cluster is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The cluster is active and running. + * + * Generated from protobuf enum READY = 1; + */ + const READY = 1; + /** + * The cluster is stopped. All instances in the cluster are stopped. + * Customers can start a stopped cluster at any point and all their + * instances will come back to life with same names and IP resources. In + * this state, customer pays for storage. + * Associated backups could also be present in a stopped cluster. + * + * Generated from protobuf enum STOPPED = 2; + */ + const STOPPED = 2; + /** + * The cluster is empty and has no associated resources. + * All instances, associated storage and backups have been deleted. + * + * Generated from protobuf enum EMPTY = 3; + */ + const PBEMPTY = 3; + /** + * The cluster is being created. + * + * Generated from protobuf enum CREATING = 4; + */ + const CREATING = 4; + /** + * The cluster is being deleted. + * + * Generated from protobuf enum DELETING = 5; + */ + const DELETING = 5; + /** + * The creation of the cluster failed. + * + * Generated from protobuf enum FAILED = 6; + */ + const FAILED = 6; + /** + * The cluster is bootstrapping with data from some other source. + * Direct mutations to the cluster (e.g. adding read pool) are not allowed. + * + * Generated from protobuf enum BOOTSTRAPPING = 7; + */ + const BOOTSTRAPPING = 7; + /** + * The cluster is under maintenance. AlloyDB regularly performs maintenance + * and upgrades on customer clusters. Updates on the cluster are + * not allowed while the cluster is in this state. + * + * Generated from protobuf enum MAINTENANCE = 8; + */ + const MAINTENANCE = 8; + /** + * The cluster is being promoted. + * + * Generated from protobuf enum PROMOTING = 9; + */ + const PROMOTING = 9; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::READY => 'READY', + self::STOPPED => 'STOPPED', + self::PBEMPTY => 'EMPTY', + self::CREATING => 'CREATING', + self::DELETING => 'DELETING', + self::FAILED => 'FAILED', + self::BOOTSTRAPPING => 'BOOTSTRAPPING', + self::MAINTENANCE => 'MAINTENANCE', + self::PROMOTING => 'PROMOTING', + ]; + + 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/AlloyDb/src/V1beta/ConnectionInfo.php b/AlloyDb/src/V1beta/ConnectionInfo.php new file mode 100644 index 000000000000..5f92ef3a1c2f --- /dev/null +++ b/AlloyDb/src/V1beta/ConnectionInfo.php @@ -0,0 +1,186 @@ +google.cloud.alloydb.v1beta.ConnectionInfo + */ +class ConnectionInfo extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the ConnectionInfo singleton resource, e.g.: + * projects/{project}/locations/{location}/clusters/*/instances/*/connectionInfo + * This field currently has no semantic meaning. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Output only. The IP address for the Instance. + * This is the connection endpoint for an end-user application. + * + * Generated from protobuf field string ip_address = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $ip_address = ''; + /** + * Output only. The pem-encoded chain that may be used to verify the X.509 + * certificate. Expected to be in issuer-to-root order according to RFC 5246. + * + * Generated from protobuf field repeated string pem_certificate_chain = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $pem_certificate_chain; + /** + * Output only. The unique ID of the Instance. + * + * Generated from protobuf field string instance_uid = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $instance_uid = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the ConnectionInfo singleton resource, e.g.: + * projects/{project}/locations/{location}/clusters/*/instances/*/connectionInfo + * This field currently has no semantic meaning. + * @type string $ip_address + * Output only. The IP address for the Instance. + * This is the connection endpoint for an end-user application. + * @type array|\Google\Protobuf\Internal\RepeatedField $pem_certificate_chain + * Output only. The pem-encoded chain that may be used to verify the X.509 + * certificate. Expected to be in issuer-to-root order according to RFC 5246. + * @type string $instance_uid + * Output only. The unique ID of the Instance. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The name of the ConnectionInfo singleton resource, e.g.: + * projects/{project}/locations/{location}/clusters/*/instances/*/connectionInfo + * This field currently has no semantic meaning. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the ConnectionInfo singleton resource, e.g.: + * projects/{project}/locations/{location}/clusters/*/instances/*/connectionInfo + * This field currently has no semantic meaning. + * + * 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 IP address for the Instance. + * This is the connection endpoint for an end-user application. + * + * Generated from protobuf field string ip_address = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getIpAddress() + { + return $this->ip_address; + } + + /** + * Output only. The IP address for the Instance. + * This is the connection endpoint for an end-user application. + * + * Generated from protobuf field string ip_address = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setIpAddress($var) + { + GPBUtil::checkString($var, True); + $this->ip_address = $var; + + return $this; + } + + /** + * Output only. The pem-encoded chain that may be used to verify the X.509 + * certificate. Expected to be in issuer-to-root order according to RFC 5246. + * + * Generated from protobuf field repeated string pem_certificate_chain = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPemCertificateChain() + { + return $this->pem_certificate_chain; + } + + /** + * Output only. The pem-encoded chain that may be used to verify the X.509 + * certificate. Expected to be in issuer-to-root order according to RFC 5246. + * + * Generated from protobuf field repeated string pem_certificate_chain = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPemCertificateChain($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->pem_certificate_chain = $arr; + + return $this; + } + + /** + * Output only. The unique ID of the Instance. + * + * Generated from protobuf field string instance_uid = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getInstanceUid() + { + return $this->instance_uid; + } + + /** + * Output only. The unique ID of the Instance. + * + * Generated from protobuf field string instance_uid = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setInstanceUid($var) + { + GPBUtil::checkString($var, True); + $this->instance_uid = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/ContinuousBackupConfig.php b/AlloyDb/src/V1beta/ContinuousBackupConfig.php new file mode 100644 index 000000000000..7ccda52f283f --- /dev/null +++ b/AlloyDb/src/V1beta/ContinuousBackupConfig.php @@ -0,0 +1,176 @@ +google.cloud.alloydb.v1beta.ContinuousBackupConfig + */ +class ContinuousBackupConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Whether ContinuousBackup is enabled. + * + * Generated from protobuf field optional bool enabled = 1; + */ + protected $enabled = null; + /** + * The number of days backups and logs will be retained, which determines the + * window of time that data is recoverable for. If not set, it defaults to 14 + * days. + * + * Generated from protobuf field int32 recovery_window_days = 4; + */ + protected $recovery_window_days = 0; + /** + * The encryption config can be specified to encrypt the + * backups with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionConfig encryption_config = 3; + */ + protected $encryption_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enabled + * Whether ContinuousBackup is enabled. + * @type int $recovery_window_days + * The number of days backups and logs will be retained, which determines the + * window of time that data is recoverable for. If not set, it defaults to 14 + * days. + * @type \Google\Cloud\AlloyDb\V1beta\EncryptionConfig $encryption_config + * The encryption config can be specified to encrypt the + * backups with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Whether ContinuousBackup is enabled. + * + * Generated from protobuf field optional bool enabled = 1; + * @return bool + */ + public function getEnabled() + { + return isset($this->enabled) ? $this->enabled : false; + } + + public function hasEnabled() + { + return isset($this->enabled); + } + + public function clearEnabled() + { + unset($this->enabled); + } + + /** + * Whether ContinuousBackup is enabled. + * + * Generated from protobuf field optional bool enabled = 1; + * @param bool $var + * @return $this + */ + public function setEnabled($var) + { + GPBUtil::checkBool($var); + $this->enabled = $var; + + return $this; + } + + /** + * The number of days backups and logs will be retained, which determines the + * window of time that data is recoverable for. If not set, it defaults to 14 + * days. + * + * Generated from protobuf field int32 recovery_window_days = 4; + * @return int + */ + public function getRecoveryWindowDays() + { + return $this->recovery_window_days; + } + + /** + * The number of days backups and logs will be retained, which determines the + * window of time that data is recoverable for. If not set, it defaults to 14 + * days. + * + * Generated from protobuf field int32 recovery_window_days = 4; + * @param int $var + * @return $this + */ + public function setRecoveryWindowDays($var) + { + GPBUtil::checkInt32($var); + $this->recovery_window_days = $var; + + return $this; + } + + /** + * The encryption config can be specified to encrypt the + * backups with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionConfig encryption_config = 3; + * @return \Google\Cloud\AlloyDb\V1beta\EncryptionConfig|null + */ + public function getEncryptionConfig() + { + return $this->encryption_config; + } + + public function hasEncryptionConfig() + { + return isset($this->encryption_config); + } + + public function clearEncryptionConfig() + { + unset($this->encryption_config); + } + + /** + * The encryption config can be specified to encrypt the + * backups with a customer-managed encryption key (CMEK). When this field is + * not specified, the backup will then use default encryption scheme to + * protect the user data. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionConfig encryption_config = 3; + * @param \Google\Cloud\AlloyDb\V1beta\EncryptionConfig $var + * @return $this + */ + public function setEncryptionConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\EncryptionConfig::class); + $this->encryption_config = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/ContinuousBackupInfo.php b/AlloyDb/src/V1beta/ContinuousBackupInfo.php new file mode 100644 index 000000000000..b6ee210473ad --- /dev/null +++ b/AlloyDb/src/V1beta/ContinuousBackupInfo.php @@ -0,0 +1,168 @@ +google.cloud.alloydb.v1beta.ContinuousBackupInfo + */ +class ContinuousBackupInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The encryption information for the WALs and backups required + * for ContinuousBackup. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionInfo encryption_info = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $encryption_info = null; + /** + * Output only. When ContinuousBackup was most recently enabled. Set to null + * if ContinuousBackup is not enabled. + * + * Generated from protobuf field .google.protobuf.Timestamp enabled_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $enabled_time = null; + /** + * Output only. Days of the week on which a continuous backup is taken. Output + * only field. Ignored if passed into the request. + * + * Generated from protobuf field repeated .google.type.DayOfWeek schedule = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $schedule; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AlloyDb\V1beta\EncryptionInfo $encryption_info + * Output only. The encryption information for the WALs and backups required + * for ContinuousBackup. + * @type \Google\Protobuf\Timestamp $enabled_time + * Output only. When ContinuousBackup was most recently enabled. Set to null + * if ContinuousBackup is not enabled. + * @type array|\Google\Protobuf\Internal\RepeatedField $schedule + * Output only. Days of the week on which a continuous backup is taken. Output + * only field. Ignored if passed into the request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The encryption information for the WALs and backups required + * for ContinuousBackup. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionInfo encryption_info = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1beta\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 WALs and backups required + * for ContinuousBackup. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionInfo encryption_info = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1beta\EncryptionInfo $var + * @return $this + */ + public function setEncryptionInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\EncryptionInfo::class); + $this->encryption_info = $var; + + return $this; + } + + /** + * Output only. When ContinuousBackup was most recently enabled. Set to null + * if ContinuousBackup is not enabled. + * + * Generated from protobuf field .google.protobuf.Timestamp enabled_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEnabledTime() + { + return $this->enabled_time; + } + + public function hasEnabledTime() + { + return isset($this->enabled_time); + } + + public function clearEnabledTime() + { + unset($this->enabled_time); + } + + /** + * Output only. When ContinuousBackup was most recently enabled. Set to null + * if ContinuousBackup is not enabled. + * + * Generated from protobuf field .google.protobuf.Timestamp enabled_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEnabledTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->enabled_time = $var; + + return $this; + } + + /** + * Output only. Days of the week on which a continuous backup is taken. Output + * only field. Ignored if passed into the request. + * + * Generated from protobuf field repeated .google.type.DayOfWeek schedule = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSchedule() + { + return $this->schedule; + } + + /** + * Output only. Days of the week on which a continuous backup is taken. Output + * only field. Ignored if passed into the request. + * + * Generated from protobuf field repeated .google.type.DayOfWeek schedule = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSchedule($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Type\DayOfWeek::class); + $this->schedule = $arr; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/ContinuousBackupSource.php b/AlloyDb/src/V1beta/ContinuousBackupSource.php new file mode 100644 index 000000000000..66bc25214a76 --- /dev/null +++ b/AlloyDb/src/V1beta/ContinuousBackupSource.php @@ -0,0 +1,119 @@ +google.cloud.alloydb.v1beta.ContinuousBackupSource + */ +class ContinuousBackupSource extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The source cluster from which to restore. This cluster must have + * continuous backup enabled for this operation to succeed. For the required + * format, see the comment on the Cluster.name field. + * + * Generated from protobuf field string cluster = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster = ''; + /** + * Required. The point in time to restore to. + * + * Generated from protobuf field .google.protobuf.Timestamp point_in_time = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $point_in_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $cluster + * Required. The source cluster from which to restore. This cluster must have + * continuous backup enabled for this operation to succeed. For the required + * format, see the comment on the Cluster.name field. + * @type \Google\Protobuf\Timestamp $point_in_time + * Required. The point in time to restore to. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Required. The source cluster from which to restore. This cluster must have + * continuous backup enabled for this operation to succeed. For the required + * format, see the comment on the Cluster.name field. + * + * Generated from protobuf field string cluster = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getCluster() + { + return $this->cluster; + } + + /** + * Required. The source cluster from which to restore. This cluster must have + * continuous backup enabled for this operation to succeed. For the required + * format, see the comment on the Cluster.name field. + * + * Generated from protobuf field string cluster = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setCluster($var) + { + GPBUtil::checkString($var, True); + $this->cluster = $var; + + return $this; + } + + /** + * Required. The point in time to restore to. + * + * Generated from protobuf field .google.protobuf.Timestamp point_in_time = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getPointInTime() + { + return $this->point_in_time; + } + + public function hasPointInTime() + { + return isset($this->point_in_time); + } + + public function clearPointInTime() + { + unset($this->point_in_time); + } + + /** + * Required. The point in time to restore to. + * + * Generated from protobuf field .google.protobuf.Timestamp point_in_time = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setPointInTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->point_in_time = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/CreateBackupRequest.php b/AlloyDb/src/V1beta/CreateBackupRequest.php new file mode 100644 index 000000000000..b105775eac50 --- /dev/null +++ b/AlloyDb/src/V1beta/CreateBackupRequest.php @@ -0,0 +1,257 @@ +google.cloud.alloydb.v1beta.CreateBackupRequest + */ +class CreateBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Value for parent. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. ID of the requesting object. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup_id = ''; + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Value for parent. + * @type string $backup_id + * Required. ID of the requesting object. + * @type \Google\Cloud\AlloyDb\V1beta\Backup $backup + * Required. The resource being created + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Value for parent. + * + * 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. Value for parent. + * + * 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. ID of the requesting object. + * + * Generated from protobuf field string backup_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getBackupId() + { + return $this->backup_id; + } + + /** + * Required. ID of the requesting object. + * + * 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 resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1beta\Backup|null + */ + public function getBackup() + { + return $this->backup; + } + + public function hasBackup() + { + return isset($this->backup); + } + + public function clearBackup() + { + unset($this->backup); + } + + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Backup backup = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1beta\Backup $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\Backup::class); + $this->backup = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/CreateClusterRequest.php b/AlloyDb/src/V1beta/CreateClusterRequest.php new file mode 100644 index 000000000000..fc8aa0f92db8 --- /dev/null +++ b/AlloyDb/src/V1beta/CreateClusterRequest.php @@ -0,0 +1,265 @@ +google.cloud.alloydb.v1beta.CreateClusterRequest + */ +class CreateClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. ID of the requesting object. + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster_id = ''; + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * @type string $cluster_id + * Required. ID of the requesting object. + * @type \Google\Cloud\AlloyDb\V1beta\Cluster $cluster + * Required. The resource being created + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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 parent resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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. ID of the requesting object. + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getClusterId() + { + return $this->cluster_id; + } + + /** + * Required. ID of the requesting object. + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setClusterId($var) + { + GPBUtil::checkString($var, True); + $this->cluster_id = $var; + + return $this; + } + + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1beta\Cluster|null + */ + public function getCluster() + { + return $this->cluster; + } + + public function hasCluster() + { + return isset($this->cluster); + } + + public function clearCluster() + { + unset($this->cluster); + } + + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1beta\Cluster $var + * @return $this + */ + public function setCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\Cluster::class); + $this->cluster = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/CreateInstanceRequest.php b/AlloyDb/src/V1beta/CreateInstanceRequest.php new file mode 100644 index 000000000000..b330b8e68a2a --- /dev/null +++ b/AlloyDb/src/V1beta/CreateInstanceRequest.php @@ -0,0 +1,265 @@ +google.cloud.alloydb.v1beta.CreateInstanceRequest + */ +class CreateInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. ID of the requesting object. + * + * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance_id = ''; + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * @type string $instance_id + * Required. ID of the requesting object. + * @type \Google\Cloud\AlloyDb\V1beta\Instance $instance + * Required. The resource being created + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * + * 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 parent resource. For the required format, see the + * comment on the Instance.name field. + * + * 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. ID of the requesting object. + * + * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getInstanceId() + { + return $this->instance_id; + } + + /** + * Required. ID of the requesting object. + * + * 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 resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1beta\Instance|null + */ + public function getInstance() + { + return $this->instance; + } + + public function hasInstance() + { + return isset($this->instance); + } + + public function clearInstance() + { + unset($this->instance); + } + + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1beta\Instance $var + * @return $this + */ + public function setInstance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\Instance::class); + $this->instance = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/CreateInstanceRequests.php b/AlloyDb/src/V1beta/CreateInstanceRequests.php new file mode 100644 index 000000000000..26e9b5390090 --- /dev/null +++ b/AlloyDb/src/V1beta/CreateInstanceRequests.php @@ -0,0 +1,71 @@ +google.cloud.alloydb.v1beta.CreateInstanceRequests + */ +class CreateInstanceRequests extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Primary and read replica instances to be created. This list + * should not be empty. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.CreateInstanceRequest create_instance_requests = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $create_instance_requests; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\AlloyDb\V1beta\CreateInstanceRequest>|\Google\Protobuf\Internal\RepeatedField $create_instance_requests + * Required. Primary and read replica instances to be created. This list + * should not be empty. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Primary and read replica instances to be created. This list + * should not be empty. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.CreateInstanceRequest create_instance_requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCreateInstanceRequests() + { + return $this->create_instance_requests; + } + + /** + * Required. Primary and read replica instances to be created. This list + * should not be empty. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.CreateInstanceRequest create_instance_requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\AlloyDb\V1beta\CreateInstanceRequest>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCreateInstanceRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1beta\CreateInstanceRequest::class); + $this->create_instance_requests = $arr; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/CreateSecondaryClusterRequest.php b/AlloyDb/src/V1beta/CreateSecondaryClusterRequest.php new file mode 100644 index 000000000000..fd02c644fbcc --- /dev/null +++ b/AlloyDb/src/V1beta/CreateSecondaryClusterRequest.php @@ -0,0 +1,263 @@ +google.cloud.alloydb.v1beta.CreateSecondaryClusterRequest + */ +class CreateSecondaryClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource (the primary cluster). For the + * required format, see the comment on the Cluster.name field. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. ID of the requesting object (the secondary cluster). + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster_id = ''; + /** + * Required. Configuration of the requesting object (the secondary cluster). + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource (the primary cluster). For the + * required format, see the comment on the Cluster.name field. + * @type string $cluster_id + * Required. ID of the requesting object (the secondary cluster). + * @type \Google\Cloud\AlloyDb\V1beta\Cluster $cluster + * Required. Configuration of the requesting object (the secondary cluster). + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource (the primary cluster). For the + * required format, see the comment on the Cluster.name field. + * + * 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 parent resource (the primary cluster). For the + * required format, see the comment on the Cluster.name field. + * + * 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. ID of the requesting object (the secondary cluster). + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getClusterId() + { + return $this->cluster_id; + } + + /** + * Required. ID of the requesting object (the secondary cluster). + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setClusterId($var) + { + GPBUtil::checkString($var, True); + $this->cluster_id = $var; + + return $this; + } + + /** + * Required. Configuration of the requesting object (the secondary cluster). + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1beta\Cluster|null + */ + public function getCluster() + { + return $this->cluster; + } + + public function hasCluster() + { + return isset($this->cluster); + } + + public function clearCluster() + { + unset($this->cluster); + } + + /** + * Required. Configuration of the requesting object (the secondary cluster). + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1beta\Cluster $var + * @return $this + */ + public function setCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\Cluster::class); + $this->cluster = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/CreateSecondaryInstanceRequest.php b/AlloyDb/src/V1beta/CreateSecondaryInstanceRequest.php new file mode 100644 index 000000000000..47c2979f0739 --- /dev/null +++ b/AlloyDb/src/V1beta/CreateSecondaryInstanceRequest.php @@ -0,0 +1,265 @@ +google.cloud.alloydb.v1beta.CreateSecondaryInstanceRequest + */ +class CreateSecondaryInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. ID of the requesting object. + * + * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance_id = ''; + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * @type string $instance_id + * Required. ID of the requesting object. + * @type \Google\Cloud\AlloyDb\V1beta\Instance $instance + * Required. The resource being created + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * + * 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 parent resource. For the required format, see the + * comment on the Instance.name field. + * + * 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. ID of the requesting object. + * + * Generated from protobuf field string instance_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getInstanceId() + { + return $this->instance_id; + } + + /** + * Required. ID of the requesting object. + * + * 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 resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1beta\Instance|null + */ + public function getInstance() + { + return $this->instance; + } + + public function hasInstance() + { + return isset($this->instance); + } + + public function clearInstance() + { + unset($this->instance); + } + + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance instance = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1beta\Instance $var + * @return $this + */ + public function setInstance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\Instance::class); + $this->instance = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * request. + * + * Generated from protobuf field bool validate_only = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/DatabaseVersion.php b/AlloyDb/src/V1beta/DatabaseVersion.php new file mode 100644 index 000000000000..5ed66935bbaf --- /dev/null +++ b/AlloyDb/src/V1beta/DatabaseVersion.php @@ -0,0 +1,61 @@ +google.cloud.alloydb.v1beta.DatabaseVersion + */ +class DatabaseVersion +{ + /** + * This is an unknown database version. + * + * Generated from protobuf enum DATABASE_VERSION_UNSPECIFIED = 0; + */ + const DATABASE_VERSION_UNSPECIFIED = 0; + /** + * DEPRECATED - The database version is Postgres 13. + * + * Generated from protobuf enum POSTGRES_13 = 1 [deprecated = true]; + */ + const POSTGRES_13 = 1; + /** + * The database version is Postgres 14. + * + * Generated from protobuf enum POSTGRES_14 = 2; + */ + const POSTGRES_14 = 2; + + private static $valueToName = [ + self::DATABASE_VERSION_UNSPECIFIED => 'DATABASE_VERSION_UNSPECIFIED', + self::POSTGRES_13 => 'POSTGRES_13', + self::POSTGRES_14 => 'POSTGRES_14', + ]; + + 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/AlloyDb/src/V1beta/DeleteBackupRequest.php b/AlloyDb/src/V1beta/DeleteBackupRequest.php new file mode 100644 index 000000000000..27d8cc420c20 --- /dev/null +++ b/AlloyDb/src/V1beta/DeleteBackupRequest.php @@ -0,0 +1,225 @@ +google.cloud.alloydb.v1beta.DeleteBackupRequest + */ +class DeleteBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the resource. For the required format, see the comment on + * the Backup.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + /** + * Optional. The current etag of the Backup. + * If an etag is provided and does not match the current etag of the Backup, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $etag = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the resource. For the required format, see the comment on + * the Backup.name field. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * @type string $etag + * Optional. The current etag of the Backup. + * If an etag is provided and does not match the current etag of the Backup, + * deletion will be blocked and an ABORTED error will be returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the resource. For the required format, see the comment on + * the Backup.name field. + * + * 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 resource. For the required format, see the comment on + * the Backup.name field. + * + * 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. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Optional. The current etag of the Backup. + * If an etag is provided and does not match the current etag of the Backup, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. The current etag of the Backup. + * If an etag is provided and does not match the current etag of the Backup, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/DeleteClusterRequest.php b/AlloyDb/src/V1beta/DeleteClusterRequest.php new file mode 100644 index 000000000000..d580897f1f88 --- /dev/null +++ b/AlloyDb/src/V1beta/DeleteClusterRequest.php @@ -0,0 +1,259 @@ +google.cloud.alloydb.v1beta.DeleteClusterRequest + */ +class DeleteClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $etag = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + /** + * Optional. Whether to cascade delete child instances for given cluster. + * + * Generated from protobuf field bool force = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $force = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $etag + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * @type bool $force + * Optional. Whether to cascade delete child instances for given cluster. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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 resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Optional. Whether to cascade delete child instances for given cluster. + * + * Generated from protobuf field bool force = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * Optional. Whether to cascade delete child instances for given cluster. + * + * Generated from protobuf field bool force = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/DeleteInstanceRequest.php b/AlloyDb/src/V1beta/DeleteInstanceRequest.php new file mode 100644 index 000000000000..1666a6ec9898 --- /dev/null +++ b/AlloyDb/src/V1beta/DeleteInstanceRequest.php @@ -0,0 +1,225 @@ +google.cloud.alloydb.v1beta.DeleteInstanceRequest + */ +class DeleteInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. The current etag of the Instance. + * If an etag is provided and does not match the current etag of the Instance, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $etag = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $etag + * Optional. The current etag of the Instance. + * If an etag is provided and does not match the current etag of the Instance, + * deletion will be blocked and an ABORTED error will be returned. + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * 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 resource. For the required format, see the + * comment on the Instance.name field. + * + * 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. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. The current etag of the Instance. + * If an etag is provided and does not match the current etag of the Instance, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. The current etag of the Instance. + * If an etag is provided and does not match the current etag of the Instance, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/EncryptionConfig.php b/AlloyDb/src/V1beta/EncryptionConfig.php new file mode 100644 index 000000000000..889b996900d2 --- /dev/null +++ b/AlloyDb/src/V1beta/EncryptionConfig.php @@ -0,0 +1,76 @@ +google.cloud.alloydb.v1beta.EncryptionConfig + */ +class EncryptionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The fully-qualified resource name of the KMS key. + * Each Cloud KMS key is regionalized and has the following format: + * projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME] + * + * Generated from protobuf field string kms_key_name = 1; + */ + protected $kms_key_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $kms_key_name + * The fully-qualified resource name of the KMS key. + * Each Cloud KMS key is regionalized and has the following format: + * projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME] + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The fully-qualified resource name of the KMS key. + * Each Cloud KMS key is regionalized and has the following format: + * projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME] + * + * Generated from protobuf field string kms_key_name = 1; + * @return string + */ + public function getKmsKeyName() + { + return $this->kms_key_name; + } + + /** + * The fully-qualified resource name of the KMS key. + * Each Cloud KMS key is regionalized and has the following format: + * projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME] + * + * Generated from protobuf field string kms_key_name = 1; + * @param string $var + * @return $this + */ + public function setKmsKeyName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_name = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/EncryptionInfo.php b/AlloyDb/src/V1beta/EncryptionInfo.php new file mode 100644 index 000000000000..ae4a15a5fea2 --- /dev/null +++ b/AlloyDb/src/V1beta/EncryptionInfo.php @@ -0,0 +1,105 @@ +google.cloud.alloydb.v1beta.EncryptionInfo + */ +class EncryptionInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Type of encryption. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionInfo.Type encryption_type = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $encryption_type = 0; + /** + * Output only. Cloud KMS key versions that are being used to protect the + * database or the backup. + * + * Generated from protobuf field repeated string kms_key_versions = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + private $kms_key_versions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $encryption_type + * Output only. Type of encryption. + * @type array|\Google\Protobuf\Internal\RepeatedField $kms_key_versions + * Output only. Cloud KMS key versions that are being used to protect the + * database or the backup. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Type of encryption. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionInfo.Type encryption_type = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getEncryptionType() + { + return $this->encryption_type; + } + + /** + * Output only. Type of encryption. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.EncryptionInfo.Type encryption_type = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setEncryptionType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1beta\EncryptionInfo\Type::class); + $this->encryption_type = $var; + + return $this; + } + + /** + * Output only. Cloud KMS key versions that are being used to protect the + * database or the backup. + * + * Generated from protobuf field repeated string kms_key_versions = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getKmsKeyVersions() + { + return $this->kms_key_versions; + } + + /** + * Output only. Cloud KMS key versions that are being used to protect the + * database or the backup. + * + * Generated from protobuf field repeated string kms_key_versions = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setKmsKeyVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->kms_key_versions = $arr; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/EncryptionInfo/Type.php b/AlloyDb/src/V1beta/EncryptionInfo/Type.php new file mode 100644 index 000000000000..274f20a08fe9 --- /dev/null +++ b/AlloyDb/src/V1beta/EncryptionInfo/Type.php @@ -0,0 +1,64 @@ +google.cloud.alloydb.v1beta.EncryptionInfo.Type + */ +class Type +{ + /** + * Encryption type not specified. Defaults to GOOGLE_DEFAULT_ENCRYPTION. + * + * 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 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. + * KMS key versions will 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); + } +} + + diff --git a/AlloyDb/src/V1beta/FailoverInstanceRequest.php b/AlloyDb/src/V1beta/FailoverInstanceRequest.php new file mode 100644 index 000000000000..4e86f1d59317 --- /dev/null +++ b/AlloyDb/src/V1beta/FailoverInstanceRequest.php @@ -0,0 +1,183 @@ +google.cloud.alloydb.v1beta.FailoverInstanceRequest + */ +class FailoverInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the failover. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the failover. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * 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 resource. For the required format, see the + * comment on the Instance.name field. + * + * 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. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the failover. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the failover. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/Gapic/AlloyDBAdminGapicClient.php b/AlloyDb/src/V1beta/Gapic/AlloyDBAdminGapicClient.php new file mode 100644 index 000000000000..3a21857275e9 --- /dev/null +++ b/AlloyDb/src/V1beta/Gapic/AlloyDBAdminGapicClient.php @@ -0,0 +1,3146 @@ +clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $requests = new CreateInstanceRequests(); + * $operationResponse = $alloyDBAdminClient->batchCreateInstances($formattedParent, $requests); + * $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 = $alloyDBAdminClient->batchCreateInstances($formattedParent, $requests); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'batchCreateInstances'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->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. + * + * @experimental + */ +class AlloyDBAdminGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.alloydb.v1beta.AlloyDBAdmin'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'alloydb.googleapis.com'; + + /** 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', + ]; + + private static $backupNameTemplate; + + private static $clusterNameTemplate; + + private static $instanceNameTemplate; + + private static $locationNameTemplate; + + private static $networkNameTemplate; + + 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/alloy_db_admin_client_config.json', + 'descriptorsConfigPath' => + __DIR__ . '/../resources/alloy_db_admin_descriptor_config.php', + 'gcpApiConfigPath' => + __DIR__ . '/../resources/alloy_db_admin_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => + __DIR__ . + '/../resources/alloy_db_admin_rest_client_config.php', + ], + ], + ]; + } + + private static function getBackupNameTemplate() + { + if (self::$backupNameTemplate == null) { + self::$backupNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}/backups/{backup}' + ); + } + + return self::$backupNameTemplate; + } + + private static function getClusterNameTemplate() + { + if (self::$clusterNameTemplate == null) { + self::$clusterNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}/clusters/{cluster}' + ); + } + + return self::$clusterNameTemplate; + } + + private static function getInstanceNameTemplate() + { + if (self::$instanceNameTemplate == null) { + self::$instanceNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance}' + ); + } + + return self::$instanceNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate( + 'projects/{project}/locations/{location}' + ); + } + + return self::$locationNameTemplate; + } + + private static function getNetworkNameTemplate() + { + if (self::$networkNameTemplate == null) { + self::$networkNameTemplate = new PathTemplate( + 'projects/{project}/global/networks/{network}' + ); + } + + return self::$networkNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'backup' => self::getBackupNameTemplate(), + 'cluster' => self::getClusterNameTemplate(), + 'instance' => self::getInstanceNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'network' => self::getNetworkNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a backup + * resource. + * + * @param string $project + * @param string $location + * @param string $backup + * + * @return string The formatted backup resource. + * + * @experimental + */ + public static function backupName($project, $location, $backup) + { + return self::getBackupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'backup' => $backup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a cluster + * resource. + * + * @param string $project + * @param string $location + * @param string $cluster + * + * @return string The formatted cluster resource. + * + * @experimental + */ + public static function clusterName($project, $location, $cluster) + { + return self::getClusterNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'cluster' => $cluster, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a instance + * resource. + * + * @param string $project + * @param string $location + * @param string $cluster + * @param string $instance + * + * @return string The formatted instance resource. + * + * @experimental + */ + public static function instanceName( + $project, + $location, + $cluster, + $instance + ) { + return self::getInstanceNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'cluster' => $cluster, + 'instance' => $instance, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + * + * @experimental + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a network + * resource. + * + * @param string $project + * @param string $network + * + * @return string The formatted network resource. + * + * @experimental + */ + public static function networkName($project, $network) + { + return self::getNetworkNameTemplate()->render([ + 'project' => $project, + 'network' => $network, + ]); + } + + /** + * 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}/locations/{location}/backups/{backup} + * - cluster: projects/{project}/locations/{location}/clusters/{cluster} + * - instance: projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance} + * - location: projects/{project}/locations/{location} + * - network: projects/{project}/global/networks/{network} + * + * 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. + * + * @experimental + */ + 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 + * + * @experimental + */ + 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 + * + * @experimental + */ + 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 'alloydb.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 + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Creates new instances under the given project, location and cluster. + * There can be only one primary instance in a cluster. If the primary + * instance exists in the cluster as well as this request, then API will + * throw an error. + * The primary instance should exist before any read pool instance is + * created. If the primary instance is a part of the request payload, then + * the API will take care of creating instances in the correct order. + * This method is here to support Google-internal use cases, and is not meant + * for external customers to consume. Please do not start relying on it; its + * behavior is subject to change without notice. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $requests = new CreateInstanceRequests(); + * $operationResponse = $alloyDBAdminClient->batchCreateInstances($formattedParent, $requests); + * $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 = $alloyDBAdminClient->batchCreateInstances($formattedParent, $requests); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'batchCreateInstances'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. + * @param CreateInstanceRequests $requests Required. Resources being created. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function batchCreateInstances( + $parent, + $requests, + array $optionalArgs = [] + ) { + $request = new BatchCreateInstancesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setRequests($requests); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'BatchCreateInstances', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Creates a new Backup in a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->locationName('[PROJECT]', '[LOCATION]'); + * $backupId = 'backup_id'; + * $backup = new Backup(); + * $operationResponse = $alloyDBAdminClient->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 = $alloyDBAdminClient->createBackup($formattedParent, $backupId, $backup); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->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 { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. Value for parent. + * @param string $backupId Required. ID of the requesting object. + * @param Backup $backup Required. The resource being created + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + 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['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'CreateBackup', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Creates a new Cluster in a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->locationName('[PROJECT]', '[LOCATION]'); + * $clusterId = 'cluster_id'; + * $cluster = new Cluster(); + * $operationResponse = $alloyDBAdminClient->createCluster($formattedParent, $clusterId, $cluster); + * $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 = $alloyDBAdminClient->createCluster($formattedParent, $clusterId, $cluster); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'createCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * @param string $clusterId Required. ID of the requesting object. + * @param Cluster $cluster Required. The resource being created + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * 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\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createCluster( + $parent, + $clusterId, + $cluster, + array $optionalArgs = [] + ) { + $request = new CreateClusterRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setClusterId($clusterId); + $request->setCluster($cluster); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'CreateCluster', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Creates a new Instance in a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $instanceId = 'instance_id'; + * $instance = new Instance(); + * $operationResponse = $alloyDBAdminClient->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 = $alloyDBAdminClient->createInstance($formattedParent, $instanceId, $instance); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->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 { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * @param string $instanceId Required. ID of the requesting object. + * @param Instance $instance Required. The resource being created + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * 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\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createInstance( + $parent, + $instanceId, + $instance, + array $optionalArgs = [] + ) { + $request = new CreateInstanceRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setInstanceId($instanceId); + $request->setInstance($instance); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'CreateInstance', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Creates a cluster of type SECONDARY in the given location using + * the primary cluster as the source. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->locationName('[PROJECT]', '[LOCATION]'); + * $clusterId = 'cluster_id'; + * $cluster = new Cluster(); + * $operationResponse = $alloyDBAdminClient->createSecondaryCluster($formattedParent, $clusterId, $cluster); + * $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 = $alloyDBAdminClient->createSecondaryCluster($formattedParent, $clusterId, $cluster); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'createSecondaryCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource (the primary cluster). For the + * required format, see the comment on the Cluster.name field. + * @param string $clusterId Required. ID of the requesting object (the secondary cluster). + * @param Cluster $cluster Required. Configuration of the requesting object (the secondary cluster). + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * 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\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createSecondaryCluster( + $parent, + $clusterId, + $cluster, + array $optionalArgs = [] + ) { + $request = new CreateSecondaryClusterRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setClusterId($clusterId); + $request->setCluster($cluster); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'CreateSecondaryCluster', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Creates a new SECONDARY Instance in a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $instanceId = 'instance_id'; + * $instance = new Instance(); + * $operationResponse = $alloyDBAdminClient->createSecondaryInstance($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 = $alloyDBAdminClient->createSecondaryInstance($formattedParent, $instanceId, $instance); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'createSecondaryInstance'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * @param string $instanceId Required. ID of the requesting object. + * @param Instance $instance Required. The resource being created + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the create + * 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\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function createSecondaryInstance( + $parent, + $instanceId, + $instance, + array $optionalArgs = [] + ) { + $request = new CreateSecondaryInstanceRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setInstanceId($instanceId); + $request->setInstance($instance); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'CreateSecondaryInstance', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Deletes a single Backup. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP]'); + * $operationResponse = $alloyDBAdminClient->deleteBackup($formattedName); + * $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 = $alloyDBAdminClient->deleteBackup($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'deleteBackup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the resource. For the required format, see the comment on + * the Backup.name field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * @type string $etag + * Optional. The current etag of the Backup. + * If an etag is provided and does not match the current etag of the Backup, + * deletion will be blocked and an ABORTED error will be 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\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function deleteBackup($name, array $optionalArgs = []) + { + $request = new DeleteBackupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + 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->startOperationsCall( + 'DeleteBackup', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Deletes a single Cluster. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $operationResponse = $alloyDBAdminClient->deleteCluster($formattedName); + * $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 = $alloyDBAdminClient->deleteCluster($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'deleteCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $etag + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * @type bool $force + * Optional. Whether to cascade delete child instances for given cluster. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function deleteCluster($name, array $optionalArgs = []) + { + $request = new DeleteClusterRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['force'])) { + $request->setForce($optionalArgs['force']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'DeleteCluster', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Deletes a single Instance. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + * $operationResponse = $alloyDBAdminClient->deleteInstance($formattedName); + * $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 = $alloyDBAdminClient->deleteInstance($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'deleteInstance'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $etag + * Optional. The current etag of the Instance. + * If an etag is provided and does not match the current etag of the Instance, + * deletion will be blocked and an ABORTED error will be returned. + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function deleteInstance($name, array $optionalArgs = []) + { + $request = new DeleteInstanceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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->startOperationsCall( + 'DeleteInstance', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Forces a Failover for a highly available instance. + * Failover promotes the HA standby instance as the new primary. + * Imperative only. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + * $operationResponse = $alloyDBAdminClient->failoverInstance($formattedName); + * $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 = $alloyDBAdminClient->failoverInstance($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'failoverInstance'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the failover. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function failoverInstance($name, array $optionalArgs = []) + { + $request = new FailoverInstanceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'FailoverInstance', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Generate a client certificate signed by a Cluster CA. + * The sole purpose of this endpoint is to support the Auth Proxy client and + * the endpoint's behavior is subject to change without notice, so do not rely + * on its behavior remaining constant. Future changes will not break the Auth + * Proxy client. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $response = $alloyDBAdminClient->generateClientCertificate($formattedParent); + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. The required format is: + * * projects/{project}/locations/{location}/clusters/{cluster} + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $pemCsr + * Optional. A pem-encoded X.509 certificate signing request (CSR). + * @type Duration $certDuration + * Optional. An optional hint to the endpoint to generate the client + * certificate with the requested duration. The duration can be from 1 hour to + * 24 hours. The endpoint may or may not honor the hint. If the hint is left + * unspecified or is not honored, then the endpoint will pick an appropriate + * default duration. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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\AlloyDb\V1beta\GenerateClientCertificateResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function generateClientCertificate($parent, array $optionalArgs = []) + { + $request = new GenerateClientCertificateRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['pemCsr'])) { + $request->setPemCsr($optionalArgs['pemCsr']); + } + + if (isset($optionalArgs['certDuration'])) { + $request->setCertDuration($optionalArgs['certDuration']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'GenerateClientCertificate', + GenerateClientCertificateResponse::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Gets details of a single Backup. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP]'); + * $response = $alloyDBAdminClient->getBackup($formattedName); + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. Name of the resource + * @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\AlloyDb\V1beta\Backup + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + 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 details of a single Cluster. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $response = $alloyDBAdminClient->getCluster($formattedName); + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * @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\AlloyDb\V1beta\Cluster + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getCluster($name, array $optionalArgs = []) + { + $request = new GetClusterRequest(); + $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( + 'GetCluster', + Cluster::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Get instance metadata used for a connection. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + * $response = $alloyDBAdminClient->getConnectionInfo($formattedParent); + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. The required format is: + * projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance} + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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\AlloyDb\V1beta\ConnectionInfo + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getConnectionInfo($parent, array $optionalArgs = []) + { + $request = new GetConnectionInfoRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'GetConnectionInfo', + ConnectionInfo::class, + $optionalArgs, + $request + )->wait(); + } + + /** + * Gets details of a single Instance. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + * $response = $alloyDBAdminClient->getInstance($formattedName); + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @param array $optionalArgs { + * Optional. + * + * @type int $view + * The view of the instance to return. + * For allowed values, use constants defined on {@see \Google\Cloud\AlloyDb\V1beta\InstanceView} + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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\AlloyDb\V1beta\Instance + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getInstance($name, array $optionalArgs = []) + { + $request = new GetInstanceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['view'])) { + $request->setView($optionalArgs['view']); + } + + $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(); + } + + /** + * Lists Backups in a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $alloyDBAdminClient->listBackups($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $alloyDBAdminClient->listBackups($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. Parent value for ListBackupsRequest + * @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 + * Filtering results + * @type string $orderBy + * Hint for how to order the results + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function listBackups($parent, array $optionalArgs = []) + { + $request = new ListBackupsRequest(); + $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['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $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 Clusters in a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $alloyDBAdminClient->listClusters($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $alloyDBAdminClient->listClusters($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with the following format: + * * projects/{project}/locations/- + * @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 + * Optional. Filtering results + * @type string $orderBy + * Optional. Hint for how to order the results + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function listClusters($parent, array $optionalArgs = []) + { + $request = new ListClustersRequest(); + $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['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( + 'ListClusters', + $optionalArgs, + ListClustersResponse::class, + $request + ); + } + + /** + * Lists Instances in a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * // Iterate over pages of elements + * $pagedResponse = $alloyDBAdminClient->listInstances($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $alloyDBAdminClient->listInstances($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with one of the following + * formats: + * * projects/{project}/locations/-/clusters/- + * * projects/{project}/locations/{region}/clusters/- + * @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 + * Optional. Filtering results + * @type string $orderBy + * Optional. Hint for how to order the results + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + 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['orderBy'])) { + $request->setOrderBy($optionalArgs['orderBy']); + } + + $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 + ); + } + + /** + * Lists SupportedDatabaseFlags for a given project and location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $alloyDBAdminClient->listSupportedDatabaseFlags($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $alloyDBAdminClient->listSupportedDatabaseFlags($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. The required format is: + * * projects/{project}/locations/{location} + * + * Regardless of the parent specified here, as long it is contains a valid + * project and location, the service will return a static list of supported + * flags resources. Note that we do not yet support region-specific + * flags. + * @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 + * + * @experimental + */ + public function listSupportedDatabaseFlags( + $parent, + array $optionalArgs = [] + ) { + $request = new ListSupportedDatabaseFlagsRequest(); + $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( + 'ListSupportedDatabaseFlags', + $optionalArgs, + ListSupportedDatabaseFlagsResponse::class, + $request + ); + } + + /** + * Promotes a SECONDARY cluster. This turns down replication + * from the PRIMARY cluster and promotes a secondary cluster + * into its own standalone cluster. + * Imperative only. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + * $operationResponse = $alloyDBAdminClient->promoteCluster($formattedName); + * $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 = $alloyDBAdminClient->promoteCluster($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'promoteCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $etag + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function promoteCluster($name, array $optionalArgs = []) + { + $request = new PromoteClusterRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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->startOperationsCall( + 'PromoteCluster', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Restart an Instance in a cluster. + * Imperative only. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedName = $alloyDBAdminClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + * $operationResponse = $alloyDBAdminClient->restartInstance($formattedName); + * $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 = $alloyDBAdminClient->restartInstance($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'restartInstance'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @param array $optionalArgs { + * Optional. + * + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the restart. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function restartInstance($name, array $optionalArgs = []) + { + $request = new RestartInstanceRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'RestartInstance', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Creates a new Cluster in a given project and location, with a volume + * restored from the provided source, either a backup ID or a point-in-time + * and a source cluster. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $formattedParent = $alloyDBAdminClient->locationName('[PROJECT]', '[LOCATION]'); + * $clusterId = 'cluster_id'; + * $cluster = new Cluster(); + * $operationResponse = $alloyDBAdminClient->restoreCluster($formattedParent, $clusterId, $cluster); + * $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 = $alloyDBAdminClient->restoreCluster($formattedParent, $clusterId, $cluster); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'restoreCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * @param string $clusterId Required. ID of the requesting object. + * @param Cluster $cluster Required. The resource being created + * @param array $optionalArgs { + * Optional. + * + * @type BackupSource $backupSource + * Backup source. + * @type ContinuousBackupSource $continuousBackupSource + * ContinuousBackup source. Continuous backup needs to be enabled in the + * source cluster for this operation to succeed. + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the import + * 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\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function restoreCluster( + $parent, + $clusterId, + $cluster, + array $optionalArgs = [] + ) { + $request = new RestoreClusterRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setClusterId($clusterId); + $request->setCluster($cluster); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['backupSource'])) { + $request->setBackupSource($optionalArgs['backupSource']); + } + + if (isset($optionalArgs['continuousBackupSource'])) { + $request->setContinuousBackupSource( + $optionalArgs['continuousBackupSource'] + ); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + 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( + 'RestoreCluster', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Updates the parameters of a single Backup. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $backup = new Backup(); + * $operationResponse = $alloyDBAdminClient->updateBackup($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 = $alloyDBAdminClient->updateBackup($backup); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'updateBackup'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param Backup $backup Required. The resource being updated + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Backup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * @type bool $allowMissing + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new backup is created and `update_mask` is ignored. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function updateBackup($backup, array $optionalArgs = []) + { + $request = new UpdateBackupRequest(); + $requestParamHeaders = []; + $request->setBackup($backup); + $requestParamHeaders['backup.name'] = $backup->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'UpdateBackup', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Updates the parameters of a single Cluster. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $cluster = new Cluster(); + * $operationResponse = $alloyDBAdminClient->updateCluster($cluster); + * $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 = $alloyDBAdminClient->updateCluster($cluster); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->resumeOperation($operationName, 'updateCluster'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param Cluster $cluster Required. The resource being updated + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Cluster resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * @type bool $allowMissing + * Optional. If set to true, update succeeds even if cluster is not found. In + * that case, a new cluster is created and `update_mask` is ignored. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function updateCluster($cluster, array $optionalArgs = []) + { + $request = new UpdateClusterRequest(); + $requestParamHeaders = []; + $request->setCluster($cluster); + $requestParamHeaders['cluster.name'] = $cluster->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startOperationsCall( + 'UpdateCluster', + $optionalArgs, + $request, + $this->getOperationsClient() + )->wait(); + } + + /** + * Updates the parameters of a single Instance. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $instance = new Instance(); + * $operationResponse = $alloyDBAdminClient->updateInstance($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 = $alloyDBAdminClient->updateInstance($instance); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $alloyDBAdminClient->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 { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param Instance $instance Required. The resource being updated + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Instance resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type string $requestId + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validateOnly + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * @type bool $allowMissing + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new instance is created and `update_mask` is ignored. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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 + * + * @experimental + */ + public function updateInstance($instance, array $optionalArgs = []) + { + $request = new UpdateInstanceRequest(); + $requestParamHeaders = []; + $request->setInstance($instance); + $requestParamHeaders['instance.name'] = $instance->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['requestId'])) { + $request->setRequestId($optionalArgs['requestId']); + } + + if (isset($optionalArgs['validateOnly'])) { + $request->setValidateOnly($optionalArgs['validateOnly']); + } + + if (isset($optionalArgs['allowMissing'])) { + $request->setAllowMissing($optionalArgs['allowMissing']); + } + + $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(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * $response = $alloyDBAdminClient->getLocation(); + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. 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\Location\Location + * + * @throws ApiException if the remote call fails + * + * @experimental + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor( + $requestParamHeaders + ); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( + 'GetLocation', + Location::class, + $optionalArgs, + $request, + Call::UNARY_CALL, + 'google.cloud.location.Locations' + )->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $alloyDBAdminClient = new AlloyDBAdminClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $alloyDBAdminClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $alloyDBAdminClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $alloyDBAdminClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @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 + * + * @experimental + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + 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( + 'ListLocations', + $optionalArgs, + ListLocationsResponse::class, + $request, + 'google.cloud.location.Locations' + ); + } +} diff --git a/AlloyDb/src/V1beta/GenerateClientCertificateRequest.php b/AlloyDb/src/V1beta/GenerateClientCertificateRequest.php new file mode 100644 index 000000000000..eeb6cc230e56 --- /dev/null +++ b/AlloyDb/src/V1beta/GenerateClientCertificateRequest.php @@ -0,0 +1,240 @@ +google.cloud.alloydb.v1beta.GenerateClientCertificateRequest + */ +class GenerateClientCertificateRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. The required format is: + * * projects/{project}/locations/{location}/clusters/{cluster} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. A pem-encoded X.509 certificate signing request (CSR). + * + * Generated from protobuf field string pem_csr = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $pem_csr = ''; + /** + * Optional. An optional hint to the endpoint to generate the client + * certificate with the requested duration. The duration can be from 1 hour to + * 24 hours. The endpoint may or may not honor the hint. If the hint is left + * unspecified or is not honored, then the endpoint will pick an appropriate + * default duration. + * + * Generated from protobuf field .google.protobuf.Duration cert_duration = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $cert_duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. The required format is: + * * projects/{project}/locations/{location}/clusters/{cluster} + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $pem_csr + * Optional. A pem-encoded X.509 certificate signing request (CSR). + * @type \Google\Protobuf\Duration $cert_duration + * Optional. An optional hint to the endpoint to generate the client + * certificate with the requested duration. The duration can be from 1 hour to + * 24 hours. The endpoint may or may not honor the hint. If the hint is left + * unspecified or is not honored, then the endpoint will pick an appropriate + * default duration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. The required format is: + * * projects/{project}/locations/{location}/clusters/{cluster} + * + * 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 parent resource. The required format is: + * * projects/{project}/locations/{location}/clusters/{cluster} + * + * 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 optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. A pem-encoded X.509 certificate signing request (CSR). + * + * Generated from protobuf field string pem_csr = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPemCsr() + { + return $this->pem_csr; + } + + /** + * Optional. A pem-encoded X.509 certificate signing request (CSR). + * + * Generated from protobuf field string pem_csr = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPemCsr($var) + { + GPBUtil::checkString($var, True); + $this->pem_csr = $var; + + return $this; + } + + /** + * Optional. An optional hint to the endpoint to generate the client + * certificate with the requested duration. The duration can be from 1 hour to + * 24 hours. The endpoint may or may not honor the hint. If the hint is left + * unspecified or is not honored, then the endpoint will pick an appropriate + * default duration. + * + * Generated from protobuf field .google.protobuf.Duration cert_duration = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Duration|null + */ + public function getCertDuration() + { + return $this->cert_duration; + } + + public function hasCertDuration() + { + return isset($this->cert_duration); + } + + public function clearCertDuration() + { + unset($this->cert_duration); + } + + /** + * Optional. An optional hint to the endpoint to generate the client + * certificate with the requested duration. The duration can be from 1 hour to + * 24 hours. The endpoint may or may not honor the hint. If the hint is left + * unspecified or is not honored, then the endpoint will pick an appropriate + * default duration. + * + * Generated from protobuf field .google.protobuf.Duration cert_duration = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setCertDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->cert_duration = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/GenerateClientCertificateResponse.php b/AlloyDb/src/V1beta/GenerateClientCertificateResponse.php new file mode 100644 index 000000000000..ed08dedcc500 --- /dev/null +++ b/AlloyDb/src/V1beta/GenerateClientCertificateResponse.php @@ -0,0 +1,105 @@ +google.cloud.alloydb.v1beta.GenerateClientCertificateResponse + */ +class GenerateClientCertificateResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The pem-encoded, signed X.509 certificate. + * + * Generated from protobuf field string pem_certificate = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $pem_certificate = ''; + /** + * Output only. The pem-encoded chain that may be used to verify the X.509 + * certificate. Expected to be in issuer-to-root order according to RFC 5246. + * + * Generated from protobuf field repeated string pem_certificate_chain = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $pem_certificate_chain; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $pem_certificate + * Output only. The pem-encoded, signed X.509 certificate. + * @type array|\Google\Protobuf\Internal\RepeatedField $pem_certificate_chain + * Output only. The pem-encoded chain that may be used to verify the X.509 + * certificate. Expected to be in issuer-to-root order according to RFC 5246. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The pem-encoded, signed X.509 certificate. + * + * Generated from protobuf field string pem_certificate = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getPemCertificate() + { + return $this->pem_certificate; + } + + /** + * Output only. The pem-encoded, signed X.509 certificate. + * + * Generated from protobuf field string pem_certificate = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setPemCertificate($var) + { + GPBUtil::checkString($var, True); + $this->pem_certificate = $var; + + return $this; + } + + /** + * Output only. The pem-encoded chain that may be used to verify the X.509 + * certificate. Expected to be in issuer-to-root order according to RFC 5246. + * + * Generated from protobuf field repeated string pem_certificate_chain = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPemCertificateChain() + { + return $this->pem_certificate_chain; + } + + /** + * Output only. The pem-encoded chain that may be used to verify the X.509 + * certificate. Expected to be in issuer-to-root order according to RFC 5246. + * + * Generated from protobuf field repeated string pem_certificate_chain = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPemCertificateChain($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->pem_certificate_chain = $arr; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/GetBackupRequest.php b/AlloyDb/src/V1beta/GetBackupRequest.php new file mode 100644 index 000000000000..a5863ee3745a --- /dev/null +++ b/AlloyDb/src/V1beta/GetBackupRequest.php @@ -0,0 +1,67 @@ +google.cloud.alloydb.v1beta.GetBackupRequest + */ +class GetBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the resource + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of the resource + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the resource + * + * 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 resource + * + * 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/AlloyDb/src/V1beta/GetClusterRequest.php b/AlloyDb/src/V1beta/GetClusterRequest.php new file mode 100644 index 000000000000..7b995728bed8 --- /dev/null +++ b/AlloyDb/src/V1beta/GetClusterRequest.php @@ -0,0 +1,71 @@ +google.cloud.alloydb.v1beta.GetClusterRequest + */ +class GetClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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 resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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/AlloyDb/src/V1beta/GetConnectionInfoRequest.php b/AlloyDb/src/V1beta/GetConnectionInfoRequest.php new file mode 100644 index 000000000000..321d3f02e8e4 --- /dev/null +++ b/AlloyDb/src/V1beta/GetConnectionInfoRequest.php @@ -0,0 +1,145 @@ +google.cloud.alloydb.v1beta.GetConnectionInfoRequest + */ +class GetConnectionInfoRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. The required format is: + * projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. The required format is: + * projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance} + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. The required format is: + * projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance} + * + * 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 parent resource. The required format is: + * projects/{project}/locations/{location}/clusters/{cluster}/instances/{instance} + * + * 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 optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/GetInstanceRequest.php b/AlloyDb/src/V1beta/GetInstanceRequest.php new file mode 100644 index 000000000000..a257b0e4165e --- /dev/null +++ b/AlloyDb/src/V1beta/GetInstanceRequest.php @@ -0,0 +1,105 @@ +google.cloud.alloydb.v1beta.GetInstanceRequest + */ +class GetInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The view of the instance to return. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.InstanceView view = 2; + */ + protected $view = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @type int $view + * The view of the instance to return. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * 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 resource. For the required format, see the + * comment on the Instance.name field. + * + * 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; + } + + /** + * The view of the instance to return. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.InstanceView view = 2; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * The view of the instance to return. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.InstanceView view = 2; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1beta\InstanceView::class); + $this->view = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/Instance.php b/AlloyDb/src/V1beta/Instance.php new file mode 100644 index 000000000000..3ca72cc9f929 --- /dev/null +++ b/AlloyDb/src/V1beta/Instance.php @@ -0,0 +1,966 @@ +google.cloud.alloydb.v1beta.Instance + */ +class Instance extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The name of the instance resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id}/instances/{instance_id} + * where the cluster and instance ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the instance resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * User-settable and human-readable display name for the Instance. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $uid = ''; + /** + * Output only. Create time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $delete_time = null; + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 7; + */ + private $labels; + /** + * Output only. The current serving state of the instance. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * Required. The type of the instance. Specified at creation time. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.InstanceType instance_type = 9 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance_type = 0; + /** + * Configurations for the machines that host the underlying + * database engine. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.MachineConfig machine_config = 10; + */ + protected $machine_config = null; + /** + * Availability type of an Instance. + * Defaults to REGIONAL for both primary and read instances. + * Note that primary and read instances can have different availability types. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.AvailabilityType availability_type = 11; + */ + protected $availability_type = 0; + /** + * The Compute Engine zone that the instance should serve from, per + * https://cloud.google.com/compute/docs/regions-zones + * This can ONLY be specified for ZONAL instances. + * If present for a REGIONAL instance, an error will be thrown. + * If this is absent for a ZONAL instance, instance is created in a random + * zone with available capacity. + * + * Generated from protobuf field string gce_zone = 12; + */ + protected $gce_zone = ''; + /** + * Database flags. Set at instance level. + * * They are copied from primary instance on read instance creation. + * * Read instances can set new or override existing flags that are relevant + * for reads, e.g. for enabling columnar cache on a read instance. Flags + * set on read instance may or may not be present on primary. + * This is a list of "key": "value" pairs. + * "key": The name of the flag. These flags are passed at instance setup time, + * so include both server options and system variables for Postgres. Flags are + * specified with underscores, not hyphens. + * "value": The value of the flag. Booleans are set to **on** for true + * and **off** for false. This field must be omitted if the flag + * doesn't take a value. + * + * Generated from protobuf field map database_flags = 13; + */ + private $database_flags; + /** + * Output only. This is set for the read-write VM of the PRIMARY instance + * only. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.Node writable_node = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $writable_node = null; + /** + * Output only. List of available read-only VMs in this instance, including + * the standby for a PRIMARY instance. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.Instance.Node nodes = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $nodes; + /** + * Configuration for query insights. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.QueryInsightsInstanceConfig query_insights_config = 21; + */ + protected $query_insights_config = null; + /** + * Read pool specific config. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.ReadPoolConfig read_pool_config = 14; + */ + protected $read_pool_config = null; + /** + * Output only. The IP address for the Instance. + * This is the connection endpoint for an end-user application. + * + * Generated from protobuf field string ip_address = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $ip_address = ''; + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Instance does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * + * Generated from protobuf field bool reconciling = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reconciling = false; + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 17; + */ + protected $etag = ''; + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 18; + */ + private $annotations; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The name of the instance resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id}/instances/{instance_id} + * where the cluster and instance ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the instance resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * @type string $display_name + * User-settable and human-readable display name for the Instance. + * @type string $uid + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Create time stamp + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Update time stamp + * @type \Google\Protobuf\Timestamp $delete_time + * Output only. Delete time stamp + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels as key value pairs + * @type int $state + * Output only. The current serving state of the instance. + * @type int $instance_type + * Required. The type of the instance. Specified at creation time. + * @type \Google\Cloud\AlloyDb\V1beta\Instance\MachineConfig $machine_config + * Configurations for the machines that host the underlying + * database engine. + * @type int $availability_type + * Availability type of an Instance. + * Defaults to REGIONAL for both primary and read instances. + * Note that primary and read instances can have different availability types. + * @type string $gce_zone + * The Compute Engine zone that the instance should serve from, per + * https://cloud.google.com/compute/docs/regions-zones + * This can ONLY be specified for ZONAL instances. + * If present for a REGIONAL instance, an error will be thrown. + * If this is absent for a ZONAL instance, instance is created in a random + * zone with available capacity. + * @type array|\Google\Protobuf\Internal\MapField $database_flags + * Database flags. Set at instance level. + * * They are copied from primary instance on read instance creation. + * * Read instances can set new or override existing flags that are relevant + * for reads, e.g. for enabling columnar cache on a read instance. Flags + * set on read instance may or may not be present on primary. + * This is a list of "key": "value" pairs. + * "key": The name of the flag. These flags are passed at instance setup time, + * so include both server options and system variables for Postgres. Flags are + * specified with underscores, not hyphens. + * "value": The value of the flag. Booleans are set to **on** for true + * and **off** for false. This field must be omitted if the flag + * doesn't take a value. + * @type \Google\Cloud\AlloyDb\V1beta\Instance\Node $writable_node + * Output only. This is set for the read-write VM of the PRIMARY instance + * only. + * @type array<\Google\Cloud\AlloyDb\V1beta\Instance\Node>|\Google\Protobuf\Internal\RepeatedField $nodes + * Output only. List of available read-only VMs in this instance, including + * the standby for a PRIMARY instance. + * @type \Google\Cloud\AlloyDb\V1beta\Instance\QueryInsightsInstanceConfig $query_insights_config + * Configuration for query insights. + * @type \Google\Cloud\AlloyDb\V1beta\Instance\ReadPoolConfig $read_pool_config + * Read pool specific config. + * @type string $ip_address + * Output only. The IP address for the Instance. + * This is the connection endpoint for an end-user application. + * @type bool $reconciling + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Instance does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * @type string $etag + * For Resource freshness validation (https://google.aip.dev/154) + * @type array|\Google\Protobuf\Internal\MapField $annotations + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The name of the instance resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id}/instances/{instance_id} + * where the cluster and instance ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the instance resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * + * 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 instance resource with the format: + * * projects/{project}/locations/{region}/clusters/{cluster_id}/instances/{instance_id} + * where the cluster and instance ID segments should satisfy the regex + * expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of + * lowercase letters, numbers, and dashes, starting with a letter, and ending + * with a letter or number. For more details see https://google.aip.dev/122. + * The prefix of the instance resource name is the name of the parent + * resource: + * * projects/{project}/locations/{region}/clusters/{cluster_id} + * + * 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; + } + + /** + * User-settable and human-readable display name for the Instance. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * User-settable and human-readable display name for the Instance. + * + * 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. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * Output only. The system-generated UID of the resource. The UID is assigned + * when the resource is created, and it is retained until it is deleted. + * + * Generated from protobuf field string uid = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setUid($var) + { + GPBUtil::checkString($var, True); + $this->uid = $var; + + return $this; + } + + /** + * Output only. Create time stamp + * + * 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. Create time stamp + * + * 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. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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. Update time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.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. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getDeleteTime() + { + return $this->delete_time; + } + + public function hasDeleteTime() + { + return isset($this->delete_time); + } + + public function clearDeleteTime() + { + unset($this->delete_time); + } + + /** + * Output only. Delete time stamp + * + * Generated from protobuf field .google.protobuf.Timestamp delete_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setDeleteTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->delete_time = $var; + + return $this; + } + + /** + * Labels as key value pairs + * + * Generated from protobuf field map labels = 7; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * Labels as key value pairs + * + * 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; + } + + /** + * Output only. The current serving state of the instance. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The current serving state of the instance. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.State state = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1beta\Instance\State::class); + $this->state = $var; + + return $this; + } + + /** + * Required. The type of the instance. Specified at creation time. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.InstanceType instance_type = 9 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getInstanceType() + { + return $this->instance_type; + } + + /** + * Required. The type of the instance. Specified at creation time. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.InstanceType instance_type = 9 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setInstanceType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1beta\Instance\InstanceType::class); + $this->instance_type = $var; + + return $this; + } + + /** + * Configurations for the machines that host the underlying + * database engine. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.MachineConfig machine_config = 10; + * @return \Google\Cloud\AlloyDb\V1beta\Instance\MachineConfig|null + */ + public function getMachineConfig() + { + return $this->machine_config; + } + + public function hasMachineConfig() + { + return isset($this->machine_config); + } + + public function clearMachineConfig() + { + unset($this->machine_config); + } + + /** + * Configurations for the machines that host the underlying + * database engine. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.MachineConfig machine_config = 10; + * @param \Google\Cloud\AlloyDb\V1beta\Instance\MachineConfig $var + * @return $this + */ + public function setMachineConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\Instance\MachineConfig::class); + $this->machine_config = $var; + + return $this; + } + + /** + * Availability type of an Instance. + * Defaults to REGIONAL for both primary and read instances. + * Note that primary and read instances can have different availability types. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.AvailabilityType availability_type = 11; + * @return int + */ + public function getAvailabilityType() + { + return $this->availability_type; + } + + /** + * Availability type of an Instance. + * Defaults to REGIONAL for both primary and read instances. + * Note that primary and read instances can have different availability types. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.AvailabilityType availability_type = 11; + * @param int $var + * @return $this + */ + public function setAvailabilityType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1beta\Instance\AvailabilityType::class); + $this->availability_type = $var; + + return $this; + } + + /** + * The Compute Engine zone that the instance should serve from, per + * https://cloud.google.com/compute/docs/regions-zones + * This can ONLY be specified for ZONAL instances. + * If present for a REGIONAL instance, an error will be thrown. + * If this is absent for a ZONAL instance, instance is created in a random + * zone with available capacity. + * + * Generated from protobuf field string gce_zone = 12; + * @return string + */ + public function getGceZone() + { + return $this->gce_zone; + } + + /** + * The Compute Engine zone that the instance should serve from, per + * https://cloud.google.com/compute/docs/regions-zones + * This can ONLY be specified for ZONAL instances. + * If present for a REGIONAL instance, an error will be thrown. + * If this is absent for a ZONAL instance, instance is created in a random + * zone with available capacity. + * + * Generated from protobuf field string gce_zone = 12; + * @param string $var + * @return $this + */ + public function setGceZone($var) + { + GPBUtil::checkString($var, True); + $this->gce_zone = $var; + + return $this; + } + + /** + * Database flags. Set at instance level. + * * They are copied from primary instance on read instance creation. + * * Read instances can set new or override existing flags that are relevant + * for reads, e.g. for enabling columnar cache on a read instance. Flags + * set on read instance may or may not be present on primary. + * This is a list of "key": "value" pairs. + * "key": The name of the flag. These flags are passed at instance setup time, + * so include both server options and system variables for Postgres. Flags are + * specified with underscores, not hyphens. + * "value": The value of the flag. Booleans are set to **on** for true + * and **off** for false. This field must be omitted if the flag + * doesn't take a value. + * + * Generated from protobuf field map database_flags = 13; + * @return \Google\Protobuf\Internal\MapField + */ + public function getDatabaseFlags() + { + return $this->database_flags; + } + + /** + * Database flags. Set at instance level. + * * They are copied from primary instance on read instance creation. + * * Read instances can set new or override existing flags that are relevant + * for reads, e.g. for enabling columnar cache on a read instance. Flags + * set on read instance may or may not be present on primary. + * This is a list of "key": "value" pairs. + * "key": The name of the flag. These flags are passed at instance setup time, + * so include both server options and system variables for Postgres. Flags are + * specified with underscores, not hyphens. + * "value": The value of the flag. Booleans are set to **on** for true + * and **off** for false. This field must be omitted if the flag + * doesn't take a value. + * + * Generated from protobuf field map database_flags = 13; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setDatabaseFlags($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->database_flags = $arr; + + return $this; + } + + /** + * Output only. This is set for the read-write VM of the PRIMARY instance + * only. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.Node writable_node = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1beta\Instance\Node|null + */ + public function getWritableNode() + { + return $this->writable_node; + } + + public function hasWritableNode() + { + return isset($this->writable_node); + } + + public function clearWritableNode() + { + unset($this->writable_node); + } + + /** + * Output only. This is set for the read-write VM of the PRIMARY instance + * only. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.Node writable_node = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1beta\Instance\Node $var + * @return $this + */ + public function setWritableNode($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\Instance\Node::class); + $this->writable_node = $var; + + return $this; + } + + /** + * Output only. List of available read-only VMs in this instance, including + * the standby for a PRIMARY instance. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.Instance.Node nodes = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNodes() + { + return $this->nodes; + } + + /** + * Output only. List of available read-only VMs in this instance, including + * the standby for a PRIMARY instance. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.Instance.Node nodes = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\AlloyDb\V1beta\Instance\Node>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNodes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1beta\Instance\Node::class); + $this->nodes = $arr; + + return $this; + } + + /** + * Configuration for query insights. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.QueryInsightsInstanceConfig query_insights_config = 21; + * @return \Google\Cloud\AlloyDb\V1beta\Instance\QueryInsightsInstanceConfig|null + */ + public function getQueryInsightsConfig() + { + return $this->query_insights_config; + } + + public function hasQueryInsightsConfig() + { + return isset($this->query_insights_config); + } + + public function clearQueryInsightsConfig() + { + unset($this->query_insights_config); + } + + /** + * Configuration for query insights. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.QueryInsightsInstanceConfig query_insights_config = 21; + * @param \Google\Cloud\AlloyDb\V1beta\Instance\QueryInsightsInstanceConfig $var + * @return $this + */ + public function setQueryInsightsConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\Instance\QueryInsightsInstanceConfig::class); + $this->query_insights_config = $var; + + return $this; + } + + /** + * Read pool specific config. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.ReadPoolConfig read_pool_config = 14; + * @return \Google\Cloud\AlloyDb\V1beta\Instance\ReadPoolConfig|null + */ + public function getReadPoolConfig() + { + return $this->read_pool_config; + } + + public function hasReadPoolConfig() + { + return isset($this->read_pool_config); + } + + public function clearReadPoolConfig() + { + unset($this->read_pool_config); + } + + /** + * Read pool specific config. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance.ReadPoolConfig read_pool_config = 14; + * @param \Google\Cloud\AlloyDb\V1beta\Instance\ReadPoolConfig $var + * @return $this + */ + public function setReadPoolConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\Instance\ReadPoolConfig::class); + $this->read_pool_config = $var; + + return $this; + } + + /** + * Output only. The IP address for the Instance. + * This is the connection endpoint for an end-user application. + * + * Generated from protobuf field string ip_address = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getIpAddress() + { + return $this->ip_address; + } + + /** + * Output only. The IP address for the Instance. + * This is the connection endpoint for an end-user application. + * + * Generated from protobuf field string ip_address = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setIpAddress($var) + { + GPBUtil::checkString($var, True); + $this->ip_address = $var; + + return $this; + } + + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Instance does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * + * Generated from protobuf field bool reconciling = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getReconciling() + { + return $this->reconciling; + } + + /** + * Output only. Reconciling (https://google.aip.dev/128#reconciliation). + * Set to true if the current state of Instance does not match the user's + * intended state, and the service is actively updating the resource to + * reconcile them. This can happen due to user-triggered updates or + * system actions like failover or maintenance. + * + * Generated from protobuf field bool reconciling = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setReconciling($var) + { + GPBUtil::checkBool($var); + $this->reconciling = $var; + + return $this; + } + + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 17; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * For Resource freshness validation (https://google.aip.dev/154) + * + * Generated from protobuf field string etag = 17; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 18; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAnnotations() + { + return $this->annotations; + } + + /** + * Annotations to allow client tools to store small amount of arbitrary data. + * This is distinct from labels. + * https://google.aip.dev/128 + * + * Generated from protobuf field map annotations = 18; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAnnotations($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->annotations = $arr; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/Instance/AvailabilityType.php b/AlloyDb/src/V1beta/Instance/AvailabilityType.php new file mode 100644 index 000000000000..41dc33a56257 --- /dev/null +++ b/AlloyDb/src/V1beta/Instance/AvailabilityType.php @@ -0,0 +1,66 @@ +ZONAL: The instance serves data from only one zone. + * Outages in that zone affect instance availability. + *
REGIONAL: The instance can serve data from more than one zone + * in a region (it is highly available). + * + * Protobuf type google.cloud.alloydb.v1beta.Instance.AvailabilityType + */ +class AvailabilityType +{ + /** + * This is an unknown Availability type. + * + * Generated from protobuf enum AVAILABILITY_TYPE_UNSPECIFIED = 0; + */ + const AVAILABILITY_TYPE_UNSPECIFIED = 0; + /** + * Zonal available instance. + * + * Generated from protobuf enum ZONAL = 1; + */ + const ZONAL = 1; + /** + * Regional (or Highly) available instance. + * + * Generated from protobuf enum REGIONAL = 2; + */ + const REGIONAL = 2; + + private static $valueToName = [ + self::AVAILABILITY_TYPE_UNSPECIFIED => 'AVAILABILITY_TYPE_UNSPECIFIED', + self::ZONAL => 'ZONAL', + self::REGIONAL => 'REGIONAL', + ]; + + 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/AlloyDb/src/V1beta/Instance/InstanceType.php b/AlloyDb/src/V1beta/Instance/InstanceType.php new file mode 100644 index 000000000000..57bb19e8db67 --- /dev/null +++ b/AlloyDb/src/V1beta/Instance/InstanceType.php @@ -0,0 +1,74 @@ +google.cloud.alloydb.v1beta.Instance.InstanceType + */ +class InstanceType +{ + /** + * The type of the instance is unknown. + * + * Generated from protobuf enum INSTANCE_TYPE_UNSPECIFIED = 0; + */ + const INSTANCE_TYPE_UNSPECIFIED = 0; + /** + * PRIMARY instances support read and write operations. + * + * Generated from protobuf enum PRIMARY = 1; + */ + const PRIMARY = 1; + /** + * READ POOL instances support read operations only. Each read pool instance + * consists of one or more homogeneous nodes. + * * Read pool of size 1 can only have zonal availability. + * * Read pools with node count of 2 or more can have regional + * availability (nodes are present in 2 or more zones in a region). + * + * Generated from protobuf enum READ_POOL = 2; + */ + const READ_POOL = 2; + /** + * SECONDARY instances support read operations only. SECONDARY instance + * is a cross-region read replica + * + * Generated from protobuf enum SECONDARY = 3; + */ + const SECONDARY = 3; + + private static $valueToName = [ + self::INSTANCE_TYPE_UNSPECIFIED => 'INSTANCE_TYPE_UNSPECIFIED', + self::PRIMARY => 'PRIMARY', + self::READ_POOL => 'READ_POOL', + self::SECONDARY => 'SECONDARY', + ]; + + 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/AlloyDb/src/V1beta/Instance/MachineConfig.php b/AlloyDb/src/V1beta/Instance/MachineConfig.php new file mode 100644 index 000000000000..6e452b65a85a --- /dev/null +++ b/AlloyDb/src/V1beta/Instance/MachineConfig.php @@ -0,0 +1,68 @@ +google.cloud.alloydb.v1beta.Instance.MachineConfig + */ +class MachineConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The number of CPU's in the VM instance. + * + * Generated from protobuf field int32 cpu_count = 1; + */ + protected $cpu_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $cpu_count + * The number of CPU's in the VM instance. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The number of CPU's in the VM instance. + * + * Generated from protobuf field int32 cpu_count = 1; + * @return int + */ + public function getCpuCount() + { + return $this->cpu_count; + } + + /** + * The number of CPU's in the VM instance. + * + * Generated from protobuf field int32 cpu_count = 1; + * @param int $var + * @return $this + */ + public function setCpuCount($var) + { + GPBUtil::checkInt32($var); + $this->cpu_count = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1beta/Instance/Node.php b/AlloyDb/src/V1beta/Instance/Node.php new file mode 100644 index 000000000000..a58ad32a4490 --- /dev/null +++ b/AlloyDb/src/V1beta/Instance/Node.php @@ -0,0 +1,184 @@ +google.cloud.alloydb.v1beta.Instance.Node + */ +class Node extends \Google\Protobuf\Internal\Message +{ + /** + * The Compute Engine zone of the VM e.g. "us-central1-b". + * + * Generated from protobuf field string zone_id = 1; + */ + protected $zone_id = ''; + /** + * The identifier of the VM e.g. "test-read-0601-407e52be-ms3l". + * + * Generated from protobuf field string id = 2; + */ + protected $id = ''; + /** + * The private IP address of the VM e.g. "10.57.0.34". + * + * Generated from protobuf field string ip = 3; + */ + protected $ip = ''; + /** + * Determined by state of the compute VM and postgres-service health. + * Compute VM state can have values listed in + * https://cloud.google.com/compute/docs/instances/instance-life-cycle and + * postgres-service health can have values: HEALTHY and UNHEALTHY. + * + * Generated from protobuf field string state = 4; + */ + protected $state = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $zone_id + * The Compute Engine zone of the VM e.g. "us-central1-b". + * @type string $id + * The identifier of the VM e.g. "test-read-0601-407e52be-ms3l". + * @type string $ip + * The private IP address of the VM e.g. "10.57.0.34". + * @type string $state + * Determined by state of the compute VM and postgres-service health. + * Compute VM state can have values listed in + * https://cloud.google.com/compute/docs/instances/instance-life-cycle and + * postgres-service health can have values: HEALTHY and UNHEALTHY. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The Compute Engine zone of the VM e.g. "us-central1-b". + * + * Generated from protobuf field string zone_id = 1; + * @return string + */ + public function getZoneId() + { + return $this->zone_id; + } + + /** + * The Compute Engine zone of the VM e.g. "us-central1-b". + * + * Generated from protobuf field string zone_id = 1; + * @param string $var + * @return $this + */ + public function setZoneId($var) + { + GPBUtil::checkString($var, True); + $this->zone_id = $var; + + return $this; + } + + /** + * The identifier of the VM e.g. "test-read-0601-407e52be-ms3l". + * + * Generated from protobuf field string id = 2; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * The identifier of the VM e.g. "test-read-0601-407e52be-ms3l". + * + * Generated from protobuf field string id = 2; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * The private IP address of the VM e.g. "10.57.0.34". + * + * Generated from protobuf field string ip = 3; + * @return string + */ + public function getIp() + { + return $this->ip; + } + + /** + * The private IP address of the VM e.g. "10.57.0.34". + * + * Generated from protobuf field string ip = 3; + * @param string $var + * @return $this + */ + public function setIp($var) + { + GPBUtil::checkString($var, True); + $this->ip = $var; + + return $this; + } + + /** + * Determined by state of the compute VM and postgres-service health. + * Compute VM state can have values listed in + * https://cloud.google.com/compute/docs/instances/instance-life-cycle and + * postgres-service health can have values: HEALTHY and UNHEALTHY. + * + * Generated from protobuf field string state = 4; + * @return string + */ + public function getState() + { + return $this->state; + } + + /** + * Determined by state of the compute VM and postgres-service health. + * Compute VM state can have values listed in + * https://cloud.google.com/compute/docs/instances/instance-life-cycle and + * postgres-service health can have values: HEALTHY and UNHEALTHY. + * + * Generated from protobuf field string state = 4; + * @param string $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkString($var, True); + $this->state = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1beta/Instance/QueryInsightsInstanceConfig.php b/AlloyDb/src/V1beta/Instance/QueryInsightsInstanceConfig.php new file mode 100644 index 000000000000..0843fc8decf2 --- /dev/null +++ b/AlloyDb/src/V1beta/Instance/QueryInsightsInstanceConfig.php @@ -0,0 +1,220 @@ +google.cloud.alloydb.v1beta.Instance.QueryInsightsInstanceConfig + */ +class QueryInsightsInstanceConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Record application tags for an instance. + * This flag is turned "on" by default. + * + * Generated from protobuf field optional bool record_application_tags = 2; + */ + protected $record_application_tags = null; + /** + * Record client address for an instance. Client address is PII information. + * This flag is turned "on" by default. + * + * Generated from protobuf field optional bool record_client_address = 3; + */ + protected $record_client_address = null; + /** + * Query string length. The default value is 1024. + * Any integer between 256 and 4500 is considered valid. + * + * Generated from protobuf field uint32 query_string_length = 4; + */ + protected $query_string_length = 0; + /** + * Number of query execution plans captured by Insights per minute + * for all queries combined. The default value is 5. + * Any integer between 0 and 20 is considered valid. + * + * Generated from protobuf field optional uint32 query_plans_per_minute = 5; + */ + protected $query_plans_per_minute = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $record_application_tags + * Record application tags for an instance. + * This flag is turned "on" by default. + * @type bool $record_client_address + * Record client address for an instance. Client address is PII information. + * This flag is turned "on" by default. + * @type int $query_string_length + * Query string length. The default value is 1024. + * Any integer between 256 and 4500 is considered valid. + * @type int $query_plans_per_minute + * Number of query execution plans captured by Insights per minute + * for all queries combined. The default value is 5. + * Any integer between 0 and 20 is considered valid. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Record application tags for an instance. + * This flag is turned "on" by default. + * + * Generated from protobuf field optional bool record_application_tags = 2; + * @return bool + */ + public function getRecordApplicationTags() + { + return isset($this->record_application_tags) ? $this->record_application_tags : false; + } + + public function hasRecordApplicationTags() + { + return isset($this->record_application_tags); + } + + public function clearRecordApplicationTags() + { + unset($this->record_application_tags); + } + + /** + * Record application tags for an instance. + * This flag is turned "on" by default. + * + * Generated from protobuf field optional bool record_application_tags = 2; + * @param bool $var + * @return $this + */ + public function setRecordApplicationTags($var) + { + GPBUtil::checkBool($var); + $this->record_application_tags = $var; + + return $this; + } + + /** + * Record client address for an instance. Client address is PII information. + * This flag is turned "on" by default. + * + * Generated from protobuf field optional bool record_client_address = 3; + * @return bool + */ + public function getRecordClientAddress() + { + return isset($this->record_client_address) ? $this->record_client_address : false; + } + + public function hasRecordClientAddress() + { + return isset($this->record_client_address); + } + + public function clearRecordClientAddress() + { + unset($this->record_client_address); + } + + /** + * Record client address for an instance. Client address is PII information. + * This flag is turned "on" by default. + * + * Generated from protobuf field optional bool record_client_address = 3; + * @param bool $var + * @return $this + */ + public function setRecordClientAddress($var) + { + GPBUtil::checkBool($var); + $this->record_client_address = $var; + + return $this; + } + + /** + * Query string length. The default value is 1024. + * Any integer between 256 and 4500 is considered valid. + * + * Generated from protobuf field uint32 query_string_length = 4; + * @return int + */ + public function getQueryStringLength() + { + return $this->query_string_length; + } + + /** + * Query string length. The default value is 1024. + * Any integer between 256 and 4500 is considered valid. + * + * Generated from protobuf field uint32 query_string_length = 4; + * @param int $var + * @return $this + */ + public function setQueryStringLength($var) + { + GPBUtil::checkUint32($var); + $this->query_string_length = $var; + + return $this; + } + + /** + * Number of query execution plans captured by Insights per minute + * for all queries combined. The default value is 5. + * Any integer between 0 and 20 is considered valid. + * + * Generated from protobuf field optional uint32 query_plans_per_minute = 5; + * @return int + */ + public function getQueryPlansPerMinute() + { + return isset($this->query_plans_per_minute) ? $this->query_plans_per_minute : 0; + } + + public function hasQueryPlansPerMinute() + { + return isset($this->query_plans_per_minute); + } + + public function clearQueryPlansPerMinute() + { + unset($this->query_plans_per_minute); + } + + /** + * Number of query execution plans captured by Insights per minute + * for all queries combined. The default value is 5. + * Any integer between 0 and 20 is considered valid. + * + * Generated from protobuf field optional uint32 query_plans_per_minute = 5; + * @param int $var + * @return $this + */ + public function setQueryPlansPerMinute($var) + { + GPBUtil::checkUint32($var); + $this->query_plans_per_minute = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1beta/Instance/ReadPoolConfig.php b/AlloyDb/src/V1beta/Instance/ReadPoolConfig.php new file mode 100644 index 000000000000..41b4e646be5d --- /dev/null +++ b/AlloyDb/src/V1beta/Instance/ReadPoolConfig.php @@ -0,0 +1,68 @@ +google.cloud.alloydb.v1beta.Instance.ReadPoolConfig + */ +class ReadPoolConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Read capacity, i.e. number of nodes in a read pool instance. + * + * Generated from protobuf field int32 node_count = 1; + */ + protected $node_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $node_count + * Read capacity, i.e. number of nodes in a read pool instance. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Read capacity, i.e. number of nodes in a read pool instance. + * + * Generated from protobuf field int32 node_count = 1; + * @return int + */ + public function getNodeCount() + { + return $this->node_count; + } + + /** + * Read capacity, i.e. number of nodes in a read pool instance. + * + * Generated from protobuf field int32 node_count = 1; + * @param int $var + * @return $this + */ + public function setNodeCount($var) + { + GPBUtil::checkInt32($var); + $this->node_count = $var; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1beta/Instance/State.php b/AlloyDb/src/V1beta/Instance/State.php new file mode 100644 index 000000000000..8ddeffdca082 --- /dev/null +++ b/AlloyDb/src/V1beta/Instance/State.php @@ -0,0 +1,110 @@ +google.cloud.alloydb.v1beta.Instance.State + */ +class State +{ + /** + * The state of the instance is unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The instance is active and running. + * + * Generated from protobuf enum READY = 1; + */ + const READY = 1; + /** + * The instance is stopped. Instance name and IP resources are preserved. + * + * Generated from protobuf enum STOPPED = 2; + */ + const STOPPED = 2; + /** + * The instance is being created. + * + * Generated from protobuf enum CREATING = 3; + */ + const CREATING = 3; + /** + * The instance is being deleted. + * + * Generated from protobuf enum DELETING = 4; + */ + const DELETING = 4; + /** + * The instance is down for maintenance. + * + * Generated from protobuf enum MAINTENANCE = 5; + */ + const MAINTENANCE = 5; + /** + * The creation of the instance failed or a fatal error occurred during + * an operation on the instance. + * Note: Instances in this state would tried to be auto-repaired. And + * Customers should be able to restart, update or delete these instances. + * + * Generated from protobuf enum FAILED = 6; + */ + const FAILED = 6; + /** + * Index 7 is used in the producer apis for ROLLED_BACK state. Keeping that + * index unused in case that state also needs to exposed via consumer apis + * in future. + * The instance has been configured to sync data from some other source. + * + * Generated from protobuf enum BOOTSTRAPPING = 8; + */ + const BOOTSTRAPPING = 8; + /** + * The instance is being promoted. + * + * Generated from protobuf enum PROMOTING = 9; + */ + const PROMOTING = 9; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::READY => 'READY', + self::STOPPED => 'STOPPED', + self::CREATING => 'CREATING', + self::DELETING => 'DELETING', + self::MAINTENANCE => 'MAINTENANCE', + self::FAILED => 'FAILED', + self::BOOTSTRAPPING => 'BOOTSTRAPPING', + self::PROMOTING => 'PROMOTING', + ]; + + 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/AlloyDb/src/V1beta/InstanceView.php b/AlloyDb/src/V1beta/InstanceView.php new file mode 100644 index 000000000000..6cf60b54e17a --- /dev/null +++ b/AlloyDb/src/V1beta/InstanceView.php @@ -0,0 +1,65 @@ +google.cloud.alloydb.v1beta.InstanceView + */ +class InstanceView +{ + /** + * INSTANCE_VIEW_UNSPECIFIED Not specified, equivalent to BASIC. + * + * Generated from protobuf enum INSTANCE_VIEW_UNSPECIFIED = 0; + */ + const INSTANCE_VIEW_UNSPECIFIED = 0; + /** + * BASIC server responses for a primary or read instance include all the + * relevant instance details, excluding the details of each node in the + * instance. The default value. + * + * Generated from protobuf enum INSTANCE_VIEW_BASIC = 1; + */ + const INSTANCE_VIEW_BASIC = 1; + /** + * FULL response is equivalent to BASIC for primary instance (for now). + * For read pool instance, this includes details of each node in the pool. + * + * Generated from protobuf enum INSTANCE_VIEW_FULL = 2; + */ + const INSTANCE_VIEW_FULL = 2; + + private static $valueToName = [ + self::INSTANCE_VIEW_UNSPECIFIED => 'INSTANCE_VIEW_UNSPECIFIED', + self::INSTANCE_VIEW_BASIC => 'INSTANCE_VIEW_BASIC', + self::INSTANCE_VIEW_FULL => 'INSTANCE_VIEW_FULL', + ]; + + 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/AlloyDb/src/V1beta/ListBackupsRequest.php b/AlloyDb/src/V1beta/ListBackupsRequest.php new file mode 100644 index 000000000000..97c8e67e0c9c --- /dev/null +++ b/AlloyDb/src/V1beta/ListBackupsRequest.php @@ -0,0 +1,207 @@ +google.cloud.alloydb.v1beta.ListBackupsRequest + */ +class ListBackupsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Parent value for ListBackupsRequest + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Filtering results + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * Hint for how to order the results + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Parent value for ListBackupsRequest + * @type int $page_size + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @type string $page_token + * A token identifying a page of results the server should return. + * @type string $filter + * Filtering results + * @type string $order_by + * Hint for how to order the results + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. Parent value for ListBackupsRequest + * + * 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. Parent value for ListBackupsRequest + * + * 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; + } + + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * 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; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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; + } + + /** + * Filtering results + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Filtering results + * + * 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; + } + + /** + * Hint for how to order the results + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Hint for how to order the results + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/ListBackupsResponse.php b/AlloyDb/src/V1beta/ListBackupsResponse.php new file mode 100644 index 000000000000..38fecf7acff7 --- /dev/null +++ b/AlloyDb/src/V1beta/ListBackupsResponse.php @@ -0,0 +1,135 @@ +google.cloud.alloydb.v1beta.ListBackupsResponse + */ +class ListBackupsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of Backup + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.Backup backups = 1; + */ + private $backups; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * 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\AlloyDb\V1beta\Backup>|\Google\Protobuf\Internal\RepeatedField $backups + * The list of Backup + * @type string $next_page_token + * A token identifying a page of results the server should return. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * The list of Backup + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.Backup backups = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBackups() + { + return $this->backups; + } + + /** + * The list of Backup + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.Backup backups = 1; + * @param array<\Google\Cloud\AlloyDb\V1beta\Backup>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBackups($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1beta\Backup::class); + $this->backups = $arr; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * 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/AlloyDb/src/V1beta/ListClustersRequest.php b/AlloyDb/src/V1beta/ListClustersRequest.php new file mode 100644 index 000000000000..79fe6741e205 --- /dev/null +++ b/AlloyDb/src/V1beta/ListClustersRequest.php @@ -0,0 +1,219 @@ +google.cloud.alloydb.v1beta.ListClustersRequest + */ +class ListClustersRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with the following format: + * * projects/{project}/locations/- + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Optional. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with the following format: + * * projects/{project}/locations/- + * @type int $page_size + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @type string $page_token + * A token identifying a page of results the server should return. + * @type string $filter + * Optional. Filtering results + * @type string $order_by + * Optional. Hint for how to order the results + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with the following format: + * * projects/{project}/locations/- + * + * 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 parent resource. For the required format, see the + * comment on the Cluster.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with the following format: + * * projects/{project}/locations/- + * + * 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. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/ListClustersResponse.php b/AlloyDb/src/V1beta/ListClustersResponse.php new file mode 100644 index 000000000000..90673b1a4358 --- /dev/null +++ b/AlloyDb/src/V1beta/ListClustersResponse.php @@ -0,0 +1,135 @@ +google.cloud.alloydb.v1beta.ListClustersResponse + */ +class ListClustersResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of Cluster + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.Cluster clusters = 1; + */ + private $clusters; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * 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\AlloyDb\V1beta\Cluster>|\Google\Protobuf\Internal\RepeatedField $clusters + * The list of Cluster + * @type string $next_page_token + * A token identifying a page of results the server should return. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * The list of Cluster + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.Cluster clusters = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getClusters() + { + return $this->clusters; + } + + /** + * The list of Cluster + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.Cluster clusters = 1; + * @param array<\Google\Cloud\AlloyDb\V1beta\Cluster>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setClusters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1beta\Cluster::class); + $this->clusters = $arr; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * 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/AlloyDb/src/V1beta/ListInstancesRequest.php b/AlloyDb/src/V1beta/ListInstancesRequest.php new file mode 100644 index 000000000000..61a7c9a1f142 --- /dev/null +++ b/AlloyDb/src/V1beta/ListInstancesRequest.php @@ -0,0 +1,227 @@ +google.cloud.alloydb.v1beta.ListInstancesRequest + */ +class ListInstancesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with one of the following + * formats: + * * projects/{project}/locations/-/clusters/- + * * projects/{project}/locations/{region}/clusters/- + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Optional. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with one of the following + * formats: + * * projects/{project}/locations/-/clusters/- + * * projects/{project}/locations/{region}/clusters/- + * @type int $page_size + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * @type string $page_token + * A token identifying a page of results the server should return. + * @type string $filter + * Optional. Filtering results + * @type string $order_by + * Optional. Hint for how to order the results + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with one of the following + * formats: + * * projects/{project}/locations/-/clusters/- + * * projects/{project}/locations/{region}/clusters/- + * + * 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 parent resource. For the required format, see the + * comment on the Instance.name field. Additionally, you can perform an + * aggregated list operation by specifying a value with one of the following + * formats: + * * projects/{project}/locations/-/clusters/- + * * projects/{project}/locations/{region}/clusters/- + * + * 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. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filtering results + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Hint for how to order the results + * + * Generated from protobuf field string order_by = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/ListInstancesResponse.php b/AlloyDb/src/V1beta/ListInstancesResponse.php new file mode 100644 index 000000000000..fb10a034d42f --- /dev/null +++ b/AlloyDb/src/V1beta/ListInstancesResponse.php @@ -0,0 +1,135 @@ +google.cloud.alloydb.v1beta.ListInstancesResponse + */ +class ListInstancesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of Instance + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.Instance instances = 1; + */ + private $instances; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + /** + * Locations that could not be reached. + * + * 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\AlloyDb\V1beta\Instance>|\Google\Protobuf\Internal\RepeatedField $instances + * The list of Instance + * @type string $next_page_token + * A token identifying a page of results the server should return. + * @type array|\Google\Protobuf\Internal\RepeatedField $unreachable + * Locations that could not be reached. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * The list of Instance + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.Instance instances = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInstances() + { + return $this->instances; + } + + /** + * The list of Instance + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.Instance instances = 1; + * @param array<\Google\Cloud\AlloyDb\V1beta\Instance>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInstances($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1beta\Instance::class); + $this->instances = $arr; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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; + } + + /** + * Locations that could not be reached. + * + * Generated from protobuf field repeated string unreachable = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUnreachable() + { + return $this->unreachable; + } + + /** + * Locations that could not be reached. + * + * 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/AlloyDb/src/V1beta/ListSupportedDatabaseFlagsRequest.php b/AlloyDb/src/V1beta/ListSupportedDatabaseFlagsRequest.php new file mode 100644 index 000000000000..5f0dd98c3470 --- /dev/null +++ b/AlloyDb/src/V1beta/ListSupportedDatabaseFlagsRequest.php @@ -0,0 +1,159 @@ +google.cloud.alloydb.v1beta.ListSupportedDatabaseFlagsRequest + */ +class ListSupportedDatabaseFlagsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. The required format is: + * * projects/{project}/locations/{location} + * Regardless of the parent specified here, as long it is contains a valid + * project and location, the service will return a static list of supported + * flags resources. Note that we do not yet support region-specific + * flags. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent resource. The required format is: + * * projects/{project}/locations/{location} + * Regardless of the parent specified here, as long it is contains a valid + * project and location, the service will return a static list of supported + * flags resources. Note that we do not yet support region-specific + * flags. + * @type int $page_size + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @type string $page_token + * A token identifying a page of results the server should return. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent resource. The required format is: + * * projects/{project}/locations/{location} + * Regardless of the parent specified here, as long it is contains a valid + * project and location, the service will return a static list of supported + * flags resources. Note that we do not yet support region-specific + * flags. + * + * 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 parent resource. The required format is: + * * projects/{project}/locations/{location} + * Regardless of the parent specified here, as long it is contains a valid + * project and location, the service will return a static list of supported + * flags resources. Note that we do not yet support region-specific + * flags. + * + * 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; + } + + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * + * 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; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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/AlloyDb/src/V1beta/ListSupportedDatabaseFlagsResponse.php b/AlloyDb/src/V1beta/ListSupportedDatabaseFlagsResponse.php new file mode 100644 index 000000000000..519a0fed0ade --- /dev/null +++ b/AlloyDb/src/V1beta/ListSupportedDatabaseFlagsResponse.php @@ -0,0 +1,101 @@ +google.cloud.alloydb.v1beta.ListSupportedDatabaseFlagsResponse + */ +class ListSupportedDatabaseFlagsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of SupportedDatabaseFlags. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.SupportedDatabaseFlag supported_database_flags = 1; + */ + private $supported_database_flags; + /** + * A token identifying a page of results the server should return. + * + * 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\AlloyDb\V1beta\SupportedDatabaseFlag>|\Google\Protobuf\Internal\RepeatedField $supported_database_flags + * The list of SupportedDatabaseFlags. + * @type string $next_page_token + * A token identifying a page of results the server should return. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * The list of SupportedDatabaseFlags. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.SupportedDatabaseFlag supported_database_flags = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSupportedDatabaseFlags() + { + return $this->supported_database_flags; + } + + /** + * The list of SupportedDatabaseFlags. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.SupportedDatabaseFlag supported_database_flags = 1; + * @param array<\Google\Cloud\AlloyDb\V1beta\SupportedDatabaseFlag>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSupportedDatabaseFlags($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\AlloyDb\V1beta\SupportedDatabaseFlag::class); + $this->supported_database_flags = $arr; + + return $this; + } + + /** + * A token identifying a page of results the server should return. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token identifying a page of results the server should return. + * + * 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/AlloyDb/src/V1beta/MigrationSource.php b/AlloyDb/src/V1beta/MigrationSource.php new file mode 100644 index 000000000000..c3bcc142fd39 --- /dev/null +++ b/AlloyDb/src/V1beta/MigrationSource.php @@ -0,0 +1,144 @@ +google.cloud.alloydb.v1beta.MigrationSource + */ +class MigrationSource extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The host and port of the on-premises instance in host:port + * format + * + * Generated from protobuf field string host_port = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $host_port = ''; + /** + * Output only. Place holder for the external source identifier(e.g DMS job + * name) that created the cluster. + * + * Generated from protobuf field string reference_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $reference_id = ''; + /** + * Output only. Type of migration source. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.MigrationSource.MigrationSourceType source_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $source_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $host_port + * Output only. The host and port of the on-premises instance in host:port + * format + * @type string $reference_id + * Output only. Place holder for the external source identifier(e.g DMS job + * name) that created the cluster. + * @type int $source_type + * Output only. Type of migration source. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The host and port of the on-premises instance in host:port + * format + * + * Generated from protobuf field string host_port = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getHostPort() + { + return $this->host_port; + } + + /** + * Output only. The host and port of the on-premises instance in host:port + * format + * + * Generated from protobuf field string host_port = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setHostPort($var) + { + GPBUtil::checkString($var, True); + $this->host_port = $var; + + return $this; + } + + /** + * Output only. Place holder for the external source identifier(e.g DMS job + * name) that created the cluster. + * + * Generated from protobuf field string reference_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getReferenceId() + { + return $this->reference_id; + } + + /** + * Output only. Place holder for the external source identifier(e.g DMS job + * name) that created the cluster. + * + * Generated from protobuf field string reference_id = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setReferenceId($var) + { + GPBUtil::checkString($var, True); + $this->reference_id = $var; + + return $this; + } + + /** + * Output only. Type of migration source. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.MigrationSource.MigrationSourceType source_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getSourceType() + { + return $this->source_type; + } + + /** + * Output only. Type of migration source. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.MigrationSource.MigrationSourceType source_type = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setSourceType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1beta\MigrationSource\MigrationSourceType::class); + $this->source_type = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/MigrationSource/MigrationSourceType.php b/AlloyDb/src/V1beta/MigrationSource/MigrationSourceType.php new file mode 100644 index 000000000000..42b4ae27be87 --- /dev/null +++ b/AlloyDb/src/V1beta/MigrationSource/MigrationSourceType.php @@ -0,0 +1,55 @@ +google.cloud.alloydb.v1beta.MigrationSource.MigrationSourceType + */ +class MigrationSourceType +{ + /** + * Migration source is unknown. + * + * Generated from protobuf enum MIGRATION_SOURCE_TYPE_UNSPECIFIED = 0; + */ + const MIGRATION_SOURCE_TYPE_UNSPECIFIED = 0; + /** + * DMS source means the cluster was created via DMS migration job. + * + * Generated from protobuf enum DMS = 1; + */ + const DMS = 1; + + private static $valueToName = [ + self::MIGRATION_SOURCE_TYPE_UNSPECIFIED => 'MIGRATION_SOURCE_TYPE_UNSPECIFIED', + self::DMS => 'DMS', + ]; + + 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/AlloyDb/src/V1beta/OperationMetadata.php b/AlloyDb/src/V1beta/OperationMetadata.php new file mode 100644 index 000000000000..b7a852470274 --- /dev/null +++ b/AlloyDb/src/V1beta/OperationMetadata.php @@ -0,0 +1,349 @@ +google.cloud.alloydb.v1beta.OperationMetadata + */ +class OperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $target = ''; + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $verb = ''; + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $status_message = ''; + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $requested_cancellation = false; + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $api_version = ''; + protected $request_specific; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AlloyDb\V1beta\BatchCreateInstancesMetadata $batch_create_instances_metadata + * Output only. BatchCreateInstances related metadata. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time the operation was created. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time the operation finished running. + * @type string $target + * Output only. Server-defined resource path for the target of the operation. + * @type string $verb + * Output only. Name of the verb executed by the operation. + * @type string $status_message + * Output only. Human-readable status of the operation, if any. + * @type bool $requested_cancellation + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * @type string $api_version + * Output only. API version used to start the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Output only. BatchCreateInstances related metadata. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.BatchCreateInstancesMetadata batch_create_instances_metadata = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\AlloyDb\V1beta\BatchCreateInstancesMetadata|null + */ + public function getBatchCreateInstancesMetadata() + { + return $this->readOneof(8); + } + + public function hasBatchCreateInstancesMetadata() + { + return $this->hasOneof(8); + } + + /** + * Output only. BatchCreateInstances related metadata. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.BatchCreateInstancesMetadata batch_create_instances_metadata = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\AlloyDb\V1beta\BatchCreateInstancesMetadata $var + * @return $this + */ + public function setBatchCreateInstancesMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\BatchCreateInstancesMetadata::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * Output only. The time the operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.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 operation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 1 [(.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 the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @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); + } + + /** + * Output only. The time the operation finished running. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTarget() + { + return $this->target; + } + + /** + * Output only. Server-defined resource path for the target of the operation. + * + * Generated from protobuf field string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTarget($var) + { + GPBUtil::checkString($var, True); + $this->target = $var; + + return $this; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getVerb() + { + return $this->verb; + } + + /** + * Output only. Name of the verb executed by the operation. + * + * Generated from protobuf field string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setVerb($var) + { + GPBUtil::checkString($var, True); + $this->verb = $var; + + return $this; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getStatusMessage() + { + return $this->status_message; + } + + /** + * Output only. Human-readable status of the operation, if any. + * + * Generated from protobuf field string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setStatusMessage($var) + { + GPBUtil::checkString($var, True); + $this->status_message = $var; + + return $this; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getRequestedCancellation() + { + return $this->requested_cancellation; + } + + /** + * Output only. Identifies whether the user has requested cancellation + * of the operation. Operations that have successfully been cancelled + * have [Operation.error][] value with a + * [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + * `Code.CANCELLED`. + * + * Generated from protobuf field bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setRequestedCancellation($var) + { + GPBUtil::checkBool($var); + $this->requested_cancellation = $var; + + return $this; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * Output only. API version used to start the operation. + * + * Generated from protobuf field string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + + /** + * @return string + */ + public function getRequestSpecific() + { + return $this->whichOneof("request_specific"); + } + +} + diff --git a/AlloyDb/src/V1beta/PromoteClusterRequest.php b/AlloyDb/src/V1beta/PromoteClusterRequest.php new file mode 100644 index 000000000000..daf0cacf087f --- /dev/null +++ b/AlloyDb/src/V1beta/PromoteClusterRequest.php @@ -0,0 +1,225 @@ +google.cloud.alloydb.v1beta.PromoteClusterRequest + */ +class PromoteClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $etag = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type string $etag + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource. For the required format, see the + * comment on the Cluster.name field + * + * 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 resource. For the required format, see the + * comment on the Cluster.name field + * + * 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. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. The current etag of the Cluster. + * If an etag is provided and does not match the current etag of the Cluster, + * deletion will be blocked and an ABORTED error will be returned. + * + * Generated from protobuf field string etag = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the delete. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/RestartInstanceRequest.php b/AlloyDb/src/V1beta/RestartInstanceRequest.php new file mode 100644 index 000000000000..a651f553da3e --- /dev/null +++ b/AlloyDb/src/V1beta/RestartInstanceRequest.php @@ -0,0 +1,181 @@ +google.cloud.alloydb.v1beta.RestartInstanceRequest + */ +class RestartInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the restart. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the restart. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the resource. For the required format, see the + * comment on the Instance.name field. + * + * 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 resource. For the required format, see the + * comment on the Instance.name field. + * + * 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. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the restart. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the restart. + * + * Generated from protobuf field bool validate_only = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/RestoreClusterRequest.php b/AlloyDb/src/V1beta/RestoreClusterRequest.php new file mode 100644 index 000000000000..46651d5bb3ca --- /dev/null +++ b/AlloyDb/src/V1beta/RestoreClusterRequest.php @@ -0,0 +1,344 @@ +google.cloud.alloydb.v1beta.RestoreClusterRequest + */ +class RestoreClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. ID of the requesting object. + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster_id = ''; + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the import + * request. + * + * Generated from protobuf field bool validate_only = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AlloyDb\V1beta\BackupSource $backup_source + * Backup source. + * @type \Google\Cloud\AlloyDb\V1beta\ContinuousBackupSource $continuous_backup_source + * ContinuousBackup source. Continuous backup needs to be enabled in the + * source cluster for this operation to succeed. + * @type string $parent + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * @type string $cluster_id + * Required. ID of the requesting object. + * @type \Google\Cloud\AlloyDb\V1beta\Cluster $cluster + * Required. The resource being created + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the import + * request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Backup source. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.BackupSource backup_source = 4; + * @return \Google\Cloud\AlloyDb\V1beta\BackupSource|null + */ + public function getBackupSource() + { + return $this->readOneof(4); + } + + public function hasBackupSource() + { + return $this->hasOneof(4); + } + + /** + * Backup source. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.BackupSource backup_source = 4; + * @param \Google\Cloud\AlloyDb\V1beta\BackupSource $var + * @return $this + */ + public function setBackupSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\BackupSource::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * ContinuousBackup source. Continuous backup needs to be enabled in the + * source cluster for this operation to succeed. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.ContinuousBackupSource continuous_backup_source = 8; + * @return \Google\Cloud\AlloyDb\V1beta\ContinuousBackupSource|null + */ + public function getContinuousBackupSource() + { + return $this->readOneof(8); + } + + public function hasContinuousBackupSource() + { + return $this->hasOneof(8); + } + + /** + * ContinuousBackup source. Continuous backup needs to be enabled in the + * source cluster for this operation to succeed. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.ContinuousBackupSource continuous_backup_source = 8; + * @param \Google\Cloud\AlloyDb\V1beta\ContinuousBackupSource $var + * @return $this + */ + public function setContinuousBackupSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\ContinuousBackupSource::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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 parent resource. For the required format, see the + * comment on the Cluster.name field. + * + * 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. ID of the requesting object. + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getClusterId() + { + return $this->cluster_id; + } + + /** + * Required. ID of the requesting object. + * + * Generated from protobuf field string cluster_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setClusterId($var) + { + GPBUtil::checkString($var, True); + $this->cluster_id = $var; + + return $this; + } + + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1beta\Cluster|null + */ + public function getCluster() + { + return $this->cluster; + } + + public function hasCluster() + { + return isset($this->cluster); + } + + public function clearCluster() + { + unset($this->cluster); + } + + /** + * Required. The resource being created + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster cluster = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1beta\Cluster $var + * @return $this + */ + public function setCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\Cluster::class); + $this->cluster = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the import + * request. + * + * Generated from protobuf field bool validate_only = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the import + * request. + * + * Generated from protobuf field bool validate_only = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/AlloyDb/src/V1beta/SslConfig.php b/AlloyDb/src/V1beta/SslConfig.php new file mode 100644 index 000000000000..f95c420eeba8 --- /dev/null +++ b/AlloyDb/src/V1beta/SslConfig.php @@ -0,0 +1,105 @@ +google.cloud.alloydb.v1beta.SslConfig + */ +class SslConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. SSL mode. Specifies client-server SSL/TLS connection behavior. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.SslConfig.SslMode ssl_mode = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $ssl_mode = 0; + /** + * Optional. Certificate Authority (CA) source. Only CA_SOURCE_MANAGED is + * supported currently, and is the default value. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.SslConfig.CaSource ca_source = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $ca_source = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $ssl_mode + * Optional. SSL mode. Specifies client-server SSL/TLS connection behavior. + * @type int $ca_source + * Optional. Certificate Authority (CA) source. Only CA_SOURCE_MANAGED is + * supported currently, and is the default value. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Optional. SSL mode. Specifies client-server SSL/TLS connection behavior. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.SslConfig.SslMode ssl_mode = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getSslMode() + { + return $this->ssl_mode; + } + + /** + * Optional. SSL mode. Specifies client-server SSL/TLS connection behavior. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.SslConfig.SslMode ssl_mode = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setSslMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1beta\SslConfig\SslMode::class); + $this->ssl_mode = $var; + + return $this; + } + + /** + * Optional. Certificate Authority (CA) source. Only CA_SOURCE_MANAGED is + * supported currently, and is the default value. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.SslConfig.CaSource ca_source = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getCaSource() + { + return $this->ca_source; + } + + /** + * Optional. Certificate Authority (CA) source. Only CA_SOURCE_MANAGED is + * supported currently, and is the default value. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.SslConfig.CaSource ca_source = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setCaSource($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1beta\SslConfig\CaSource::class); + $this->ca_source = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/SslConfig/CaSource.php b/AlloyDb/src/V1beta/SslConfig/CaSource.php new file mode 100644 index 000000000000..4c95b51cead8 --- /dev/null +++ b/AlloyDb/src/V1beta/SslConfig/CaSource.php @@ -0,0 +1,56 @@ +google.cloud.alloydb.v1beta.SslConfig.CaSource + */ +class CaSource +{ + /** + * Certificate Authority (CA) source not specified. Defaults to + * CA_SOURCE_MANAGED. + * + * Generated from protobuf enum CA_SOURCE_UNSPECIFIED = 0; + */ + const CA_SOURCE_UNSPECIFIED = 0; + /** + * Certificate Authority (CA) managed by the AlloyDB Cluster. + * + * Generated from protobuf enum CA_SOURCE_MANAGED = 1; + */ + const CA_SOURCE_MANAGED = 1; + + private static $valueToName = [ + self::CA_SOURCE_UNSPECIFIED => 'CA_SOURCE_UNSPECIFIED', + self::CA_SOURCE_MANAGED => 'CA_SOURCE_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); + } +} + + diff --git a/AlloyDb/src/V1beta/SslConfig/SslMode.php b/AlloyDb/src/V1beta/SslConfig/SslMode.php new file mode 100644 index 000000000000..5b153a5c65f4 --- /dev/null +++ b/AlloyDb/src/V1beta/SslConfig/SslMode.php @@ -0,0 +1,73 @@ +google.cloud.alloydb.v1beta.SslConfig.SslMode + */ +class SslMode +{ + /** + * SSL mode not specified. Defaults to SSL_MODE_ALLOW. + * + * Generated from protobuf enum SSL_MODE_UNSPECIFIED = 0; + */ + const SSL_MODE_UNSPECIFIED = 0; + /** + * SSL connections are optional. CA verification not enforced. + * + * Generated from protobuf enum SSL_MODE_ALLOW = 1; + */ + const SSL_MODE_ALLOW = 1; + /** + * SSL connections are required. CA verification not enforced. + * Clients may use locally self-signed certificates (default psql client + * behavior). + * + * Generated from protobuf enum SSL_MODE_REQUIRE = 2; + */ + const SSL_MODE_REQUIRE = 2; + /** + * SSL connections are required. CA verification enforced. + * Clients must have certificates signed by a Cluster CA, e.g. via + * GenerateClientCertificate. + * + * Generated from protobuf enum SSL_MODE_VERIFY_CA = 3; + */ + const SSL_MODE_VERIFY_CA = 3; + + private static $valueToName = [ + self::SSL_MODE_UNSPECIFIED => 'SSL_MODE_UNSPECIFIED', + self::SSL_MODE_ALLOW => 'SSL_MODE_ALLOW', + self::SSL_MODE_REQUIRE => 'SSL_MODE_REQUIRE', + self::SSL_MODE_VERIFY_CA => 'SSL_MODE_VERIFY_CA', + ]; + + 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/AlloyDb/src/V1beta/SupportedDatabaseFlag.php b/AlloyDb/src/V1beta/SupportedDatabaseFlag.php new file mode 100644 index 000000000000..7aea82a4c7cb --- /dev/null +++ b/AlloyDb/src/V1beta/SupportedDatabaseFlag.php @@ -0,0 +1,337 @@ +google.cloud.alloydb.v1beta.SupportedDatabaseFlag + */ +class SupportedDatabaseFlag extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the flag resource, following Google Cloud conventions, e.g.: + * * projects/{project}/locations/{location}/flags/{flag} + * This field currently has no semantic meaning. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The name of the database flag, e.g. "max_allowed_packets". + * The is a possibly key for the Instance.database_flags map field. + * + * Generated from protobuf field string flag_name = 2; + */ + protected $flag_name = ''; + /** + * Generated from protobuf field .google.cloud.alloydb.v1beta.SupportedDatabaseFlag.ValueType value_type = 3; + */ + protected $value_type = 0; + /** + * Whether the database flag accepts multiple values. If true, + * a comma-separated list of stringified values may be specified. + * + * Generated from protobuf field bool accepts_multiple_values = 4; + */ + protected $accepts_multiple_values = false; + /** + * Major database engine versions for which this flag is supported. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.DatabaseVersion supported_db_versions = 5; + */ + private $supported_db_versions; + /** + * Whether setting or updating this flag on an Instance requires a database + * restart. If a flag that requires database restart is set, the backend + * will automatically restart the database (making sure to satisfy any + * availability SLO's). + * + * Generated from protobuf field bool requires_db_restart = 6; + */ + protected $requires_db_restart = false; + protected $restrictions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\AlloyDb\V1beta\SupportedDatabaseFlag\StringRestrictions $string_restrictions + * Restriction on STRING type value. + * @type \Google\Cloud\AlloyDb\V1beta\SupportedDatabaseFlag\IntegerRestrictions $integer_restrictions + * Restriction on INTEGER type value. + * @type string $name + * The name of the flag resource, following Google Cloud conventions, e.g.: + * * projects/{project}/locations/{location}/flags/{flag} + * This field currently has no semantic meaning. + * @type string $flag_name + * The name of the database flag, e.g. "max_allowed_packets". + * The is a possibly key for the Instance.database_flags map field. + * @type int $value_type + * @type bool $accepts_multiple_values + * Whether the database flag accepts multiple values. If true, + * a comma-separated list of stringified values may be specified. + * @type array|\Google\Protobuf\Internal\RepeatedField $supported_db_versions + * Major database engine versions for which this flag is supported. + * @type bool $requires_db_restart + * Whether setting or updating this flag on an Instance requires a database + * restart. If a flag that requires database restart is set, the backend + * will automatically restart the database (making sure to satisfy any + * availability SLO's). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * Restriction on STRING type value. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.SupportedDatabaseFlag.StringRestrictions string_restrictions = 7; + * @return \Google\Cloud\AlloyDb\V1beta\SupportedDatabaseFlag\StringRestrictions|null + */ + public function getStringRestrictions() + { + return $this->readOneof(7); + } + + public function hasStringRestrictions() + { + return $this->hasOneof(7); + } + + /** + * Restriction on STRING type value. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.SupportedDatabaseFlag.StringRestrictions string_restrictions = 7; + * @param \Google\Cloud\AlloyDb\V1beta\SupportedDatabaseFlag\StringRestrictions $var + * @return $this + */ + public function setStringRestrictions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\SupportedDatabaseFlag\StringRestrictions::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * Restriction on INTEGER type value. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.SupportedDatabaseFlag.IntegerRestrictions integer_restrictions = 8; + * @return \Google\Cloud\AlloyDb\V1beta\SupportedDatabaseFlag\IntegerRestrictions|null + */ + public function getIntegerRestrictions() + { + return $this->readOneof(8); + } + + public function hasIntegerRestrictions() + { + return $this->hasOneof(8); + } + + /** + * Restriction on INTEGER type value. + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.SupportedDatabaseFlag.IntegerRestrictions integer_restrictions = 8; + * @param \Google\Cloud\AlloyDb\V1beta\SupportedDatabaseFlag\IntegerRestrictions $var + * @return $this + */ + public function setIntegerRestrictions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\SupportedDatabaseFlag\IntegerRestrictions::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * The name of the flag resource, following Google Cloud conventions, e.g.: + * * projects/{project}/locations/{location}/flags/{flag} + * This field currently has no semantic meaning. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the flag resource, following Google Cloud conventions, e.g.: + * * projects/{project}/locations/{location}/flags/{flag} + * This field currently has no semantic meaning. + * + * 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 the database flag, e.g. "max_allowed_packets". + * The is a possibly key for the Instance.database_flags map field. + * + * Generated from protobuf field string flag_name = 2; + * @return string + */ + public function getFlagName() + { + return $this->flag_name; + } + + /** + * The name of the database flag, e.g. "max_allowed_packets". + * The is a possibly key for the Instance.database_flags map field. + * + * Generated from protobuf field string flag_name = 2; + * @param string $var + * @return $this + */ + public function setFlagName($var) + { + GPBUtil::checkString($var, True); + $this->flag_name = $var; + + return $this; + } + + /** + * Generated from protobuf field .google.cloud.alloydb.v1beta.SupportedDatabaseFlag.ValueType value_type = 3; + * @return int + */ + public function getValueType() + { + return $this->value_type; + } + + /** + * Generated from protobuf field .google.cloud.alloydb.v1beta.SupportedDatabaseFlag.ValueType value_type = 3; + * @param int $var + * @return $this + */ + public function setValueType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1beta\SupportedDatabaseFlag\ValueType::class); + $this->value_type = $var; + + return $this; + } + + /** + * Whether the database flag accepts multiple values. If true, + * a comma-separated list of stringified values may be specified. + * + * Generated from protobuf field bool accepts_multiple_values = 4; + * @return bool + */ + public function getAcceptsMultipleValues() + { + return $this->accepts_multiple_values; + } + + /** + * Whether the database flag accepts multiple values. If true, + * a comma-separated list of stringified values may be specified. + * + * Generated from protobuf field bool accepts_multiple_values = 4; + * @param bool $var + * @return $this + */ + public function setAcceptsMultipleValues($var) + { + GPBUtil::checkBool($var); + $this->accepts_multiple_values = $var; + + return $this; + } + + /** + * Major database engine versions for which this flag is supported. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.DatabaseVersion supported_db_versions = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSupportedDbVersions() + { + return $this->supported_db_versions; + } + + /** + * Major database engine versions for which this flag is supported. + * + * Generated from protobuf field repeated .google.cloud.alloydb.v1beta.DatabaseVersion supported_db_versions = 5; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSupportedDbVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\AlloyDb\V1beta\DatabaseVersion::class); + $this->supported_db_versions = $arr; + + return $this; + } + + /** + * Whether setting or updating this flag on an Instance requires a database + * restart. If a flag that requires database restart is set, the backend + * will automatically restart the database (making sure to satisfy any + * availability SLO's). + * + * Generated from protobuf field bool requires_db_restart = 6; + * @return bool + */ + public function getRequiresDbRestart() + { + return $this->requires_db_restart; + } + + /** + * Whether setting or updating this flag on an Instance requires a database + * restart. If a flag that requires database restart is set, the backend + * will automatically restart the database (making sure to satisfy any + * availability SLO's). + * + * Generated from protobuf field bool requires_db_restart = 6; + * @param bool $var + * @return $this + */ + public function setRequiresDbRestart($var) + { + GPBUtil::checkBool($var); + $this->requires_db_restart = $var; + + return $this; + } + + /** + * @return string + */ + public function getRestrictions() + { + return $this->whichOneof("restrictions"); + } + +} + diff --git a/AlloyDb/src/V1beta/SupportedDatabaseFlag/IntegerRestrictions.php b/AlloyDb/src/V1beta/SupportedDatabaseFlag/IntegerRestrictions.php new file mode 100644 index 000000000000..77d7e639c95e --- /dev/null +++ b/AlloyDb/src/V1beta/SupportedDatabaseFlag/IntegerRestrictions.php @@ -0,0 +1,176 @@ +google.cloud.alloydb.v1beta.SupportedDatabaseFlag.IntegerRestrictions + */ +class IntegerRestrictions extends \Google\Protobuf\Internal\Message +{ + /** + * The minimum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value min_value = 1; + */ + protected $min_value = null; + /** + * The maximum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value max_value = 2; + */ + protected $max_value = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Int64Value $min_value + * The minimum value that can be specified, if applicable. + * @type \Google\Protobuf\Int64Value $max_value + * The maximum value that can be specified, if applicable. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The minimum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value min_value = 1; + * @return \Google\Protobuf\Int64Value|null + */ + public function getMinValue() + { + return $this->min_value; + } + + public function hasMinValue() + { + return isset($this->min_value); + } + + public function clearMinValue() + { + unset($this->min_value); + } + + /** + * Returns the unboxed value from getMinValue() + + * The minimum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value min_value = 1; + * @return int|string|null + */ + public function getMinValueUnwrapped() + { + return $this->readWrapperValue("min_value"); + } + + /** + * The minimum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value min_value = 1; + * @param \Google\Protobuf\Int64Value $var + * @return $this + */ + public function setMinValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Int64Value::class); + $this->min_value = $var; + + return $this; + } + + /** + * Sets the field by wrapping a primitive type in a Google\Protobuf\Int64Value object. + + * The minimum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value min_value = 1; + * @param int|string|null $var + * @return $this + */ + public function setMinValueUnwrapped($var) + { + $this->writeWrapperValue("min_value", $var); + return $this;} + + /** + * The maximum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value max_value = 2; + * @return \Google\Protobuf\Int64Value|null + */ + public function getMaxValue() + { + return $this->max_value; + } + + public function hasMaxValue() + { + return isset($this->max_value); + } + + public function clearMaxValue() + { + unset($this->max_value); + } + + /** + * Returns the unboxed value from getMaxValue() + + * The maximum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value max_value = 2; + * @return int|string|null + */ + public function getMaxValueUnwrapped() + { + return $this->readWrapperValue("max_value"); + } + + /** + * The maximum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value max_value = 2; + * @param \Google\Protobuf\Int64Value $var + * @return $this + */ + public function setMaxValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Int64Value::class); + $this->max_value = $var; + + return $this; + } + + /** + * Sets the field by wrapping a primitive type in a Google\Protobuf\Int64Value object. + + * The maximum value that can be specified, if applicable. + * + * Generated from protobuf field .google.protobuf.Int64Value max_value = 2; + * @param int|string|null $var + * @return $this + */ + public function setMaxValueUnwrapped($var) + { + $this->writeWrapperValue("max_value", $var); + return $this;} + +} + + diff --git a/AlloyDb/src/V1beta/SupportedDatabaseFlag/StringRestrictions.php b/AlloyDb/src/V1beta/SupportedDatabaseFlag/StringRestrictions.php new file mode 100644 index 000000000000..3af895f3db7e --- /dev/null +++ b/AlloyDb/src/V1beta/SupportedDatabaseFlag/StringRestrictions.php @@ -0,0 +1,72 @@ +google.cloud.alloydb.v1beta.SupportedDatabaseFlag.StringRestrictions + */ +class StringRestrictions extends \Google\Protobuf\Internal\Message +{ + /** + * The list of allowed values, if bounded. This field will be empty + * if there is a unbounded number of allowed values. + * + * Generated from protobuf field repeated string allowed_values = 1; + */ + private $allowed_values; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $allowed_values + * The list of allowed values, if bounded. This field will be empty + * if there is a unbounded number of allowed values. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The list of allowed values, if bounded. This field will be empty + * if there is a unbounded number of allowed values. + * + * Generated from protobuf field repeated string allowed_values = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAllowedValues() + { + return $this->allowed_values; + } + + /** + * The list of allowed values, if bounded. This field will be empty + * if there is a unbounded number of allowed values. + * + * Generated from protobuf field repeated string allowed_values = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAllowedValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->allowed_values = $arr; + + return $this; + } + +} + + diff --git a/AlloyDb/src/V1beta/SupportedDatabaseFlag/ValueType.php b/AlloyDb/src/V1beta/SupportedDatabaseFlag/ValueType.php new file mode 100644 index 000000000000..00d1197d85c2 --- /dev/null +++ b/AlloyDb/src/V1beta/SupportedDatabaseFlag/ValueType.php @@ -0,0 +1,78 @@ +google.cloud.alloydb.v1beta.SupportedDatabaseFlag.ValueType + */ +class ValueType +{ + /** + * This is an unknown flag type. + * + * Generated from protobuf enum VALUE_TYPE_UNSPECIFIED = 0; + */ + const VALUE_TYPE_UNSPECIFIED = 0; + /** + * String type flag. + * + * Generated from protobuf enum STRING = 1; + */ + const STRING = 1; + /** + * Integer type flag. + * + * Generated from protobuf enum INTEGER = 2; + */ + const INTEGER = 2; + /** + * Float type flag. + * + * Generated from protobuf enum FLOAT = 3; + */ + const FLOAT = 3; + /** + * Denotes that the flag does not accept any values. + * + * Generated from protobuf enum NONE = 4; + */ + const NONE = 4; + + private static $valueToName = [ + self::VALUE_TYPE_UNSPECIFIED => 'VALUE_TYPE_UNSPECIFIED', + self::STRING => 'STRING', + self::INTEGER => 'INTEGER', + self::FLOAT => 'FLOAT', + self::NONE => 'NONE', + ]; + + 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/AlloyDb/src/V1beta/UpdateBackupRequest.php b/AlloyDb/src/V1beta/UpdateBackupRequest.php new file mode 100644 index 000000000000..acf677a37046 --- /dev/null +++ b/AlloyDb/src/V1beta/UpdateBackupRequest.php @@ -0,0 +1,287 @@ +google.cloud.alloydb.v1beta.UpdateBackupRequest + */ +class UpdateBackupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Backup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Backup backup = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $backup = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + /** + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new backup is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $allow_missing = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Backup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\AlloyDb\V1beta\Backup $backup + * Required. The resource being updated + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * @type bool $allow_missing + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new backup is created and `update_mask` is ignored. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Backup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @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); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Backup resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Backup backup = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1beta\Backup|null + */ + public function getBackup() + { + return $this->backup; + } + + public function hasBackup() + { + return isset($this->backup); + } + + public function clearBackup() + { + unset($this->backup); + } + + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Backup backup = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1beta\Backup $var + * @return $this + */ + public function setBackup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\Backup::class); + $this->backup = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, the backend validates the request, but doesn't actually + * execute it. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new backup is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new backup is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/UpdateClusterRequest.php b/AlloyDb/src/V1beta/UpdateClusterRequest.php new file mode 100644 index 000000000000..a84bb6b0f1cd --- /dev/null +++ b/AlloyDb/src/V1beta/UpdateClusterRequest.php @@ -0,0 +1,291 @@ +google.cloud.alloydb.v1beta.UpdateClusterRequest + */ +class UpdateClusterRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Cluster resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cluster = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + /** + * Optional. If set to true, update succeeds even if cluster is not found. In + * that case, a new cluster is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $allow_missing = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Cluster resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\AlloyDb\V1beta\Cluster $cluster + * Required. The resource being updated + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * @type bool $allow_missing + * Optional. If set to true, update succeeds even if cluster is not found. In + * that case, a new cluster is created and `update_mask` is ignored. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Cluster resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @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); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Cluster resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1beta\Cluster|null + */ + public function getCluster() + { + return $this->cluster; + } + + public function hasCluster() + { + return isset($this->cluster); + } + + public function clearCluster() + { + unset($this->cluster); + } + + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Cluster cluster = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1beta\Cluster $var + * @return $this + */ + public function setCluster($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\Cluster::class); + $this->cluster = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Optional. If set to true, update succeeds even if cluster is not found. In + * that case, a new cluster is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * Optional. If set to true, update succeeds even if cluster is not found. In + * that case, a new cluster is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/UpdateInstanceRequest.php b/AlloyDb/src/V1beta/UpdateInstanceRequest.php new file mode 100644 index 000000000000..9e384c42caf5 --- /dev/null +++ b/AlloyDb/src/V1beta/UpdateInstanceRequest.php @@ -0,0 +1,291 @@ +google.cloud.alloydb.v1beta.UpdateInstanceRequest + */ +class UpdateInstanceRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Instance resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance instance = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $instance = null; + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $request_id = ''; + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $validate_only = false; + /** + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new instance is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $allow_missing = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Field mask is used to specify the fields to be overwritten in the + * Instance resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @type \Google\Cloud\AlloyDb\V1beta\Instance $instance + * Required. The resource being updated + * @type string $request_id + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @type bool $validate_only + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * @type bool $allow_missing + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new instance is created and `update_mask` is ignored. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Service::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Instance resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @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); + } + + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Instance resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance instance = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\AlloyDb\V1beta\Instance|null + */ + public function getInstance() + { + return $this->instance; + } + + public function hasInstance() + { + return isset($this->instance); + } + + public function clearInstance() + { + unset($this->instance); + } + + /** + * Required. The resource being updated + * + * Generated from protobuf field .google.cloud.alloydb.v1beta.Instance instance = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\AlloyDb\V1beta\Instance $var + * @return $this + */ + public function setInstance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1beta\Instance::class); + $this->instance = $var; + + return $this; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRequestId() + { + return $this->request_id; + } + + /** + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * + * Generated from protobuf field string request_id = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRequestId($var) + { + GPBUtil::checkString($var, True); + $this->request_id = $var; + + return $this; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getValidateOnly() + { + return $this->validate_only; + } + + /** + * Optional. If set, performs request validation (e.g. permission checks and + * any other type of validation), but do not actually execute the update + * request. + * + * Generated from protobuf field bool validate_only = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setValidateOnly($var) + { + GPBUtil::checkBool($var); + $this->validate_only = $var; + + return $this; + } + + /** + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new instance is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getAllowMissing() + { + return $this->allow_missing; + } + + /** + * Optional. If set to true, update succeeds even if instance is not found. In + * that case, a new instance is created and `update_mask` is ignored. + * + * Generated from protobuf field bool allow_missing = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setAllowMissing($var) + { + GPBUtil::checkBool($var); + $this->allow_missing = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/UserPassword.php b/AlloyDb/src/V1beta/UserPassword.php new file mode 100644 index 000000000000..e06daa34e50a --- /dev/null +++ b/AlloyDb/src/V1beta/UserPassword.php @@ -0,0 +1,102 @@ +google.cloud.alloydb.v1beta.UserPassword + */ +class UserPassword extends \Google\Protobuf\Internal\Message +{ + /** + * The database username. + * + * Generated from protobuf field string user = 1; + */ + protected $user = ''; + /** + * The initial password for the user. + * + * Generated from protobuf field string password = 2; + */ + protected $password = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $user + * The database username. + * @type string $password + * The initial password for the user. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Alloydb\V1Beta\Resources::initOnce(); + parent::__construct($data); + } + + /** + * The database username. + * + * Generated from protobuf field string user = 1; + * @return string + */ + public function getUser() + { + return $this->user; + } + + /** + * The database username. + * + * Generated from protobuf field string user = 1; + * @param string $var + * @return $this + */ + public function setUser($var) + { + GPBUtil::checkString($var, True); + $this->user = $var; + + return $this; + } + + /** + * The initial password for the user. + * + * Generated from protobuf field string password = 2; + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * The initial password for the user. + * + * Generated from protobuf field string password = 2; + * @param string $var + * @return $this + */ + public function setPassword($var) + { + GPBUtil::checkString($var, True); + $this->password = $var; + + return $this; + } + +} + diff --git a/AlloyDb/src/V1beta/gapic_metadata.json b/AlloyDb/src/V1beta/gapic_metadata.json new file mode 100644 index 000000000000..0e205d9469dd --- /dev/null +++ b/AlloyDb/src/V1beta/gapic_metadata.json @@ -0,0 +1,153 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.alloydb.v1beta", + "libraryPackage": "Google\\Cloud\\AlloyDb\\V1beta", + "services": { + "AlloyDBAdmin": { + "clients": { + "grpc": { + "libraryClient": "AlloyDBAdminGapicClient", + "rpcs": { + "BatchCreateInstances": { + "methods": [ + "batchCreateInstances" + ] + }, + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "CreateCluster": { + "methods": [ + "createCluster" + ] + }, + "CreateInstance": { + "methods": [ + "createInstance" + ] + }, + "CreateSecondaryCluster": { + "methods": [ + "createSecondaryCluster" + ] + }, + "CreateSecondaryInstance": { + "methods": [ + "createSecondaryInstance" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "DeleteCluster": { + "methods": [ + "deleteCluster" + ] + }, + "DeleteInstance": { + "methods": [ + "deleteInstance" + ] + }, + "FailoverInstance": { + "methods": [ + "failoverInstance" + ] + }, + "GenerateClientCertificate": { + "methods": [ + "generateClientCertificate" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "GetCluster": { + "methods": [ + "getCluster" + ] + }, + "GetConnectionInfo": { + "methods": [ + "getConnectionInfo" + ] + }, + "GetInstance": { + "methods": [ + "getInstance" + ] + }, + "ListBackups": { + "methods": [ + "listBackups" + ] + }, + "ListClusters": { + "methods": [ + "listClusters" + ] + }, + "ListInstances": { + "methods": [ + "listInstances" + ] + }, + "ListSupportedDatabaseFlags": { + "methods": [ + "listSupportedDatabaseFlags" + ] + }, + "PromoteCluster": { + "methods": [ + "promoteCluster" + ] + }, + "RestartInstance": { + "methods": [ + "restartInstance" + ] + }, + "RestoreCluster": { + "methods": [ + "restoreCluster" + ] + }, + "UpdateBackup": { + "methods": [ + "updateBackup" + ] + }, + "UpdateCluster": { + "methods": [ + "updateCluster" + ] + }, + "UpdateInstance": { + "methods": [ + "updateInstance" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/AlloyDb/src/V1beta/resources/alloy_db_admin_client_config.json b/AlloyDb/src/V1beta/resources/alloy_db_admin_client_config.json new file mode 100644 index 000000000000..57f01281129c --- /dev/null +++ b/AlloyDb/src/V1beta/resources/alloy_db_admin_client_config.json @@ -0,0 +1,179 @@ +{ + "interfaces": { + "google.cloud.alloydb.v1beta.AlloyDBAdmin": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ], + "no_retry_1_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": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "BatchCreateInstances": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateInstance": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateSecondaryCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "CreateSecondaryInstance": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteBackup": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "DeleteInstance": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "FailoverInstance": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GenerateClientCertificate": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetBackup": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetCluster": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetConnectionInfo": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetInstance": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListBackups": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListClusters": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListInstances": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListSupportedDatabaseFlags": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "PromoteCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "RestartInstance": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "RestoreCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateCluster": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "UpdateInstance": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/AlloyDb/src/V1beta/resources/alloy_db_admin_descriptor_config.php b/AlloyDb/src/V1beta/resources/alloy_db_admin_descriptor_config.php new file mode 100644 index 000000000000..29809f58c566 --- /dev/null +++ b/AlloyDb/src/V1beta/resources/alloy_db_admin_descriptor_config.php @@ -0,0 +1,218 @@ + [ + 'google.cloud.alloydb.v1beta.AlloyDBAdmin' => [ + 'BatchCreateInstances' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1beta\BatchCreateInstancesResponse', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateBackup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1beta\Backup', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1beta\Cluster', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateInstance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1beta\Instance', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateSecondaryCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1beta\Cluster', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'CreateSecondaryInstance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1beta\Instance', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteBackup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'DeleteInstance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'FailoverInstance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1beta\Instance', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'PromoteCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1beta\Cluster', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'RestartInstance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1beta\Instance', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'RestoreCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1beta\Cluster', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateBackup' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1beta\Backup', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateCluster' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1beta\Cluster', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'UpdateInstance' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\AlloyDb\V1beta\Instance', + 'metadataReturnType' => '\Google\Cloud\AlloyDb\V1beta\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], + 'ListBackups' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getBackups', + ], + ], + 'ListClusters' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getClusters', + ], + ], + 'ListInstances' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getInstances', + ], + ], + 'ListSupportedDatabaseFlags' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getSupportedDatabaseFlags', + ], + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + ], + ], + ], +]; diff --git a/AlloyDb/src/V1beta/resources/alloy_db_admin_rest_client_config.php b/AlloyDb/src/V1beta/resources/alloy_db_admin_rest_client_config.php new file mode 100644 index 000000000000..4fc0b06d6396 --- /dev/null +++ b/AlloyDb/src/V1beta/resources/alloy_db_admin_rest_client_config.php @@ -0,0 +1,380 @@ + [ + 'google.cloud.alloydb.v1beta.AlloyDBAdmin' => [ + 'BatchCreateInstances' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/clusters/*}/instances:batchCreate', + 'body' => 'requests', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateBackup' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*}/backups', + 'body' => 'backup', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'backup_id', + ], + ], + 'CreateCluster' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*}/clusters', + 'body' => 'cluster', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'cluster_id', + ], + ], + 'CreateInstance' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/clusters/*}/instances', + 'body' => 'instance', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'instance_id', + ], + ], + 'CreateSecondaryCluster' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*}/clusters:createsecondary', + 'body' => 'cluster', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateSecondaryInstance' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/clusters/*}/instances:createsecondary', + 'body' => 'instance', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteBackup' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/backups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteCluster' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/clusters/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteInstance' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/clusters/*/instances/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'FailoverInstance' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/clusters/*/instances/*}:failover', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GenerateClientCertificate' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/clusters/*}:generateClientCertificate', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetBackup' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/backups/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetCluster' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/clusters/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetConnectionInfo' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/clusters/*/instances/*}/connectionInfo', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetInstance' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/clusters/*/instances/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListBackups' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*}/backups', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListClusters' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*}/clusters', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListInstances' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/clusters/*}/instances', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListSupportedDatabaseFlags' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*}/supportedDatabaseFlags', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'PromoteCluster' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/clusters/*}:promote', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'RestartInstance' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/clusters/*/instances/*}:restart', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'RestoreCluster' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*}/clusters:restore', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateBackup' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1beta/{backup.name=projects/*/locations/*/backups/*}', + 'body' => 'backup', + 'placeholders' => [ + 'backup.name' => [ + 'getters' => [ + 'getBackup', + 'getName', + ], + ], + ], + ], + 'UpdateCluster' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1beta/{cluster.name=projects/*/locations/*/clusters/*}', + 'body' => 'cluster', + 'placeholders' => [ + 'cluster.name' => [ + 'getters' => [ + 'getCluster', + 'getName', + ], + ], + ], + ], + 'UpdateInstance' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1beta/{instance.name=projects/*/locations/*/clusters/*/instances/*}', + 'body' => 'instance', + 'placeholders' => [ + 'instance.name' => [ + 'getters' => [ + 'getInstance', + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/operations/*}:cancel', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/AlloyDb/tests/Unit/V1/AlloyDBAdminClientTest.php b/AlloyDb/tests/Unit/V1/AlloyDBAdminClientTest.php new file mode 100644 index 000000000000..5cf49269a1e8 --- /dev/null +++ b/AlloyDb/tests/Unit/V1/AlloyDBAdminClientTest.php @@ -0,0 +1,2405 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return AlloyDBAdminClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new AlloyDBAdminClient($options); + } + + /** @test */ + public function batchCreateInstancesTest() + { + $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/batchCreateInstancesTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new BatchCreateInstancesResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/batchCreateInstancesTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $requests = new CreateInstanceRequests(); + $requestsCreateInstanceRequests = []; + $requests->setCreateInstanceRequests($requestsCreateInstanceRequests); + $response = $gapicClient->batchCreateInstances($formattedParent, $requests); + $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.cloud.alloydb.v1.AlloyDBAdmin/BatchCreateInstances', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getRequests(); + $this->assertProtobufEquals($requests, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchCreateInstancesTest'); + $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 batchCreateInstancesExceptionTest() + { + $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/batchCreateInstancesTest'); + $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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $requests = new CreateInstanceRequests(); + $requestsCreateInstanceRequests = []; + $requests->setCreateInstanceRequests($requestsCreateInstanceRequests); + $response = $gapicClient->batchCreateInstances($formattedParent, $requests); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchCreateInstancesTest'); + 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); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $clusterUid = 'clusterUid-1141213045'; + $clusterName = 'clusterName-1018081872'; + $reconciling = false; + $etag = 'etag3123477'; + $sizeBytes = 1796325715; + $expectedResponse = new Backup(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setClusterUid($clusterUid); + $expectedResponse->setClusterName($clusterName); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $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->locationName('[PROJECT]', '[LOCATION]'); + $backupId = 'backupId1355353272'; + $backup = new Backup(); + $backupClusterName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $backup->setClusterName($backupClusterName); + $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.cloud.alloydb.v1.AlloyDBAdmin/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->locationName('[PROJECT]', '[LOCATION]'); + $backupId = 'backupId1355353272'; + $backup = new Backup(); + $backupClusterName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $backup->setClusterName($backupClusterName); + $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 createClusterTest() + { + $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/createClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $network = 'network1843485230'; + $etag = 'etag3123477'; + $reconciling = false; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setNetwork($network); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->createCluster($formattedParent, $clusterId, $cluster); + $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.cloud.alloydb.v1.AlloyDBAdmin/CreateCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getClusterId(); + $this->assertProtobufEquals($clusterId, $actualValue); + $actualValue = $actualApiRequestObject->getCluster(); + $this->assertProtobufEquals($cluster, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createClusterTest'); + $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 createClusterExceptionTest() + { + $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/createClusterTest'); + $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->locationName('[PROJECT]', '[LOCATION]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->createCluster($formattedParent, $clusterId, $cluster); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createClusterTest'); + 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 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'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $gceZone = 'gceZone-227587294'; + $ipAddress = 'ipAddress1480014044'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Instance(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setGceZone($gceZone); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $instanceId = 'instanceId-2101995259'; + $instance = new Instance(); + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + $instance->setInstanceType($instanceInstanceType); + $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.cloud.alloydb.v1.AlloyDBAdmin/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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $instanceId = 'instanceId-2101995259'; + $instance = new Instance(); + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + $instance->setInstanceType($instanceInstanceType); + $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 deleteBackupTest() + { + $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/deleteBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP]'); + $response = $gapicClient->deleteBackup($formattedName); + $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.cloud.alloydb.v1.AlloyDBAdmin/DeleteBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupTest'); + $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 deleteBackupExceptionTest() + { + $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/deleteBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP]'); + $response = $gapicClient->deleteBackup($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupTest'); + 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 deleteClusterTest() + { + $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/deleteClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $response = $gapicClient->deleteCluster($formattedName); + $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.cloud.alloydb.v1.AlloyDBAdmin/DeleteCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteClusterTest'); + $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 deleteClusterExceptionTest() + { + $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/deleteClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $response = $gapicClient->deleteCluster($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteClusterTest'); + 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() + { + $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/deleteInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteInstanceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + $response = $gapicClient->deleteInstance($formattedName); + $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.cloud.alloydb.v1.AlloyDBAdmin/DeleteInstance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteInstanceTest'); + $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 deleteInstanceExceptionTest() + { + $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/deleteInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + $response = $gapicClient->deleteInstance($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteInstanceTest'); + 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 failoverInstanceTest() + { + $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/failoverInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $gceZone = 'gceZone-227587294'; + $ipAddress = 'ipAddress1480014044'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Instance(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setGceZone($gceZone); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/failoverInstanceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + $response = $gapicClient->failoverInstance($formattedName); + $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.cloud.alloydb.v1.AlloyDBAdmin/FailoverInstance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/failoverInstanceTest'); + $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 failoverInstanceExceptionTest() + { + $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/failoverInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + $response = $gapicClient->failoverInstance($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/failoverInstanceTest'); + 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 getBackupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $clusterUid = 'clusterUid-1141213045'; + $clusterName = 'clusterName-1018081872'; + $reconciling = false; + $etag = 'etag3123477'; + $sizeBytes = 1796325715; + $expectedResponse = new Backup(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setClusterUid($clusterUid); + $expectedResponse->setClusterName($clusterName); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setSizeBytes($sizeBytes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[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.cloud.alloydb.v1.AlloyDBAdmin/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]', '[LOCATION]', '[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 getClusterTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $network = 'network1843485230'; + $etag = 'etag3123477'; + $reconciling = false; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setNetwork($network); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $response = $gapicClient->getCluster($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.alloydb.v1.AlloyDBAdmin/GetCluster', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getClusterExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + try { + $gapicClient->getCluster($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 getInstanceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $gceZone = 'gceZone-227587294'; + $ipAddress = 'ipAddress1480014044'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Instance(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setGceZone($gceZone); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[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.cloud.alloydb.v1.AlloyDBAdmin/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]', '[LOCATION]', '[CLUSTER]', '[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 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->locationName('[PROJECT]', '[LOCATION]'); + $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.cloud.alloydb.v1.AlloyDBAdmin/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->locationName('[PROJECT]', '[LOCATION]'); + 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 listClustersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $clustersElement = new Cluster(); + $clusters = [ + $clustersElement, + ]; + $expectedResponse = new ListClustersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setClusters($clusters); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listClusters($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getClusters()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.alloydb.v1.AlloyDBAdmin/ListClusters', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listClustersExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listClusters($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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $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.cloud.alloydb.v1.AlloyDBAdmin/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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + 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 listSupportedDatabaseFlagsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $supportedDatabaseFlagsElement = new SupportedDatabaseFlag(); + $supportedDatabaseFlags = [ + $supportedDatabaseFlagsElement, + ]; + $expectedResponse = new ListSupportedDatabaseFlagsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSupportedDatabaseFlags($supportedDatabaseFlags); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listSupportedDatabaseFlags($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSupportedDatabaseFlags()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.alloydb.v1.AlloyDBAdmin/ListSupportedDatabaseFlags', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSupportedDatabaseFlagsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listSupportedDatabaseFlags($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 restartInstanceTest() + { + $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/restartInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $gceZone = 'gceZone-227587294'; + $ipAddress = 'ipAddress1480014044'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Instance(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setGceZone($gceZone); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/restartInstanceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + $response = $gapicClient->restartInstance($formattedName); + $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.cloud.alloydb.v1.AlloyDBAdmin/RestartInstance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restartInstanceTest'); + $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 restartInstanceExceptionTest() + { + $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/restartInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + $response = $gapicClient->restartInstance($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restartInstanceTest'); + 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 restoreClusterTest() + { + $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/restoreClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $network = 'network1843485230'; + $etag = 'etag3123477'; + $reconciling = false; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setNetwork($network); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/restoreClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->restoreCluster($formattedParent, $clusterId, $cluster); + $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.cloud.alloydb.v1.AlloyDBAdmin/RestoreCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getClusterId(); + $this->assertProtobufEquals($clusterId, $actualValue); + $actualValue = $actualApiRequestObject->getCluster(); + $this->assertProtobufEquals($cluster, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restoreClusterTest'); + $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 restoreClusterExceptionTest() + { + $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/restoreClusterTest'); + $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->locationName('[PROJECT]', '[LOCATION]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->restoreCluster($formattedParent, $clusterId, $cluster); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restoreClusterTest'); + 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 updateBackupTest() + { + $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/updateBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $clusterUid = 'clusterUid-1141213045'; + $clusterName = 'clusterName-1018081872'; + $reconciling = false; + $etag = 'etag3123477'; + $sizeBytes = 1796325715; + $expectedResponse = new Backup(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setClusterUid($clusterUid); + $expectedResponse->setClusterName($clusterName); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setSizeBytes($sizeBytes); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $backup = new Backup(); + $backupClusterName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $backup->setClusterName($backupClusterName); + $response = $gapicClient->updateBackup($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.cloud.alloydb.v1.AlloyDBAdmin/UpdateBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getBackup(); + $this->assertProtobufEquals($backup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateBackupTest'); + $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 updateBackupExceptionTest() + { + $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/updateBackupTest'); + $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 + $backup = new Backup(); + $backupClusterName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $backup->setClusterName($backupClusterName); + $response = $gapicClient->updateBackup($backup); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateBackupTest'); + 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 updateClusterTest() + { + $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/updateClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $network = 'network1843485230'; + $etag = 'etag3123477'; + $reconciling = false; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setNetwork($network); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->updateCluster($cluster); + $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.cloud.alloydb.v1.AlloyDBAdmin/UpdateCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getCluster(); + $this->assertProtobufEquals($cluster, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateClusterTest'); + $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 updateClusterExceptionTest() + { + $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/updateClusterTest'); + $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 + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->updateCluster($cluster); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateClusterTest'); + 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 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'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $gceZone = 'gceZone-227587294'; + $ipAddress = 'ipAddress1480014044'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Instance(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setGceZone($gceZone); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $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(); + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + $instance->setInstanceType($instanceInstanceType); + $response = $gapicClient->updateInstance($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.cloud.alloydb.v1.AlloyDBAdmin/UpdateInstance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getInstance(); + $this->assertProtobufEquals($instance, $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(); + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + $instance->setInstanceType($instanceInstanceType); + $response = $gapicClient->updateInstance($instance); + $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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getLocation(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + try { + $gapicClient->getLocation(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + try { + $gapicClient->listLocations(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/AlloyDb/tests/Unit/V1alpha/AlloyDBAdminClientTest.php b/AlloyDb/tests/Unit/V1alpha/AlloyDBAdminClientTest.php new file mode 100644 index 000000000000..f7bf6eea6b1c --- /dev/null +++ b/AlloyDb/tests/Unit/V1alpha/AlloyDBAdminClientTest.php @@ -0,0 +1,2944 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return AlloyDBAdminClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new AlloyDBAdminClient($options); + } + + /** @test */ + public function batchCreateInstancesTest() + { + $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/batchCreateInstancesTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new BatchCreateInstancesResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/batchCreateInstancesTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $requests = new CreateInstanceRequests(); + $requestsCreateInstanceRequests = []; + $requests->setCreateInstanceRequests($requestsCreateInstanceRequests); + $response = $gapicClient->batchCreateInstances($formattedParent, $requests); + $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.cloud.alloydb.v1alpha.AlloyDBAdmin/BatchCreateInstances', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getRequests(); + $this->assertProtobufEquals($requests, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchCreateInstancesTest'); + $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 batchCreateInstancesExceptionTest() + { + $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/batchCreateInstancesTest'); + $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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $requests = new CreateInstanceRequests(); + $requestsCreateInstanceRequests = []; + $requests->setCreateInstanceRequests($requestsCreateInstanceRequests); + $response = $gapicClient->batchCreateInstances($formattedParent, $requests); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchCreateInstancesTest'); + 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); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $clusterUid = 'clusterUid-1141213045'; + $clusterName = 'clusterName-1018081872'; + $reconciling = false; + $etag = 'etag3123477'; + $sizeBytes = 1796325715; + $expectedResponse = new Backup(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setClusterUid($clusterUid); + $expectedResponse->setClusterName($clusterName); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $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->locationName('[PROJECT]', '[LOCATION]'); + $backupId = 'backupId1355353272'; + $backup = new Backup(); + $backupClusterName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $backup->setClusterName($backupClusterName); + $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.cloud.alloydb.v1alpha.AlloyDBAdmin/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->locationName('[PROJECT]', '[LOCATION]'); + $backupId = 'backupId1355353272'; + $backup = new Backup(); + $backupClusterName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $backup->setClusterName($backupClusterName); + $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 createClusterTest() + { + $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/createClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $network = 'network1843485230'; + $etag = 'etag3123477'; + $reconciling = false; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setNetwork($network); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->createCluster($formattedParent, $clusterId, $cluster); + $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.cloud.alloydb.v1alpha.AlloyDBAdmin/CreateCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getClusterId(); + $this->assertProtobufEquals($clusterId, $actualValue); + $actualValue = $actualApiRequestObject->getCluster(); + $this->assertProtobufEquals($cluster, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createClusterTest'); + $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 createClusterExceptionTest() + { + $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/createClusterTest'); + $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->locationName('[PROJECT]', '[LOCATION]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->createCluster($formattedParent, $clusterId, $cluster); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createClusterTest'); + 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 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'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $gceZone = 'gceZone-227587294'; + $ipAddress = 'ipAddress1480014044'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Instance(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setGceZone($gceZone); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $instanceId = 'instanceId-2101995259'; + $instance = new Instance(); + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + $instance->setInstanceType($instanceInstanceType); + $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.cloud.alloydb.v1alpha.AlloyDBAdmin/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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $instanceId = 'instanceId-2101995259'; + $instance = new Instance(); + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + $instance->setInstanceType($instanceInstanceType); + $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 createSecondaryClusterTest() + { + $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/createSecondaryClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $network = 'network1843485230'; + $etag = 'etag3123477'; + $reconciling = false; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setNetwork($network); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createSecondaryClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->createSecondaryCluster($formattedParent, $clusterId, $cluster); + $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.cloud.alloydb.v1alpha.AlloyDBAdmin/CreateSecondaryCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getClusterId(); + $this->assertProtobufEquals($clusterId, $actualValue); + $actualValue = $actualApiRequestObject->getCluster(); + $this->assertProtobufEquals($cluster, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createSecondaryClusterTest'); + $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 createSecondaryClusterExceptionTest() + { + $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/createSecondaryClusterTest'); + $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->locationName('[PROJECT]', '[LOCATION]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->createSecondaryCluster($formattedParent, $clusterId, $cluster); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createSecondaryClusterTest'); + 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 createSecondaryInstanceTest() + { + $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/createSecondaryInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $gceZone = 'gceZone-227587294'; + $ipAddress = 'ipAddress1480014044'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Instance(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setGceZone($gceZone); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createSecondaryInstanceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $instanceId = 'instanceId-2101995259'; + $instance = new Instance(); + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + $instance->setInstanceType($instanceInstanceType); + $response = $gapicClient->createSecondaryInstance($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.cloud.alloydb.v1alpha.AlloyDBAdmin/CreateSecondaryInstance', $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/createSecondaryInstanceTest'); + $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 createSecondaryInstanceExceptionTest() + { + $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/createSecondaryInstanceTest'); + $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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $instanceId = 'instanceId-2101995259'; + $instance = new Instance(); + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + $instance->setInstanceType($instanceInstanceType); + $response = $gapicClient->createSecondaryInstance($formattedParent, $instanceId, $instance); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createSecondaryInstanceTest'); + 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() + { + $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/deleteBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP]'); + $response = $gapicClient->deleteBackup($formattedName); + $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.cloud.alloydb.v1alpha.AlloyDBAdmin/DeleteBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupTest'); + $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 deleteBackupExceptionTest() + { + $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/deleteBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP]'); + $response = $gapicClient->deleteBackup($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupTest'); + 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 deleteClusterTest() + { + $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/deleteClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $response = $gapicClient->deleteCluster($formattedName); + $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.cloud.alloydb.v1alpha.AlloyDBAdmin/DeleteCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteClusterTest'); + $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 deleteClusterExceptionTest() + { + $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/deleteClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $response = $gapicClient->deleteCluster($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteClusterTest'); + 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() + { + $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/deleteInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteInstanceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + $response = $gapicClient->deleteInstance($formattedName); + $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.cloud.alloydb.v1alpha.AlloyDBAdmin/DeleteInstance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteInstanceTest'); + $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 deleteInstanceExceptionTest() + { + $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/deleteInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + $response = $gapicClient->deleteInstance($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteInstanceTest'); + 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 failoverInstanceTest() + { + $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/failoverInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $gceZone = 'gceZone-227587294'; + $ipAddress = 'ipAddress1480014044'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Instance(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setGceZone($gceZone); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/failoverInstanceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + $response = $gapicClient->failoverInstance($formattedName); + $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.cloud.alloydb.v1alpha.AlloyDBAdmin/FailoverInstance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/failoverInstanceTest'); + $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 failoverInstanceExceptionTest() + { + $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/failoverInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + $response = $gapicClient->failoverInstance($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/failoverInstanceTest'); + 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 generateClientCertificateTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $pemCertificate = 'pemCertificate1234463984'; + $expectedResponse = new GenerateClientCertificateResponse(); + $expectedResponse->setPemCertificate($pemCertificate); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $response = $gapicClient->generateClientCertificate($formattedParent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.alloydb.v1alpha.AlloyDBAdmin/GenerateClientCertificate', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateClientCertificateExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + try { + $gapicClient->generateClientCertificate($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 getBackupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $clusterUid = 'clusterUid-1141213045'; + $clusterName = 'clusterName-1018081872'; + $reconciling = false; + $etag = 'etag3123477'; + $sizeBytes = 1796325715; + $expectedResponse = new Backup(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setClusterUid($clusterUid); + $expectedResponse->setClusterName($clusterName); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setSizeBytes($sizeBytes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[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.cloud.alloydb.v1alpha.AlloyDBAdmin/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]', '[LOCATION]', '[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 getClusterTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $network = 'network1843485230'; + $etag = 'etag3123477'; + $reconciling = false; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setNetwork($network); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $response = $gapicClient->getCluster($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.alloydb.v1alpha.AlloyDBAdmin/GetCluster', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getClusterExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + try { + $gapicClient->getCluster($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 getConnectionInfoTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $ipAddress = 'ipAddress1480014044'; + $instanceUid = 'instanceUid-737331802'; + $expectedResponse = new ConnectionInfo(); + $expectedResponse->setName($name); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setInstanceUid($instanceUid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + $response = $gapicClient->getConnectionInfo($formattedParent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.alloydb.v1alpha.AlloyDBAdmin/GetConnectionInfo', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getConnectionInfoExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + try { + $gapicClient->getConnectionInfo($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 getInstanceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $gceZone = 'gceZone-227587294'; + $ipAddress = 'ipAddress1480014044'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Instance(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setGceZone($gceZone); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[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.cloud.alloydb.v1alpha.AlloyDBAdmin/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]', '[LOCATION]', '[CLUSTER]', '[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 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->locationName('[PROJECT]', '[LOCATION]'); + $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.cloud.alloydb.v1alpha.AlloyDBAdmin/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->locationName('[PROJECT]', '[LOCATION]'); + 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 listClustersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $clustersElement = new Cluster(); + $clusters = [ + $clustersElement, + ]; + $expectedResponse = new ListClustersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setClusters($clusters); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listClusters($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getClusters()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.alloydb.v1alpha.AlloyDBAdmin/ListClusters', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listClustersExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listClusters($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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $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.cloud.alloydb.v1alpha.AlloyDBAdmin/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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + 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 listSupportedDatabaseFlagsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $supportedDatabaseFlagsElement = new SupportedDatabaseFlag(); + $supportedDatabaseFlags = [ + $supportedDatabaseFlagsElement, + ]; + $expectedResponse = new ListSupportedDatabaseFlagsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSupportedDatabaseFlags($supportedDatabaseFlags); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listSupportedDatabaseFlags($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSupportedDatabaseFlags()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.alloydb.v1alpha.AlloyDBAdmin/ListSupportedDatabaseFlags', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSupportedDatabaseFlagsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listSupportedDatabaseFlags($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 promoteClusterTest() + { + $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/promoteClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $network = 'network1843485230'; + $etag2 = 'etag2-1293302904'; + $reconciling = false; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setNetwork($network); + $expectedResponse->setEtag($etag2); + $expectedResponse->setReconciling($reconciling); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/promoteClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $response = $gapicClient->promoteCluster($formattedName); + $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.cloud.alloydb.v1alpha.AlloyDBAdmin/PromoteCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/promoteClusterTest'); + $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 promoteClusterExceptionTest() + { + $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/promoteClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $response = $gapicClient->promoteCluster($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/promoteClusterTest'); + 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 restartInstanceTest() + { + $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/restartInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $gceZone = 'gceZone-227587294'; + $ipAddress = 'ipAddress1480014044'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Instance(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setGceZone($gceZone); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/restartInstanceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + $response = $gapicClient->restartInstance($formattedName); + $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.cloud.alloydb.v1alpha.AlloyDBAdmin/RestartInstance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restartInstanceTest'); + $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 restartInstanceExceptionTest() + { + $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/restartInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + $response = $gapicClient->restartInstance($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restartInstanceTest'); + 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 restoreClusterTest() + { + $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/restoreClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $network = 'network1843485230'; + $etag = 'etag3123477'; + $reconciling = false; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setNetwork($network); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/restoreClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->restoreCluster($formattedParent, $clusterId, $cluster); + $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.cloud.alloydb.v1alpha.AlloyDBAdmin/RestoreCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getClusterId(); + $this->assertProtobufEquals($clusterId, $actualValue); + $actualValue = $actualApiRequestObject->getCluster(); + $this->assertProtobufEquals($cluster, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restoreClusterTest'); + $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 restoreClusterExceptionTest() + { + $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/restoreClusterTest'); + $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->locationName('[PROJECT]', '[LOCATION]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->restoreCluster($formattedParent, $clusterId, $cluster); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restoreClusterTest'); + 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 updateBackupTest() + { + $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/updateBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $clusterUid = 'clusterUid-1141213045'; + $clusterName = 'clusterName-1018081872'; + $reconciling = false; + $etag = 'etag3123477'; + $sizeBytes = 1796325715; + $expectedResponse = new Backup(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setClusterUid($clusterUid); + $expectedResponse->setClusterName($clusterName); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setSizeBytes($sizeBytes); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $backup = new Backup(); + $backupClusterName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $backup->setClusterName($backupClusterName); + $response = $gapicClient->updateBackup($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.cloud.alloydb.v1alpha.AlloyDBAdmin/UpdateBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getBackup(); + $this->assertProtobufEquals($backup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateBackupTest'); + $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 updateBackupExceptionTest() + { + $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/updateBackupTest'); + $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 + $backup = new Backup(); + $backupClusterName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $backup->setClusterName($backupClusterName); + $response = $gapicClient->updateBackup($backup); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateBackupTest'); + 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 updateClusterTest() + { + $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/updateClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $network = 'network1843485230'; + $etag = 'etag3123477'; + $reconciling = false; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setNetwork($network); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->updateCluster($cluster); + $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.cloud.alloydb.v1alpha.AlloyDBAdmin/UpdateCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getCluster(); + $this->assertProtobufEquals($cluster, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateClusterTest'); + $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 updateClusterExceptionTest() + { + $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/updateClusterTest'); + $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 + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->updateCluster($cluster); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateClusterTest'); + 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 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'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $gceZone = 'gceZone-227587294'; + $ipAddress = 'ipAddress1480014044'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Instance(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setGceZone($gceZone); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $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(); + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + $instance->setInstanceType($instanceInstanceType); + $response = $gapicClient->updateInstance($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.cloud.alloydb.v1alpha.AlloyDBAdmin/UpdateInstance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getInstance(); + $this->assertProtobufEquals($instance, $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(); + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + $instance->setInstanceType($instanceInstanceType); + $response = $gapicClient->updateInstance($instance); + $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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getLocation(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + try { + $gapicClient->getLocation(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + try { + $gapicClient->listLocations(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/AlloyDb/tests/Unit/V1beta/AlloyDBAdminClientTest.php b/AlloyDb/tests/Unit/V1beta/AlloyDBAdminClientTest.php new file mode 100644 index 000000000000..31990770dbf6 --- /dev/null +++ b/AlloyDb/tests/Unit/V1beta/AlloyDBAdminClientTest.php @@ -0,0 +1,2944 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return AlloyDBAdminClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new AlloyDBAdminClient($options); + } + + /** @test */ + public function batchCreateInstancesTest() + { + $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/batchCreateInstancesTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new BatchCreateInstancesResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/batchCreateInstancesTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $requests = new CreateInstanceRequests(); + $requestsCreateInstanceRequests = []; + $requests->setCreateInstanceRequests($requestsCreateInstanceRequests); + $response = $gapicClient->batchCreateInstances($formattedParent, $requests); + $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.cloud.alloydb.v1beta.AlloyDBAdmin/BatchCreateInstances', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getRequests(); + $this->assertProtobufEquals($requests, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchCreateInstancesTest'); + $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 batchCreateInstancesExceptionTest() + { + $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/batchCreateInstancesTest'); + $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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $requests = new CreateInstanceRequests(); + $requestsCreateInstanceRequests = []; + $requests->setCreateInstanceRequests($requestsCreateInstanceRequests); + $response = $gapicClient->batchCreateInstances($formattedParent, $requests); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchCreateInstancesTest'); + 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); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $clusterUid = 'clusterUid-1141213045'; + $clusterName = 'clusterName-1018081872'; + $reconciling = false; + $etag = 'etag3123477'; + $sizeBytes = 1796325715; + $expectedResponse = new Backup(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setClusterUid($clusterUid); + $expectedResponse->setClusterName($clusterName); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $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->locationName('[PROJECT]', '[LOCATION]'); + $backupId = 'backupId1355353272'; + $backup = new Backup(); + $backupClusterName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $backup->setClusterName($backupClusterName); + $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.cloud.alloydb.v1beta.AlloyDBAdmin/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->locationName('[PROJECT]', '[LOCATION]'); + $backupId = 'backupId1355353272'; + $backup = new Backup(); + $backupClusterName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $backup->setClusterName($backupClusterName); + $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 createClusterTest() + { + $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/createClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $network = 'network1843485230'; + $etag = 'etag3123477'; + $reconciling = false; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setNetwork($network); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->createCluster($formattedParent, $clusterId, $cluster); + $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.cloud.alloydb.v1beta.AlloyDBAdmin/CreateCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getClusterId(); + $this->assertProtobufEquals($clusterId, $actualValue); + $actualValue = $actualApiRequestObject->getCluster(); + $this->assertProtobufEquals($cluster, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createClusterTest'); + $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 createClusterExceptionTest() + { + $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/createClusterTest'); + $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->locationName('[PROJECT]', '[LOCATION]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->createCluster($formattedParent, $clusterId, $cluster); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createClusterTest'); + 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 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'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $gceZone = 'gceZone-227587294'; + $ipAddress = 'ipAddress1480014044'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Instance(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setGceZone($gceZone); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $instanceId = 'instanceId-2101995259'; + $instance = new Instance(); + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + $instance->setInstanceType($instanceInstanceType); + $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.cloud.alloydb.v1beta.AlloyDBAdmin/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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $instanceId = 'instanceId-2101995259'; + $instance = new Instance(); + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + $instance->setInstanceType($instanceInstanceType); + $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 createSecondaryClusterTest() + { + $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/createSecondaryClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $network = 'network1843485230'; + $etag = 'etag3123477'; + $reconciling = false; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setNetwork($network); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createSecondaryClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->createSecondaryCluster($formattedParent, $clusterId, $cluster); + $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.cloud.alloydb.v1beta.AlloyDBAdmin/CreateSecondaryCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getClusterId(); + $this->assertProtobufEquals($clusterId, $actualValue); + $actualValue = $actualApiRequestObject->getCluster(); + $this->assertProtobufEquals($cluster, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createSecondaryClusterTest'); + $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 createSecondaryClusterExceptionTest() + { + $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/createSecondaryClusterTest'); + $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->locationName('[PROJECT]', '[LOCATION]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->createSecondaryCluster($formattedParent, $clusterId, $cluster); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createSecondaryClusterTest'); + 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 createSecondaryInstanceTest() + { + $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/createSecondaryInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $gceZone = 'gceZone-227587294'; + $ipAddress = 'ipAddress1480014044'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Instance(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setGceZone($gceZone); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createSecondaryInstanceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $instanceId = 'instanceId-2101995259'; + $instance = new Instance(); + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + $instance->setInstanceType($instanceInstanceType); + $response = $gapicClient->createSecondaryInstance($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.cloud.alloydb.v1beta.AlloyDBAdmin/CreateSecondaryInstance', $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/createSecondaryInstanceTest'); + $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 createSecondaryInstanceExceptionTest() + { + $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/createSecondaryInstanceTest'); + $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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $instanceId = 'instanceId-2101995259'; + $instance = new Instance(); + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + $instance->setInstanceType($instanceInstanceType); + $response = $gapicClient->createSecondaryInstance($formattedParent, $instanceId, $instance); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createSecondaryInstanceTest'); + 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() + { + $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/deleteBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP]'); + $response = $gapicClient->deleteBackup($formattedName); + $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.cloud.alloydb.v1beta.AlloyDBAdmin/DeleteBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupTest'); + $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 deleteBackupExceptionTest() + { + $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/deleteBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[BACKUP]'); + $response = $gapicClient->deleteBackup($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteBackupTest'); + 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 deleteClusterTest() + { + $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/deleteClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $response = $gapicClient->deleteCluster($formattedName); + $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.cloud.alloydb.v1beta.AlloyDBAdmin/DeleteCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteClusterTest'); + $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 deleteClusterExceptionTest() + { + $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/deleteClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $response = $gapicClient->deleteCluster($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteClusterTest'); + 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() + { + $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/deleteInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteInstanceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + $response = $gapicClient->deleteInstance($formattedName); + $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.cloud.alloydb.v1beta.AlloyDBAdmin/DeleteInstance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteInstanceTest'); + $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 deleteInstanceExceptionTest() + { + $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/deleteInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + $response = $gapicClient->deleteInstance($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteInstanceTest'); + 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 failoverInstanceTest() + { + $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/failoverInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $gceZone = 'gceZone-227587294'; + $ipAddress = 'ipAddress1480014044'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Instance(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setGceZone($gceZone); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/failoverInstanceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + $response = $gapicClient->failoverInstance($formattedName); + $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.cloud.alloydb.v1beta.AlloyDBAdmin/FailoverInstance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/failoverInstanceTest'); + $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 failoverInstanceExceptionTest() + { + $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/failoverInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + $response = $gapicClient->failoverInstance($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/failoverInstanceTest'); + 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 generateClientCertificateTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $pemCertificate = 'pemCertificate1234463984'; + $expectedResponse = new GenerateClientCertificateResponse(); + $expectedResponse->setPemCertificate($pemCertificate); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $response = $gapicClient->generateClientCertificate($formattedParent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.alloydb.v1beta.AlloyDBAdmin/GenerateClientCertificate', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateClientCertificateExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + try { + $gapicClient->generateClientCertificate($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 getBackupTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $clusterUid = 'clusterUid-1141213045'; + $clusterName = 'clusterName-1018081872'; + $reconciling = false; + $etag = 'etag3123477'; + $sizeBytes = 1796325715; + $expectedResponse = new Backup(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setClusterUid($clusterUid); + $expectedResponse->setClusterName($clusterName); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setSizeBytes($sizeBytes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->backupName('[PROJECT]', '[LOCATION]', '[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.cloud.alloydb.v1beta.AlloyDBAdmin/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]', '[LOCATION]', '[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 getClusterTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $network = 'network1843485230'; + $etag = 'etag3123477'; + $reconciling = false; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setNetwork($network); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $response = $gapicClient->getCluster($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.alloydb.v1beta.AlloyDBAdmin/GetCluster', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getClusterExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + try { + $gapicClient->getCluster($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 getConnectionInfoTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $ipAddress = 'ipAddress1480014044'; + $instanceUid = 'instanceUid-737331802'; + $expectedResponse = new ConnectionInfo(); + $expectedResponse->setName($name); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setInstanceUid($instanceUid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + $response = $gapicClient->getConnectionInfo($formattedParent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.alloydb.v1beta.AlloyDBAdmin/GetConnectionInfo', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getConnectionInfoExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + try { + $gapicClient->getConnectionInfo($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 getInstanceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $gceZone = 'gceZone-227587294'; + $ipAddress = 'ipAddress1480014044'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Instance(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setGceZone($gceZone); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[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.cloud.alloydb.v1beta.AlloyDBAdmin/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]', '[LOCATION]', '[CLUSTER]', '[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 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->locationName('[PROJECT]', '[LOCATION]'); + $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.cloud.alloydb.v1beta.AlloyDBAdmin/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->locationName('[PROJECT]', '[LOCATION]'); + 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 listClustersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $clustersElement = new Cluster(); + $clusters = [ + $clustersElement, + ]; + $expectedResponse = new ListClustersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setClusters($clusters); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listClusters($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getClusters()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.alloydb.v1beta.AlloyDBAdmin/ListClusters', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listClustersExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listClusters($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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $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.cloud.alloydb.v1beta.AlloyDBAdmin/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->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + 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 listSupportedDatabaseFlagsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $supportedDatabaseFlagsElement = new SupportedDatabaseFlag(); + $supportedDatabaseFlags = [ + $supportedDatabaseFlagsElement, + ]; + $expectedResponse = new ListSupportedDatabaseFlagsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSupportedDatabaseFlags($supportedDatabaseFlags); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listSupportedDatabaseFlags($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSupportedDatabaseFlags()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.alloydb.v1beta.AlloyDBAdmin/ListSupportedDatabaseFlags', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSupportedDatabaseFlagsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal 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->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listSupportedDatabaseFlags($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 promoteClusterTest() + { + $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/promoteClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $network = 'network1843485230'; + $etag2 = 'etag2-1293302904'; + $reconciling = false; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setNetwork($network); + $expectedResponse->setEtag($etag2); + $expectedResponse->setReconciling($reconciling); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/promoteClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $response = $gapicClient->promoteCluster($formattedName); + $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.cloud.alloydb.v1beta.AlloyDBAdmin/PromoteCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/promoteClusterTest'); + $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 promoteClusterExceptionTest() + { + $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/promoteClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $response = $gapicClient->promoteCluster($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/promoteClusterTest'); + 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 restartInstanceTest() + { + $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/restartInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $gceZone = 'gceZone-227587294'; + $ipAddress = 'ipAddress1480014044'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Instance(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setGceZone($gceZone); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/restartInstanceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + $response = $gapicClient->restartInstance($formattedName); + $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.cloud.alloydb.v1beta.AlloyDBAdmin/RestartInstance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restartInstanceTest'); + $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 restartInstanceExceptionTest() + { + $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/restartInstanceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[INSTANCE]'); + $response = $gapicClient->restartInstance($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restartInstanceTest'); + 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 restoreClusterTest() + { + $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/restoreClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $network = 'network1843485230'; + $etag = 'etag3123477'; + $reconciling = false; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setNetwork($network); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/restoreClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->restoreCluster($formattedParent, $clusterId, $cluster); + $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.cloud.alloydb.v1beta.AlloyDBAdmin/RestoreCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getClusterId(); + $this->assertProtobufEquals($clusterId, $actualValue); + $actualValue = $actualApiRequestObject->getCluster(); + $this->assertProtobufEquals($cluster, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restoreClusterTest'); + $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 restoreClusterExceptionTest() + { + $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/restoreClusterTest'); + $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->locationName('[PROJECT]', '[LOCATION]'); + $clusterId = 'clusterId240280960'; + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->restoreCluster($formattedParent, $clusterId, $cluster); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/restoreClusterTest'); + 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 updateBackupTest() + { + $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/updateBackupTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $description = 'description-1724546052'; + $clusterUid = 'clusterUid-1141213045'; + $clusterName = 'clusterName-1018081872'; + $reconciling = false; + $etag = 'etag3123477'; + $sizeBytes = 1796325715; + $expectedResponse = new Backup(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setDescription($description); + $expectedResponse->setClusterUid($clusterUid); + $expectedResponse->setClusterName($clusterName); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $expectedResponse->setSizeBytes($sizeBytes); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateBackupTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $backup = new Backup(); + $backupClusterName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $backup->setClusterName($backupClusterName); + $response = $gapicClient->updateBackup($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.cloud.alloydb.v1beta.AlloyDBAdmin/UpdateBackup', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getBackup(); + $this->assertProtobufEquals($backup, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateBackupTest'); + $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 updateBackupExceptionTest() + { + $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/updateBackupTest'); + $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 + $backup = new Backup(); + $backupClusterName = $gapicClient->clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]'); + $backup->setClusterName($backupClusterName); + $response = $gapicClient->updateBackup($backup); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateBackupTest'); + 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 updateClusterTest() + { + $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/updateClusterTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $network = 'network1843485230'; + $etag = 'etag3123477'; + $reconciling = false; + $expectedResponse = new Cluster(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setNetwork($network); + $expectedResponse->setEtag($etag); + $expectedResponse->setReconciling($reconciling); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateClusterTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->updateCluster($cluster); + $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.cloud.alloydb.v1beta.AlloyDBAdmin/UpdateCluster', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getCluster(); + $this->assertProtobufEquals($cluster, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateClusterTest'); + $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 updateClusterExceptionTest() + { + $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/updateClusterTest'); + $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 + $cluster = new Cluster(); + $clusterNetwork = $gapicClient->networkName('[PROJECT]', '[NETWORK]'); + $cluster->setNetwork($clusterNetwork); + $response = $gapicClient->updateCluster($cluster); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateClusterTest'); + 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 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'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $gceZone = 'gceZone-227587294'; + $ipAddress = 'ipAddress1480014044'; + $reconciling = false; + $etag = 'etag3123477'; + $expectedResponse = new Instance(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $expectedResponse->setGceZone($gceZone); + $expectedResponse->setIpAddress($ipAddress); + $expectedResponse->setReconciling($reconciling); + $expectedResponse->setEtag($etag); + $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(); + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + $instance->setInstanceType($instanceInstanceType); + $response = $gapicClient->updateInstance($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.cloud.alloydb.v1beta.AlloyDBAdmin/UpdateInstance', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getInstance(); + $this->assertProtobufEquals($instance, $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(); + $instanceInstanceType = InstanceType::INSTANCE_TYPE_UNSPECIFIED; + $instance->setInstanceType($instanceInstanceType); + $response = $gapicClient->updateInstance($instance); + $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 getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getLocation(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + try { + $gapicClient->getLocation(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + try { + $gapicClient->listLocations(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/composer.json b/composer.json index 56a4b41c6f6a..541d2f5ef04f 100644 --- a/composer.json +++ b/composer.json @@ -81,6 +81,7 @@ "google/cloud-access-approval": "1.0.3", "google/cloud-advisorynotifications": "0.1.0", "google/cloud-ai-platform": "0.12.0", + "google/cloud-alloydb": "0.0.0", "google/cloud-api-gateway": "1.0.3", "google/cloud-api-keys": "0.1.4", "google/cloud-apigee-connect": "1.0.3", @@ -239,6 +240,7 @@ "GPBMetadata\\Google\\Cloud\\Accessapproval\\": "AccessApproval/metadata", "GPBMetadata\\Google\\Cloud\\Advisorynotifications\\": "AdvisoryNotifications/metadata", "GPBMetadata\\Google\\Cloud\\Aiplatform\\": "AiPlatform/metadata", + "GPBMetadata\\Google\\Cloud\\Alloydb\\": "AlloyDb/metadata", "GPBMetadata\\Google\\Cloud\\Apigateway\\": "ApiGateway/metadata", "GPBMetadata\\Google\\Cloud\\Apigeeconnect\\": "ApigeeConnect/metadata", "GPBMetadata\\Google\\Cloud\\Apigeeregistry\\": "ApigeeRegistry/metadata", @@ -384,6 +386,7 @@ "Google\\Cloud\\AIPlatform\\": "AiPlatform/src", "Google\\Cloud\\AccessApproval\\": "AccessApproval/src", "Google\\Cloud\\AdvisoryNotifications\\": "AdvisoryNotifications/src", + "Google\\Cloud\\AlloyDb\\": "AlloyDb/src", "Google\\Cloud\\ApiGateway\\": "ApiGateway/src", "Google\\Cloud\\ApiKeys\\": "ApiKeys/src", "Google\\Cloud\\ApigeeConnect\\": "ApigeeConnect/src",